[PATCH 11/19] staging: wfx: rename wfx_do_unjoin() into wfx_reset()

From: Jerome Pouiller
Date: Fri May 15 2020 - 04:35:26 EST


From: JÃrÃme Pouiller <jerome.pouiller@xxxxxxxxxx>

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 <jerome.pouiller@xxxxxxxxxx>
---
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 1a876a0faaf5..e077f42b62dc 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 c84c3749ec4f..8a20ad9ae017 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.26.2