WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XENBUS] Another simplification -- bus_fo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XENBUS] Another simplification -- bus_for_each_dev() better than bus_find_device().
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Jun 2006 22:50:18 +0000
Delivery-date: Fri, 30 Jun 2006 15:52:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID a377304fc4e614618ebf4500fe42fe4c17fb3e90
# Parent  4d7565ba9ff3bb4740bb6e46d8fd30a967e940dc
[XENBUS] Another simplification -- bus_for_each_dev() better than 
bus_find_device().
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff -r 4d7565ba9ff3 -r a377304fc4e6 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Fri Jun 30 
18:14:57 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Fri Jun 30 
22:02:18 2006 +0100
@@ -1037,7 +1037,7 @@ postcore_initcall(xenbus_probe_init);
 postcore_initcall(xenbus_probe_init);
 
 
-static int find_disconnected_device_(struct device *dev, void *data)
+static int is_disconnected_device(struct device *dev, void *data)
 {
        struct xenbus_device *xendev = to_xenbus_device(dev);
 
@@ -1051,10 +1051,10 @@ static int find_disconnected_device_(str
        return (xendev->state != XenbusStateConnected);
 }
 
-static struct device *find_disconnected_device(struct device *start)
-{
-       return bus_find_device(&xenbus_frontend.bus, start, NULL,
-                              find_disconnected_device_);
+static int exists_disconnected_device(void)
+{
+       return bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL,
+                               is_disconnected_device);
 }
 
 static int print_device_status(struct device *dev, void *data)
@@ -1091,17 +1091,12 @@ static int __init wait_for_devices(void)
 static int __init wait_for_devices(void)
 {
        unsigned long timeout = jiffies + 10*HZ;
-       struct device *dev = NULL;
 
        if (!is_running_on_xen())
                return -ENODEV;
 
-       while (time_before(jiffies, timeout)) {
-               if ((dev = find_disconnected_device(NULL)) == NULL)
-                       break;
-               put_device(dev);
+       while (time_before(jiffies, timeout) && exists_disconnected_device())
                schedule_timeout_interruptible(HZ/10);
-       }
 
        bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL,
                         print_device_status);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XENBUS] Another simplification -- bus_for_each_dev() better than bus_find_device()., Xen patchbot-unstable <=