Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XENBUS] Improve the code for waiting for

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XENBUS] Improve the code for waiting for devices to connect. Provide
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 30 Jun 2006 17:40:14 +0000
Delivery-date: Fri, 30 Jun 2006 10:42:18 -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 f5a5f49935fda0bb613275c614fc7462bff75ba3
# Parent  17e9daeb2c504389a8de8b5ed814bbe75878dca3
[XENBUS] Improve the code for waiting for devices to connect. Provide
a more useful error when devices fail to connect.
From: Mark McLoughlin <markmc@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c |   45 ++++++++---------
 1 files changed, 23 insertions(+), 22 deletions(-)

diff -r 17e9daeb2c50 -r f5a5f49935fd 
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 
14:41:13 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Fri Jun 30 
17:02:22 2006 +0100
@@ -886,28 +886,18 @@ EXPORT_SYMBOL_GPL(unregister_xenstore_no
 EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
 
 
-static int all_devices_ready_(struct device *dev, void *data)
+static int find_disconnected_device_(struct device *dev, void *data)
 {
        struct xenbus_device *xendev = to_xenbus_device(dev);
-       int *result = data;
-
-       if (xendev->state != XenbusStateConnected) {
-               *result = 0;
-               return 1;
-       }
-
-       return 0;
-}
-
-
-static int all_devices_ready(void)
-{
-       int ready = 1;
-       bus_for_each_dev(&xenbus_frontend.bus, NULL, &ready,
-                        all_devices_ready_);
-       return ready;
-}
-
+
+       return (xendev->state == XenbusStateConnected) ? 0 : 1;
+}
+
+static struct device *find_disconnected_device(struct device *start)
+{
+       return bus_find_device(&xenbus_frontend.bus, start, NULL,
+                              find_disconnected_device_);
+}
 
 void xenbus_probe(void *unused)
 {
@@ -1077,17 +1067,28 @@ static int __init wait_for_devices(void)
 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;
 
        while (time_before(jiffies, timeout)) {
-               if (all_devices_ready())
+               if ((dev = find_disconnected_device(NULL)) == NULL)
                        return 0;
+               put_device(dev);
                schedule_timeout_interruptible(HZ/10);
        }
 
-       printk(KERN_WARNING "XENBUS: Timeout connecting to devices!\n");
+       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);
+       }
+
        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] Improve the code for waiting for devices to connect. Provide, Xen patchbot-unstable <=