diff options
author | Arnd Bergmann <arnd@arndb.de> | 2011-03-02 00:13:05 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-02 16:03:59 -0500 |
commit | 9720b4bc76a83807c68e00c62bfba575251bb73e (patch) | |
tree | 41794e9b5f715bf5ee52d428cadcf70ac773347b /drivers/staging/usbip/stub_dev.c | |
parent | 8c81161615feb8c666c675ec7a660dc9b011683f (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_dev.c')
-rw-r--r-- | drivers/staging/usbip/stub_dev.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index a7ce51cc8909..8214c353d9f5 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -18,6 +18,7 @@ */ #include <linux/slab.h> +#include <linux/kthread.h> #include "usbip_common.h" #include "stub.h" @@ -138,7 +139,8 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr, spin_unlock(&sdev->ud.lock); - usbip_start_threads(&sdev->ud); + sdev->ud.tcp_rx = kthread_run(stub_rx_loop, &sdev->ud, "stub_rx"); + sdev->ud.tcp_tx = kthread_run(stub_tx_loop, &sdev->ud, "stub_tx"); spin_lock(&sdev->ud.lock); sdev->ud.status = SDEV_ST_USED; @@ -218,7 +220,8 @@ static void stub_shutdown_connection(struct usbip_device *ud) } /* 1. stop threads */ - usbip_stop_threads(ud); + kthread_stop(ud->tcp_rx); + kthread_stop(ud->tcp_tx); /* 2. close the socket */ /* @@ -336,9 +339,6 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev, */ sdev->devid = (busnum << 16) | devnum; - usbip_task_init(&sdev->ud.tcp_rx, "stub_rx", stub_rx_loop); - usbip_task_init(&sdev->ud.tcp_tx, "stub_tx", stub_tx_loop); - sdev->ud.side = USBIP_STUB; sdev->ud.status = SDEV_ST_AVAILABLE; /* sdev->ud.lock = SPIN_LOCK_UNLOCKED; */ @@ -543,7 +543,7 @@ static void stub_disconnect(struct usb_interface *interface) stub_remove_files(&interface->dev); /*If usb reset called from event handler*/ - if (busid_priv->sdev->ud.eh.thread == current) { + if (busid_priv->sdev->ud.eh == current) { busid_priv->interf_count--; return; } |