Commit 4d4efe3e authored by Vaishali Thakkar's avatar Vaishali Thakkar Committed by Greg Kroah-Hartman

Staging: rtl8188eu: Eliminate use of _set_timer

This patch introduces the use of API function mod_timer
instead of driver specific function _set_timer as it is
a more efficient and standard way to update the expire
field of an active timer. Also, definition of function
_set_timer is removed as it is no longer needed after
this change.

Here, these cases are handled using Coccinelle and
semantic patch used for this is as follows:

@@ expression x; expression y;@@

- _set_timer (&x, y);
+ mod_timer (&x, jiffies + msecs_to_jiffies (y));
Signed-off-by: default avatarVaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e7b1269d
...@@ -325,7 +325,8 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, ...@@ -325,7 +325,8 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid,
if (res == _SUCCESS) { if (res == _SUCCESS) {
pmlmepriv->scan_start_time = jiffies; pmlmepriv->scan_start_time = jiffies;
_set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT); mod_timer(&pmlmepriv->scan_to_timer,
jiffies + msecs_to_jiffies(SCANNING_TIMEOUT));
rtw_led_control(padapter, LED_CTL_SITE_SURVEY); rtw_led_control(padapter, LED_CTL_SITE_SURVEY);
...@@ -1234,9 +1235,11 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) ...@@ -1234,9 +1235,11 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
if (pcmd->res == H2C_DROPPED) { if (pcmd->res == H2C_DROPPED) {
/* TODO: cancel timer and do timeout handler directly... */ /* TODO: cancel timer and do timeout handler directly... */
/* need to make timeout handlerOS independent */ /* need to make timeout handlerOS independent */
_set_timer(&pmlmepriv->scan_to_timer, 1); mod_timer(&pmlmepriv->scan_to_timer,
jiffies + msecs_to_jiffies(1));
} else if (pcmd->res != H2C_SUCCESS) { } else if (pcmd->res != H2C_SUCCESS) {
_set_timer(&pmlmepriv->scan_to_timer, 1); mod_timer(&pmlmepriv->scan_to_timer,
jiffies + msecs_to_jiffies(1));
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: MgntActrtw_set_802_11_bssid_LIST_SCAN Fail ************\n\n.")); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: MgntActrtw_set_802_11_bssid_LIST_SCAN Fail ************\n\n."));
} }
...@@ -1270,10 +1273,12 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) ...@@ -1270,10 +1273,12 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
if (pcmd->res == H2C_DROPPED) { if (pcmd->res == H2C_DROPPED) {
/* TODO: cancel timer and do timeout handler directly... */ /* TODO: cancel timer and do timeout handler directly... */
/* need to make timeout handlerOS independent */ /* need to make timeout handlerOS independent */
_set_timer(&pmlmepriv->assoc_timer, 1); mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(1));
} else if (pcmd->res != H2C_SUCCESS) { } else if (pcmd->res != H2C_SUCCESS) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("********Error:rtw_select_and_join_from_scanned_queue Wait Sema Fail ************\n")); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("********Error:rtw_select_and_join_from_scanned_queue Wait Sema Fail ************\n"));
_set_timer(&pmlmepriv->assoc_timer, 1); mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(1));
} }
rtw_free_cmd_obj(pcmd); rtw_free_cmd_obj(pcmd);
...@@ -1291,7 +1296,8 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) ...@@ -1291,7 +1296,8 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
if (pcmd->res != H2C_SUCCESS) { if (pcmd->res != H2C_SUCCESS) {
RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n.")); RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("\n ********Error: rtw_createbss_cmd_callback Fail ************\n\n."));
_set_timer(&pmlmepriv->assoc_timer, 1); mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(1));
} }
del_timer_sync(&pmlmepriv->assoc_timer); del_timer_sync(&pmlmepriv->assoc_timer);
......
...@@ -86,7 +86,8 @@ u8 rtw_do_join(struct adapter *padapter) ...@@ -86,7 +86,8 @@ u8 rtw_do_join(struct adapter *padapter)
select_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv); select_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv);
if (select_ret == _SUCCESS) { if (select_ret == _SUCCESS) {
pmlmepriv->to_join = false; pmlmepriv->to_join = false;
_set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
} else { } else {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) { if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) {
/* submit createbss_cmd to change to a ADHOC_MASTER */ /* submit createbss_cmd to change to a ADHOC_MASTER */
......
...@@ -122,14 +122,16 @@ static void SwLedBlink1(struct LED_871x *pLed) ...@@ -122,14 +122,16 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
break; break;
case LED_BLINK_NORMAL: case LED_BLINK_NORMAL:
if (pLed->bLedOn) if (pLed->bLedOn)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
break; break;
case LED_BLINK_SCAN: case LED_BLINK_SCAN:
pLed->BlinkTimes--; pLed->BlinkTimes--;
...@@ -143,7 +145,8 @@ static void SwLedBlink1(struct LED_871x *pLed) ...@@ -143,7 +145,8 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) { } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
pLed->bLedNoLinkBlinkInProgress = true; pLed->bLedNoLinkBlinkInProgress = true;
...@@ -152,7 +155,8 @@ static void SwLedBlink1(struct LED_871x *pLed) ...@@ -152,7 +155,8 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
} }
pLed->bLedScanBlinkInProgress = false; pLed->bLedScanBlinkInProgress = false;
...@@ -161,7 +165,8 @@ static void SwLedBlink1(struct LED_871x *pLed) ...@@ -161,7 +165,8 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
} }
break; break;
case LED_BLINK_TXRX: case LED_BLINK_TXRX:
...@@ -176,7 +181,8 @@ static void SwLedBlink1(struct LED_871x *pLed) ...@@ -176,7 +181,8 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) { } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
pLed->bLedNoLinkBlinkInProgress = true; pLed->bLedNoLinkBlinkInProgress = true;
...@@ -185,7 +191,8 @@ static void SwLedBlink1(struct LED_871x *pLed) ...@@ -185,7 +191,8 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
} }
pLed->BlinkTimes = 0; pLed->BlinkTimes = 0;
...@@ -195,7 +202,8 @@ static void SwLedBlink1(struct LED_871x *pLed) ...@@ -195,7 +202,8 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
} }
break; break;
case LED_BLINK_WPS: case LED_BLINK_WPS:
...@@ -203,7 +211,8 @@ static void SwLedBlink1(struct LED_871x *pLed) ...@@ -203,7 +211,8 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
break; break;
case LED_BLINK_WPS_STOP: /* WPS success */ case LED_BLINK_WPS_STOP: /* WPS success */
if (pLed->BlinkingLedState == RTW_LED_ON) if (pLed->BlinkingLedState == RTW_LED_ON)
...@@ -218,14 +227,15 @@ static void SwLedBlink1(struct LED_871x *pLed) ...@@ -218,14 +227,15 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
pLed->bLedWPSBlinkInProgress = false; pLed->bLedWPSBlinkInProgress = false;
} else { } else {
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
_set_timer(&(pLed->BlinkTimer), mod_timer(&pLed->BlinkTimer, jiffies +
LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA); msecs_to_jiffies(LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA));
} }
break; break;
default: default:
...@@ -262,7 +272,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct ...@@ -262,7 +272,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
} }
break; break;
case LED_CTL_LINK: case LED_CTL_LINK:
...@@ -283,7 +294,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct ...@@ -283,7 +294,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
} }
break; break;
case LED_CTL_SITE_SURVEY: case LED_CTL_SITE_SURVEY:
...@@ -311,7 +323,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct ...@@ -311,7 +323,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
} }
break; break;
case LED_CTL_TX: case LED_CTL_TX:
...@@ -334,7 +347,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct ...@@ -334,7 +347,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
} }
break; break;
case LED_CTL_START_WPS: /* wait until xinpin finish */ case LED_CTL_START_WPS: /* wait until xinpin finish */
...@@ -362,7 +376,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct ...@@ -362,7 +376,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
} }
break; break;
case LED_CTL_STOP_WPS: case LED_CTL_STOP_WPS:
...@@ -389,11 +404,12 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct ...@@ -389,11 +404,12 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct
pLed->CurrLedState = LED_BLINK_WPS_STOP; pLed->CurrLedState = LED_BLINK_WPS_STOP;
if (pLed->bLedOn) { if (pLed->bLedOn) {
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
_set_timer(&(pLed->BlinkTimer), mod_timer(&pLed->BlinkTimer, jiffies +
LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA); msecs_to_jiffies(LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA));
} else { } else {
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), 0); mod_timer(&pLed->BlinkTimer,
jiffies + msecs_to_jiffies(0));
} }
break; break;
case LED_CTL_STOP_WPS_FAIL: case LED_CTL_STOP_WPS_FAIL:
...@@ -407,7 +423,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct ...@@ -407,7 +423,8 @@ static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAct
pLed->BlinkingLedState = RTW_LED_OFF; pLed->BlinkingLedState = RTW_LED_OFF;
else else
pLed->BlinkingLedState = RTW_LED_ON; pLed->BlinkingLedState = RTW_LED_ON;
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA); mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
break; break;
case LED_CTL_POWER_OFF: case LED_CTL_POWER_OFF:
pLed->CurrLedState = RTW_LED_OFF; pLed->CurrLedState = RTW_LED_OFF;
......
...@@ -665,7 +665,8 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) ...@@ -665,7 +665,8 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
set_fwstate(pmlmepriv, _FW_UNDER_LINKING); set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
if (rtw_select_and_join_from_scanned_queue(pmlmepriv) == _SUCCESS) { if (rtw_select_and_join_from_scanned_queue(pmlmepriv) == _SUCCESS) {
_set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
} else { } else {
struct wlan_bssid_ex *pdev_network = &(adapter->registrypriv.dev_network); struct wlan_bssid_ex *pdev_network = &(adapter->registrypriv.dev_network);
u8 *pibss = adapter->registrypriv.dev_network.MacAddress; u8 *pibss = adapter->registrypriv.dev_network.MacAddress;
...@@ -692,7 +693,8 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) ...@@ -692,7 +693,8 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
pmlmepriv->to_join = false; pmlmepriv->to_join = false;
s_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv); s_ret = rtw_select_and_join_from_scanned_queue(pmlmepriv);
if (_SUCCESS == s_ret) { if (_SUCCESS == s_ret) {
_set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT); mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
} else if (s_ret == 2) { /* there is no need to wait for join */ } else if (s_ret == 2) { /* there is no need to wait for join */
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
rtw_indicate_connect(adapter); rtw_indicate_connect(adapter);
...@@ -1127,14 +1129,16 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf) ...@@ -1127,14 +1129,16 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
} else if (pnetwork->join_res == -4) { } else if (pnetwork->join_res == -4) {
rtw_reset_securitypriv(adapter); rtw_reset_securitypriv(adapter);
_set_timer(&pmlmepriv->assoc_timer, 1); mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(1));
if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == true) { if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == true) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("fail! clear _FW_UNDER_LINKING ^^^fw_state=%x\n", get_fwstate(pmlmepriv))); RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("fail! clear _FW_UNDER_LINKING ^^^fw_state=%x\n", get_fwstate(pmlmepriv)));
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
} }
} else { /* if join_res < 0 (join fails), then try again */ } else { /* if join_res < 0 (join fails), then try again */
_set_timer(&pmlmepriv->assoc_timer, 1); mod_timer(&pmlmepriv->assoc_timer,
jiffies + msecs_to_jiffies(1));
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
} }
...@@ -1449,7 +1453,8 @@ void rtw_dynamic_check_timer_handlder(void *function_context) ...@@ -1449,7 +1453,8 @@ void rtw_dynamic_check_timer_handlder(void *function_context)
rtw_auto_scan_handler(adapter); rtw_auto_scan_handler(adapter);
} }
exit: exit:
_set_timer(&adapter->mlmepriv.dynamic_chk_timer, 2000); mod_timer(&adapter->mlmepriv.dynamic_chk_timer,
jiffies + msecs_to_jiffies(2000));
} }
#define RTW_SCAN_RESULT_EXPIRE 2000 #define RTW_SCAN_RESULT_EXPIRE 2000
......
...@@ -3972,8 +3972,8 @@ void start_clnt_join(struct adapter *padapter) ...@@ -3972,8 +3972,8 @@ void start_clnt_join(struct adapter *padapter)
/* and enable a timer */ /* and enable a timer */
beacon_timeout = decide_wait_for_beacon_timeout(pmlmeinfo->bcn_interval); beacon_timeout = decide_wait_for_beacon_timeout(pmlmeinfo->bcn_interval);
set_link_timer(pmlmeext, beacon_timeout); set_link_timer(pmlmeext, beacon_timeout);
_set_timer(&padapter->mlmepriv.assoc_timer, mod_timer(&padapter->mlmepriv.assoc_timer, jiffies +
(REAUTH_TO * REAUTH_LIMIT) + (REASSOC_TO*REASSOC_LIMIT) + beacon_timeout); msecs_to_jiffies((REAUTH_TO * REAUTH_LIMIT) + (REASSOC_TO * REASSOC_LIMIT) + beacon_timeout));
pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE; pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE;
} else if (caps&cap_IBSS) { /* adhoc client */ } else if (caps&cap_IBSS) { /* adhoc client */
...@@ -5406,7 +5406,8 @@ u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf) ...@@ -5406,7 +5406,8 @@ u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf)
if (((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && (pmlmeinfo->HT_enable)) || if (((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && (pmlmeinfo->HT_enable)) ||
((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) { ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) {
issue_action_BA(padapter, pparm->addr, RTW_WLAN_ACTION_ADDBA_REQ, (u16)pparm->tid); issue_action_BA(padapter, pparm->addr, RTW_WLAN_ACTION_ADDBA_REQ, (u16)pparm->tid);
_set_timer(&psta->addba_retry_timer, ADDBA_TO); mod_timer(&psta->addba_retry_timer,
jiffies + msecs_to_jiffies(ADDBA_TO));
} else { } else {
psta->htpriv.candidate_tid_bitmap &= ~BIT(pparm->tid); psta->htpriv.candidate_tid_bitmap &= ~BIT(pparm->tid);
} }
......
...@@ -1927,7 +1927,8 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, ...@@ -1927,7 +1927,8 @@ static int recv_indicatepkt_reorder(struct adapter *padapter,
/* recv_indicatepkts_in_order(padapter, preorder_ctrl, true); */ /* recv_indicatepkts_in_order(padapter, preorder_ctrl, true); */
if (recv_indicatepkts_in_order(padapter, preorder_ctrl, false)) { if (recv_indicatepkts_in_order(padapter, preorder_ctrl, false)) {
_set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); mod_timer(&preorder_ctrl->reordering_ctrl_timer,
jiffies + msecs_to_jiffies(REORDER_WAIT_TIME));
spin_unlock_bh(&ppending_recvframe_queue->lock); spin_unlock_bh(&ppending_recvframe_queue->lock);
} else { } else {
spin_unlock_bh(&ppending_recvframe_queue->lock); spin_unlock_bh(&ppending_recvframe_queue->lock);
...@@ -1957,7 +1958,8 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext) ...@@ -1957,7 +1958,8 @@ void rtw_reordering_ctrl_timeout_handler(void *pcontext)
spin_lock_bh(&ppending_recvframe_queue->lock); spin_lock_bh(&ppending_recvframe_queue->lock);
if (recv_indicatepkts_in_order(padapter, preorder_ctrl, true) == true) if (recv_indicatepkts_in_order(padapter, preorder_ctrl, true) == true)
_set_timer(&preorder_ctrl->reordering_ctrl_timer, REORDER_WAIT_TIME); mod_timer(&preorder_ctrl->reordering_ctrl_timer,
jiffies + msecs_to_jiffies(REORDER_WAIT_TIME));
spin_unlock_bh(&ppending_recvframe_queue->lock); spin_unlock_bh(&ppending_recvframe_queue->lock);
} }
......
...@@ -85,11 +85,6 @@ static inline void _init_timer(struct timer_list *ptimer, ...@@ -85,11 +85,6 @@ static inline void _init_timer(struct timer_list *ptimer,
init_timer(ptimer); init_timer(ptimer);
} }
static inline void _set_timer(struct timer_list *ptimer, u32 delay_time)
{
mod_timer(ptimer , (jiffies+msecs_to_jiffies(delay_time)));
}
#define RTW_TIMER_HDL_ARGS void *FunctionContext #define RTW_TIMER_HDL_ARGS void *FunctionContext
#define RTW_TIMER_HDL_NAME(name) rtw_##name##_timer_hdl #define RTW_TIMER_HDL_NAME(name) rtw_##name##_timer_hdl
#define RTW_DECLARE_TIMER_HDL(name) \ #define RTW_DECLARE_TIMER_HDL(name) \
......
...@@ -650,14 +650,12 @@ void link_timer_hdl(void *funtion_context); ...@@ -650,14 +650,12 @@ void link_timer_hdl(void *funtion_context);
void addba_timer_hdl(void *function_context); void addba_timer_hdl(void *function_context);
#define set_survey_timer(mlmeext, ms) \ #define set_survey_timer(mlmeext, ms) \
do { \ mod_timer(&mlmeext->survey_timer, jiffies + \
_set_timer(&(mlmeext)->survey_timer, (ms)); \ msecs_to_jiffies(ms))
} while (0)
#define set_link_timer(mlmeext, ms) \ #define set_link_timer(mlmeext, ms) \
do { \ mod_timer(&mlmeext->link_timer, jiffies + \
_set_timer(&(mlmeext)->link_timer, (ms)); \ msecs_to_jiffies(ms))
} while (0)
int cckrates_included(unsigned char *rate, int ratelen); int cckrates_included(unsigned char *rate, int ratelen);
int cckratesonly_included(unsigned char *rate, int ratelen); int cckratesonly_included(unsigned char *rate, int ratelen);
......
...@@ -233,9 +233,8 @@ struct pwrctrl_priv { ...@@ -233,9 +233,8 @@ struct pwrctrl_priv {
#define RTW_PWR_STATE_CHK_INTERVAL 2000 #define RTW_PWR_STATE_CHK_INTERVAL 2000
#define _rtw_set_pwr_state_check_timer(pwrctrlpriv, ms) \ #define _rtw_set_pwr_state_check_timer(pwrctrlpriv, ms) \
do { \ mod_timer(&pwrctrlpriv->pwr_state_check_timer, \
_set_timer(&(pwrctrlpriv)->pwr_state_check_timer, (ms)); \ jiffies + msecs_to_jiffies(ms))
} while (0)
#define rtw_set_pwr_state_check_timer(pwrctrl) \ #define rtw_set_pwr_state_check_timer(pwrctrl) \
_rtw_set_pwr_state_check_timer((pwrctrl), \ _rtw_set_pwr_state_check_timer((pwrctrl), \
......
...@@ -216,8 +216,8 @@ struct recv_priv { ...@@ -216,8 +216,8 @@ struct recv_priv {
}; };
#define rtw_set_signal_stat_timer(recvpriv) \ #define rtw_set_signal_stat_timer(recvpriv) \
_set_timer(&(recvpriv)->signal_stat_timer, \ mod_timer(&(recvpriv)->signal_stat_timer, jiffies + \
(recvpriv)->signal_stat_sampling_interval) msecs_to_jiffies((recvpriv)->signal_stat_sampling_interval))
struct sta_recv_priv { struct sta_recv_priv {
spinlock_t lock; spinlock_t lock;
......
...@@ -998,7 +998,8 @@ int _netdev_open(struct net_device *pnetdev) ...@@ -998,7 +998,8 @@ int _netdev_open(struct net_device *pnetdev)
} }
padapter->net_closed = false; padapter->net_closed = false;
_set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); mod_timer(&padapter->mlmepriv.dynamic_chk_timer,
jiffies + msecs_to_jiffies(2000));
padapter->pwrctrlpriv.bips_processing = false; padapter->pwrctrlpriv.bips_processing = false;
rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv);
...@@ -1052,7 +1053,8 @@ static int ips_netdrv_open(struct adapter *padapter) ...@@ -1052,7 +1053,8 @@ static int ips_netdrv_open(struct adapter *padapter)
padapter->intf_start(padapter); padapter->intf_start(padapter);
rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv);
_set_timer(&padapter->mlmepriv.dynamic_chk_timer, 5000); mod_timer(&padapter->mlmepriv.dynamic_chk_timer,
jiffies + msecs_to_jiffies(5000));
return _SUCCESS; return _SUCCESS;
......
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