Staging: rtl8712: 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 setup and set the timer.
To be compatible with the change, argument types of
referenced functions are changed. Also, definition of
function _init_timer is removed as it is no longer needed
after this change.

This is done 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-03 22:34:22 +05:30 committed by Greg Kroah-Hartman
parent 47f0585a20
commit e922df7d3e
8 changed files with 40 additions and 49 deletions

View File

@ -32,39 +32,39 @@
#include "drv_types.h"
#include "mlme_osdep.h"
static void sitesurvey_ctrl_handler(void *FunctionContext)
static void sitesurvey_ctrl_handler(unsigned long data)
{
struct _adapter *adapter = (struct _adapter *)FunctionContext;
struct _adapter *adapter = (struct _adapter *)data;
_r8712_sitesurvey_ctrl_handler(adapter);
mod_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
jiffies + msecs_to_jiffies(3000));
}
static void join_timeout_handler (void *FunctionContext)
static void join_timeout_handler (unsigned long data)
{
struct _adapter *adapter = (struct _adapter *)FunctionContext;
struct _adapter *adapter = (struct _adapter *)data;
_r8712_join_timeout_handler(adapter);
}
static void _scan_timeout_handler (void *FunctionContext)
static void _scan_timeout_handler (unsigned long data)
{
struct _adapter *adapter = (struct _adapter *)FunctionContext;
struct _adapter *adapter = (struct _adapter *)data;
r8712_scan_timeout_handler(adapter);
}
static void dhcp_timeout_handler (void *FunctionContext)
static void dhcp_timeout_handler (unsigned long data)
{
struct _adapter *adapter = (struct _adapter *)FunctionContext;
struct _adapter *adapter = (struct _adapter *)data;
_r8712_dhcp_timeout_handler(adapter);
}
static void wdg_timeout_handler (void *FunctionContext)
static void wdg_timeout_handler (unsigned long data)
{
struct _adapter *adapter = (struct _adapter *)FunctionContext;
struct _adapter *adapter = (struct _adapter *)data;
_r8712_wdg_timeout_handler(adapter);
@ -76,17 +76,17 @@ void r8712_init_mlme_timer(struct _adapter *padapter)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
_init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev,
join_timeout_handler, (pmlmepriv->nic_hdl));
_init_timer(&(pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer),
padapter->pnetdev, sitesurvey_ctrl_handler,
(u8 *)(pmlmepriv->nic_hdl));
_init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev,
_scan_timeout_handler, (pmlmepriv->nic_hdl));
_init_timer(&(pmlmepriv->dhcp_timer), padapter->pnetdev,
dhcp_timeout_handler, (u8 *)(pmlmepriv->nic_hdl));
_init_timer(&(pmlmepriv->wdg_timer), padapter->pnetdev,
wdg_timeout_handler, (u8 *)(pmlmepriv->nic_hdl));
setup_timer(&pmlmepriv->assoc_timer, join_timeout_handler,
(unsigned long)padapter);
setup_timer(&pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer,
sitesurvey_ctrl_handler,
(unsigned long)padapter);
setup_timer(&pmlmepriv->scan_to_timer, _scan_timeout_handler,
(unsigned long)padapter);
setup_timer(&pmlmepriv->dhcp_timer, dhcp_timeout_handler,
(unsigned long)padapter);
setup_timer(&pmlmepriv->wdg_timer, wdg_timeout_handler,
(unsigned long)padapter);
}
void r8712_os_indicate_connect(struct _adapter *adapter)
@ -118,9 +118,9 @@ void r8712_os_indicate_disconnect(struct _adapter *adapter)
btkip_countermeasure;
memset((unsigned char *)&adapter->securitypriv, 0,
sizeof(struct security_priv));
_init_timer(&(adapter->securitypriv.tkip_timer),
adapter->pnetdev, r8712_use_tkipkey_handler,
adapter);
setup_timer(&adapter->securitypriv.tkip_timer,
r8712_use_tkipkey_handler,
(unsigned long)adapter);
/* Restore the PMK information to securitypriv structure
* for the following connection. */
memcpy(&adapter->securitypriv.PMKIDList[0],

View File

@ -323,8 +323,8 @@ u8 r8712_init_drv_sw(struct _adapter *padapter)
_r8712_init_recv_priv(&padapter->recvpriv, padapter);
memset((unsigned char *)&padapter->securitypriv, 0,
sizeof(struct security_priv));
_init_timer(&(padapter->securitypriv.tkip_timer), padapter->pnetdev,
r8712_use_tkipkey_handler, padapter);
setup_timer(&padapter->securitypriv.tkip_timer,
r8712_use_tkipkey_handler, (unsigned long)padapter);
_r8712_init_sta_priv(&padapter->stapriv);
padapter->stapriv.padapter = padapter;
r8712_init_bcmc_stainfo(padapter);

View File

@ -60,15 +60,6 @@ struct __queue {
#define LIST_CONTAINOR(ptr, type, member) \
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
static inline void _init_timer(struct timer_list *ptimer,
struct net_device *padapter,
void *pfunc, void *cntx)
{
ptimer->function = pfunc;
ptimer->data = (addr_t)cntx;
init_timer(ptimer);
}
static inline void _cancel_timer(struct timer_list *ptimer, u8 *bcancelled)
{
del_timer(ptimer);

View File

@ -137,18 +137,17 @@ _recv_indicatepkt_drop:
precvpriv->rx_drop++;
}
static void _r8712_reordering_ctrl_timeout_handler (void *FunctionContext)
static void _r8712_reordering_ctrl_timeout_handler (unsigned long data)
{
struct recv_reorder_ctrl *preorder_ctrl =
(struct recv_reorder_ctrl *)FunctionContext;
(struct recv_reorder_ctrl *)data;
r8712_reordering_ctrl_timeout_handler(preorder_ctrl);
}
void r8712_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
{
struct _adapter *padapter = preorder_ctrl->padapter;
_init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev,
_r8712_reordering_ctrl_timeout_handler, preorder_ctrl);
setup_timer(&preorder_ctrl->reordering_ctrl_timer,
_r8712_reordering_ctrl_timeout_handler,
(unsigned long)preorder_ctrl);
}

View File

@ -97,7 +97,8 @@ static void InitLed871x(struct _adapter *padapter, struct LED_871x *pLed,
pLed->bLedBlinkInProgress = false;
pLed->BlinkTimes = 0;
pLed->BlinkingLedState = LED_UNKNOWN;
_init_timer(&(pLed->BlinkTimer), nic, BlinkTimerCallback, pLed);
setup_timer(&pLed->BlinkTimer, BlinkTimerCallback,
(unsigned long)pLed);
INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback);
}

View File

@ -165,9 +165,9 @@ static void rpwm_workitem_callback(struct work_struct *work)
}
}
static void rpwm_check_handler (void *FunctionContext)
static void rpwm_check_handler (unsigned long data)
{
struct _adapter *adapter = (struct _adapter *)FunctionContext;
struct _adapter *adapter = (struct _adapter *)data;
_rpwm_check_handler(adapter);
}
@ -186,8 +186,8 @@ void r8712_init_pwrctrl_priv(struct _adapter *padapter)
r8712_write8(padapter, 0x1025FE58, 0);
INIT_WORK(&pwrctrlpriv->SetPSModeWorkItem, SetPSModeWorkItemCallback);
INIT_WORK(&pwrctrlpriv->rpwm_workitem, rpwm_workitem_callback);
_init_timer(&(pwrctrlpriv->rpwm_check_timer),
padapter->pnetdev, rpwm_check_handler, (u8 *)padapter);
setup_timer(&pwrctrlpriv->rpwm_check_timer, rpwm_check_handler,
(unsigned long)padapter);
}
/*

View File

@ -1392,9 +1392,9 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe)
return _SUCCESS;
}
void r8712_use_tkipkey_handler(void *FunctionContext)
void r8712_use_tkipkey_handler(unsigned long data)
{
struct _adapter *padapter = (struct _adapter *)FunctionContext;
struct _adapter *padapter = (struct _adapter *)data;
padapter->securitypriv.busetkipkey = true;
}

View File

@ -216,7 +216,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe);
u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe);
u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe);
void r8712_wep_decrypt(struct _adapter *padapter, u8 *precvframe);
void r8712_use_tkipkey_handler(void *FunctionContext);
void r8712_use_tkipkey_handler(unsigned long data);
#endif /*__RTL871X_SECURITY_H_ */