[PATCH v2 44/55] staging: wfx: hif_scan() never fails

Jérôme Pouiller Jerome.Pouiller at silabs.com
Tue Dec 17 16:15:28 UTC 2019


From: Jérôme Pouiller <jerome.pouiller at silabs.com>

If scan fails, status is returned in hif_ind_scan_cmpl. hif_scan
always return a success. So, we can simplify the code.

Signed-off-by: Jérôme Pouiller <jerome.pouiller at silabs.com>
---
 drivers/staging/wfx/scan.c | 20 ++------------------
 drivers/staging/wfx/scan.h |  1 -
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c
index 4b95e6a97df7..cdccb67cb30e 100644
--- a/drivers/staging/wfx/scan.c
+++ b/drivers/staging/wfx/scan.c
@@ -36,7 +36,6 @@ static void wfx_scan_restart_delayed(struct wfx_vif *wvif)
 
 static int wfx_scan_start(struct wfx_vif *wvif, struct wfx_scan_params *scan)
 {
-	int ret;
 	int tmo = 500;
 
 	if (wvif->state == WFX_STATE_PRE_STA)
@@ -48,15 +47,8 @@ static int wfx_scan_start(struct wfx_vif *wvif, struct wfx_scan_params *scan)
 	atomic_set(&wvif->wdev->scan_in_progress, 1);
 
 	schedule_delayed_work(&wvif->scan.timeout, msecs_to_jiffies(tmo));
-	ret = hif_scan(wvif, scan);
-	if (ret) {
-		wfx_scan_failed_cb(wvif);
-		atomic_set(&wvif->scan.in_progress, 0);
-		atomic_set(&wvif->wdev->scan_in_progress, 0);
-		cancel_delayed_work_sync(&wvif->scan.timeout);
-		wfx_scan_restart_delayed(wvif);
-	}
-	return ret;
+	hif_scan(wvif, scan);
+	return 0;
 }
 
 int wfx_hw_scan(struct ieee80211_hw *hw,
@@ -245,14 +237,6 @@ static void wfx_scan_complete(struct wfx_vif *wvif)
 	wfx_scan_work(&wvif->scan.work);
 }
 
-void wfx_scan_failed_cb(struct wfx_vif *wvif)
-{
-	if (cancel_delayed_work_sync(&wvif->scan.timeout) > 0) {
-		wvif->scan.status = -EIO;
-		schedule_work(&wvif->scan.timeout.work);
-	}
-}
-
 void wfx_scan_complete_cb(struct wfx_vif *wvif,
 			  const struct hif_ind_scan_cmpl *arg)
 {
diff --git a/drivers/staging/wfx/scan.h b/drivers/staging/wfx/scan.h
index c7c0ab178c87..e71e5f0f522e 100644
--- a/drivers/staging/wfx/scan.h
+++ b/drivers/staging/wfx/scan.h
@@ -38,6 +38,5 @@ void wfx_scan_work(struct work_struct *work);
 void wfx_scan_timeout(struct work_struct *work);
 void wfx_scan_complete_cb(struct wfx_vif *wvif,
 			  const struct hif_ind_scan_cmpl *arg);
-void wfx_scan_failed_cb(struct wfx_vif *wvif);
 
 #endif /* WFX_SCAN_H */
-- 
2.24.0



More information about the devel mailing list