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

Staging: rtl8712: Eliminate use of _set_timer



This patch introduces the use of API function mod_timer
instead of driver specific function _set_timer as it is
a more efficient and standard way to update the expire
field of an active timer. Also, definition of function
_set_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; expression y;@@

- _set_timer (&x, y);
+ mod_timer (&x, jiffies + msecs_to_jiffies (y));

Signed-off-by: default avatarVaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1862eec4
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ static void sitesurvey_ctrl_handler(void *FunctionContext)
	struct _adapter *adapter = (struct _adapter *)FunctionContext;

	_r8712_sitesurvey_ctrl_handler(adapter);
	_set_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
		   3000);
	mod_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
		  jiffies + msecs_to_jiffies(3000));
}

static void join_timeout_handler (void *FunctionContext)
@@ -68,7 +68,8 @@ static void wdg_timeout_handler (void *FunctionContext)

	_r8712_wdg_timeout_handler(adapter);

	_set_timer(&adapter->mlmepriv.wdg_timer, 2000);
	mod_timer(&adapter->mlmepriv.wdg_timer,
		  jiffies + msecs_to_jiffies(2000));
}

void r8712_init_mlme_timer(struct _adapter *padapter)
+4 −3
Original line number Diff line number Diff line
@@ -255,9 +255,10 @@ void r8712_stop_drv_threads(struct _adapter *padapter)

static void start_drv_timers(struct _adapter *padapter)
{
	_set_timer(&padapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
		   5000);
	_set_timer(&padapter->mlmepriv.wdg_timer, 2000);
	mod_timer(&padapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer,
		  jiffies + msecs_to_jiffies(5000));
	mod_timer(&padapter->mlmepriv.wdg_timer,
		  jiffies + msecs_to_jiffies(2000));
}

void r8712_stop_drv_timers(struct _adapter *padapter)
+0 −5
Original line number Diff line number Diff line
@@ -69,11 +69,6 @@ static inline void _init_timer(struct timer_list *ptimer,
	init_timer(ptimer);
}

static inline void _set_timer(struct timer_list *ptimer, u32 delay_time)
{
	mod_timer(ptimer, (jiffies+msecs_to_jiffies(delay_time)));
}

static inline void _cancel_timer(struct timer_list *ptimer, u8 *bcancelled)
{
	del_timer(ptimer);
+173 −151

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -604,8 +604,8 @@ static int recv_indicatepkt_reorder(struct _adapter *padapter,
	 */
	if (r8712_recv_indicatepkts_in_order(padapter, preorder_ctrl, false) ==
	    true) {
		_set_timer(&preorder_ctrl->reordering_ctrl_timer,
			   REORDER_WAIT_TIME);
		mod_timer(&preorder_ctrl->reordering_ctrl_timer,
			  jiffies + msecs_to_jiffies(REORDER_WAIT_TIME));
		spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql);
	} else {
		spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql);
Loading