Staging: rtl8188eu: Eliminate use of _init_timer

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>
This commit is contained in:
Vaishali Thakkar 2015-03-11 11:41:24 +05:30 committed by Greg Kroah-Hartman
parent 4d4efe3e95
commit 28af7ea81e
12 changed files with 52 additions and 49 deletions

View 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);
}

View 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)

View 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 @@ void survey_timer_hdl(void *function_context)
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)

View File

@ -281,9 +281,9 @@ void rtw_ps_processor(struct adapter *padapter)
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)

View 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 @@ static int recv_indicatepkt_reorder(struct adapter *padapter,
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 @@ s32 rtw_recv_entry(struct recv_frame *precvframe)
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;

View File

@ -76,15 +76,6 @@ static inline int _enter_critical_mutex(struct mutex *pmutex,
return ret;
}
static inline void _init_timer(struct timer_list *ptimer,
struct net_device *nic_hdl,
void *pfunc, void *cntx)
{
ptimer->function = pfunc;
ptimer->data = (unsigned long)cntx;
init_timer(ptimer);
}
#define RTW_TIMER_HDL_ARGS void *FunctionContext
#define RTW_TIMER_HDL_NAME(name) rtw_##name##_timer_hdl
#define RTW_DECLARE_TIMER_HDL(name) \

View File

@ -103,7 +103,7 @@ struct led_priv {
(adapt)->ledpriv.LedControlHandler((adapt), (action)); \
} while (0)
void BlinkTimerCallback(void *data);
void BlinkTimerCallback(unsigned long data);
void BlinkWorkItemCallback(struct work_struct *work);
void ResetLedStatus(struct LED_871x *pLed);

View File

@ -551,10 +551,10 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter);
void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter);
void _rtw_join_timeout_handler(void *function_context);
void rtw_scan_timeout_handler(void *function_context);
void _rtw_join_timeout_handler(unsigned long data);
void rtw_scan_timeout_handler(unsigned long data);
void rtw_dynamic_check_timer_handlder(void *function_context);
void rtw_dynamic_check_timer_handlder(unsigned long data);
#define rtw_is_scan_deny(adapter) false
#define rtw_clear_scan_deny(adapter) do {} while (0)
#define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0)

View File

@ -645,9 +645,9 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter,
void linked_status_chk(struct adapter *padapter);
void survey_timer_hdl(void *function_context);
void link_timer_hdl(void *funtion_context);
void addba_timer_hdl(void *function_context);
void survey_timer_hdl(unsigned long data);
void link_timer_hdl(unsigned long data);
void addba_timer_hdl(unsigned long data);
#define set_survey_timer(mlmeext, ms) \
mod_timer(&mlmeext->survey_timer, jiffies + \

View File

@ -278,7 +278,7 @@ void rtw_free_recvframe_queue(struct __queue *pframequeue,
struct __queue *pfree_recv_queue);
u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter);
void rtw_reordering_ctrl_timeout_handler(void *pcontext);
void rtw_reordering_ctrl_timeout_handler(unsigned long data);
static inline u8 *get_rxmem(struct recv_frame *precvframe)
{

View File

@ -29,9 +29,12 @@ void rtw_init_mlme_timer(struct adapter *padapter)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
_init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, _rtw_join_timeout_handler, padapter);
_init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, rtw_scan_timeout_handler, padapter);
_init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, rtw_dynamic_check_timer_handlder, padapter);
setup_timer(&pmlmepriv->assoc_timer, _rtw_join_timeout_handler,
(unsigned long)padapter);
setup_timer(&pmlmepriv->scan_to_timer, rtw_scan_timeout_handler,
(unsigned long)padapter);
setup_timer(&pmlmepriv->dynamic_chk_timer,
rtw_dynamic_check_timer_handlder, (unsigned long)padapter);
}
void rtw_os_indicate_connect(struct adapter *adapter)
@ -130,15 +133,18 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie)
void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta)
{
_init_timer(&psta->addba_retry_timer, padapter->pnetdev, addba_timer_hdl, psta);
setup_timer(&psta->addba_retry_timer, addba_timer_hdl,
(unsigned long)psta);
}
void init_mlme_ext_timer(struct adapter *padapter)
{
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
_init_timer(&pmlmeext->survey_timer, padapter->pnetdev, survey_timer_hdl, padapter);
_init_timer(&pmlmeext->link_timer, padapter->pnetdev, link_timer_hdl, padapter);
setup_timer(&pmlmeext->survey_timer, survey_timer_hdl,
(unsigned long)padapter);
setup_timer(&pmlmeext->link_timer, link_timer_hdl,
(unsigned long)padapter);
}
#ifdef CONFIG_88EU_AP_MODE

View File

@ -193,7 +193,8 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
{
struct adapter *padapter = preorder_ctrl->padapter;
_init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, rtw_reordering_ctrl_timeout_handler, preorder_ctrl);
setup_timer(&preorder_ctrl->reordering_ctrl_timer,
rtw_reordering_ctrl_timeout_handler,
(unsigned long)preorder_ctrl);
}