Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200529121256.1045521-1-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jérôme Pouiller and committed by
Greg Kroah-Hartman
29de523a 8cf50934

+8 -6
+4 -2
drivers/staging/wfx/hif_tx.c
··· 240 240 } 241 241 242 242 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) 244 244 { 245 245 int ret, i; 246 246 struct hif_msg *hif; ··· 289 289 tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay; 290 290 tmo_chan_fg *= body->num_of_probe_requests; 291 291 tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU; 292 + if (timeout) 293 + *timeout = usecs_to_jiffies(tmo); 292 294 293 295 wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len); 294 296 ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); 295 297 kfree(hif); 296 - return ret ? ret : usecs_to_jiffies(tmo); 298 + return ret; 297 299 } 298 300 299 301 int hif_stop_scan(struct wfx_vif *wvif)
+1 -1
drivers/staging/wfx/hif_tx.h
··· 42 42 int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, 43 43 void *buf, size_t buf_size); 44 44 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); 46 46 int hif_stop_scan(struct wfx_vif *wvif); 47 47 int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, 48 48 struct ieee80211_channel *channel, const u8 *ssid, int ssidlen);
+3 -3
drivers/staging/wfx/scan.c
··· 56 56 wfx_tx_lock_flush(wvif->wdev); 57 57 wvif->scan_abort = false; 58 58 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) { 61 61 wfx_tx_unlock(wvif->wdev); 62 - return timeout; 62 + return -EIO; 63 63 } 64 64 ret = wait_for_completion_timeout(&wvif->scan_complete, timeout); 65 65 if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)