ia64/xen-unstable
changeset 10630:a377304fc4e6
[XENBUS] Another simplification -- bus_for_each_dev() better than bus_find_device().
Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Fri Jun 30 22:02:18 2006 +0100 (2006-06-30) |
parents | 4d7565ba9ff3 |
children | 130a5badf2b7 |
files | linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c |
line diff
1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Fri Jun 30 18:14:57 2006 +0100 1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Fri Jun 30 22:02:18 2006 +0100 1.3 @@ -1037,7 +1037,7 @@ static int __init xenbus_probe_init(void 1.4 postcore_initcall(xenbus_probe_init); 1.5 1.6 1.7 -static int find_disconnected_device_(struct device *dev, void *data) 1.8 +static int is_disconnected_device(struct device *dev, void *data) 1.9 { 1.10 struct xenbus_device *xendev = to_xenbus_device(dev); 1.11 1.12 @@ -1051,10 +1051,10 @@ static int find_disconnected_device_(str 1.13 return (xendev->state != XenbusStateConnected); 1.14 } 1.15 1.16 -static struct device *find_disconnected_device(struct device *start) 1.17 +static int exists_disconnected_device(void) 1.18 { 1.19 - return bus_find_device(&xenbus_frontend.bus, start, NULL, 1.20 - find_disconnected_device_); 1.21 + return bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, 1.22 + is_disconnected_device); 1.23 } 1.24 1.25 static int print_device_status(struct device *dev, void *data) 1.26 @@ -1091,17 +1091,12 @@ static int print_device_status(struct de 1.27 static int __init wait_for_devices(void) 1.28 { 1.29 unsigned long timeout = jiffies + 10*HZ; 1.30 - struct device *dev = NULL; 1.31 1.32 if (!is_running_on_xen()) 1.33 return -ENODEV; 1.34 1.35 - while (time_before(jiffies, timeout)) { 1.36 - if ((dev = find_disconnected_device(NULL)) == NULL) 1.37 - break; 1.38 - put_device(dev); 1.39 + while (time_before(jiffies, timeout) && exists_disconnected_device()) 1.40 schedule_timeout_interruptible(HZ/10); 1.41 - } 1.42 1.43 bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, 1.44 print_device_status);