staging: r8188eu: remove _cancel_timer wrapper
authorMartin Kaiser <martin@kaiser.cx>
Sat, 15 Jan 2022 16:55:31 +0000 (17:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jan 2022 15:27:23 +0000 (16:27 +0100)
Remove the _cancel_timer wrapper function and call del_timer_sync
directly.

None of the callers needs the bcancelled variable that's populated by
_cancel_timer, these variables can be removed in the calling functions.

rtw_surveydone_event_callback calls _cancel_timer only if it believes
that the timer is currently running. We can drop this. It's safe to
call del_timer_sync when the timer is not running. The timer in question,
scan_to_timer, is used only for the site survey command (the rtw_survey
functions) so we won't be stopping it while it's in use by someone else.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220115165536.231210-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_cmd.c
drivers/staging/r8188eu/core/rtw_mlme.c
drivers/staging/r8188eu/core/rtw_p2p.c
drivers/staging/r8188eu/include/osdep_service.h

index 410b5dacfaa7c7a4ecc16209081c9fbd468f19f2..266bb7db5252c1deda1cd97a84a27c053f159351 100644 (file)
@@ -1460,7 +1460,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;
@@ -1470,7 +1469,7 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
        if (pcmd->res != H2C_SUCCESS)
                _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 189b48b17326c6f4986c63113367c5be560856c6..6533a7babb65371cf4a54007fe3419a7fc9aeec8 100644 (file)
@@ -676,7 +676,6 @@ exit:
 void rtw_surveydone_event_callback(struct adapter      *adapter, u8 *pbuf)
 {
        struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
-       u8 timer_cancelled = 0;
 
        spin_lock_bh(&pmlmepriv->lock);
 
@@ -686,16 +685,12 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
                pmlmepriv->wps_probe_req_ie = NULL;
        }
 
-       if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
-               timer_cancelled = 1;
-
+       if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
                _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
-       }
 
        spin_unlock_bh(&pmlmepriv->lock);
 
-       if (timer_cancelled)
-               _cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled);
+       del_timer_sync(&pmlmepriv->scan_to_timer);
 
        spin_lock_bh(&pmlmepriv->lock);
        rtw_set_signal_stat_timer(&adapter->recvpriv);
@@ -1017,7 +1012,6 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net
 
 void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
 {
-       u8 timer_cancelled;
        struct sta_info *ptarget_sta = NULL, *pcur_sta = NULL;
        struct  sta_priv *pstapriv = &adapter->stapriv;
        struct  mlme_priv       *pmlmepriv = &adapter->mlmepriv;
@@ -1092,8 +1086,8 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
                                rtw_indicate_connect(adapter);
                        }
 
-                       /* s5. Cancle assoc_timer */
-                       _cancel_timer(&pmlmepriv->assoc_timer, &timer_cancelled);
+                       /* s5. Cancel assoc_timer */
+                       del_timer_sync(&pmlmepriv->assoc_timer);
                } else {
                        spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
                        goto ignore_joinbss_callback;
index 7b30b9b64b41094233b5263562d7a60bd420b754..50b4fca869a7a09a0758907a4d27c62c49b14f29 100644 (file)
@@ -1380,9 +1380,7 @@ u8 process_p2p_group_negotation_confirm(struct wifidirect_info *pwdinfo, u8 *pfr
                        result = attr_content;
 
                        if (attr_content == P2P_STATUS_SUCCESS) {
-                               u8      bcancelled = 0;
-
-                               _cancel_timer(&pwdinfo->restore_p2p_state_timer, &bcancelled);
+                               del_timer_sync(&pwdinfo->restore_p2p_state_timer);
 
                                /*      Commented by Albert 20100911 */
                                /*      Todo: Need to handle the case which both Intents are the same. */
index 8ca9f86e3c9b3eda099dddde5454c095b2f7b42b..754691cb2b12f28089571656ce1a6bd6875b6d06 100644 (file)
@@ -59,12 +59,6 @@ static inline void _set_timer(struct timer_list *ptimer,u32 delay_time)
        mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
 }
 
-static inline void _cancel_timer(struct timer_list *ptimer,u8 *bcancelled)
-{
-       del_timer_sync(ptimer);
-       *bcancelled=  true;/* true ==1; false==0 */
-}
-
 static inline int rtw_netif_queue_stopped(struct net_device *pnetdev)
 {
        return  netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 0)) &&