diff options
author | Peter Teoh <htmldeveloper@gmail.com> | 2009-03-21 02:20:23 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-03 14:53:31 -0700 |
commit | d44ca7af9e79abf4e80514583734cffed1117ee1 (patch) | |
tree | 8d4bf6b25c63f892074f086f0aacf5034fdfe831 /drivers/staging/rt2870/common/2870_rtmp_init.c | |
parent | a955dc39c0dd14e7f85c3d288478294fa133ea90 (diff) |
Staging: rt2870: Removal of kernel_thread() API
Replacing the use of kernel_thread() with kthread_run(). But as
kthread_run() returned a task structure, as compared with
kernel_thread() returning a PID, it was found to be more efficient to
store the task structure pointer as a field data instead of PID
pointer. On top of modifying the field to store task structure
pointer, the initialization of the field (assigned to
THREAD_PID_INIT_VALUE) was also found unnecessary - as no where it is
found to be used.
Signed-off-by: Peter Teoh <htmldeveloper@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rt2870/common/2870_rtmp_init.c')
-rw-r--r-- | drivers/staging/rt2870/common/2870_rtmp_init.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/staging/rt2870/common/2870_rtmp_init.c b/drivers/staging/rt2870/common/2870_rtmp_init.c index 9f5143b3922..cb16d2fcf60 100644 --- a/drivers/staging/rt2870/common/2870_rtmp_init.c +++ b/drivers/staging/rt2870/common/2870_rtmp_init.c @@ -727,8 +727,8 @@ NDIS_STATUS AdapterBlockAllocateMemory( usb_dev = pObj->pUsb_Dev; - pObj->MLMEThr_pid = THREAD_PID_INIT_VALUE; - pObj->RTUSBCmdThr_pid = THREAD_PID_INIT_VALUE; + pObj->MLMEThr_task = NULL; + pObj->RTUSBCmdThr_task = NULL; *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); @@ -765,7 +765,7 @@ NDIS_STATUS CreateThreads( { PRTMP_ADAPTER pAd = net_dev->ml_priv; POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; - pid_t pid_number = -1; + struct task_struct *tsk; //init_MUTEX(&(pAd->usbdev_semaphore)); @@ -779,36 +779,39 @@ NDIS_STATUS CreateThreads( init_completion (&pAd->TimerQComplete); // Creat MLME Thread - pObj->MLMEThr_pid= THREAD_PID_INIT_VALUE; - pid_number = kernel_thread(MlmeThread, pAd, CLONE_VM); - if (pid_number < 0) - { + pObj->MLMEThr_task = NULL; + tsk = kthread_run(MlmeThread, pAd, pAd->net_dev->name); + + if (IS_ERR(tsk)) { printk (KERN_WARNING "%s: unable to start Mlme thread\n",pAd->net_dev->name); return NDIS_STATUS_FAILURE; } - pObj->MLMEThr_pid = GET_PID(pid_number); + + pObj->MLMEThr_task = tsk; // Wait for the thread to start wait_for_completion(&(pAd->mlmeComplete)); // Creat Command Thread - pObj->RTUSBCmdThr_pid= THREAD_PID_INIT_VALUE; - pid_number = kernel_thread(RTUSBCmdThread, pAd, CLONE_VM); - if (pid_number < 0) + pObj->RTUSBCmdThr_task = NULL; + tsk = kthread_run(RTUSBCmdThread, pAd, pAd->net_dev->name); + + if (IS_ERR(tsk) < 0) { printk (KERN_WARNING "%s: unable to start RTUSBCmd thread\n",pAd->net_dev->name); return NDIS_STATUS_FAILURE; } - pObj->RTUSBCmdThr_pid = GET_PID(pid_number); + + pObj->RTUSBCmdThr_task = tsk; wait_for_completion(&(pAd->CmdQComplete)); - pObj->TimerQThr_pid= THREAD_PID_INIT_VALUE; - pid_number = kernel_thread(TimerQThread, pAd, CLONE_VM); - if (pid_number < 0) + pObj->TimerQThr_task = NULL; + tsk = kthread_run(TimerQThread, pAd, pAd->net_dev->name); + if (IS_ERR(tsk) < 0) { printk (KERN_WARNING "%s: unable to start TimerQThread\n",pAd->net_dev->name); return NDIS_STATUS_FAILURE; } - pObj->TimerQThr_pid = GET_PID(pid_number); + pObj->TimerQThr_task = tsk; // Wait for the thread to start wait_for_completion(&(pAd->TimerQComplete)); |