aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/usbip/stub_tx.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-03-02 00:13:05 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-03-02 16:03:59 -0500
commit9720b4bc76a83807c68e00c62bfba575251bb73e (patch)
tree41794e9b5f715bf5ee52d428cadcf70ac773347b /drivers/staging/usbip/stub_tx.c
parent8c81161615feb8c666c675ec7a660dc9b011683f (diff)
staging/usbip: convert to kthread
usbip has its own infrastructure for managing kernel threads, similar to kthread. By changing it to use the standard functions, we can simplify the code and get rid of one of the last BKL users at the same time. Includes changes suggested by Max Vozeler. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Takahiro Hirofuchi <hirofuchi@users.sourceforge.net> Cc: Max Vozeler <max@vozeler.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/usbip/stub_tx.c')
-rw-r--r--drivers/staging/usbip/stub_tx.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/staging/usbip/stub_tx.c b/drivers/staging/usbip/stub_tx.c
index d7136e2c86f..5523f25998e 100644
--- a/drivers/staging/usbip/stub_tx.c
+++ b/drivers/staging/usbip/stub_tx.c
@@ -18,6 +18,7 @@
*/
#include <linux/slab.h>
+#include <linux/kthread.h>
#include "usbip_common.h"
#include "stub.h"
@@ -333,17 +334,12 @@ static int stub_send_ret_unlink(struct stub_device *sdev)
/*-------------------------------------------------------------------------*/
-void stub_tx_loop(struct usbip_task *ut)
+int stub_tx_loop(void *data)
{
- struct usbip_device *ud = container_of(ut, struct usbip_device, tcp_tx);
+ struct usbip_device *ud = data;
struct stub_device *sdev = container_of(ud, struct stub_device, ud);
- while (1) {
- if (signal_pending(current)) {
- usbip_dbg_stub_tx("signal catched\n");
- break;
- }
-
+ while (!kthread_should_stop()) {
if (usbip_event_happened(ud))
break;
@@ -369,6 +365,9 @@ void stub_tx_loop(struct usbip_task *ut)
wait_event_interruptible(sdev->tx_waitq,
(!list_empty(&sdev->priv_tx) ||
- !list_empty(&sdev->unlink_tx)));
+ !list_empty(&sdev->unlink_tx) ||
+ kthread_should_stop()));
}
+
+ return 0;
}