mac80211: brcmfmac: firmware halt and scan cleanup
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 303-v4.15-0005-brcmfmac-get-rid-of-brcmf_cfg80211_escan-function.patch
1 From 588378f15cff285ac81c929239ccba01d7f71d50 Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Wed, 8 Nov 2017 14:36:35 +0100
4 Subject: [PATCH] brcmfmac: get rid of brcmf_cfg80211_escan() function
5
6 The function brcmf_cfg80211_escan() is only called by brcmf_cfg80211_scan()
7 so there is no reason to split in two function especially since the latter
8 does not do an awful lot.
9
10 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
11 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
12 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
13 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
14 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 ---
16 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 34 +++++++---------------
17 1 file changed, 10 insertions(+), 24 deletions(-)
18
19 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
20 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
21 @@ -1071,13 +1071,16 @@ brcmf_do_escan(struct brcmf_if *ifp, str
22 }
23
24 static s32
25 -brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif,
26 - struct cfg80211_scan_request *request)
27 +brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
28 {
29 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
30 - s32 err;
31 + struct brcmf_cfg80211_vif *vif;
32 + s32 err = 0;
33
34 - brcmf_dbg(SCAN, "START ESCAN\n");
35 + brcmf_dbg(TRACE, "Enter\n");
36 + vif = container_of(request->wdev, struct brcmf_cfg80211_vif, wdev);
37 + if (!check_vif_up(vif))
38 + return -EIO;
39
40 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
41 brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status);
42 @@ -1102,6 +1105,8 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
43 if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
44 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
45
46 + brcmf_dbg(SCAN, "START ESCAN\n");
47 +
48 cfg->scan_request = request;
49 set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
50
51 @@ -1121,31 +1126,12 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
52 return 0;
53
54 scan_out:
55 + brcmf_err("scan error (%d)\n", err);
56 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
57 cfg->scan_request = NULL;
58 return err;
59 }
60
61 -static s32
62 -brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
63 -{
64 - struct brcmf_cfg80211_vif *vif;
65 - s32 err = 0;
66 -
67 - brcmf_dbg(TRACE, "Enter\n");
68 - vif = container_of(request->wdev, struct brcmf_cfg80211_vif, wdev);
69 - if (!check_vif_up(vif))
70 - return -EIO;
71 -
72 - err = brcmf_cfg80211_escan(wiphy, vif, request);
73 -
74 - if (err)
75 - brcmf_err("scan error (%d)\n", err);
76 -
77 - brcmf_dbg(TRACE, "Exit\n");
78 - return err;
79 -}
80 -
81 static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
82 {
83 s32 err = 0;