# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID 4d7565ba9ff3bb4740bb6e46d8fd30a967e940dc
# Parent 9633faf65e224a875042c3adc7152f2761a50679
[XENBUS] Another fix to the wait-for-device-connection code.
The new method for printing unconnected device status is arguably
cleaner and also does not screw up reference counts (previous code
called bus_find_device() with no put_device() on the result.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c | 43 ++++++-----------
1 files changed, 17 insertions(+), 26 deletions(-)
diff -r 9633faf65e22 -r 4d7565ba9ff3
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
17:53:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Fri Jun 30
18:14:57 2006 +0100
@@ -1057,15 +1057,21 @@ static struct device *find_disconnected_
find_disconnected_device_);
}
-static int find_driverless_device_(struct device *dev, void *data)
-{
- return !dev->driver;
-}
-
-static struct device *find_driverless_device(struct device *start)
-{
- return bus_find_device(&xenbus_frontend.bus, start, NULL,
- find_driverless_device_);
+static int print_device_status(struct device *dev, void *data)
+{
+ struct xenbus_device *xendev = to_xenbus_device(dev);
+
+ if (!dev->driver) {
+ /* Information only: is this too noisy? */
+ printk(KERN_INFO "XENBUS: Device with no driver: %s\n",
+ xendev->nodename);
+ } else if (xendev->state != XenbusStateConnected) {
+ printk(KERN_WARNING "XENBUS: Timeout connecting "
+ "to device: %s (state %d)\n",
+ xendev->nodename, xendev->state);
+ }
+
+ return 0;
}
/*
@@ -1086,7 +1092,6 @@ static int __init wait_for_devices(void)
{
unsigned long timeout = jiffies + 10*HZ;
struct device *dev = NULL;
- struct xenbus_device *xendev;
if (!is_running_on_xen())
return -ENODEV;
@@ -1098,22 +1103,8 @@ static int __init wait_for_devices(void)
schedule_timeout_interruptible(HZ/10);
}
- /* List devices which have drivers but are not yet connected. */
- while (dev != NULL) {
- xendev = to_xenbus_device(dev);
-
- printk(KERN_WARNING "XENBUS: Timeout connecting "
- "to device: %s\n", xendev->nodename);
-
- dev = find_disconnected_device(dev);
- }
-
- /* List devices with no driver (this is not necessarily an error). */
- while ((dev = find_driverless_device(dev)) != NULL) {
- xendev = to_xenbus_device(dev);
- printk(KERN_INFO "XENBUS: Device with no driver: %s\n",
- xendev->nodename);
- }
+ bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL,
+ print_device_status);
return 0;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|