From: Jérôme Pouiller <jerome.pouiller@xxxxxxxxxx> Original code allows to detect an BSS loss during a scan and delaying the handling of BSS loss. However, there it is no real problem to just make these two events mutually exclusive (there is just a performance penalty). Signed-off-by: Jérôme Pouiller <jerome.pouiller@xxxxxxxxxx> --- drivers/staging/wfx/scan.c | 4 ---- drivers/staging/wfx/sta.c | 18 +++--------------- drivers/staging/wfx/wfx.h | 1 - 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index bdbce6926e91..dde2f8868147 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -95,10 +95,6 @@ void wfx_hw_scan_work(struct work_struct *work) mutex_unlock(&wvif->wdev->conf_mutex); mutex_unlock(&wvif->scan_lock); __ieee80211_scan_completed_compat(wvif->wdev->hw, ret < 0); - if (wvif->delayed_link_loss) { - wvif->delayed_link_loss = false; - wfx_cqm_bssloss_sm(wvif, 1, 0, 0); - } } int wfx_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index 7ae763e96455..3296bc3521d5 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -63,7 +63,6 @@ void wfx_cqm_bssloss_sm(struct wfx_vif *wvif, int init, int good, int bad) int tx = 0; mutex_lock(&wvif->bss_loss_lock); - wvif->delayed_link_loss = 0; cancel_work_sync(&wvif->bss_params_work); if (init) { @@ -429,18 +428,9 @@ static void wfx_event_handler_work(struct work_struct *work) switch (event->evt.event_id) { case HIF_EVENT_IND_BSSLOST: cancel_work_sync(&wvif->unjoin_work); - if (mutex_trylock(&wvif->scan_lock)) { - wfx_cqm_bssloss_sm(wvif, 1, 0, 0); - mutex_unlock(&wvif->scan_lock); - } else { - /* Scan is in progress. Delay reporting. - * Scan complete will trigger bss_loss_work - */ - wvif->delayed_link_loss = 1; - /* Also start a watchdog. */ - schedule_delayed_work(&wvif->bss_loss_work, - 5 * HZ); - } + mutex_lock(&wvif->scan_lock); + wfx_cqm_bssloss_sm(wvif, 1, 0, 0); + mutex_unlock(&wvif->scan_lock); break; case HIF_EVENT_IND_BSSREGAINED: wfx_cqm_bssloss_sm(wvif, 0, 0, 0); @@ -497,8 +487,6 @@ static void wfx_do_unjoin(struct wfx_vif *wvif) { mutex_lock(&wvif->wdev->conf_mutex); - wvif->delayed_link_loss = false; - if (!wvif->state) goto done; diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h index 5e7c911db024..db433bee87af 100644 --- a/drivers/staging/wfx/wfx.h +++ b/drivers/staging/wfx/wfx.h @@ -70,7 +70,6 @@ struct wfx_vif { int id; enum wfx_state state; - int delayed_link_loss; int bss_loss_state; u32 bss_loss_confirm_id; struct mutex bss_loss_lock; -- 2.20.1