ia64/xen-unstable

changeset 7371:179027128d99

Disable watch callbacks while running the driver probe callback.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Wed Oct 12 18:43:26 2005 +0100 (2005-10-12)
parents 2796f432858e
children d6e0eb8622cd
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Wed Oct 12 18:25:40 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Wed Oct 12 18:43:26 2005 +0100
     1.3 @@ -39,6 +39,8 @@
     1.4  #include <linux/notifier.h>
     1.5  #include "xenbus_comms.h"
     1.6  
     1.7 +extern struct semaphore xenwatch_mutex;
     1.8 +
     1.9  #define streq(a, b) (strcmp((a), (b)) == 0)
    1.10  
    1.11  static struct notifier_block *xenstore_chain;
    1.12 @@ -205,6 +207,7 @@ static int xenbus_dev_probe(struct devic
    1.13  	struct xenbus_device *dev = to_xenbus_device(_dev);
    1.14  	struct xenbus_driver *drv = to_xenbus_driver(_dev->driver);
    1.15  	const struct xenbus_device_id *id;
    1.16 +	int ret;
    1.17  
    1.18  	if (!drv->probe)
    1.19  		return -ENODEV;
    1.20 @@ -213,7 +216,10 @@ static int xenbus_dev_probe(struct devic
    1.21  	if (!id)
    1.22  		return -ENODEV;
    1.23  
    1.24 -	return drv->probe(dev, id);
    1.25 +	down(&xenwatch_mutex);
    1.26 +	ret = drv->probe(dev, id);
    1.27 +	up(&xenwatch_mutex);
    1.28 +	return ret;
    1.29  }
    1.30  
    1.31  static int xenbus_dev_remove(struct device *_dev)
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Wed Oct 12 18:25:40 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Wed Oct 12 18:43:26 2005 +0100
     2.3 @@ -92,7 +92,7 @@ static DEFINE_SPINLOCK(watch_events_lock
     2.4   * carrying out work.
     2.5   */
     2.6  static pid_t xenwatch_pid;
     2.7 -static DECLARE_MUTEX(xenwatch_mutex);
     2.8 +/* static */ DECLARE_MUTEX(xenwatch_mutex);
     2.9  static DECLARE_WAIT_QUEUE_HEAD(watch_events_waitq);
    2.10  
    2.11  static int get_error(const char *errorstring)