]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: vt6656: device.h convert sTimerCommand to delayed_work
authorMalcolm Priestley <tvboxspy@gmail.com>
Fri, 27 Sep 2013 15:48:14 +0000 (16:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Oct 2013 01:33:13 +0000 (18:33 -0700)
timer to delay workqueue.
sTimerCommand -> run_command_work

sTimerCommand is very heavy on the system timer.

Improves over performance of driver and reduce the atomic
area of driver.

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

index 8e396341c5e84aad180e15acbf4d06e74d6a276d..63806e8e3174dbbb05d5c372e3f96975d7104279 100644 (file)
@@ -707,7 +707,7 @@ struct vnt_private {
        u8 byBBCR09;
 
        /* command timer */
-       struct timer_list sTimerCommand;
+       struct delayed_work run_command_work;
 
        struct timer_list sTimerTxData;
        unsigned long nTxDataTimeCout;
index 6f9d28182445ce99b2d37bcd37aaae3c3d2bdc03..2bb5ab59f24f91de7120efe667fa93a09263fb89 100644 (file)
@@ -702,6 +702,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
 
        device_set_options(pDevice);
        spin_lock_init(&pDevice->lock);
+       INIT_DELAYED_WORK(&pDevice->run_command_work, vRunCommand);
 
        pDevice->tx_80211 = device_dma0_tx_80211;
        pDevice->vnt_mgmt.pAdapter = (void *) pDevice;
@@ -1076,7 +1077,9 @@ static int device_close(struct net_device *dev)
     MP_CLEAR_FLAG(pDevice, fMP_POST_WRITES);
     MP_CLEAR_FLAG(pDevice, fMP_POST_READS);
     pDevice->fKillEventPollingThread = true;
-    del_timer(&pDevice->sTimerCommand);
+
+       cancel_delayed_work_sync(&pDevice->run_command_work);
+
     del_timer(&pMgmt->sTimerSecondCallback);
 
     del_timer(&pDevice->sTimerTxData);
index 0013cb73d83bcc94dfdadb5e5f3c0aadfdfe9236..3b9bfcb40fcbcfdb52c366812085ece335797c30 100644 (file)
@@ -268,20 +268,14 @@ struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice,
 
 void vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond)
 {
-
-       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;
+       schedule_delayed_work(&pDevice->run_command_work,
+                                               msecs_to_jiffies(MSecond));
 }
 
-void vRunCommand(struct vnt_private *pDevice)
+void vRunCommand(struct work_struct *work)
 {
+       struct vnt_private *pDevice =
+               container_of(work, struct vnt_private, run_command_work.work);
        struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
        PWLAN_IE_SSID pItemSSID;
        PWLAN_IE_SSID pItemSSIDCurr;
@@ -1156,14 +1150,8 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice)
 //mike add:reset command timer
 void vResetCommandTimer(struct vnt_private *pDevice)
 {
+       cancel_delayed_work_sync(&pDevice->run_command_work);
 
-       //delete timer
-       del_timer(&pDevice->sTimerCommand);
-       //init timer
-       init_timer(&pDevice->sTimerCommand);
-       pDevice->sTimerCommand.data = (unsigned long)pDevice;
-       pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
-       pDevice->sTimerCommand.expires = RUN_AT(HZ);
        pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
        pDevice->uCmdDequeueIdx = 0;
        pDevice->uCmdEnqueueIdx = 0;
index db8b4cf7fd601ff4f29832658481abbb2c8c3708..cd12558d5d3f2d7fecac80d41a74bc96be790d07 100644 (file)
@@ -105,14 +105,7 @@ void vResetCommandTimer(struct vnt_private *);
 
 int bScheduleCommand(struct vnt_private *, CMD_CODE eCommand, u8 *pbyItem0);
 
-void vRunCommand(struct vnt_private *);
-
-/*
-void
-WCMDvCommandThread(
-    void * Context
-    );
-*/
+void vRunCommand(struct work_struct *work);
 
 void BSSvSecondTxData(struct vnt_private *);
 
index a69b883139485b4cefd40d5a73dbd4bd65c0e51e..03629c562b1913a0ac42f579085b4e21a9591aee 100644 (file)
@@ -218,11 +218,6 @@ void vMgrObjectInit(struct vnt_private *pDevice)
     pMgmt->sTimerSecondCallback.function = (TimerFunction)BSSvSecondCallBack;
     pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ);
 
-    init_timer(&pDevice->sTimerCommand);
-    pDevice->sTimerCommand.data = (unsigned long)pDevice;
-    pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
-    pDevice->sTimerCommand.expires = RUN_AT(HZ);
-
     init_timer(&pDevice->sTimerTxData);
     pDevice->sTimerTxData.data = (unsigned long)pDevice;
     pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
@@ -844,8 +839,8 @@ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice,
               pDevice->bwextstep3 = false;
               pDevice->bWPASuppWextEnabled = false;
 
-if(pMgmt->eCurrState == WMAC_STATE_ASSOC)
-      timer_expire(pDevice->sTimerCommand, 0);
+       if (pMgmt->eCurrState == WMAC_STATE_ASSOC)
+               schedule_delayed_work(&pDevice->run_command_work, 0);
 
     return;
 }
@@ -1127,7 +1122,7 @@ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice,
             if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){
                 DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n");
                 pMgmt->eCurrState = WMAC_STATE_AUTH;
-              timer_expire(pDevice->sTimerCommand, 0);
+               schedule_delayed_work(&pDevice->run_command_work, 0);
             }
             else {
                 DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n");
@@ -1302,7 +1297,7 @@ static void s_vMgrRxAuthenSequence_4(struct vnt_private *pDevice,
     if ( cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS ){
         DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n");
         pMgmt->eCurrState = WMAC_STATE_AUTH;
-        timer_expire(pDevice->sTimerCommand, 0);
+       schedule_delayed_work(&pDevice->run_command_work, 0);
     }
     else{
         DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n");