Skip to content

Commit 29de523

Browse files
jerome-pouillergregkh
authored andcommitted
staging: wfx: fix coherency of hif_scan() prototype
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8cf5093 commit 29de523

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

drivers/staging/wfx/hif_tx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
240240
}
241241

242242
int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req,
243-
int chan_start_idx, int chan_num)
243+
int chan_start_idx, int chan_num, int *timeout)
244244
{
245245
int ret, i;
246246
struct hif_msg *hif;
@@ -289,11 +289,13 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req,
289289
tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay;
290290
tmo_chan_fg *= body->num_of_probe_requests;
291291
tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU;
292+
if (timeout)
293+
*timeout = usecs_to_jiffies(tmo);
292294

293295
wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len);
294296
ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
295297
kfree(hif);
296-
return ret ? ret : usecs_to_jiffies(tmo);
298+
return ret;
297299
}
298300

299301
int hif_stop_scan(struct wfx_vif *wvif)

drivers/staging/wfx/hif_tx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
4242
int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id,
4343
void *buf, size_t buf_size);
4444
int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211,
45-
int chan_start, int chan_num);
45+
int chan_start, int chan_num, int *timeout);
4646
int hif_stop_scan(struct wfx_vif *wvif);
4747
int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
4848
struct ieee80211_channel *channel, const u8 *ssid, int ssidlen);

drivers/staging/wfx/scan.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ static int send_scan_req(struct wfx_vif *wvif,
5656
wfx_tx_lock_flush(wvif->wdev);
5757
wvif->scan_abort = false;
5858
reinit_completion(&wvif->scan_complete);
59-
timeout = hif_scan(wvif, req, start_idx, i - start_idx);
60-
if (timeout < 0) {
59+
ret = hif_scan(wvif, req, start_idx, i - start_idx, &timeout);
60+
if (ret) {
6161
wfx_tx_unlock(wvif->wdev);
62-
return timeout;
62+
return -EIO;
6363
}
6464
ret = wait_for_completion_timeout(&wvif->scan_complete, timeout);
6565
if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)

0 commit comments

Comments
 (0)