direct-io.hg

changeset 10573:9633faf65e22

[XENBUS] Do not wait for devices with no driver to connect.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@dhcp93.uk.xensource.com
date Fri Jun 30 17:53:52 2006 +0100 (2006-06-30)
parents 640d3bc77ea6
children 4d7565ba9ff3
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 17:12:31 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Fri Jun 30 17:53:52 2006 +0100
     1.3 @@ -886,19 +886,6 @@ void unregister_xenstore_notifier(struct
     1.4  EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
     1.5  
     1.6  
     1.7 -static int find_disconnected_device_(struct device *dev, void *data)
     1.8 -{
     1.9 -	struct xenbus_device *xendev = to_xenbus_device(dev);
    1.10 -
    1.11 -	return (xendev->state == XenbusStateConnected) ? 0 : 1;
    1.12 -}
    1.13 -
    1.14 -static struct device *find_disconnected_device(struct device *start)
    1.15 -{
    1.16 -	return bus_find_device(&xenbus_frontend.bus, start, NULL,
    1.17 -			       find_disconnected_device_);
    1.18 -}
    1.19 -
    1.20  void xenbus_probe(void *unused)
    1.21  {
    1.22  	BUG_ON((xenstored_ready <= 0));
    1.23 @@ -1050,6 +1037,37 @@ static int __init xenbus_probe_init(void
    1.24  postcore_initcall(xenbus_probe_init);
    1.25  
    1.26  
    1.27 +static int find_disconnected_device_(struct device *dev, void *data)
    1.28 +{
    1.29 +	struct xenbus_device *xendev = to_xenbus_device(dev);
    1.30 +
    1.31 +	/*
    1.32 +	 * A device with no driver will never connect. We care only about
    1.33 +	 * devices which should currently be in the process of connecting.
    1.34 +	 */
    1.35 +	if (!dev->driver)
    1.36 +		return 0;
    1.37 +
    1.38 +	return (xendev->state != XenbusStateConnected);
    1.39 +}
    1.40 +
    1.41 +static struct device *find_disconnected_device(struct device *start)
    1.42 +{
    1.43 +	return bus_find_device(&xenbus_frontend.bus, start, NULL,
    1.44 +			       find_disconnected_device_);
    1.45 +}
    1.46 +
    1.47 +static int find_driverless_device_(struct device *dev, void *data)
    1.48 +{
    1.49 +	return !dev->driver;
    1.50 +}
    1.51 +
    1.52 +static struct device *find_driverless_device(struct device *start)
    1.53 +{
    1.54 +	return bus_find_device(&xenbus_frontend.bus, start, NULL,
    1.55 +			       find_driverless_device_);
    1.56 +}
    1.57 +
    1.58  /*
    1.59   * On a 10 second timeout, wait for all devices currently configured.  We need
    1.60   * to do this to guarantee that the filesystems and / or network devices
    1.61 @@ -1075,20 +1093,28 @@ static int __init wait_for_devices(void)
    1.62  
    1.63  	while (time_before(jiffies, timeout)) {
    1.64  		if ((dev = find_disconnected_device(NULL)) == NULL)
    1.65 -			return 0;
    1.66 +			break;
    1.67  		put_device(dev);
    1.68  		schedule_timeout_interruptible(HZ/10);
    1.69  	}
    1.70  
    1.71 +	/* List devices which have drivers but are not yet connected. */
    1.72  	while (dev != NULL) {
    1.73  		xendev = to_xenbus_device(dev);
    1.74  
    1.75 -		printk(KERN_WARNING "XENBUS: Timeout connecting to device: %s\n",
    1.76 -		       xendev->nodename);
    1.77 +		printk(KERN_WARNING "XENBUS: Timeout connecting "
    1.78 +		       "to device: %s\n", xendev->nodename);
    1.79  
    1.80  		dev = find_disconnected_device(dev);
    1.81  	}
    1.82  
    1.83 +	/* List devices with no driver (this is not necessarily an error). */
    1.84 +	while ((dev = find_driverless_device(dev)) != NULL) {
    1.85 +		xendev = to_xenbus_device(dev);
    1.86 +		printk(KERN_INFO "XENBUS: Device with no driver: %s\n",
    1.87 +		       xendev->nodename);
    1.88 +	}
    1.89 +
    1.90  	return 0;
    1.91  }
    1.92