staging/usbip: convert to kthread
[deliverable/linux.git] / drivers / staging / usbip / stub_tx.c
index d7136e2c86faa16a1e64638047dc0109dca0d533..5523f25998e6fcbae42de8490a7cee68f47506ca 100644 (file)
@@ -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;
 }
This page took 0.025388 seconds and 5 git commands to generate.