Skip to content

Commit 382d020

Browse files
v-thakkargregkh
authored andcommitted
Staging: rtl8712: Eliminate use of _cancel_timer
Use 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 Signed-off-by: Vaishali Thakkar <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6501c8e commit 382d020

File tree

4 files changed

+4
-16
lines changed

4 files changed

+4
-16
lines changed

drivers/staging/rtl8712/osdep_service.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ struct __queue {
6060
#define LIST_CONTAINOR(ptr, type, member) \
6161
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
6262

63-
static inline void _cancel_timer(struct timer_list *ptimer, u8 *bcancelled)
64-
{
65-
del_timer(ptimer);
66-
*bcancelled = true; /*true ==1; false==0*/
67-
}
68-
6963
#ifndef BIT
7064
#define BIT(x) (1 << (x))
7165
#endif

drivers/staging/rtl8712/rtl871x_cmd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,6 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter,
900900
struct cmd_obj *pcmd)
901901
{
902902
unsigned long irqL;
903-
u8 timer_cancelled;
904903
struct sta_info *psta = NULL;
905904
struct wlan_network *pwlan = NULL;
906905
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -911,7 +910,7 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter,
911910
if (pcmd->res != H2C_SUCCESS)
912911
mod_timer(&pmlmepriv->assoc_timer,
913912
jiffies + msecs_to_jiffies(1));
914-
_cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled);
913+
del_timer_sync(&pmlmepriv->assoc_timer);
915914
#ifdef __BIG_ENDIAN
916915
/* endian_convert */
917916
pnetwork->Length = le32_to_cpu(pnetwork->Length);

drivers/staging/rtl8712/rtl871x_mlme.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,7 @@ void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf)
582582
spin_lock_irqsave(&pmlmepriv->lock, irqL);
583583

584584
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) {
585-
u8 timer_cancelled;
586-
587-
_cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled);
585+
del_timer_sync(&pmlmepriv->scan_to_timer);
588586

589587
_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
590588
}
@@ -717,7 +715,6 @@ void r8712_ind_disconnect(struct _adapter *padapter)
717715
void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
718716
{
719717
unsigned long irqL = 0, irqL2;
720-
u8 timer_cancelled;
721718
struct sta_info *ptarget_sta = NULL, *pcur_sta = NULL;
722719
struct sta_priv *pstapriv = &adapter->stapriv;
723720
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
@@ -911,8 +908,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
911908
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)
912909
== true)
913910
r8712_indicate_connect(adapter);
914-
_cancel_timer(&pmlmepriv->assoc_timer,
915-
&timer_cancelled);
911+
del_timer_sync(&pmlmepriv->assoc_timer);
916912
} else
917913
goto ignore_joinbss_callback;
918914
} else {

drivers/staging/rtl8712/rtl871x_xmit.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,12 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
203203
pattrib->ether_type = ntohs(etherhdr.h_proto);
204204

205205
{
206-
u8 bool;
207206
/*If driver xmit ARP packet, driver can set ps mode to initial
208207
* setting. It stands for getting DHCP or fix IP.*/
209208
if (pattrib->ether_type == 0x0806) {
210209
if (padapter->pwrctrlpriv.pwr_mode !=
211210
padapter->registrypriv.power_mgnt) {
212-
_cancel_timer(&(pmlmepriv->dhcp_timer), &bool);
211+
del_timer_sync(&pmlmepriv->dhcp_timer);
213212
r8712_set_ps_mode(padapter, padapter->registrypriv.
214213
power_mgnt, padapter->registrypriv.smart_ps);
215214
}

0 commit comments

Comments
 (0)