staging: vt6656: 64bit fixes: vCommandTimerWait change calculation of timer.
authorMalcolm Priestley <tvboxspy@gmail.com>
Sun, 11 Nov 2012 16:07:57 +0000 (16:07 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2012 20:51:32 +0000 (12:51 -0800)
The timer appears to run too fast/race on 64 bit systems.

Using msecs_to_jiffies seems to cause a deadlock on 64 bit.

A calculation of (MSecond * HZ) / 1000 appears to run satisfactory.

Change BSSIDInfoCount to u32.

After this patch the driver can be successfully connect on little endian 64/32 bit systems.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/wcmd.c
drivers/staging/vt6656/wpa2.h

index 586fbe1627f74f7e7ece1c8e15bd56016e71d73e..b854d7ef97d73e673cfd7a6ebe25ab1d52b34b34 100644 (file)
@@ -316,17 +316,19 @@ s_MgrMakeProbeRequest(
     return pTxPacket;
 }
 
-void vCommandTimerWait(void *hDeviceContext, unsigned int MSecond)
+void vCommandTimerWait(void *hDeviceContext, unsigned long MSecond)
 {
-    PSDevice        pDevice = (PSDevice)hDeviceContext;
+       PSDevice pDevice = (PSDevice)hDeviceContext;
 
-    init_timer(&pDevice->sTimerCommand);
-    pDevice->sTimerCommand.data = (unsigned long)pDevice;
-    pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
-    // RUN_AT :1 msec ~= (HZ/1024)
-    pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10);
-    add_timer(&pDevice->sTimerCommand);
-    return;
+       init_timer(&pDevice->sTimerCommand);
+
+       pDevice->sTimerCommand.data = (unsigned long)pDevice;
+       pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
+       pDevice->sTimerCommand.expires = RUN_AT((MSecond * HZ) / 1000);
+
+       add_timer(&pDevice->sTimerCommand);
+
+       return;
 }
 
 void vRunCommand(void *hDeviceContext)
index 46c295905b48adbc0e5f7da80e81ada654831444..c359252a6b0e37af1d160a1811fc3dcbab24ab69 100644 (file)
@@ -45,8 +45,8 @@ typedef struct tagsPMKIDInfo {
 } PMKIDInfo, *PPMKIDInfo;
 
 typedef struct tagSPMKIDCache {
-    unsigned long       BSSIDInfoCount;
-    PMKIDInfo   BSSIDInfo[MAX_PMKID_CACHE];
+       u32 BSSIDInfoCount;
+       PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
 } SPMKIDCache, *PSPMKIDCache;