ia64/xen-unstable

changeset 9108:990b436099be

Clean up use of wait_event_interruptible().

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Mar 02 18:57:03 2006 +0100 (2006-03-02)
parents 8f1f6c70e4f5
children b50d3fca138e
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.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_comms.c	Thu Mar 02 15:41:45 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Thu Mar 02 18:57:03 2006 +0100
     1.3 @@ -89,14 +89,18 @@ int xb_write(const void *data, unsigned 
     1.4  {
     1.5  	struct xenstore_domain_interface *intf = xenstore_domain_interface();
     1.6  	XENSTORE_RING_IDX cons, prod;
     1.7 +	int rc;
     1.8  
     1.9  	while (len != 0) {
    1.10  		void *dst;
    1.11  		unsigned int avail;
    1.12  
    1.13 -		wait_event_interruptible(xb_waitq,
    1.14 -					 (intf->req_prod - intf->req_cons) !=
    1.15 -					 XENSTORE_RING_SIZE);
    1.16 +		rc = wait_event_interruptible(
    1.17 +			xb_waitq,
    1.18 +			(intf->req_prod - intf->req_cons) !=
    1.19 +			XENSTORE_RING_SIZE);
    1.20 +		if (rc < 0)
    1.21 +			return rc;
    1.22  
    1.23  		/* Read indexes, then verify. */
    1.24  		cons = intf->req_cons;
    1.25 @@ -130,13 +134,17 @@ int xb_read(void *data, unsigned len)
    1.26  {
    1.27  	struct xenstore_domain_interface *intf = xenstore_domain_interface();
    1.28  	XENSTORE_RING_IDX cons, prod;
    1.29 +	int rc;
    1.30  
    1.31  	while (len != 0) {
    1.32  		unsigned int avail;
    1.33  		const char *src;
    1.34  
    1.35 -		wait_event_interruptible(xb_waitq,
    1.36 -					 intf->rsp_cons != intf->rsp_prod);
    1.37 +		rc = wait_event_interruptible(
    1.38 +			xb_waitq,
    1.39 +			intf->rsp_cons != intf->rsp_prod);
    1.40 +		if (rc < 0)
    1.41 +			return rc;
    1.42  
    1.43  		/* Read indexes, then verify. */
    1.44  		cons = intf->rsp_cons;
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Thu Mar 02 15:41:45 2006 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Thu Mar 02 18:57:03 2006 +0100
     2.3 @@ -123,8 +123,9 @@ static void *read_reply(enum xsd_sockmsg
     2.4  
     2.5  	while (list_empty(&xs_state.reply_list)) {
     2.6  		spin_unlock(&xs_state.reply_lock);
     2.7 -		wait_event_interruptible(xs_state.reply_waitq,
     2.8 -					 !list_empty(&xs_state.reply_list));
     2.9 +		/* XXX FIXME: Avoid synchronous wait for response here. */
    2.10 +		wait_event(xs_state.reply_waitq,
    2.11 +			   !list_empty(&xs_state.reply_list));
    2.12  		spin_lock(&xs_state.reply_lock);
    2.13  	}
    2.14  
    2.15 @@ -685,6 +686,9 @@ static int xenwatch_thread(void *unused)
    2.16  		wait_event_interruptible(watch_events_waitq,
    2.17  					 !list_empty(&watch_events));
    2.18  
    2.19 +		if (kthread_should_stop())
    2.20 +			break;
    2.21 +
    2.22  		down(&xenwatch_mutex);
    2.23  
    2.24  		spin_lock(&watch_events_lock);
    2.25 @@ -705,6 +709,8 @@ static int xenwatch_thread(void *unused)
    2.26  
    2.27  		up(&xenwatch_mutex);
    2.28  	}
    2.29 +
    2.30 +	return 0;
    2.31  }
    2.32  
    2.33  static int process_msg(void)
    2.34 @@ -778,7 +784,11 @@ static int xenbus_thread(void *unused)
    2.35  		if (err)
    2.36  			printk(KERN_WARNING "XENBUS error %d while reading "
    2.37  			       "message\n", err);
    2.38 +		if (kthread_should_stop())
    2.39 +			break;
    2.40  	}
    2.41 +
    2.42 +	return 0;
    2.43  }
    2.44  
    2.45  int xs_init(void)