staging: vt6656: covert BSSvSecondCallBack to delayed_work.
authorMalcolm Priestley <tvboxspy@gmail.com>
Fri, 27 Sep 2013 15:51:13 +0000 (16:51 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Oct 2013 01:33:13 +0000 (18:33 -0700)
timer to delay workqueue.
sTimerSecondCallback -> second_callback_work

The delayed work queue is declared in device.h

This timer is very heavy on the system.

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/bssdb.c
drivers/staging/vt6656/bssdb.h
drivers/staging/vt6656/device.h
drivers/staging/vt6656/main_usb.c
drivers/staging/vt6656/wcmd.c
drivers/staging/vt6656/wmgr.c
drivers/staging/vt6656/wmgr.h

index ed1d609cc25fbc2bf06ce684dcdd5902dfb6aef2..ae0438a43ea586a246c88b4fbc062dd5385f9dd6 100644 (file)
@@ -813,8 +813,10 @@ void BSSvAddMulticastNode(struct vnt_private *pDevice)
  *
 -*/
 
-void BSSvSecondCallBack(struct vnt_private *pDevice)
+void BSSvSecondCallBack(struct work_struct *work)
 {
+       struct vnt_private *pDevice = container_of(work,
+                       struct vnt_private, second_callback_work.work);
        struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
        int ii;
        PWLAN_IE_SSID pItemSSID, pCurrSSID;
@@ -1126,8 +1128,7 @@ else {
 
     spin_unlock_irq(&pDevice->lock);
 
-    pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ);
-    add_timer(&pMgmt->sTimerSecondCallback);
+       schedule_delayed_work(&pDevice->second_callback_work, HZ);
 }
 
 /*+
index bce3b46541656f71a603ad6d402db19813f7e2c3..fc418555bc4d983dcc98a3776440ea86374dabe1 100644 (file)
@@ -262,7 +262,7 @@ void BSSvCreateOneNode(struct vnt_private *, u32 *puNodeIndex);
 void BSSvUpdateAPNode(struct vnt_private *, u16 *pwCapInfo,
        PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pExtSuppRates);
 
-void BSSvSecondCallBack(struct vnt_private *);
+void BSSvSecondCallBack(struct work_struct *work);
 
 void BSSvUpdateNodeTxCounter(struct vnt_private *, PSStatCounter pStatistic,
        u8 byTSR, u8 byPktNO);
index 63806e8e3174dbbb05d5c372e3f96975d7104279..6052f4cdc76885a10f76fea98c6e9dcfaec90430 100644 (file)
@@ -708,6 +708,8 @@ struct vnt_private {
 
        /* command timer */
        struct delayed_work run_command_work;
+       /* One second callback */
+       struct delayed_work second_callback_work;
 
        struct timer_list sTimerTxData;
        unsigned long nTxDataTimeCout;
index 2bb5ab59f24f91de7120efe667fa93a09263fb89..605c6f3901010b9503f4a8e16054621cf3c294c8 100644 (file)
@@ -703,6 +703,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);
+       INIT_DELAYED_WORK(&pDevice->second_callback_work, BSSvSecondCallBack);
 
        pDevice->tx_80211 = device_dma0_tx_80211;
        pDevice->vnt_mgmt.pAdapter = (void *) pDevice;
@@ -985,7 +986,9 @@ static int  device_open(struct net_device *dev)
     tasklet_init(&pDevice->RxMngWorkItem, (void *)RXvMngWorkItem, (unsigned long)pDevice);
     tasklet_init(&pDevice->ReadWorkItem, (void *)RXvWorkItem, (unsigned long)pDevice);
     tasklet_init(&pDevice->EventWorkItem, (void *)INTvWorkItem, (unsigned long)pDevice);
-       add_timer(&pDevice->vnt_mgmt.sTimerSecondCallback);
+
+       schedule_delayed_work(&pDevice->second_callback_work, HZ);
+
        pDevice->int_interval = 100;  /* max 100 microframes */
     pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
 
@@ -1079,8 +1082,7 @@ static int device_close(struct net_device *dev)
     pDevice->fKillEventPollingThread = true;
 
        cancel_delayed_work_sync(&pDevice->run_command_work);
-
-    del_timer(&pMgmt->sTimerSecondCallback);
+       cancel_delayed_work_sync(&pDevice->second_callback_work);
 
     del_timer(&pDevice->sTimerTxData);
 
index 3b9bfcb40fcbcfdb52c366812085ece335797c30..debb87a6aba7997d2fe2db61e90101bb7a47dc26 100644 (file)
@@ -690,7 +690,7 @@ void vRunCommand(struct work_struct *work)
             DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n");
 
             if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
-                del_timer(&pMgmt->sTimerSecondCallback);
+               cancel_delayed_work_sync(&pDevice->second_callback_work);
                 pMgmt->eCurrState = WMAC_STATE_IDLE;
                 pMgmt->eCurrMode = WMAC_MODE_STANDBY;
                 pDevice->bLinkPass = false;
@@ -718,7 +718,7 @@ void vRunCommand(struct work_struct *work)
                 }
                 pDevice->bLinkPass = true;
                 ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER);
-                add_timer(&pMgmt->sTimerSecondCallback);
+               schedule_delayed_work(&pDevice->second_callback_work, HZ);
             }
             s_bCommandComplete(pDevice);
             break;
index 03629c562b1913a0ac42f579085b4e21a9591aee..5a6a5bad0c429a764ec6a32a6b9ae9257e9905bf 100644 (file)
@@ -213,11 +213,6 @@ void vMgrObjectInit(struct vnt_private *pDevice)
     pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
     BSSvClearBSSList((void *) pDevice, false);
 
-    init_timer(&pMgmt->sTimerSecondCallback);
-    pMgmt->sTimerSecondCallback.data = (unsigned long)pDevice;
-    pMgmt->sTimerSecondCallback.function = (TimerFunction)BSSvSecondCallBack;
-    pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ);
-
     init_timer(&pDevice->sTimerTxData);
     pDevice->sTimerTxData.data = (unsigned long)pDevice;
     pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
index 5424c7f820ade84f57ac0a1af70fcc195b246cea..26ba47da467b0cc81164e534ac4babf4857dd686 100644 (file)
@@ -310,9 +310,6 @@ struct vnt_manager {
        u8 byMgmtPacketPool[sizeof(struct vnt_tx_mgmt)
                + WLAN_A3FR_MAXLEN];
 
-       /* One second callback timer */
-       struct timer_list sTimerSecondCallback;
-
        /* Temporarily Rx Mgmt Packet Descriptor */
        struct vnt_rx_mgmt sRxPacket;