From 5a48a4a3efb45fb18970c05e3a6b6bf5d72dbb7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Pouiller?= Date: Fri, 15 May 2020 10:33:17 +0200 Subject: [PATCH] staging: wfx: rename wfx_do_unjoin() into wfx_reset() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In fact, wfx_do_unjoin() resets the interface. This mechanism can be used in more cases than just disassociating from a BSS. So, rename it to reflect that fact. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200515083325.378539-12-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/sta.c | 32 +++++++++++++++----------------- drivers/staging/wfx/sta.h | 1 + 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 1a876a0..e077f42 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -315,20 +315,6 @@ void wfx_set_default_unicast_key(struct ieee80211_hw *hw, hif_wep_default_key_id(wvif, idx); } -// Call it with wdev->conf_mutex locked -static void wfx_do_unjoin(struct wfx_vif *wvif) -{ - /* Unjoin is a reset. */ - wfx_tx_lock_flush(wvif->wdev); - hif_reset(wvif, false); - wfx_tx_policy_init(wvif); - if (wvif_count(wvif->wdev) <= 1) - hif_set_block_ack_policy(wvif, 0xFF, 0xFF); - wfx_tx_unlock(wvif->wdev); - wvif->bss_not_support_ps_poll = false; - cancel_delayed_work_sync(&wvif->beacon_loss_work); -} - static void wfx_set_mfp(struct wfx_vif *wvif, struct cfg80211_bss *bss) { @@ -359,6 +345,18 @@ static void wfx_set_mfp(struct wfx_vif *wvif, hif_set_mfp(wvif, mfpc, mfpr); } +void wfx_reset(struct wfx_vif *wvif) +{ + wfx_tx_lock_flush(wvif->wdev); + hif_reset(wvif, false); + wfx_tx_policy_init(wvif); + if (wvif_count(wvif->wdev) <= 1) + hif_set_block_ack_policy(wvif, 0xFF, 0xFF); + wfx_tx_unlock(wvif->wdev); + wvif->bss_not_support_ps_poll = false; + cancel_delayed_work_sync(&wvif->beacon_loss_work); +} + static void wfx_do_join(struct wfx_vif *wvif) { int ret; @@ -395,7 +393,7 @@ static void wfx_do_join(struct wfx_vif *wvif) ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen); if (ret) { ieee80211_connection_loss(wvif->vif); - wfx_do_unjoin(wvif); + wfx_reset(wvif); } else { /* Due to beacon filtering it is possible that the * AP's beacon is not known for the mac80211 stack. @@ -513,7 +511,7 @@ void wfx_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; - wfx_do_unjoin(wvif); + wfx_reset(wvif); } static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable) @@ -580,7 +578,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (info->assoc || info->ibss_joined) wfx_join_finalize(wvif, info); else if (!info->assoc && vif->type == NL80211_IFTYPE_STATION) - wfx_do_unjoin(wvif); + wfx_reset(wvif); else dev_warn(wdev->dev, "%s: misunderstood change: ASSOC\n", __func__); diff --git a/drivers/staging/wfx/sta.h b/drivers/staging/wfx/sta.h index c84c374..8a20ad9 100644 --- a/drivers/staging/wfx/sta.h +++ b/drivers/staging/wfx/sta.h @@ -71,6 +71,7 @@ void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd cmd); void wfx_event_report_rssi(struct wfx_vif *wvif, u8 raw_rcpi_rssi); // Other Helpers +void wfx_reset(struct wfx_vif *wvif); u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates); #endif /* WFX_STA_H */ -- 2.7.4