diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-09-22 19:54:53 (GMT) |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-09-22 20:01:40 (GMT) |
commit | ae19ffbadc1b2100285a5b5b3d0a4e0a11390904 (patch) | |
tree | 3c2086ab67398a019089a47ca3f362a4bc6db74f /drivers/staging/usbip/usbip_event.c | |
parent | 34e84f39a27d059a3e6ec6e8b94aafa702e6f220 (diff) | |
parent | 9173a8ef24a6b1b8031507b35b8ffe5f85a87692 (diff) | |
download | linux-fsl-qoriq-ae19ffbadc1b2100285a5b5b3d0a4e0a11390904.tar.xz |
Merge branch 'master' into for-linus
Diffstat (limited to 'drivers/staging/usbip/usbip_event.c')
-rw-r--r-- | drivers/staging/usbip/usbip_event.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c index 4318553..6da1021 100644 --- a/drivers/staging/usbip/usbip_event.c +++ b/drivers/staging/usbip/usbip_event.c @@ -18,16 +18,17 @@ */ #include "usbip_common.h" +#include <linux/kthread.h> static int event_handler(struct usbip_device *ud) { - dbg_eh("enter\n"); + usbip_dbg_eh("enter\n"); /* * Events are handled by only this thread. */ - while (usbip_event_happend(ud)) { - dbg_eh("pending event %lx\n", ud->event); + while (usbip_event_happened(ud)) { + usbip_dbg_eh("pending event %lx\n", ud->event); /* * NOTE: shutdown must come first. @@ -77,30 +78,38 @@ static void event_handler_loop(struct usbip_task *ut) while (1) { if (signal_pending(current)) { - dbg_eh("signal catched!\n"); + usbip_dbg_eh("signal catched!\n"); break; } if (event_handler(ud) < 0) break; - wait_event_interruptible(ud->eh_waitq, usbip_event_happend(ud)); - dbg_eh("wakeup\n"); + wait_event_interruptible(ud->eh_waitq, + usbip_event_happened(ud)); + usbip_dbg_eh("wakeup\n"); } } -void usbip_start_eh(struct usbip_device *ud) +int usbip_start_eh(struct usbip_device *ud) { struct usbip_task *eh = &ud->eh; + struct task_struct *th; init_waitqueue_head(&ud->eh_waitq); ud->event = 0; usbip_task_init(eh, "usbip_eh", event_handler_loop); - kernel_thread(usbip_thread, (void *)eh, 0); + th = kthread_run(usbip_thread, (void *)eh, "usbip"); + if (IS_ERR(th)) { + printk(KERN_WARNING + "Unable to start control thread\n"); + return PTR_ERR(th); + } wait_for_completion(&eh->thread_done); + return 0; } EXPORT_SYMBOL_GPL(usbip_start_eh); @@ -109,7 +118,7 @@ void usbip_stop_eh(struct usbip_device *ud) struct usbip_task *eh = &ud->eh; wait_for_completion(&eh->thread_done); - dbg_eh("usbip_eh has finished\n"); + usbip_dbg_eh("usbip_eh has finished\n"); } EXPORT_SYMBOL_GPL(usbip_stop_eh); @@ -125,17 +134,17 @@ void usbip_event_add(struct usbip_device *ud, unsigned long event) } EXPORT_SYMBOL_GPL(usbip_event_add); -int usbip_event_happend(struct usbip_device *ud) +int usbip_event_happened(struct usbip_device *ud) { - int happend = 0; + int happened = 0; spin_lock(&ud->lock); if (ud->event != 0) - happend = 1; + happened = 1; spin_unlock(&ud->lock); - return happend; + return happened; } -EXPORT_SYMBOL_GPL(usbip_event_happend); +EXPORT_SYMBOL_GPL(usbip_event_happened); |