[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XENBUS] Another simplification -- bus_for_each_dev() better than bus_find_device().



# 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.