Staging: rtl8712: Eliminate use of _cancel_timer
authorVaishali Thakkar <vthakkar1994@gmail.com>
Fri, 6 Mar 2015 10:53:51 +0000 (16:23 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Mar 2015 14:46:07 +0000 (15:46 +0100)
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 <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/osdep_service.h
drivers/staging/rtl8712/rtl871x_cmd.c
drivers/staging/rtl8712/rtl871x_mlme.c
drivers/staging/rtl8712/rtl871x_xmit.c

index 33be7788945ad3a2843e2dbcd6b3d99406f43e8d..0a7f58c59df521aab10911520a39810be8ff38b2 100644 (file)
@@ -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
index d105ade43f676f46ddc22c174b466f06670050e1..1a1c38f885d6b191d5a62b5fb1aae26713dd6cb3 100644 (file)
@@ -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);
index 8faa46150f0944aacc46389de76fd15444e442f0..ef8a10e568b5819977c417bca59ef430bc0675bd 100644 (file)
@@ -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 {
index a28af03c9d8adb4e4b51e5c708cd3456b7e344c3..2e4fa88951ad88f4a622fe9a81e9641ca69ba7ea 100644 (file)
@@ -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.*/
        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);
                }