From: Vaishali Thakkar Date: Wed, 11 Mar 2015 06:11:07 +0000 (+0530) Subject: Staging: rtl8188eu: Eliminate use of _set_timer X-Git-Tag: omap-for-v4.1/fixes-rc1~165^2~138^2~397 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d4efe3e95805982b1d8f3f54203c67ba6687338;p=pandora-kernel.git 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: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 4b4346244953..89b5e48ed68a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -325,7 +325,8 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, if (res == _SUCCESS) { 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); @@ -1234,9 +1235,11 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* 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) { - _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.")); } @@ -1270,10 +1273,12 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->res == H2C_DROPPED) { /* TODO: cancel timer and do timeout handler directly... */ /* 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) { 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); @@ -1291,7 +1296,8 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd) if (pcmd->res != H2C_SUCCESS) { 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); Reading git-diff-tree failed