aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/atm/usbatm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-25 15:40:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-25 15:40:57 -0400
commit37b05b17985ecc43a33e2a8cbdaa220115de4703 (patch)
tree8213bf790182711677018ed322a9ccf61470242e /drivers/usb/atm/usbatm.c
parentce1d5b23a8d1e19866ab82bdec0dc41fde5273d8 (diff)
parent4953d141dc5db748475001cfbfdcc42e66cf900e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (120 commits) usb: don't update devnum for wusb devices wusb: make ep0_reinit available for modules wusb: devices dont use a set address wusb: teach choose_address() about wireless devices wusb: add link wusb-usb device wusb: add authenticathed bit to usb_dev USB: remove unnecessary type casting of urb->context usb serial: more fixes and groundwork for tty changes USB: replace remaining __FUNCTION__ occurrences USB: usbfs: export the URB_NO_INTERRUPT flag to userspace USB: fix compile problems in ehci-hcd USB: ehci: qh_completions cleanup and bugfix USB: cdc-acm: signedness fix USB: add documentation about callbacks USB: don't explicitly reenable root-hub status interrupts USB: OHCI: turn off RD when remote wakeup is disabled USB: HCDs use the do_remote_wakeup flag USB: g_file_storage: ignore bulk-out data after invalid CBW USB: serial: remove endpoints setting checks from core and header USB: serial: remove unneeded number endpoints settings ...
Diffstat (limited to 'drivers/usb/atm/usbatm.c')
-rw-r--r--drivers/usb/atm/usbatm.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index e717f5b1caee..07228721cafe 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -80,6 +80,7 @@
80#include <linux/stat.h> 80#include <linux/stat.h>
81#include <linux/timer.h> 81#include <linux/timer.h>
82#include <linux/wait.h> 82#include <linux/wait.h>
83#include <linux/kthread.h>
83 84
84#ifdef VERBOSE_DEBUG 85#ifdef VERBOSE_DEBUG
85static int usbatm_print_packet(const unsigned char *data, int len); 86static int usbatm_print_packet(const unsigned char *data, int len);
@@ -1014,10 +1015,7 @@ static int usbatm_do_heavy_init(void *arg)
1014 struct usbatm_data *instance = arg; 1015 struct usbatm_data *instance = arg;
1015 int ret; 1016 int ret;
1016 1017
1017 daemonize(instance->driver->driver_name);
1018 allow_signal(SIGTERM); 1018 allow_signal(SIGTERM);
1019 instance->thread_pid = current->pid;
1020
1021 complete(&instance->thread_started); 1019 complete(&instance->thread_started);
1022 1020
1023 ret = instance->driver->heavy_init(instance, instance->usb_intf); 1021 ret = instance->driver->heavy_init(instance, instance->usb_intf);
@@ -1026,7 +1024,7 @@ static int usbatm_do_heavy_init(void *arg)
1026 ret = usbatm_atm_init(instance); 1024 ret = usbatm_atm_init(instance);
1027 1025
1028 mutex_lock(&instance->serialize); 1026 mutex_lock(&instance->serialize);
1029 instance->thread_pid = -1; 1027 instance->thread = NULL;
1030 mutex_unlock(&instance->serialize); 1028 mutex_unlock(&instance->serialize);
1031 1029
1032 complete_and_exit(&instance->thread_exited, ret); 1030 complete_and_exit(&instance->thread_exited, ret);
@@ -1034,13 +1032,18 @@ static int usbatm_do_heavy_init(void *arg)
1034 1032
1035static int usbatm_heavy_init(struct usbatm_data *instance) 1033static int usbatm_heavy_init(struct usbatm_data *instance)
1036{ 1034{
1037 int ret = kernel_thread(usbatm_do_heavy_init, instance, CLONE_FS | CLONE_FILES); 1035 struct task_struct *t;
1038 1036
1039 if (ret < 0) { 1037 t = kthread_create(usbatm_do_heavy_init, instance,
1040 usb_err(instance, "%s: failed to create kernel_thread (%d)!\n", __func__, ret); 1038 instance->driver->driver_name);
1041 return ret; 1039 if (IS_ERR(t)) {
1040 usb_err(instance, "%s: failed to create kernel_thread (%ld)!\n",
1041 __func__, PTR_ERR(t));
1042 return PTR_ERR(t);
1042 } 1043 }
1043 1044
1045 instance->thread = t;
1046 wake_up_process(t);
1044 wait_for_completion(&instance->thread_started); 1047 wait_for_completion(&instance->thread_started);
1045 1048
1046 return 0; 1049 return 0;
@@ -1124,7 +1127,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
1124 kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */ 1127 kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */
1125 mutex_init(&instance->serialize); 1128 mutex_init(&instance->serialize);
1126 1129
1127 instance->thread_pid = -1; 1130 instance->thread = NULL;
1128 init_completion(&instance->thread_started); 1131 init_completion(&instance->thread_started);
1129 init_completion(&instance->thread_exited); 1132 init_completion(&instance->thread_exited);
1130 1133
@@ -1287,8 +1290,8 @@ void usbatm_usb_disconnect(struct usb_interface *intf)
1287 1290
1288 mutex_lock(&instance->serialize); 1291 mutex_lock(&instance->serialize);
1289 instance->disconnected = 1; 1292 instance->disconnected = 1;
1290 if (instance->thread_pid >= 0) 1293 if (instance->thread != NULL)
1291 kill_proc(instance->thread_pid, SIGTERM, 1); 1294 send_sig(SIGTERM, instance->thread, 1);
1292 mutex_unlock(&instance->serialize); 1295 mutex_unlock(&instance->serialize);
1293 1296
1294 wait_for_completion(&instance->thread_exited); 1297 wait_for_completion(&instance->thread_exited);