Commit a7cc76b2 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Greg Kroah-Hartman

Staging: rtxxx0: kill PID macros

* kill PID macros
* unify now identical RT30xx and !RT30xx code
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 659473ce
...@@ -158,15 +158,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ ...@@ -158,15 +158,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
#define NDIS_PACKET_TYPE_BROADCAST 2 #define NDIS_PACKET_TYPE_BROADCAST 2
#define NDIS_PACKET_TYPE_ALL_MULTICAST 3 #define NDIS_PACKET_TYPE_ALL_MULTICAST 3
#ifndef RT30xx
typedef struct pid * THREAD_PID;
#define THREAD_PID_INIT_VALUE NULL
#define GET_PID(_v) find_get_pid(_v)
#define GET_PID_NUMBER(_v) pid_nr(_v)
#define CHECK_PID_LEGALITY(_pid) if (pid_nr(_pid) > 0)
#define KILL_THREAD_PID(_A, _B, _C) kill_pid(_A, _B, _C)
#endif
struct os_lock { struct os_lock {
spinlock_t lock; spinlock_t lock;
unsigned long flags; unsigned long flags;
...@@ -182,16 +173,9 @@ struct os_cookie { ...@@ -182,16 +173,9 @@ struct os_cookie {
#ifdef RT2870 #ifdef RT2870
struct usb_device *pUsb_Dev; struct usb_device *pUsb_Dev;
#ifndef RT30xx
THREAD_PID MLMEThr_pid;
THREAD_PID RTUSBCmdThr_pid;
THREAD_PID TimerQThr_pid;
#endif
#ifdef RT30xx
struct pid *MLMEThr_pid; struct pid *MLMEThr_pid;
struct pid *RTUSBCmdThr_pid; struct pid *RTUSBCmdThr_pid;
struct pid *TimerQThr_pid; struct pid *TimerQThr_pid;
#endif
#endif // RT2870 // #endif // RT2870 //
struct tasklet_struct rx_done_task; struct tasklet_struct rx_done_task;
......
...@@ -348,12 +348,7 @@ INT MlmeThread( ...@@ -348,12 +348,7 @@ INT MlmeThread(
*/ */
DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__)); DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__));
#ifndef RT30xx
pObj->MLMEThr_pid = THREAD_PID_INIT_VALUE;
#endif
#ifdef RT30xx
pObj->MLMEThr_pid = NULL; pObj->MLMEThr_pid = NULL;
#endif
complete_and_exit (&pAd->mlmeComplete, 0); complete_and_exit (&pAd->mlmeComplete, 0);
return 0; return 0;
...@@ -461,12 +456,7 @@ INT RTUSBCmdThread( ...@@ -461,12 +456,7 @@ INT RTUSBCmdThread(
*/ */
DBGPRINT(RT_DEBUG_TRACE,( "<---RTUSBCmdThread\n")); DBGPRINT(RT_DEBUG_TRACE,( "<---RTUSBCmdThread\n"));
#ifndef RT30xx
pObj->RTUSBCmdThr_pid = THREAD_PID_INIT_VALUE;
#endif
#ifdef RT30xx
pObj->RTUSBCmdThr_pid = NULL; pObj->RTUSBCmdThr_pid = NULL;
#endif
complete_and_exit (&pAd->CmdQComplete, 0); complete_and_exit (&pAd->CmdQComplete, 0);
return 0; return 0;
...@@ -560,12 +550,8 @@ INT TimerQThread( ...@@ -560,12 +550,8 @@ INT TimerQThread(
*/ */
DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__)); DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__));
#ifndef RT30xx
pObj->TimerQThr_pid = THREAD_PID_INIT_VALUE;
#endif
#ifdef RT30xx
pObj->TimerQThr_pid = NULL; pObj->TimerQThr_pid = NULL;
#endif
complete_and_exit(&pAd->TimerQComplete, 0); complete_and_exit(&pAd->TimerQComplete, 0);
return 0; return 0;
...@@ -996,76 +982,11 @@ VOID RT28xxThreadTerminate( ...@@ -996,76 +982,11 @@ VOID RT28xxThreadTerminate(
RTUSBCancelPendingIRPs(pAd); RTUSBCancelPendingIRPs(pAd);
// Terminate Threads // Terminate Threads
#ifndef RT30xx
CHECK_PID_LEGALITY(pObj->TimerQThr_pid)
{
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
printk("Terminate the TimerQThr_pid=%d!\n", GET_PID_NUMBER(pObj->TimerQThr_pid));
mb();
pAd->TimerFunc_kill = 1;
mb();
ret = KILL_THREAD_PID(pObj->TimerQThr_pid, SIGTERM, 1);
if (ret)
{
printk(KERN_WARNING "%s: unable to stop TimerQThread, pid=%d, ret=%d!\n",
pAd->net_dev->name, GET_PID_NUMBER(pObj->TimerQThr_pid), ret);
}
else
{
wait_for_completion(&pAd->TimerQComplete);
pObj->TimerQThr_pid = THREAD_PID_INIT_VALUE;
}
}
CHECK_PID_LEGALITY(pObj->MLMEThr_pid)
{
printk("Terminate the MLMEThr_pid=%d!\n", GET_PID_NUMBER(pObj->MLMEThr_pid));
mb();
pAd->mlme_kill = 1;
//RT28XX_MLME_HANDLER(pAd);
mb();
ret = KILL_THREAD_PID(pObj->MLMEThr_pid, SIGTERM, 1);
if (ret)
{
printk (KERN_WARNING "%s: unable to Mlme thread, pid=%d, ret=%d!\n",
pAd->net_dev->name, GET_PID_NUMBER(pObj->MLMEThr_pid), ret);
}
else
{
//wait_for_completion (&pAd->notify);
wait_for_completion (&pAd->mlmeComplete);
pObj->MLMEThr_pid = THREAD_PID_INIT_VALUE;
}
}
CHECK_PID_LEGALITY(pObj->RTUSBCmdThr_pid)
{
printk("Terminate the RTUSBCmdThr_pid=%d!\n", GET_PID_NUMBER(pObj->RTUSBCmdThr_pid));
mb();
NdisAcquireSpinLock(&pAd->CmdQLock);
pAd->CmdQ.CmdQState = RT2870_THREAD_STOPED;
NdisReleaseSpinLock(&pAd->CmdQLock);
mb();
//RTUSBCMDUp(pAd);
ret = KILL_THREAD_PID(pObj->RTUSBCmdThr_pid, SIGTERM, 1);
if (ret)
{
printk(KERN_WARNING "%s: unable to RTUSBCmd thread, pid=%d, ret=%d!\n",
pAd->net_dev->name, GET_PID_NUMBER(pObj->RTUSBCmdThr_pid), ret);
}
else
{
//wait_for_completion (&pAd->notify);
wait_for_completion (&pAd->CmdQComplete);
pObj->RTUSBCmdThr_pid = THREAD_PID_INIT_VALUE;
}
}
#endif
#ifdef RT30xx
if (pid_nr(pObj->TimerQThr_pid) > 0) if (pid_nr(pObj->TimerQThr_pid) > 0)
{ {
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;
printk("Terminate the TimerQThr_pid=%d!\n", pid_nr(pObj->TimerQThr_pid)); printk("Terminate the TimerQThr_pid=%d!\n", pid_nr(pObj->TimerQThr_pid));
mb(); mb();
pAd->TimerFunc_kill = 1; pAd->TimerFunc_kill = 1;
...@@ -1118,7 +1039,7 @@ VOID RT28xxThreadTerminate( ...@@ -1118,7 +1039,7 @@ VOID RT28xxThreadTerminate(
{ {
printk(KERN_WARNING "%s: unable to RTUSBCmd thread, pid=%d, ret=%d!\n", printk(KERN_WARNING "%s: unable to RTUSBCmd thread, pid=%d, ret=%d!\n",
pAd->net_dev->name, pid_nr(pObj->RTUSBCmdThr_pid), ret); pAd->net_dev->name, pid_nr(pObj->RTUSBCmdThr_pid), ret);
} }
else else
{ {
//wait_for_completion (&pAd->notify); //wait_for_completion (&pAd->notify);
...@@ -1126,7 +1047,6 @@ VOID RT28xxThreadTerminate( ...@@ -1126,7 +1047,6 @@ VOID RT28xxThreadTerminate(
pObj->RTUSBCmdThr_pid = NULL; pObj->RTUSBCmdThr_pid = NULL;
} }
} }
#endif
// Kill tasklets // Kill tasklets
pAd->mlme_kill = 0; pAd->mlme_kill = 0;
......
...@@ -699,14 +699,9 @@ NDIS_STATUS AdapterBlockAllocateMemory( ...@@ -699,14 +699,9 @@ NDIS_STATUS AdapterBlockAllocateMemory(
usb_dev = pObj->pUsb_Dev; usb_dev = pObj->pUsb_Dev;
#ifndef RT30xx
pObj->MLMEThr_pid = THREAD_PID_INIT_VALUE;
pObj->RTUSBCmdThr_pid = THREAD_PID_INIT_VALUE;
#endif
#ifdef RT30xx
pObj->MLMEThr_pid = NULL; pObj->MLMEThr_pid = NULL;
pObj->RTUSBCmdThr_pid = NULL; pObj->RTUSBCmdThr_pid = NULL;
#endif
*ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER)); *ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER));
if (*ppAd) if (*ppAd)
...@@ -761,75 +756,42 @@ NDIS_STATUS CreateThreads( ...@@ -761,75 +756,42 @@ NDIS_STATUS CreateThreads(
init_completion (&pAd->TimerQComplete); init_completion (&pAd->TimerQComplete);
// Creat MLME Thread // Creat MLME Thread
#ifndef RT30xx
pObj->MLMEThr_pid= THREAD_PID_INIT_VALUE;
pid_number = kernel_thread(MlmeThread, pAd, CLONE_VM);
if (pid_number < 0)
{
#endif
#ifdef RT30xx
pObj->MLMEThr_pid = NULL; pObj->MLMEThr_pid = NULL;
pid_number = kernel_thread(MlmeThread, pAd, CLONE_VM); pid_number = kernel_thread(MlmeThread, pAd, CLONE_VM);
if (pid_number < 0) if (pid_number < 0)
{ {
#endif
printk (KERN_WARNING "%s: unable to start Mlme thread\n",pAd->net_dev->name); printk (KERN_WARNING "%s: unable to start Mlme thread\n",pAd->net_dev->name);
return NDIS_STATUS_FAILURE; return NDIS_STATUS_FAILURE;
} }
#ifndef RT30xx
pObj->MLMEThr_pid = GET_PID(pid_number);
#endif
#ifdef RT30xx
pObj->MLMEThr_pid = find_get_pid(pid_number); pObj->MLMEThr_pid = find_get_pid(pid_number);
#endif
// Wait for the thread to start // Wait for the thread to start
wait_for_completion(&(pAd->mlmeComplete)); wait_for_completion(&(pAd->mlmeComplete));
// Creat Command Thread // Creat Command Thread
#ifndef RT30xx
pObj->RTUSBCmdThr_pid= THREAD_PID_INIT_VALUE;
pid_number = kernel_thread(RTUSBCmdThread, pAd, CLONE_VM);
if (pid_number < 0)
#endif
#ifdef RT30xx
pObj->RTUSBCmdThr_pid = NULL; pObj->RTUSBCmdThr_pid = NULL;
pid_number = kernel_thread(RTUSBCmdThread, pAd, CLONE_VM); pid_number = kernel_thread(RTUSBCmdThread, pAd, CLONE_VM);
if (pid_number < 0) if (pid_number < 0)
#endif
{ {
printk (KERN_WARNING "%s: unable to start RTUSBCmd thread\n",pAd->net_dev->name); printk (KERN_WARNING "%s: unable to start RTUSBCmd thread\n",pAd->net_dev->name);
return NDIS_STATUS_FAILURE; return NDIS_STATUS_FAILURE;
} }
#ifndef RT30xx
pObj->RTUSBCmdThr_pid = GET_PID(pid_number);
#endif
#ifdef RT30xx
pObj->RTUSBCmdThr_pid = find_get_pid(pid_number); pObj->RTUSBCmdThr_pid = find_get_pid(pid_number);
#endif
wait_for_completion(&(pAd->CmdQComplete)); wait_for_completion(&(pAd->CmdQComplete));
#ifndef RT30xx
pObj->TimerQThr_pid= THREAD_PID_INIT_VALUE;
pid_number = kernel_thread(TimerQThread, pAd, CLONE_VM);
if (pid_number < 0)
#endif
#ifdef RT30xx
pObj->TimerQThr_pid = NULL; pObj->TimerQThr_pid = NULL;
pid_number = kernel_thread(TimerQThread, pAd, CLONE_VM); pid_number = kernel_thread(TimerQThread, pAd, CLONE_VM);
if (pid_number < 0) if (pid_number < 0)
#endif
{ {
printk (KERN_WARNING "%s: unable to start TimerQThread\n",pAd->net_dev->name); printk (KERN_WARNING "%s: unable to start TimerQThread\n",pAd->net_dev->name);
return NDIS_STATUS_FAILURE; return NDIS_STATUS_FAILURE;
} }
#ifndef RT30xx
pObj->TimerQThr_pid = GET_PID(pid_number);
#endif
#ifdef RT30xx
pObj->TimerQThr_pid = find_get_pid(pid_number); pObj->TimerQThr_pid = find_get_pid(pid_number);
#endif
// Wait for the thread to start // Wait for the thread to start
wait_for_completion(&(pAd->TimerQComplete)); wait_for_completion(&(pAd->TimerQComplete));
......
...@@ -984,7 +984,7 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis( ...@@ -984,7 +984,7 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis(
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
#ifndef RT30xx #ifndef RT30xx
CHECK_PID_LEGALITY(pObj->RTUSBCmdThr_pid) if (pid_nr(pObj->RTUSBCmdThr_pid) > 0)
#endif #endif
#ifdef RT30xx #ifdef RT30xx
if (pObj->RTUSBCmdThr_pid < 0) if (pObj->RTUSBCmdThr_pid < 0)
......
...@@ -441,22 +441,6 @@ VOID RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs); ...@@ -441,22 +441,6 @@ VOID RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs);
VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs); VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs);
VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs); VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs);
#ifndef RT30xx
#define RTUSBMlmeUp(pAd) \
{ \
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
CHECK_PID_LEGALITY(pObj->MLMEThr_pid) \
up(&(pAd->mlme_semaphore)); \
}
#define RTUSBCMDUp(pAd) \
{ \
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
CHECK_PID_LEGALITY(pObj->RTUSBCmdThr_pid) \
up(&(pAd->RTUSBCmd_semaphore)); \
}
#endif
#ifdef RT30xx
#define RTUSBMlmeUp(pAd) \ #define RTUSBMlmeUp(pAd) \
{ \ { \
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \ POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
...@@ -470,7 +454,6 @@ VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs); ...@@ -470,7 +454,6 @@ VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs);
if (pid_nr(pObj->RTUSBCmdThr_pid) > 0) \ if (pid_nr(pObj->RTUSBCmdThr_pid) > 0) \
up(&(pAd->RTUSBCmd_semaphore)); \ up(&(pAd->RTUSBCmd_semaphore)); \
} }
#endif
static inline NDIS_STATUS RTMPAllocateMemory( static inline NDIS_STATUS RTMPAllocateMemory(
OUT PVOID *ptr, OUT PVOID *ptr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment