Commit 2bd4aa6a authored by Martin Kaiser's avatar Martin Kaiser Committed by Greg Kroah-Hartman
Browse files

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: default avatarMartin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220115165536.231210-7-martin@kaiser.cx


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9224cda4
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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);

+4 −10
Original line number Diff line number Diff line
@@ -676,7 +676,6 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf)
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;
+1 −3
Original line number Diff line number Diff line
@@ -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. */
+0 −6
Original line number Diff line number Diff line
@@ -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)) &&