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 fix to the wait-for-devi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XENBUS] Another fix to the wait-for-device-connection code.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Jun 2006 19:20:17 +0000
Delivery-date: Fri, 30 Jun 2006 12:22: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 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XENBUS] Another fix to the wait-for-device-connection code., Xen patchbot-unstable <=