ia64/xen-unstable

changeset 9668:b32bc0c5648d

Netfront must switch state using xenbus_switch_state() or this
is not picked up by the waiting code in xenbus_probe.c.

Also clean up the waiting code a little.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Apr 10 18:56:34 2006 +0100 (2006-04-10)
parents 6df0bdcf8c9d
children c783f340bef8
files linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Mon Apr 10 18:30:07 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Mon Apr 10 18:56:34 2006 +0100
     1.3 @@ -300,13 +300,6 @@ again:
     1.4  		goto abort_transaction;
     1.5  	}
     1.6  
     1.7 -	err = xenbus_printf(xbt, dev->nodename,
     1.8 -			    "state", "%d", XenbusStateConnected);
     1.9 -	if (err) {
    1.10 -		message = "writing frontend XenbusStateConnected";
    1.11 -		goto abort_transaction;
    1.12 -	}
    1.13 -
    1.14  	err = xenbus_transaction_end(xbt, 0);
    1.15  	if (err) {
    1.16  		if (err == -EAGAIN)
    1.17 @@ -315,6 +308,8 @@ again:
    1.18  		goto destroy_ring;
    1.19  	}
    1.20  
    1.21 +	xenbus_switch_state(dev, XenbusStateConnected);
    1.22 +
    1.23  	return 0;
    1.24  
    1.25   abort_transaction:
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Mon Apr 10 18:30:07 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Mon Apr 10 18:56:34 2006 +0100
     2.3 @@ -1065,19 +1065,16 @@ postcore_initcall(xenbus_probe_init);
     2.4   */
     2.5  static int __init wait_for_devices(void)
     2.6  {
     2.7 -	int i;
     2.8 +	unsigned long timeout = jiffies + 10*HZ;
     2.9  
    2.10 -	for (i = 0; i < 10 * HZ; i++) {
    2.11 -		if (all_devices_ready()) {
    2.12 -			return;
    2.13 -		}
    2.14 -
    2.15 -		set_current_state(TASK_INTERRUPTIBLE);
    2.16 -		schedule_timeout(1);
    2.17 +	while (time_before(jiffies, timeout)) {
    2.18 +		if (all_devices_ready())
    2.19 +			return 0;
    2.20 +		schedule_timeout_interruptible(HZ/10);
    2.21  	}
    2.22  
    2.23 -	printk(KERN_WARNING
    2.24 -	       "XENBUS: Timeout connecting to devices!\n");
    2.25 +	printk(KERN_WARNING "XENBUS: Timeout connecting to devices!\n");
    2.26 +	return 0;
    2.27  }
    2.28  
    2.29  late_initcall(wait_for_devices);