diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-03-02 18:57:03 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-03-02 18:57:03 +0100 |
commit | bfded7ad041acf4ae62a25279389eb9a868697a5 (patch) | |
tree | 0a8d3eff73df26fd7affb7fe290acd71e3904478 /linux-2.6-xen-sparse | |
parent | 9ff90bdaa1e188ef2e1e1904134059c276edc5ab (diff) | |
download | xen-bfded7ad041acf4ae62a25279389eb9a868697a5.tar.gz xen-bfded7ad041acf4ae62a25279389eb9a868697a5.tar.bz2 xen-bfded7ad041acf4ae62a25279389eb9a868697a5.zip |
Clean up use of wait_event_interruptible().
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'linux-2.6-xen-sparse')
-rw-r--r-- | linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c | 18 | ||||
-rw-r--r-- | linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c | 14 |
2 files changed, 25 insertions, 7 deletions
diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c index 59817f076b..0c7c32693c 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c @@ -89,14 +89,18 @@ int xb_write(const void *data, unsigned len) { struct xenstore_domain_interface *intf = xenstore_domain_interface(); XENSTORE_RING_IDX cons, prod; + int rc; while (len != 0) { void *dst; unsigned int avail; - wait_event_interruptible(xb_waitq, - (intf->req_prod - intf->req_cons) != - XENSTORE_RING_SIZE); + rc = wait_event_interruptible( + xb_waitq, + (intf->req_prod - intf->req_cons) != + XENSTORE_RING_SIZE); + if (rc < 0) + return rc; /* Read indexes, then verify. */ cons = intf->req_cons; @@ -130,13 +134,17 @@ int xb_read(void *data, unsigned len) { struct xenstore_domain_interface *intf = xenstore_domain_interface(); XENSTORE_RING_IDX cons, prod; + int rc; while (len != 0) { unsigned int avail; const char *src; - wait_event_interruptible(xb_waitq, - intf->rsp_cons != intf->rsp_prod); + rc = wait_event_interruptible( + xb_waitq, + intf->rsp_cons != intf->rsp_prod); + if (rc < 0) + return rc; /* Read indexes, then verify. */ cons = intf->rsp_cons; diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index 1bc9177ec5..8ee2fbb99c 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -123,8 +123,9 @@ static void *read_reply(enum xsd_sockmsg_type *type, unsigned int *len) while (list_empty(&xs_state.reply_list)) { spin_unlock(&xs_state.reply_lock); - wait_event_interruptible(xs_state.reply_waitq, - !list_empty(&xs_state.reply_list)); + /* XXX FIXME: Avoid synchronous wait for response here. */ + wait_event(xs_state.reply_waitq, + !list_empty(&xs_state.reply_list)); spin_lock(&xs_state.reply_lock); } @@ -685,6 +686,9 @@ static int xenwatch_thread(void *unused) wait_event_interruptible(watch_events_waitq, !list_empty(&watch_events)); + if (kthread_should_stop()) + break; + down(&xenwatch_mutex); spin_lock(&watch_events_lock); @@ -705,6 +709,8 @@ static int xenwatch_thread(void *unused) up(&xenwatch_mutex); } + + return 0; } static int process_msg(void) @@ -778,7 +784,11 @@ static int xenbus_thread(void *unused) if (err) printk(KERN_WARNING "XENBUS error %d while reading " "message\n", err); + if (kthread_should_stop()) + break; } + + return 0; } int xs_init(void) |