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

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
Loading
Loading
Loading
Loading
+24 −24
Original line number Diff line number Diff line
@@ -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],
+2 −2
Original line number Diff line number Diff line
@@ -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);
+0 −9
Original line number Diff line number Diff line
@@ -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);
+5 −6
Original line number Diff line number Diff line
@@ -137,18 +137,17 @@ void r8712_recv_indicatepkt(struct _adapter *padapter,
	 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);
}
+2 −1
Original line number Diff line number Diff line
@@ -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);
}

Loading