mac80211: brcmfmac: firmware halt and scan cleanup
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 303-v4.15-0003-brcmfmac-cleanup-brcmf_cfg80211_escan-function.patch
1 From 8c6efda22f5f9f73fc948f517424466be01ae84d Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Wed, 8 Nov 2017 14:36:33 +0100
4 Subject: [PATCH] brcmfmac: cleanup brcmf_cfg80211_escan() function
5
6 The function brcmf_cfg80211_escan() was always called with a non-null
7 request parameter and null pointer for this_ssid parameter. Clean up
8 the function removing the dead code path.
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 | 76 ++++------------------
17 1 file changed, 11 insertions(+), 65 deletions(-)
18
19 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
20 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
21 @@ -1072,18 +1072,10 @@ brcmf_do_escan(struct brcmf_if *ifp, str
22
23 static s32
24 brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif,
25 - struct cfg80211_scan_request *request,
26 - struct cfg80211_ssid *this_ssid)
27 + struct cfg80211_scan_request *request)
28 {
29 - struct brcmf_if *ifp = vif->ifp;
30 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
31 - struct cfg80211_ssid *ssids;
32 - u32 passive_scan;
33 - bool escan_req;
34 - bool spec_scan;
35 s32 err;
36 - struct brcmf_ssid_le ssid_le;
37 - u32 SSID_len;
38
39 brcmf_dbg(SCAN, "START ESCAN\n");
40
41 @@ -1101,8 +1093,8 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
42 cfg->scan_status);
43 return -EAGAIN;
44 }
45 - if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) {
46 - brcmf_err("Connecting: status (%lu)\n", ifp->vif->sme_state);
47 + if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
48 + brcmf_err("Connecting: status (%lu)\n", vif->sme_state);
49 return -EAGAIN;
50 }
51
52 @@ -1110,63 +1102,17 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
53 if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
54 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
55
56 - escan_req = false;
57 - if (request) {
58 - /* scan bss */
59 - ssids = request->ssids;
60 - escan_req = true;
61 - } else {
62 - /* scan in ibss */
63 - /* we don't do escan in ibss */
64 - ssids = this_ssid;
65 - }
66 -
67 cfg->scan_request = request;
68 set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
69 - if (escan_req) {
70 - cfg->escan_info.run = brcmf_run_escan;
71 - err = brcmf_p2p_scan_prep(wiphy, request, vif);
72 - if (err)
73 - goto scan_out;
74 -
75 - err = brcmf_do_escan(vif->ifp, request);
76 - if (err)
77 - goto scan_out;
78 - } else {
79 - brcmf_dbg(SCAN, "ssid \"%s\", ssid_len (%d)\n",
80 - ssids->ssid, ssids->ssid_len);
81 - memset(&ssid_le, 0, sizeof(ssid_le));
82 - SSID_len = min_t(u8, sizeof(ssid_le.SSID), ssids->ssid_len);
83 - ssid_le.SSID_len = cpu_to_le32(0);
84 - spec_scan = false;
85 - if (SSID_len) {
86 - memcpy(ssid_le.SSID, ssids->ssid, SSID_len);
87 - ssid_le.SSID_len = cpu_to_le32(SSID_len);
88 - spec_scan = true;
89 - } else
90 - brcmf_dbg(SCAN, "Broadcast scan\n");
91
92 - passive_scan = cfg->active_scan ? 0 : 1;
93 - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN,
94 - passive_scan);
95 - if (err) {
96 - brcmf_err("WLC_SET_PASSIVE_SCAN error (%d)\n", err);
97 - goto scan_out;
98 - }
99 - brcmf_scan_config_mpc(ifp, 0);
100 - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, &ssid_le,
101 - sizeof(ssid_le));
102 - if (err) {
103 - if (err == -EBUSY)
104 - brcmf_dbg(INFO, "BUSY: scan for \"%s\" canceled\n",
105 - ssid_le.SSID);
106 - else
107 - brcmf_err("WLC_SCAN error (%d)\n", err);
108 + cfg->escan_info.run = brcmf_run_escan;
109 + err = brcmf_p2p_scan_prep(wiphy, request, vif);
110 + if (err)
111 + goto scan_out;
112
113 - brcmf_scan_config_mpc(ifp, 1);
114 - goto scan_out;
115 - }
116 - }
117 + err = brcmf_do_escan(vif->ifp, request);
118 + if (err)
119 + goto scan_out;
120
121 /* Arm scan timeout timer */
122 mod_timer(&cfg->escan_timeout, jiffies +
123 @@ -1191,7 +1137,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
124 if (!check_vif_up(vif))
125 return -EIO;
126
127 - err = brcmf_cfg80211_escan(wiphy, vif, request, NULL);
128 + err = brcmf_cfg80211_escan(wiphy, vif, request);
129
130 if (err)
131 brcmf_err("scan error (%d)\n", err);