[PATCH] staging: scalar tests on pointers

From: Roel Kluin
Date: Sun Apr 26 2009 - 10:56:39 EST


RTUSBCmdThr_pid, TimerQThr_pid and MLMEThr_pid are pointers.

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
---
I think this is correct, right?

diff --git a/drivers/staging/rt3070/2870_main_dev.c b/drivers/staging/rt3070/2870_main_dev.c
index 401ddb0..6f405f9 100644
--- a/drivers/staging/rt3070/2870_main_dev.c
+++ b/drivers/staging/rt3070/2870_main_dev.c
@@ -976,7 +976,7 @@ VOID RT28xxThreadTerminate(
}
}

- if (pObj->RTUSBCmdThr_pid >= 0)
+ if (pid_nr(pObj->RTUSBCmdThr_pid) >= 0)
{
printk("Terminate the RTUSBCmdThr_pid=%d!\n", pid_nr(pObj->RTUSBCmdThr_pid));
mb();
@@ -998,7 +998,7 @@ VOID RT28xxThreadTerminate(
pObj->RTUSBCmdThr_pid = NULL;
}
}
- if (pObj->TimerQThr_pid >= 0)
+ if (pid_nr(pObj->TimerQThr_pid) >= 0)
{
POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie;

diff --git a/drivers/staging/rt3070/common/rtusb_io.c b/drivers/staging/rt3070/common/rtusb_io.c
index a6a52e3..aa6eecc 100644
--- a/drivers/staging/rt3070/common/rtusb_io.c
+++ b/drivers/staging/rt3070/common/rtusb_io.c
@@ -873,7 +873,7 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis(
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;


- if (pObj->RTUSBCmdThr_pid < 0)
+ if (pid_nr(pObj->RTUSBCmdThr_pid) < 0)
return (NDIS_STATUS_RESOURCES);

status = RTMPAllocateMemory((PVOID *)&cmdqelmt, sizeof(CmdQElmt));
diff --git a/drivers/staging/rt3070/rt2870.h b/drivers/staging/rt3070/rt2870.h
index d32a2bf..193bff4 100644
--- a/drivers/staging/rt3070/rt2870.h
+++ b/drivers/staging/rt3070/rt2870.h
@@ -567,18 +567,18 @@ VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs);
VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs);


-#define RTUSBMlmeUp(pAd) \
-{ \
+#define RTUSBMlmeUp(pAd) \
+{ \
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
- if(pObj->MLMEThr_pid>0) \
- up(&(pAd->mlme_semaphore)); \
+ if (pid_nr(pObj->MLMEThr_pid) > 0) \
+ up(&(pAd->mlme_semaphore)); \
}

-#define RTUSBCMDUp(pAd) \
-{ \
+#define RTUSBCMDUp(pAd) \
+{ \
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
- if(pObj->RTUSBCmdThr_pid>0) \
- up(&(pAd->RTUSBCmd_semaphore)); \
+ if (pid_nr(pObj->RTUSBCmdThr_pid) > 0) \
+ up(&(pAd->RTUSBCmd_semaphore)); \
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/