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

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: default avatarVaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 47f0585a
...@@ -32,39 +32,39 @@ ...@@ -32,39 +32,39 @@
#include "drv_types.h" #include "drv_types.h"
#include "mlme_osdep.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); _r8712_sitesurvey_ctrl_handler(adapter);
mod_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer, mod_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
jiffies + msecs_to_jiffies(3000)); 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); _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); 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); _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); _r8712_wdg_timeout_handler(adapter);
...@@ -76,17 +76,17 @@ void r8712_init_mlme_timer(struct _adapter *padapter) ...@@ -76,17 +76,17 @@ void r8712_init_mlme_timer(struct _adapter *padapter)
{ {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
_init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, setup_timer(&pmlmepriv->assoc_timer, join_timeout_handler,
join_timeout_handler, (pmlmepriv->nic_hdl)); (unsigned long)padapter);
_init_timer(&(pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer), setup_timer(&pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer,
padapter->pnetdev, sitesurvey_ctrl_handler, sitesurvey_ctrl_handler,
(u8 *)(pmlmepriv->nic_hdl)); (unsigned long)padapter);
_init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, setup_timer(&pmlmepriv->scan_to_timer, _scan_timeout_handler,
_scan_timeout_handler, (pmlmepriv->nic_hdl)); (unsigned long)padapter);
_init_timer(&(pmlmepriv->dhcp_timer), padapter->pnetdev, setup_timer(&pmlmepriv->dhcp_timer, dhcp_timeout_handler,
dhcp_timeout_handler, (u8 *)(pmlmepriv->nic_hdl)); (unsigned long)padapter);
_init_timer(&(pmlmepriv->wdg_timer), padapter->pnetdev, setup_timer(&pmlmepriv->wdg_timer, wdg_timeout_handler,
wdg_timeout_handler, (u8 *)(pmlmepriv->nic_hdl)); (unsigned long)padapter);
} }
void r8712_os_indicate_connect(struct _adapter *adapter) void r8712_os_indicate_connect(struct _adapter *adapter)
...@@ -118,9 +118,9 @@ void r8712_os_indicate_disconnect(struct _adapter *adapter) ...@@ -118,9 +118,9 @@ void r8712_os_indicate_disconnect(struct _adapter *adapter)
btkip_countermeasure; btkip_countermeasure;
memset((unsigned char *)&adapter->securitypriv, 0, memset((unsigned char *)&adapter->securitypriv, 0,
sizeof(struct security_priv)); sizeof(struct security_priv));
_init_timer(&(adapter->securitypriv.tkip_timer), setup_timer(&adapter->securitypriv.tkip_timer,
adapter->pnetdev, r8712_use_tkipkey_handler, r8712_use_tkipkey_handler,
adapter); (unsigned long)adapter);
/* Restore the PMK information to securitypriv structure /* Restore the PMK information to securitypriv structure
* for the following connection. */ * for the following connection. */
memcpy(&adapter->securitypriv.PMKIDList[0], memcpy(&adapter->securitypriv.PMKIDList[0],
......
...@@ -323,8 +323,8 @@ u8 r8712_init_drv_sw(struct _adapter *padapter) ...@@ -323,8 +323,8 @@ u8 r8712_init_drv_sw(struct _adapter *padapter)
_r8712_init_recv_priv(&padapter->recvpriv, padapter); _r8712_init_recv_priv(&padapter->recvpriv, padapter);
memset((unsigned char *)&padapter->securitypriv, 0, memset((unsigned char *)&padapter->securitypriv, 0,
sizeof(struct security_priv)); sizeof(struct security_priv));
_init_timer(&(padapter->securitypriv.tkip_timer), padapter->pnetdev, setup_timer(&padapter->securitypriv.tkip_timer,
r8712_use_tkipkey_handler, padapter); r8712_use_tkipkey_handler, (unsigned long)padapter);
_r8712_init_sta_priv(&padapter->stapriv); _r8712_init_sta_priv(&padapter->stapriv);
padapter->stapriv.padapter = padapter; padapter->stapriv.padapter = padapter;
r8712_init_bcmc_stainfo(padapter); r8712_init_bcmc_stainfo(padapter);
......
...@@ -60,15 +60,6 @@ struct __queue { ...@@ -60,15 +60,6 @@ struct __queue {
#define LIST_CONTAINOR(ptr, type, member) \ #define LIST_CONTAINOR(ptr, type, member) \
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->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) static inline void _cancel_timer(struct timer_list *ptimer, u8 *bcancelled)
{ {
del_timer(ptimer); del_timer(ptimer);
......
...@@ -137,18 +137,17 @@ void r8712_recv_indicatepkt(struct _adapter *padapter, ...@@ -137,18 +137,17 @@ void r8712_recv_indicatepkt(struct _adapter *padapter,
precvpriv->rx_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 *preorder_ctrl =
(struct recv_reorder_ctrl *)FunctionContext; (struct recv_reorder_ctrl *)data;
r8712_reordering_ctrl_timeout_handler(preorder_ctrl); r8712_reordering_ctrl_timeout_handler(preorder_ctrl);
} }
void r8712_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl) void r8712_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
{ {
struct _adapter *padapter = preorder_ctrl->padapter; setup_timer(&preorder_ctrl->reordering_ctrl_timer,
_r8712_reordering_ctrl_timeout_handler,
_init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, (unsigned long)preorder_ctrl);
_r8712_reordering_ctrl_timeout_handler, preorder_ctrl);
} }
...@@ -97,7 +97,8 @@ static void InitLed871x(struct _adapter *padapter, struct LED_871x *pLed, ...@@ -97,7 +97,8 @@ static void InitLed871x(struct _adapter *padapter, struct LED_871x *pLed,
pLed->bLedBlinkInProgress = false; pLed->bLedBlinkInProgress = false;
pLed->BlinkTimes = 0; pLed->BlinkTimes = 0;
pLed->BlinkingLedState = LED_UNKNOWN; pLed->BlinkingLedState = LED_UNKNOWN;
_init_timer(&(pLed->BlinkTimer), nic, BlinkTimerCallback, pLed); setup_timer(&pLed->BlinkTimer, BlinkTimerCallback,
(unsigned long)pLed);
INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback); INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback);
} }
......
...@@ -165,9 +165,9 @@ static void rpwm_workitem_callback(struct work_struct *work) ...@@ -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); _rpwm_check_handler(adapter);
} }
...@@ -186,8 +186,8 @@ void r8712_init_pwrctrl_priv(struct _adapter *padapter) ...@@ -186,8 +186,8 @@ void r8712_init_pwrctrl_priv(struct _adapter *padapter)
r8712_write8(padapter, 0x1025FE58, 0); r8712_write8(padapter, 0x1025FE58, 0);
INIT_WORK(&pwrctrlpriv->SetPSModeWorkItem, SetPSModeWorkItemCallback); INIT_WORK(&pwrctrlpriv->SetPSModeWorkItem, SetPSModeWorkItemCallback);
INIT_WORK(&pwrctrlpriv->rpwm_workitem, rpwm_workitem_callback); INIT_WORK(&pwrctrlpriv->rpwm_workitem, rpwm_workitem_callback);
_init_timer(&(pwrctrlpriv->rpwm_check_timer), setup_timer(&pwrctrlpriv->rpwm_check_timer, rpwm_check_handler,
padapter->pnetdev, rpwm_check_handler, (u8 *)padapter); (unsigned long)padapter);
} }
/* /*
......
...@@ -1392,9 +1392,9 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe) ...@@ -1392,9 +1392,9 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe)
return _SUCCESS; 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; padapter->securitypriv.busetkipkey = true;
} }
...@@ -216,7 +216,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe); ...@@ -216,7 +216,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe);
u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe); u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe);
u32 r8712_tkip_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_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_ */ #endif /*__RTL871X_SECURITY_H_ */
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