[PATCH 30/55] staging: wfx: firmware already handle powersave mode during scan

Jérôme Pouiller
2019-12-16T17:09:19Z

When user try to launch scan while connected, it is necessary to notify
the AP that we cannot receive data (using power save mode).

Firmware already handles this automatically so the code in the driver is
redundant and can be dropped.

By edge effect, hack of scan status in wfx_set_pm() is now useless.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
drivers/staging/wfx/scan.c | 14 --------------
drivers/staging/wfx/sta.c | 7 +------
2 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c
index cb7a1fdd0001..4b95e6a97df7 100644
--- a/drivers/staging/wfx/scan.c
+++ b/drivers/staging/wfx/scan.c
@@ -141,22 +141,11 @@ void wfx_scan_work(struct work_struct *work)
.scan_req.scan_type.type = 0, /* Foreground */
};
struct ieee80211_channel *first;
- bool first_run = (wvif->scan.begin == wvif->scan.curr &&
- wvif->scan.begin != wvif->scan.end);
int i;

down(&wvif->scan.lock);
mutex_lock(&wvif->wdev->conf_mutex);

- if (first_run) {
- if (wvif->state == WFX_STATE_STA &&
- !(wvif->powersave_mode.pm_mode.enter_psm)) {
- struct hif_req_set_pm_mode pm = wvif->powersave_mode;
-
- pm.pm_mode.enter_psm = 1;
- wfx_set_pm(wvif, &pm);
- }
- }

if (!wvif->scan.req || wvif->scan.curr == wvif->scan.end) {
if (wvif->scan.output_power != wvif->wdev->output_power)
@@ -177,9 +166,6 @@ void wfx_scan_work(struct work_struct *work)
__ieee80211_scan_completed_compat(wvif->wdev->hw,
wvif->scan.status ? 1 : 0);
up(&wvif->scan.lock);
- if (wvif->state == WFX_STATE_STA &&
- !(wvif->powersave_mode.pm_mode.enter_psm))
- wfx_set_pm(wvif, &wvif->powersave_mode);
return;
}
first = *wvif->scan.curr;
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 62e65493a4fe..fb45aa66fc56 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -375,7 +375,6 @@ int wfx_set_pm(struct wfx_vif *wvif, const struct hif_req_set_pm_mode *arg)
{
struct hif_req_set_pm_mode pm = *arg;
u16 uapsd_flags;
- int ret;

if (wvif->state != WFX_STATE_STA || !wvif->bss_params.aid)
return 0;
@@ -396,11 +395,7 @@ int wfx_set_pm(struct wfx_vif *wvif, const struct hif_req_set_pm_mode *arg)
msecs_to_jiffies(300)))
dev_warn(wvif->wdev->dev,
"timeout while waiting of set_pm_mode_complete\n");
- ret = hif_set_pm(wvif, &pm);
- // FIXME: why ?
- if (-ETIMEDOUT == wvif->scan.status)
- wvif->scan.status = 1;
- return ret;
+ return hif_set_pm(wvif, &pm);
}

int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
--
2.20.1