staging: rtl8723bs: replace _cancel_timer with del_timer_sync
authorRoss Schmidt <ross.schm.dev@gmail.com>
Sun, 4 Oct 2020 01:17:43 +0000 (20:17 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Oct 2020 07:59:31 +0000 (09:59 +0200)
Replace _cancel_timer with API function del_timer_sync.

One instance of del_timer_sync is moved and an unnecessary pair of spin
locks are removed.

Signed-off-by: Ross Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201004011743.10750-8-ross.schm.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_cmd.c
drivers/staging/rtl8723bs/core/rtw_mlme.c
drivers/staging/rtl8723bs/hal/sdio_ops.c
drivers/staging/rtl8723bs/include/osdep_service_linux.h

index 047ec51..2abe205 100644 (file)
@@ -2034,7 +2034,6 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter,  struct cmd_obj *pcmd)
 
 void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
 {
-       u8 timer_cancelled;
        struct sta_info *psta = NULL;
        struct wlan_network *pwlan = NULL;
        struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -2049,7 +2048,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
                _set_timer(&pmlmepriv->assoc_timer, 1);
        }
 
-       _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled);
+       del_timer_sync(&pmlmepriv->assoc_timer);
 
        spin_lock_bh(&pmlmepriv->lock);
 
index e65c5a8..9531ba5 100644 (file)
@@ -814,7 +814,6 @@ exit:
 
 void rtw_surveydone_event_callback(struct adapter      *adapter, u8 *pbuf)
 {
-       u8 timer_cancelled = false;
        struct  mlme_priv *pmlmepriv = &(adapter->mlmepriv);
 
        spin_lock_bh(&pmlmepriv->lock);
@@ -827,22 +826,12 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
        RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_surveydone_event_callback: fw_state:%x\n\n", get_fwstate(pmlmepriv)));
 
        if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
-               /* u8 timer_cancelled; */
-
-               timer_cancelled = true;
-               /* _cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled); */
-
+               del_timer_sync(&pmlmepriv->scan_to_timer);
                _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
        } else {
 
                RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("nic status =%x, survey done event comes too late!\n", get_fwstate(pmlmepriv)));
        }
-       spin_unlock_bh(&pmlmepriv->lock);
-
-       if (timer_cancelled)
-               _cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled);
-
-       spin_lock_bh(&pmlmepriv->lock);
 
        rtw_set_signal_stat_timer(&adapter->recvpriv);
 
@@ -1298,7 +1287,6 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net
 void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
 {
        static u8 retry;
-       u8 timer_cancelled;
        struct sta_info *ptarget_sta = NULL, *pcur_sta = NULL;
        struct  sta_priv *pstapriv = &adapter->stapriv;
        struct  mlme_priv *pmlmepriv = &(adapter->mlmepriv);
@@ -1392,7 +1380,7 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
                        }
 
                        /* s5. Cancel assoc_timer */
-                       _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled);
+                       del_timer_sync(&pmlmepriv->assoc_timer);
 
                        RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("Cancel assoc_timer\n"));
 
index 465f51b..369f55d 100644 (file)
@@ -945,8 +945,7 @@ void sd_int_dpc(struct adapter *adapter)
        if (hal->sdio_hisr & SDIO_HISR_CPWM1) {
                struct reportpwrstate_parm report;
 
-               u8 bcancelled;
-               _cancel_timer(&(pwrctl->pwr_rpwm_timer), &bcancelled);
+               del_timer_sync(&(pwrctl->pwr_rpwm_timer));
 
                report.state = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_HCPWM1_8723B);
 
index 4a5bdb9..498d547 100644 (file)
@@ -83,12 +83,6 @@ static inline void _set_timer(_timer *ptimer, u32 delay_time)
        mod_timer(ptimer, (jiffies + (delay_time * HZ / 1000)));
 }
 
-static inline void _cancel_timer(_timer *ptimer, u8 *bcancelled)
-{
-       del_timer_sync(ptimer);
-       *bcancelled =  true;/* true == 1; false == 0 */
-}
-
 static inline void _init_workitem(_workitem *pwork, void *pfunc, void *cntx)
 {
        INIT_WORK(pwork, pfunc);