Staging: rtl8712: Use del_timer_sync
cover Staging: rtl8712: Use del_timer_sync
This patch-set introduces the use of timer API function del_timer_sync instead of driver specific functions _cancel_timer_ex and _cancel_timer. Though definition of these functions were returning del_timer, here del_timer_sync is a preferred solution as besides deactivating a timer, it also ensures that the timer is stopped on all CPUs before the driver exists.
All of these changes are done using Coccinelle.
Vaishali Thakkar (2):
Staging: rtl8712: Eliminate _cancel_timer_ex
Staging: rtl8712: Eliminate use of _cancel_timer
drivers/staging/rtl8712/os_intfs.c | 14 +-- drivers/staging/rtl8712/osdep_service.h | 11 --- drivers/staging/rtl8712/rtl8712_led.c | 146 +++++++++++++++--------------- drivers/staging/rtl8712/rtl871x_cmd.c | 3 +- drivers/staging/rtl8712/rtl871x_mlme.c | 10 +- drivers/staging/rtl8712/rtl871x_pwrctrl.c | 2 +- drivers/staging/rtl8712/rtl871x_sta_mgt.c | 2 +- drivers/staging/rtl8712/rtl871x_xmit.c | 5 +- 8 files changed, 88 insertions(+), 105 deletions(-)
Signature · 1 line
1.9.1
PATCH RESEND 1/2 Staging: rtl8712: Eliminate use of _cancel_timer_ex
Use timer API function del_timer_sync instead of driver specific function _cancel_timer_ex as besides deactivating a timer, it ensures that the timer is stopped on all CPUs before the driver exists. Also, definition of function _cancel_timer_ex 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; @@
- _cancel_timer_ex (&x);
+ del_timer_sync (&x);
--- drivers/staging/rtl8712/os_intfs.c | 14 +-- drivers/staging/rtl8712/osdep_service.h | 5 - drivers/staging/rtl8712/rtl8712_led.c | 146 +++++++++++++++--------------- drivers/staging/rtl8712/rtl871x_mlme.c | 2 +- drivers/staging/rtl8712/rtl871x_pwrctrl.c | 2 +- drivers/staging/rtl8712/rtl871x_sta_mgt.c | 2 +- 6 files changed, 83 insertions(+), 88 deletions(-)
drivers/staging/rtl8712/os_intfs.c +7 -7
@@ -263,13 +263,13 @@ static void start_drv_timers(struct _adapter *padapter)void r8712_stop_drv_timers (struct _adapter *padapter) { -_cancel_timer_ex (&padapter->mlmepriv.assoc_timer); -_cancel_timer_ex (&padapter->securitypriv.tkip_timer); -_cancel_timer_ex (&padapter->mlmepriv.scan_to_timer); -_cancel_timer_ex (&padapter->mlmepriv.dhcp_timer); -_cancel_timer_ex (&padapter->mlmepriv.wdg_timer); -_cancel_timer_ex (&padapter->mlmepriv.sitesurveyctrl. - sitesurvey_ctrl_timer); +del_timer_sync (&padapter->mlmepriv.assoc_timer); +del_timer_sync (&padapter->securitypriv.tkip_timer); +del_timer_sync (&padapter->mlmepriv.scan_to_timer); +del_timer_sync (&padapter->mlmepriv.dhcp_timer); +del_timer_sync (&padapter->mlmepriv.wdg_timer); +del_timer_sync (&padapter->mlmepriv.sitesurveyctrl. + sitesurvey_ctrl_timer); }static u8 init_default_value (struct _adapter *padapter)
drivers/staging/rtl8712/osdep_service.h +0 -5
@@ -92,11 +92,6 @@ static inline void sleep_schedulable(int ms)schedule_timeout (delta); } -static inline unsigned char _cancel_timer_ex (struct timer_list *ptimer) -{ -return del_timer (ptimer); -} -static inline void flush_signals_thread (void ) {if (signal_pending (current))
drivers/staging/rtl8712/rtl8712_led.c +73 -73
479 lines not on this page · raw message
drivers/staging/rtl8712/rtl871x_mlme.c +1 -1
@@ -698,7 +698,7 @@ void r8712_ind_disconnect(struct _adapter *padapter) }if (padapter->pwrctrlpriv.pwr_mode != padapter->registrypriv.power_mgnt) { -_cancel_timer_ex (&pmlmepriv->dhcp_timer); +del_timer_sync (&pmlmepriv->dhcp_timer);r8712_set_ps_mode (padapter, padapter->registrypriv.power_mgnt, padapter->registrypriv.smart_ps); }
drivers/staging/rtl8712/rtl871x_pwrctrl.c +1 -1
@@ -103,7 +103,7 @@ void r8712_cpwm_int_hdl(struct _adapter *padapter,if (pwrpriv->cpwm_tog == ((preportpwrstate->state) &0x80 ))return ; -_cancel_timer_ex (&padapter->pwrctrlpriv. rpwm_check_timer); +del_timer_sync (&padapter->pwrctrlpriv.rpwm_check_timer);_enter_pwrlock (&pwrpriv->lock); pwrpriv->cpwm = (preportpwrstate->state) &0xf ;if (pwrpriv->cpwm >=PS_STATE_S2 ) {
drivers/staging/rtl8712/rtl871x_sta_mgt.c +1 -1
@@ -198,7 +198,7 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta)* cancel reordering_ctrl_timer */ for (i =0 ; i <16 ; i++) { preorder_ctrl = &psta->recvreorder_ctrl[i]; -_cancel_timer_ex (&preorder_ctrl->reordering_ctrl_timer); +del_timer_sync (&preorder_ctrl->reordering_ctrl_timer); }spin_lock (&(pfree_sta_queue->lock));/* insert into free_sta_queue; 20061114 */
Signature · 1 line
1.9.1
PATCH RESEND 2/2 Staging: rtl8712: Eliminate use of _cancel_timer
In reply to Vaishali ThakkarUse timer API function del_timer_sync instead of driver specific function _cancel_timer as besides deactivating a timer, it also ensures that the timer is stopped on all CPUs before the driver exists. Also, variables timer_cancelled and bool are removed as they are no longer needed.
@a@
expression x;
identifier y;
@@
- _cancel_timer (&x, &y);
+ del_timer_sync (&x);
@@type T; identifier a.y;@@
- T y;
...when != y
--- drivers/staging/rtl8712/osdep_service.h | 6 ------ drivers/staging/rtl8712/rtl871x_cmd.c | 3 +-- drivers/staging/rtl8712/rtl871x_mlme.c | 8 ++------ drivers/staging/rtl8712/rtl871x_xmit.c | 5 ++--- 4 files changed, 5 insertions(+), 17 deletions(-)
drivers/staging/rtl8712/osdep_service.h +0 -6
@@ -60,12 +60,6 @@ struct __queue {#define LIST_CONTAINOR (ptr, type, member) \ ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member))) -static inline void _cancel_timer (struct timer_list *ptimer,u8 *bcancelled) -{ -del_timer (ptimer); - *bcancelled = true;/*true ==1; false==0*/ -} -#ifndef BIT #define BIT (x) (1 << (x))#endif
drivers/staging/rtl8712/rtl871x_cmd.c +1 -2
@@ -900,7 +900,6 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter, struct cmd_obj *pcmd) {unsigned long irqL; -u8 timer_cancelled;struct sta_info *psta =NULL ;struct wlan_network *pwlan =NULL ;struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -911,7 +910,7 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter,if (pcmd->res !=H2C_SUCCESS )mod_timer (&pmlmepriv->assoc_timer, jiffies +msecs_to_jiffies (1 )); -_cancel_timer (&pmlmepriv->assoc_timer, &timer_cancelled); +del_timer_sync (&pmlmepriv->assoc_timer);#ifdef __BIG_ENDIAN/* endian_convert */ pnetwork->Length =le32_to_cpu (pnetwork->Length);
drivers/staging/rtl8712/rtl871x_mlme.c +2 -6
@@ -582,9 +582,7 @@ void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf)spin_lock_irqsave (&pmlmepriv->lock, irqL);if (check_fwstate (pmlmepriv, _FW_UNDER_SURVEY) == true) { -u8 timer_cancelled; - -_cancel_timer (&pmlmepriv->scan_to_timer, &timer_cancelled); +del_timer_sync (&pmlmepriv->scan_to_timer);_clr_fwstate_ (pmlmepriv, _FW_UNDER_SURVEY); }
@@ -717,7 +715,6 @@ void r8712_ind_disconnect(struct _adapter *padapter)void r8712_joinbss_event_callback (struct _adapter *adapter,u8 *pbuf) {unsigned long irqL =0 , irqL2; -u8 timer_cancelled;struct sta_info *ptarget_sta =NULL , *pcur_sta =NULL ;struct sta_priv *pstapriv = &adapter->stapriv;struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
@@ -911,8 +908,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)if (check_fwstate (pmlmepriv,WIFI_STATION_STATE ) == true)r8712_indicate_connect (adapter); -_cancel_timer (&pmlmepriv->assoc_timer, - &timer_cancelled); +del_timer_sync (&pmlmepriv->assoc_timer); }else goto ignore_joinbss_callback; }else {
drivers/staging/rtl8712/rtl871x_xmit.c +2 -3
@@ -203,13 +203,12 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, pattrib->ether_type =ntohs (etherhdr.h_proto); { -u8 bool;/*If driver xmit ARP packet, driver can set ps mode to initial -* setting. It stands for getting DHCP or fix IP.*/ +* setting. It stands for getting DHCP or fix IP.*/ if (pattrib->ether_type ==0x0806 ) {if (padapter->pwrctrlpriv.pwr_mode != padapter->registrypriv.power_mgnt) { -_cancel_timer (&(pmlmepriv->dhcp_timer), &bool); +del_timer_sync (&pmlmepriv->dhcp_timer);r8712_set_ps_mode (padapter, padapter->registrypriv. power_mgnt, padapter->registrypriv.smart_ps); }
Signature · 1 line
1.9.1
Greg KH
maintainerQuoted 14 lines · Vaishali Thakkar
This patch-set introduces the use of timer API function
del_timer_syncinstead of driver specific functions_cancel_timer_exand_cancel_timer. Though definition of these functions were returningdel_timer, heredel_timer_syncis a preferred solution as besides deactivating a timer, it also ensures that the timer is stopped on all CPUs before the driver exists.All of these changes are done using Coccinelle.
Vaishali Thakkar (2):
Staging: rtl8712: Eliminate_cancel_timer_ex
Staging: rtl8712: Eliminate use of_cancel_timer
Quoted 9 lines
drivers/staging/rtl8712/os_intfs.c | 14 +-- drivers/staging/rtl8712/osdep_service.h | 11 --- drivers/staging/rtl8712/rtl8712_led.c | 146 +++++++++++++++--------------- drivers/staging/rtl8712/rtl871x_cmd.c | 3 +- drivers/staging/rtl8712/rtl871x_mlme.c | 10 +- drivers/staging/rtl8712/rtl871x_pwrctrl.c | 2 +- drivers/staging/rtl8712/rtl871x_sta_mgt.c | 2 +- drivers/staging/rtl8712/rtl871x_xmit.c | 5 +- 8 files changed, 88 insertions(+), 105 deletions(-)
Why is this a "resend"? did I miss the first version?
Quoted 12 lines · Greg KH
Quoted 10 lines · Vaishali Thakkar
This patch-set introduces the use of timer API function
del_timer_syncinstead of driver specific functions_cancel_timer_exand_cancel_timer. Though definition of these functions were returningdel_timer, heredel_timer_syncis a preferred solution as besides deactivating a timer, it also ensures that the timer is stopped on all CPUs before the driver exists.All of these changes are done using Coccinelle.
Quoted 7 lines
Quoted 7 lines
Vaishali Thakkar (2):
Staging: rtl8712: Eliminate_cancel_timer_ex
Staging: rtl8712: Eliminate use of_cancel_timerdrivers/staging/rtl8712/os_intfs.c | 14 +-- drivers/staging/rtl8712/osdep_service.h | 11 --- drivers/staging/rtl8712/rtl8712_led.c | 146
+++++++++++++++---------------
Quoted 8 lines
Quoted 6 lines
drivers/staging/rtl8712/rtl871x_cmd.c | 3 +- drivers/staging/rtl8712/rtl871x_mlme.c | 10 +- drivers/staging/rtl8712/rtl871x_pwrctrl.c | 2 +- drivers/staging/rtl8712/rtl871x_sta_mgt.c | 2 +- drivers/staging/rtl8712/rtl871x_xmit.c | 5 +- 8 files changed, 88 insertions(+), 105 deletions(-)Why is this a "resend"? did I miss the first version?
Yes. First version was not in your patch queue. So, you told me to resend.