From 2bd4aa6acb115d6fd9225401e3cf38852f6ec7de Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Sat, 15 Jan 2022 17:55:31 +0100 Subject: [PATCH] staging: r8188eu: remove _cancel_timer wrapper 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 Link: https://lore.kernel.org/r/20220115165536.231210-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- drivers/staging/r8188eu/core/rtw_cmd.c | 3 +-- drivers/staging/r8188eu/core/rtw_mlme.c | 14 ++++---------- drivers/staging/r8188eu/core/rtw_p2p.c | 4 +--- drivers/staging/r8188eu/include/osdep_service.h | 6 ------ 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index 410b5da..266bb7d 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -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); diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 189b48b..6533a7b 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -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; diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c index 7b30b9b..50b4fca 100644 --- a/drivers/staging/r8188eu/core/rtw_p2p.c +++ b/drivers/staging/r8188eu/core/rtw_p2p.c @@ -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. */ diff --git a/drivers/staging/r8188eu/include/osdep_service.h b/drivers/staging/r8188eu/include/osdep_service.h index 8ca9f86..754691c 100644 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@ -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)) && -- 2.7.4