Staging: rtl8188eu: Eliminate use of _init_timer
authorVaishali Thakkar <vthakkar1994@gmail.com>
Wed, 11 Mar 2015 06:11:24 +0000 (11:41 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Mar 2015 15:07:15 +0000 (16:07 +0100)
This patch introduces the use of API function setup_timer
instead of driver specific function init_timer as it is
the preferred and standard way to set and setup the timer.
To be compatible with the changes, argument types of
referenced functions are changed. Also, definition of
function _init_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, y; identifier a, b;@@

- _init_timer (&x, y, a, b);
+ setup_timer (&x, a, (unsigned long)b);

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 files changed:
drivers/staging/rtl8188eu/core/rtw_led.c
drivers/staging/rtl8188eu/core/rtw_mlme.c
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
drivers/staging/rtl8188eu/core/rtw_recv.c
drivers/staging/rtl8188eu/include/osdep_service.h
drivers/staging/rtl8188eu/include/rtw_led.h
drivers/staging/rtl8188eu/include/rtw_mlme.h
drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
drivers/staging/rtl8188eu/include/rtw_recv.h
drivers/staging/rtl8188eu/os_dep/mlme_linux.c
drivers/staging/rtl8188eu/os_dep/recv_linux.c

index e8b82b2..94405dc 100644 (file)
@@ -22,9 +22,9 @@
 /*             Callback function of LED BlinkTimer, */
 /*             it just schedules to corresponding BlinkWorkItem/led_blink_hdl */
 /*  */
-void BlinkTimerCallback(void *data)
+void BlinkTimerCallback(unsigned long data)
 {
-       struct LED_871x *pLed = data;
+       struct LED_871x *pLed = (struct LED_871x *)data;
        struct adapter *padapter = pLed->padapter;
 
        if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped))
@@ -72,7 +72,8 @@ void InitLed871x(struct adapter *padapter, struct LED_871x *pLed)
 
        ResetLedStatus(pLed);
 
-       _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed);
+       setup_timer(&(pLed->BlinkTimer), BlinkTimerCallback,
+                   (unsigned long)pLed);
 
        INIT_WORK(&(pLed->BlinkWorkItem), BlinkWorkItemCallback);
 }
index f006679..bd87b7d 100644 (file)
@@ -1364,9 +1364,9 @@ void rtw_cpwm_event_callback(struct adapter *padapter, u8 *pbuf)
 * _rtw_join_timeout_handler - Timeout/faliure handler for CMD JoinBss
 * @adapter: pointer to struct adapter structure
 */
-void _rtw_join_timeout_handler (void *function_context)
+void _rtw_join_timeout_handler (unsigned long data)
 {
-       struct adapter *adapter = function_context;
+       struct adapter *adapter = (struct adapter *)data;
        struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
        int do_join_r;
 
@@ -1406,9 +1406,9 @@ void _rtw_join_timeout_handler (void *function_context)
 * rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey
 * @adapter: pointer to struct adapter structure
 */
-void rtw_scan_timeout_handler (void *function_context)
+void rtw_scan_timeout_handler (unsigned long data)
 {
-       struct adapter *adapter = function_context;
+       struct adapter *adapter = (struct adapter *)data;
        struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
 
        DBG_88E(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv));
@@ -1433,9 +1433,9 @@ static void rtw_auto_scan_handler(struct adapter *padapter)
        }
 }
 
-void rtw_dynamic_check_timer_handlder(void *function_context)
+void rtw_dynamic_check_timer_handlder(unsigned long data)
 {
-       struct adapter *adapter = (struct adapter *)function_context;
+       struct adapter *adapter = (struct adapter *)data;
        struct registry_priv *pregistrypriv = &adapter->registrypriv;
 
        if (!adapter)
index e496276..ec80860 100644 (file)
@@ -4835,9 +4835,9 @@ void linked_status_chk(struct adapter *padapter)
        }
 }
 
-void survey_timer_hdl(void *function_context)
+void survey_timer_hdl(unsigned long data)
 {
-       struct adapter *padapter = function_context;
+       struct adapter *padapter = (struct adapter *)data;
        struct cmd_obj  *ph2c;
        struct sitesurvey_parm  *psurveyPara;
        struct cmd_priv                                 *pcmdpriv = &padapter->cmdpriv;
@@ -4875,9 +4875,9 @@ exit_survey_timer_hdl:
        return;
 }
 
-void link_timer_hdl(void *function_context)
+void link_timer_hdl(unsigned long data)
 {
-       struct adapter *padapter = (struct adapter *)function_context;
+       struct adapter *padapter = (struct adapter *)data;
        struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info    *pmlmeinfo = &(pmlmeext->mlmext_info);
 
@@ -4912,9 +4912,9 @@ void link_timer_hdl(void *function_context)
        return;
 }
 
-void addba_timer_hdl(void *function_context)
+void addba_timer_hdl(unsigned long data)
 {
-       struct sta_info *psta = function_context;
+       struct sta_info *psta = (struct sta_info *)data;
        struct ht_priv  *phtpriv;
 
        if (!psta)
index df463a2..ec0a8a4 100644 (file)
@@ -281,9 +281,9 @@ exit:
        pwrpriv->ps_processing = false;
 }
 
-static void pwr_state_check_handler(void *FunctionContext)
+static void pwr_state_check_handler(unsigned long data)
 {
-       struct adapter *padapter = FunctionContext;
+       struct adapter *padapter = (struct adapter *)data;
        rtw_ps_cmd(padapter);
 }
 
@@ -544,7 +544,9 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 
        pwrctrlpriv->btcoex_rfon = false;
 
-       _init_timer(&(pwrctrlpriv->pwr_state_check_timer), padapter->pnetdev, pwr_state_check_handler, (u8 *)padapter);
+       setup_timer(&pwrctrlpriv->pwr_state_check_timer,
+                   pwr_state_check_handler,
+                   (unsigned long)padapter);
 }
 
 inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms)
index 0db421e..258336f 100644 (file)
@@ -41,7 +41,7 @@ static u8 rtw_rfc1042_header[] = {
        0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
 };
 
-void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS);
+void rtw_signal_stat_timer_hdl(unsigned long data);
 
 void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
 {
@@ -98,7 +98,9 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
 
        res = rtw_hal_init_recv_priv(padapter);
 
-       _init_timer(&precvpriv->signal_stat_timer, padapter->pnetdev, RTW_TIMER_HDL_NAME(signal_stat), padapter);
+       setup_timer(&precvpriv->signal_stat_timer,
+                   rtw_signal_stat_timer_hdl,
+                   (unsigned long)padapter);
 
        precvpriv->signal_stat_sampling_interval = 1000; /* ms */
 
@@ -1946,9 +1948,9 @@ _err_exit:
        return _FAIL;
 }
 
-void rtw_reordering_ctrl_timeout_handler(void *pcontext)
+void rtw_reordering_ctrl_timeout_handler(unsigned long data)
 {
-       struct recv_reorder_ctrl *preorder_ctrl = pcontext;
+       struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)data;
        struct adapter *padapter = preorder_ctrl->padapter;
        struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
 
@@ -2132,9 +2134,9 @@ _recv_entry_drop:
        return ret;
 }
 
-void rtw_signal_stat_timer_hdl(RTW_TIMER_HDL_ARGS)
+void rtw_signal_stat_timer_hdl(unsigned long data)
 {
-       struct adapter *adapter = (struct adapter *)FunctionContext;
+       struct adapter *adapter = (struct adapter *)data;
        struct recv_priv *recvpriv = &adapter->recvpriv;
 
        u32 tmp_s, tmp_q;