driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Pouiller <Jerome.Pouiller@silabs.com>
To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"David S . Miller" <davem@davemloft.net>,
	Kalle Valo <kvalo@codeaurora.org>
Subject: [PATCH 05/19] staging: wfx: fix coherency of hif_scan() prototype
Date: Fri, 15 May 2020 10:33:11 +0200	[thread overview]
Message-ID: <20200515083325.378539-6-Jerome.Pouiller@silabs.com> (raw)
In-Reply-To: <20200515083325.378539-1-Jerome.Pouiller@silabs.com>

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

The function hif_scan() return the timeout for the completion of the
scan request. It is the only function from hif_tx.c that return another
thing than just an error code. This behavior is not coherent with the
rest of file. Worse, if value returned is positive, the caller can't
make say if it is a timeout or the value returned by the hardware.

Uniformize API with other HIF functions, only return the error code and
pass timeout with parameters.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
---
 drivers/staging/wfx/hif_tx.c | 6 ++++--
 drivers/staging/wfx/hif_tx.h | 2 +-
 drivers/staging/wfx/scan.c   | 6 +++---
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index 893b67f2f792..6db41587cc7a 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -240,7 +240,7 @@ int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
 }
 
 int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req,
-	     int chan_start_idx, int chan_num)
+	     int chan_start_idx, int chan_num, int *timeout)
 {
 	int ret, i;
 	struct hif_msg *hif;
@@ -289,11 +289,13 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req,
 	tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay;
 	tmo_chan_fg *= body->num_of_probe_requests;
 	tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU;
+	if (*timeout)
+		*timeout = usecs_to_jiffies(tmo);
 
 	wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len);
 	ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
 	kfree(hif);
-	return ret ? ret : usecs_to_jiffies(tmo);
+	return ret;
 }
 
 int hif_stop_scan(struct wfx_vif *wvif)
diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h
index e9eca9330178..e1da28aef706 100644
--- a/drivers/staging/wfx/hif_tx.h
+++ b/drivers/staging/wfx/hif_tx.h
@@ -42,7 +42,7 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
 int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
 		  void *buf, size_t buf_size);
 int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211,
-	     int chan_start, int chan_num);
+	     int chan_start, int chan_num, int *timeout);
 int hif_stop_scan(struct wfx_vif *wvif);
 int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
 	     struct ieee80211_channel *channel, const u8 *ssid, int ssidlen);
diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c
index eff1be9fb28f..bf7ddc75c7db 100644
--- a/drivers/staging/wfx/scan.c
+++ b/drivers/staging/wfx/scan.c
@@ -56,10 +56,10 @@ static int send_scan_req(struct wfx_vif *wvif,
 	wfx_tx_lock_flush(wvif->wdev);
 	wvif->scan_abort = false;
 	reinit_completion(&wvif->scan_complete);
-	timeout = hif_scan(wvif, req, start_idx, i - start_idx);
-	if (timeout < 0) {
+	ret = hif_scan(wvif, req, start_idx, i - start_idx, &timeout);
+	if (ret) {
 		wfx_tx_unlock(wvif->wdev);
-		return timeout;
+		return -EIO;
 	}
 	ret = wait_for_completion_timeout(&wvif->scan_complete, timeout);
 	if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)
-- 
2.26.2

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2020-05-15  8:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  8:33 [PATCH 00/19] staging: wfx: various fixes Jerome Pouiller
2020-05-15  8:33 ` [PATCH 01/19] staging: wfx: fix warning when unregister a frozen device Jerome Pouiller
2020-05-15  8:33 ` [PATCH 02/19] staging: wfx: apply 80-columns rule to strings Jerome Pouiller
2020-05-15  8:33 ` [PATCH 03/19] staging: wfx: check pointers returned by allocations Jerome Pouiller
2020-05-15  8:33 ` [PATCH 04/19] staging: wfx: fix value of scan timeout Jerome Pouiller
2020-05-15  8:33 ` Jerome Pouiller [this message]
2020-05-15 13:53   ` [PATCH 05/19] staging: wfx: fix coherency of hif_scan() prototype Greg Kroah-Hartman
2020-05-15 14:01     ` Greg Kroah-Hartman
2020-05-15 15:03     ` Jérôme Pouiller
2020-05-15 15:09       ` Greg Kroah-Hartman
2020-05-15  8:33 ` [PATCH 06/19] staging: wfx: fix indentation Jerome Pouiller
2020-05-15  8:33 ` [PATCH 07/19] staging: wfx: fix status of dropped frames Jerome Pouiller
2020-05-15  8:33 ` [PATCH 08/19] staging: wfx: split out wfx_tx_fill_rates() from wfx_tx_confirm_cb() Jerome Pouiller
2020-05-15  8:33 ` [PATCH 09/19] staging: wfx: call wfx_tx_update_sta() before to destroy tx_priv Jerome Pouiller
2020-05-15  8:33 ` [PATCH 10/19] staging: wfx: fix potential use-after-free Jerome Pouiller
2020-05-15  8:33 ` [PATCH 11/19] staging: wfx: rename wfx_do_unjoin() into wfx_reset() Jerome Pouiller
2020-05-15  8:33 ` [PATCH 12/19] staging: wfx: merge wfx_stop_ap() with wfx_reset() Jerome Pouiller
2020-05-15  8:33 ` [PATCH 13/19] staging: wfx: fix potential dead lock between join and scan Jerome Pouiller
2020-05-15  8:33 ` [PATCH 14/19] staging: wfx: fix PS parameters when multiple vif are in use Jerome Pouiller
2020-05-15  8:33 ` [PATCH 15/19] staging: wfx: drop unnecessary filter configuration when disabling filter Jerome Pouiller
2020-05-15  8:33 ` [PATCH 16/19] staging: wfx: fix error reporting in wfx_start_ap() Jerome Pouiller
2020-05-15  8:33 ` [PATCH 17/19] staging: wfx: remove false-positive WARN() Jerome Pouiller
2020-05-15  8:33 ` [PATCH 18/19] staging: wfx: trace acknowledges not linked to any stations Jerome Pouiller
2020-05-15  8:33 ` [PATCH 19/19] staging: wfx: remove false positive warning Jerome Pouiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200515083325.378539-6-Jerome.Pouiller@silabs.com \
    --to=jerome.pouiller@silabs.com \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).