db6261163c9cdda615cb6cc2e915ab30c7d4c32d
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 339-v5.1-0003-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch
1 From 3ef005b82e2ad68107fc5814eaa743d171a6c362 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Wed, 16 Jan 2019 07:28:54 +0100
4 Subject: [PATCH] brcmfmac: add bphy_err() and use it in the cfg80211.c
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This new macro uses wiphy_err() which:
10 1) Should be the best choice with wiphy already created
11 2) Uses dev_err() which allows identifying error-affected device
12
13 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
14 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 ---
16 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 497 ++++++++++--------
17 .../broadcom/brcm80211/brcmfmac/debug.h | 9 +
18 2 files changed, 282 insertions(+), 224 deletions(-)
19
20 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
21 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
22 @@ -457,6 +457,7 @@ static void convert_key_from_CPU(struct
23 static int
24 send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
25 {
26 + struct wiphy *wiphy = ifp->drvr->wiphy;
27 int err;
28 struct brcmf_wsec_key_le key_le;
29
30 @@ -468,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
31 sizeof(key_le));
32
33 if (err)
34 - brcmf_err("wsec_key error (%d)\n", err);
35 + bphy_err(wiphy, "wsec_key error (%d)\n", err);
36 return err;
37 }
38
39 @@ -549,6 +550,7 @@ static int brcmf_get_first_free_bsscfgid
40
41 static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
42 {
43 + struct wiphy *wiphy = ifp->drvr->wiphy;
44 struct brcmf_mbss_ssid_le mbss_ssid_le;
45 int bsscfgidx;
46 int err;
47 @@ -565,7 +567,7 @@ static int brcmf_cfg80211_request_ap_if(
48 err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
49 sizeof(mbss_ssid_le));
50 if (err < 0)
51 - brcmf_err("setting ssid failed %d\n", err);
52 + bphy_err(wiphy, "setting ssid failed %d\n", err);
53
54 return err;
55 }
56 @@ -609,7 +611,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
57 BRCMF_VIF_EVENT_TIMEOUT);
58 brcmf_cfg80211_arm_vif_event(cfg, NULL);
59 if (!err) {
60 - brcmf_err("timeout occurred\n");
61 + bphy_err(wiphy, "timeout occurred\n");
62 err = -EIO;
63 goto fail;
64 }
65 @@ -617,7 +619,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
66 /* interface created in firmware */
67 ifp = vif->ifp;
68 if (!ifp) {
69 - brcmf_err("no if pointer provided\n");
70 + bphy_err(wiphy, "no if pointer provided\n");
71 err = -ENOENT;
72 goto fail;
73 }
74 @@ -625,7 +627,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
75 strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1);
76 err = brcmf_net_attach(ifp, true);
77 if (err) {
78 - brcmf_err("Registering netdevice failed\n");
79 + bphy_err(wiphy, "Registering netdevice failed\n");
80 goto fail;
81 }
82
83 @@ -662,7 +664,7 @@ static struct wireless_dev *brcmf_cfg802
84 brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
85 err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
86 if (err) {
87 - brcmf_err("iface validation failed: err=%d\n", err);
88 + bphy_err(wiphy, "iface validation failed: err=%d\n", err);
89 return ERR_PTR(err);
90 }
91 switch (type) {
92 @@ -687,8 +689,8 @@ static struct wireless_dev *brcmf_cfg802
93 }
94
95 if (IS_ERR(wdev))
96 - brcmf_err("add iface %s type %d failed: err=%d\n",
97 - name, type, (int)PTR_ERR(wdev));
98 + bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name,
99 + type, (int)PTR_ERR(wdev));
100 else
101 brcmf_cfg80211_update_proto_addr_mode(wdev);
102
103 @@ -703,12 +705,13 @@ static void brcmf_scan_config_mpc(struct
104
105 void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
106 {
107 + struct wiphy *wiphy = ifp->drvr->wiphy;
108 s32 err = 0;
109
110 if (check_vif_up(ifp->vif)) {
111 err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
112 if (err) {
113 - brcmf_err("fail to set mpc\n");
114 + bphy_err(wiphy, "fail to set mpc\n");
115 return;
116 }
117 brcmf_dbg(INFO, "MPC : %d\n", mpc);
118 @@ -793,7 +796,7 @@ static int brcmf_cfg80211_del_ap_iface(s
119
120 err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
121 if (err) {
122 - brcmf_err("interface_remove failed %d\n", err);
123 + bphy_err(wiphy, "interface_remove failed %d\n", err);
124 goto err_unarm;
125 }
126
127 @@ -801,7 +804,7 @@ static int brcmf_cfg80211_del_ap_iface(s
128 ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
129 BRCMF_VIF_EVENT_TIMEOUT);
130 if (!ret) {
131 - brcmf_err("timeout occurred\n");
132 + bphy_err(wiphy, "timeout occurred\n");
133 err = -EIO;
134 goto err_unarm;
135 }
136 @@ -903,14 +906,14 @@ brcmf_cfg80211_change_iface(struct wiphy
137 }
138 err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
139 if (err) {
140 - brcmf_err("iface validation failed: err=%d\n", err);
141 + bphy_err(wiphy, "iface validation failed: err=%d\n", err);
142 return err;
143 }
144 switch (type) {
145 case NL80211_IFTYPE_MONITOR:
146 case NL80211_IFTYPE_WDS:
147 - brcmf_err("type (%d) : currently we do not support this type\n",
148 - type);
149 + bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
150 + type);
151 return -EOPNOTSUPP;
152 case NL80211_IFTYPE_ADHOC:
153 infra = 0;
154 @@ -938,7 +941,7 @@ brcmf_cfg80211_change_iface(struct wiphy
155 } else {
156 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
157 if (err) {
158 - brcmf_err("WLC_SET_INFRA error (%d)\n", err);
159 + bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
160 err = -EAGAIN;
161 goto done;
162 }
163 @@ -1040,6 +1043,7 @@ static s32
164 brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
165 struct cfg80211_scan_request *request)
166 {
167 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
168 s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
169 offsetof(struct brcmf_escan_params_le, params_le);
170 struct brcmf_escan_params_le *params;
171 @@ -1071,7 +1075,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
172 if (err == -EBUSY)
173 brcmf_dbg(INFO, "system busy : escan canceled\n");
174 else
175 - brcmf_err("error (%d)\n", err);
176 + bphy_err(wiphy, "error (%d)\n", err);
177 }
178
179 kfree(params);
180 @@ -1129,21 +1133,23 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
181 brcmf_dbg(SCAN, "START ESCAN\n");
182
183 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
184 - brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status);
185 + bphy_err(wiphy, "Scanning already: status (%lu)\n",
186 + cfg->scan_status);
187 return -EAGAIN;
188 }
189 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
190 - brcmf_err("Scanning being aborted: status (%lu)\n",
191 - cfg->scan_status);
192 + bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
193 + cfg->scan_status);
194 return -EAGAIN;
195 }
196 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
197 - brcmf_err("Scanning suppressed: status (%lu)\n",
198 - cfg->scan_status);
199 + bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
200 + cfg->scan_status);
201 return -EAGAIN;
202 }
203 if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) {
204 - brcmf_err("Connecting: status (%lu)\n", ifp->vif->sme_state);
205 + bphy_err(wiphy, "Connecting: status (%lu)\n",
206 + ifp->vif->sme_state);
207 return -EAGAIN;
208 }
209
210 @@ -1235,7 +1241,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
211 err = brcmf_cfg80211_escan(wiphy, vif, request, NULL);
212
213 if (err)
214 - brcmf_err("scan error (%d)\n", err);
215 + bphy_err(wiphy, "scan error (%d)\n", err);
216
217 brcmf_dbg(TRACE, "Exit\n");
218 return err;
219 @@ -1243,36 +1249,41 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
220
221 static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
222 {
223 + struct brcmf_if *ifp = netdev_priv(ndev);
224 + struct wiphy *wiphy = ifp->drvr->wiphy;
225 s32 err = 0;
226
227 - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh",
228 - rts_threshold);
229 + err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
230 if (err)
231 - brcmf_err("Error (%d)\n", err);
232 + bphy_err(wiphy, "Error (%d)\n", err);
233
234 return err;
235 }
236
237 static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
238 {
239 + struct brcmf_if *ifp = netdev_priv(ndev);
240 + struct wiphy *wiphy = ifp->drvr->wiphy;
241 s32 err = 0;
242
243 - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh",
244 + err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
245 frag_threshold);
246 if (err)
247 - brcmf_err("Error (%d)\n", err);
248 + bphy_err(wiphy, "Error (%d)\n", err);
249
250 return err;
251 }
252
253 static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
254 {
255 + struct brcmf_if *ifp = netdev_priv(ndev);
256 + struct wiphy *wiphy = ifp->drvr->wiphy;
257 s32 err = 0;
258 u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
259
260 - err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry);
261 + err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
262 if (err) {
263 - brcmf_err("cmd (%d) , error (%d)\n", cmd, err);
264 + bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
265 return err;
266 }
267 return err;
268 @@ -1349,6 +1360,7 @@ static u16 brcmf_map_fw_linkdown_reason(
269 static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
270 {
271 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
272 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
273 s32 err = 0;
274
275 brcmf_dbg(TRACE, "Enter\n");
276 @@ -1358,7 +1370,7 @@ static void brcmf_link_down(struct brcmf
277 err = brcmf_fil_cmd_data_set(vif->ifp,
278 BRCMF_C_DISASSOC, NULL, 0);
279 if (err) {
280 - brcmf_err("WLC_DISASSOC failed (%d)\n", err);
281 + bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
282 }
283 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
284 (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
285 @@ -1442,7 +1454,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
286
287 err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
288 if (err) {
289 - brcmf_err("wsec failed (%d)\n", err);
290 + bphy_err(wiphy, "wsec failed (%d)\n", err);
291 goto done;
292 }
293
294 @@ -1454,7 +1466,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
295
296 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
297 if (err) {
298 - brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err);
299 + bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
300 goto done;
301 }
302
303 @@ -1499,7 +1511,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
304 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
305 target_channel);
306 if (err) {
307 - brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err);
308 + bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
309 goto done;
310 }
311 } else
312 @@ -1511,7 +1523,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
313 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
314 &join_params, join_params_size);
315 if (err) {
316 - brcmf_err("WLC_SET_SSID failed (%d)\n", err);
317 + bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
318 goto done;
319 }
320
321 @@ -1547,6 +1559,8 @@ brcmf_cfg80211_leave_ibss(struct wiphy *
322 static s32 brcmf_set_wpa_version(struct net_device *ndev,
323 struct cfg80211_connect_params *sme)
324 {
325 + struct brcmf_if *ifp = netdev_priv(ndev);
326 + struct wiphy *wiphy = ifp->drvr->wiphy;
327 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
328 struct brcmf_cfg80211_security *sec;
329 s32 val = 0;
330 @@ -1559,9 +1573,9 @@ static s32 brcmf_set_wpa_version(struct
331 else
332 val = WPA_AUTH_DISABLED;
333 brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
334 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
335 + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
336 if (err) {
337 - brcmf_err("set wpa_auth failed (%d)\n", err);
338 + bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
339 return err;
340 }
341 sec = &profile->sec;
342 @@ -1572,6 +1586,8 @@ static s32 brcmf_set_wpa_version(struct
343 static s32 brcmf_set_auth_type(struct net_device *ndev,
344 struct cfg80211_connect_params *sme)
345 {
346 + struct brcmf_if *ifp = netdev_priv(ndev);
347 + struct wiphy *wiphy = ifp->drvr->wiphy;
348 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
349 struct brcmf_cfg80211_security *sec;
350 s32 val = 0;
351 @@ -1592,9 +1608,9 @@ static s32 brcmf_set_auth_type(struct ne
352 break;
353 }
354
355 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
356 + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
357 if (err) {
358 - brcmf_err("set auth failed (%d)\n", err);
359 + bphy_err(wiphy, "set auth failed (%d)\n", err);
360 return err;
361 }
362 sec = &profile->sec;
363 @@ -1606,6 +1622,8 @@ static s32
364 brcmf_set_wsec_mode(struct net_device *ndev,
365 struct cfg80211_connect_params *sme)
366 {
367 + struct brcmf_if *ifp = netdev_priv(ndev);
368 + struct wiphy *wiphy = ifp->drvr->wiphy;
369 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
370 struct brcmf_cfg80211_security *sec;
371 s32 pval = 0;
372 @@ -1629,8 +1647,8 @@ brcmf_set_wsec_mode(struct net_device *n
373 pval = AES_ENABLED;
374 break;
375 default:
376 - brcmf_err("invalid cipher pairwise (%d)\n",
377 - sme->crypto.ciphers_pairwise[0]);
378 + bphy_err(wiphy, "invalid cipher pairwise (%d)\n",
379 + sme->crypto.ciphers_pairwise[0]);
380 return -EINVAL;
381 }
382 }
383 @@ -1650,8 +1668,8 @@ brcmf_set_wsec_mode(struct net_device *n
384 gval = AES_ENABLED;
385 break;
386 default:
387 - brcmf_err("invalid cipher group (%d)\n",
388 - sme->crypto.cipher_group);
389 + bphy_err(wiphy, "invalid cipher group (%d)\n",
390 + sme->crypto.cipher_group);
391 return -EINVAL;
392 }
393 }
394 @@ -1664,9 +1682,9 @@ brcmf_set_wsec_mode(struct net_device *n
395 pval = AES_ENABLED;
396
397 wsec = pval | gval;
398 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
399 + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
400 if (err) {
401 - brcmf_err("error (%d)\n", err);
402 + bphy_err(wiphy, "error (%d)\n", err);
403 return err;
404 }
405
406 @@ -1681,6 +1699,7 @@ static s32
407 brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
408 {
409 struct brcmf_if *ifp = netdev_priv(ndev);
410 + struct wiphy *wiphy = ifp->drvr->wiphy;
411 s32 val;
412 s32 err;
413 const struct brcmf_tlv *rsn_ie;
414 @@ -1696,7 +1715,7 @@ brcmf_set_key_mgmt(struct net_device *nd
415
416 err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
417 if (err) {
418 - brcmf_err("could not get wpa_auth (%d)\n", err);
419 + bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
420 return err;
421 }
422 if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
423 @@ -1708,8 +1727,8 @@ brcmf_set_key_mgmt(struct net_device *nd
424 val = WPA_AUTH_PSK;
425 break;
426 default:
427 - brcmf_err("invalid cipher group (%d)\n",
428 - sme->crypto.cipher_group);
429 + bphy_err(wiphy, "invalid cipher group (%d)\n",
430 + sme->crypto.cipher_group);
431 return -EINVAL;
432 }
433 } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
434 @@ -1727,8 +1746,8 @@ brcmf_set_key_mgmt(struct net_device *nd
435 val = WPA2_AUTH_PSK;
436 break;
437 default:
438 - brcmf_err("invalid cipher group (%d)\n",
439 - sme->crypto.cipher_group);
440 + bphy_err(wiphy, "invalid cipher group (%d)\n",
441 + sme->crypto.cipher_group);
442 return -EINVAL;
443 }
444 }
445 @@ -1771,7 +1790,7 @@ skip_mfp_config:
446 brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
447 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
448 if (err) {
449 - brcmf_err("could not set wpa_auth (%d)\n", err);
450 + bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
451 return err;
452 }
453
454 @@ -1782,6 +1801,8 @@ static s32
455 brcmf_set_sharedkey(struct net_device *ndev,
456 struct cfg80211_connect_params *sme)
457 {
458 + struct brcmf_if *ifp = netdev_priv(ndev);
459 + struct wiphy *wiphy = ifp->drvr->wiphy;
460 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
461 struct brcmf_cfg80211_security *sec;
462 struct brcmf_wsec_key key;
463 @@ -1808,7 +1829,7 @@ brcmf_set_sharedkey(struct net_device *n
464 key.len = (u32) sme->key_len;
465 key.index = (u32) sme->key_idx;
466 if (key.len > sizeof(key.data)) {
467 - brcmf_err("Too long key length (%u)\n", key.len);
468 + bphy_err(wiphy, "Too long key length (%u)\n", key.len);
469 return -EINVAL;
470 }
471 memcpy(key.data, sme->key, key.len);
472 @@ -1821,24 +1842,24 @@ brcmf_set_sharedkey(struct net_device *n
473 key.algo = CRYPTO_ALGO_WEP128;
474 break;
475 default:
476 - brcmf_err("Invalid algorithm (%d)\n",
477 - sme->crypto.ciphers_pairwise[0]);
478 + bphy_err(wiphy, "Invalid algorithm (%d)\n",
479 + sme->crypto.ciphers_pairwise[0]);
480 return -EINVAL;
481 }
482 /* Set the new key/index */
483 brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n",
484 key.len, key.index, key.algo);
485 brcmf_dbg(CONN, "key \"%s\"\n", key.data);
486 - err = send_key_to_dongle(netdev_priv(ndev), &key);
487 + err = send_key_to_dongle(ifp, &key);
488 if (err)
489 return err;
490
491 if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) {
492 brcmf_dbg(CONN, "set auth_type to shared key\n");
493 val = WL_AUTH_SHARED_KEY; /* shared key */
494 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
495 + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
496 if (err)
497 - brcmf_err("set auth failed (%d)\n", err);
498 + bphy_err(wiphy, "set auth failed (%d)\n", err);
499 }
500 return err;
501 }
502 @@ -1858,6 +1879,7 @@ enum nl80211_auth_type brcmf_war_auth_ty
503 static void brcmf_set_join_pref(struct brcmf_if *ifp,
504 struct cfg80211_bss_selection *bss_select)
505 {
506 + struct wiphy *wiphy = ifp->drvr->wiphy;
507 struct brcmf_join_pref_params join_pref_params[2];
508 enum nl80211_band band;
509 int err, i = 0;
510 @@ -1896,7 +1918,7 @@ static void brcmf_set_join_pref(struct b
511 err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
512 sizeof(join_pref_params));
513 if (err)
514 - brcmf_err("Set join_pref error (%d)\n", err);
515 + bphy_err(wiphy, "Set join_pref error (%d)\n", err);
516 }
517
518 static s32
519 @@ -1922,7 +1944,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
520 return -EIO;
521
522 if (!sme->ssid) {
523 - brcmf_err("Invalid ssid\n");
524 + bphy_err(wiphy, "Invalid ssid\n");
525 return -EOPNOTSUPP;
526 }
527
528 @@ -1951,7 +1973,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
529 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
530 sme->ie, sme->ie_len);
531 if (err)
532 - brcmf_err("Set Assoc REQ IE Failed\n");
533 + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
534 else
535 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
536
537 @@ -1972,32 +1994,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
538
539 err = brcmf_set_wpa_version(ndev, sme);
540 if (err) {
541 - brcmf_err("wl_set_wpa_version failed (%d)\n", err);
542 + bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
543 goto done;
544 }
545
546 sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
547 err = brcmf_set_auth_type(ndev, sme);
548 if (err) {
549 - brcmf_err("wl_set_auth_type failed (%d)\n", err);
550 + bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
551 goto done;
552 }
553
554 err = brcmf_set_wsec_mode(ndev, sme);
555 if (err) {
556 - brcmf_err("wl_set_set_cipher failed (%d)\n", err);
557 + bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
558 goto done;
559 }
560
561 err = brcmf_set_key_mgmt(ndev, sme);
562 if (err) {
563 - brcmf_err("wl_set_key_mgmt failed (%d)\n", err);
564 + bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
565 goto done;
566 }
567
568 err = brcmf_set_sharedkey(ndev, sme);
569 if (err) {
570 - brcmf_err("brcmf_set_sharedkey failed (%d)\n", err);
571 + bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
572 goto done;
573 }
574
575 @@ -2084,7 +2106,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
576 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
577 &join_params, join_params_size);
578 if (err)
579 - brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err);
580 + bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
581
582 done:
583 if (err)
584 @@ -2115,7 +2137,7 @@ brcmf_cfg80211_disconnect(struct wiphy *
585 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
586 &scbval, sizeof(scbval));
587 if (err)
588 - brcmf_err("error (%d)\n", err);
589 + bphy_err(wiphy, "error (%d)\n", err);
590
591 brcmf_dbg(TRACE, "Exit\n");
592 return err;
593 @@ -2142,7 +2164,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
594 case NL80211_TX_POWER_LIMITED:
595 case NL80211_TX_POWER_FIXED:
596 if (mbm < 0) {
597 - brcmf_err("TX_POWER_FIXED - dbm is negative\n");
598 + bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
599 err = -EINVAL;
600 goto done;
601 }
602 @@ -2152,7 +2174,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
603 qdbm |= WL_TXPWR_OVERRIDE;
604 break;
605 default:
606 - brcmf_err("Unsupported type %d\n", type);
607 + bphy_err(wiphy, "Unsupported type %d\n", type);
608 err = -EINVAL;
609 goto done;
610 }
611 @@ -2160,11 +2182,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy
612 disable = WL_RADIO_SW_DISABLE << 16;
613 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
614 if (err)
615 - brcmf_err("WLC_SET_RADIO error (%d)\n", err);
616 + bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
617
618 err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
619 if (err)
620 - brcmf_err("qtxpower error (%d)\n", err);
621 + bphy_err(wiphy, "qtxpower error (%d)\n", err);
622
623 done:
624 brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
625 @@ -2185,7 +2207,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
626
627 err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
628 if (err) {
629 - brcmf_err("error (%d)\n", err);
630 + bphy_err(wiphy, "error (%d)\n", err);
631 goto done;
632 }
633 *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
634 @@ -2211,7 +2233,7 @@ brcmf_cfg80211_config_default_key(struct
635
636 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
637 if (err) {
638 - brcmf_err("WLC_GET_WSEC error (%d)\n", err);
639 + bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
640 goto done;
641 }
642
643 @@ -2221,7 +2243,7 @@ brcmf_cfg80211_config_default_key(struct
644 err = brcmf_fil_cmd_int_set(ifp,
645 BRCMF_C_SET_KEY_PRIMARY, index);
646 if (err)
647 - brcmf_err("error (%d)\n", err);
648 + bphy_err(wiphy, "error (%d)\n", err);
649 }
650 done:
651 brcmf_dbg(TRACE, "Exit\n");
652 @@ -2285,7 +2307,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
653
654 if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
655 /* we ignore this key index in this case */
656 - brcmf_err("invalid key index (%d)\n", key_idx);
657 + bphy_err(wiphy, "invalid key index (%d)\n", key_idx);
658 return -EINVAL;
659 }
660
661 @@ -2294,7 +2316,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
662 mac_addr);
663
664 if (params->key_len > sizeof(key->data)) {
665 - brcmf_err("Too long key length (%u)\n", params->key_len);
666 + bphy_err(wiphy, "Too long key length (%u)\n", params->key_len);
667 return -EINVAL;
668 }
669
670 @@ -2348,7 +2370,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
671 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
672 break;
673 default:
674 - brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
675 + bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
676 err = -EINVAL;
677 goto done;
678 }
679 @@ -2359,13 +2381,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
680
681 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
682 if (err) {
683 - brcmf_err("get wsec error (%d)\n", err);
684 + bphy_err(wiphy, "get wsec error (%d)\n", err);
685 goto done;
686 }
687 wsec |= val;
688 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
689 if (err) {
690 - brcmf_err("set wsec error (%d)\n", err);
691 + bphy_err(wiphy, "set wsec error (%d)\n", err);
692 goto done;
693 }
694
695 @@ -2396,7 +2418,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
696
697 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
698 if (err) {
699 - brcmf_err("WLC_GET_WSEC error (%d)\n", err);
700 + bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
701 /* Ignore this error, may happen during DISASSOC */
702 err = -EAGAIN;
703 goto done;
704 @@ -2417,7 +2439,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
705 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
706 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
707 } else {
708 - brcmf_err("Invalid algo (0x%x)\n", wsec);
709 + bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
710 err = -EINVAL;
711 goto done;
712 }
713 @@ -2447,6 +2469,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
714 static void
715 brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
716 {
717 + struct wiphy *wiphy = ifp->drvr->wiphy;
718 s32 err;
719 u8 key_idx;
720 struct brcmf_wsec_key *key;
721 @@ -2463,18 +2486,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
722
723 err = send_key_to_dongle(ifp, key);
724 if (err) {
725 - brcmf_err("Setting WEP key failed (%d)\n", err);
726 + bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
727 return;
728 }
729 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
730 if (err) {
731 - brcmf_err("get wsec error (%d)\n", err);
732 + bphy_err(wiphy, "get wsec error (%d)\n", err);
733 return;
734 }
735 wsec |= WEP_ENABLED;
736 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
737 if (err)
738 - brcmf_err("set wsec error (%d)\n", err);
739 + bphy_err(wiphy, "set wsec error (%d)\n", err);
740 }
741
742 static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
743 @@ -2500,6 +2523,7 @@ static void brcmf_convert_sta_flags(u32
744
745 static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
746 {
747 + struct wiphy *wiphy = ifp->drvr->wiphy;
748 struct {
749 __le32 len;
750 struct brcmf_bss_info_le bss_le;
751 @@ -2515,7 +2539,7 @@ static void brcmf_fill_bss_param(struct
752 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
753 WL_BSS_INFO_MAX);
754 if (err) {
755 - brcmf_err("Failed to get bss info (%d)\n", err);
756 + bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
757 goto out_kfree;
758 }
759 si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
760 @@ -2537,6 +2561,7 @@ static s32
761 brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
762 struct station_info *sinfo)
763 {
764 + struct wiphy *wiphy = ifp->drvr->wiphy;
765 struct brcmf_scb_val_le scbval;
766 struct brcmf_pktcnt_le pktcnt;
767 s32 err;
768 @@ -2546,7 +2571,7 @@ brcmf_cfg80211_get_station_ibss(struct b
769 /* Get the current tx rate */
770 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
771 if (err < 0) {
772 - brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err);
773 + bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
774 return err;
775 }
776 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
777 @@ -2556,7 +2581,7 @@ brcmf_cfg80211_get_station_ibss(struct b
778 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
779 sizeof(scbval));
780 if (err) {
781 - brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err);
782 + bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
783 return err;
784 }
785 rssi = le32_to_cpu(scbval.val);
786 @@ -2566,7 +2591,7 @@ brcmf_cfg80211_get_station_ibss(struct b
787 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
788 sizeof(pktcnt));
789 if (err) {
790 - brcmf_err("BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
791 + bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
792 return err;
793 }
794 sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS) |
795 @@ -2614,7 +2639,7 @@ brcmf_cfg80211_get_station(struct wiphy
796 &sta_info_le,
797 sizeof(sta_info_le));
798 if (err < 0) {
799 - brcmf_err("GET STA INFO failed, %d\n", err);
800 + bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
801 goto done;
802 }
803 }
804 @@ -2683,7 +2708,8 @@ brcmf_cfg80211_get_station(struct wiphy
805 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
806 &scb_val, sizeof(scb_val));
807 if (err) {
808 - brcmf_err("Could not get rssi (%d)\n", err);
809 + bphy_err(wiphy, "Could not get rssi (%d)\n",
810 + err);
811 goto done;
812 } else {
813 rssi = le32_to_cpu(scb_val.val);
814 @@ -2714,8 +2740,8 @@ brcmf_cfg80211_dump_station(struct wiphy
815 &cfg->assoclist,
816 sizeof(cfg->assoclist));
817 if (err) {
818 - brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
819 - err);
820 + bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
821 + err);
822 cfg->assoclist.count = 0;
823 return -EOPNOTSUPP;
824 }
825 @@ -2763,9 +2789,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip
826 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
827 if (err) {
828 if (err == -ENODEV)
829 - brcmf_err("net_device is not ready yet\n");
830 + bphy_err(wiphy, "net_device is not ready yet\n");
831 else
832 - brcmf_err("error (%d)\n", err);
833 + bphy_err(wiphy, "error (%d)\n", err);
834 }
835 done:
836 brcmf_dbg(TRACE, "Exit\n");
837 @@ -2789,7 +2815,7 @@ static s32 brcmf_inform_single_bss(struc
838 s32 notify_signal;
839
840 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
841 - brcmf_err("Bss info is larger than buffer. Discarding\n");
842 + bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n");
843 return 0;
844 }
845
846 @@ -2847,6 +2873,7 @@ next_bss_le(struct brcmf_scan_results *l
847
848 static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
849 {
850 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
851 struct brcmf_scan_results *bss_list;
852 struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
853 s32 err = 0;
854 @@ -2855,8 +2882,8 @@ static s32 brcmf_inform_bss(struct brcmf
855 bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
856 if (bss_list->count != 0 &&
857 bss_list->version != BRCMF_BSS_INFO_VERSION) {
858 - brcmf_err("Version %d != WL_BSS_INFO_VERSION\n",
859 - bss_list->version);
860 + bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n",
861 + bss_list->version);
862 return -EOPNOTSUPP;
863 }
864 brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count);
865 @@ -2900,7 +2927,7 @@ static s32 brcmf_inform_ibss(struct brcm
866 err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
867 buf, WL_BSS_INFO_MAX);
868 if (err) {
869 - brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err);
870 + bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
871 goto CleanUp;
872 }
873
874 @@ -2954,6 +2981,7 @@ CleanUp:
875 static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
876 struct brcmf_if *ifp)
877 {
878 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
879 struct brcmf_bss_info_le *bi;
880 const struct brcmf_tlv *tim;
881 u16 beacon_interval;
882 @@ -2970,7 +2998,7 @@ static s32 brcmf_update_bss_info(struct
883 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
884 cfg->extra_buf, WL_EXTRA_BUF_MAX);
885 if (err) {
886 - brcmf_err("Could not get bss info %d\n", err);
887 + bphy_err(wiphy, "Could not get bss info %d\n", err);
888 goto update_bss_info_out;
889 }
890
891 @@ -2995,7 +3023,7 @@ static s32 brcmf_update_bss_info(struct
892 u32 var;
893 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
894 if (err) {
895 - brcmf_err("wl dtim_assoc failed (%d)\n", err);
896 + bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err);
897 goto update_bss_info_out;
898 }
899 dtim_period = (u8)var;
900 @@ -3033,9 +3061,10 @@ static void brcmf_escan_timeout(unsigned
901 {
902 struct brcmf_cfg80211_info *cfg =
903 (struct brcmf_cfg80211_info *)data;
904 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
905
906 if (cfg->internal_escan || cfg->scan_request) {
907 - brcmf_err("timer expired\n");
908 + bphy_err(wiphy, "timer expired\n");
909 schedule_work(&cfg->escan_timeout_work);
910 }
911 }
912 @@ -3084,6 +3113,7 @@ brcmf_cfg80211_escan_handler(struct brcm
913 const struct brcmf_event_msg *e, void *data)
914 {
915 struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
916 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
917 s32 status;
918 struct brcmf_escan_result_le *escan_result_le;
919 u32 escan_buflen;
920 @@ -3100,32 +3130,33 @@ brcmf_cfg80211_escan_handler(struct brcm
921 goto exit;
922
923 if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
924 - brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
925 + bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n",
926 + ifp->bsscfgidx);
927 return -EPERM;
928 }
929
930 if (status == BRCMF_E_STATUS_PARTIAL) {
931 brcmf_dbg(SCAN, "ESCAN Partial result\n");
932 if (e->datalen < sizeof(*escan_result_le)) {
933 - brcmf_err("invalid event data length\n");
934 + bphy_err(wiphy, "invalid event data length\n");
935 goto exit;
936 }
937 escan_result_le = (struct brcmf_escan_result_le *) data;
938 if (!escan_result_le) {
939 - brcmf_err("Invalid escan result (NULL pointer)\n");
940 + bphy_err(wiphy, "Invalid escan result (NULL pointer)\n");
941 goto exit;
942 }
943 escan_buflen = le32_to_cpu(escan_result_le->buflen);
944 if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
945 escan_buflen > e->datalen ||
946 escan_buflen < sizeof(*escan_result_le)) {
947 - brcmf_err("Invalid escan buffer length: %d\n",
948 - escan_buflen);
949 + bphy_err(wiphy, "Invalid escan buffer length: %d\n",
950 + escan_buflen);
951 goto exit;
952 }
953 if (le16_to_cpu(escan_result_le->bss_count) != 1) {
954 - brcmf_err("Invalid bss_count %d: ignoring\n",
955 - escan_result_le->bss_count);
956 + bphy_err(wiphy, "Invalid bss_count %d: ignoring\n",
957 + escan_result_le->bss_count);
958 goto exit;
959 }
960 bss_info_le = &escan_result_le->bss_info_le;
961 @@ -3140,8 +3171,8 @@ brcmf_cfg80211_escan_handler(struct brcm
962
963 bi_length = le32_to_cpu(bss_info_le->length);
964 if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
965 - brcmf_err("Ignoring invalid bss_info length: %d\n",
966 - bi_length);
967 + bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
968 + bi_length);
969 goto exit;
970 }
971
972 @@ -3149,7 +3180,7 @@ brcmf_cfg80211_escan_handler(struct brcm
973 BIT(NL80211_IFTYPE_ADHOC))) {
974 if (le16_to_cpu(bss_info_le->capability) &
975 WLAN_CAPABILITY_IBSS) {
976 - brcmf_err("Ignoring IBSS result\n");
977 + bphy_err(wiphy, "Ignoring IBSS result\n");
978 goto exit;
979 }
980 }
981 @@ -3157,7 +3188,7 @@ brcmf_cfg80211_escan_handler(struct brcm
982 list = (struct brcmf_scan_results *)
983 cfg->escan_info.escan_buf;
984 if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
985 - brcmf_err("Buffer is too small: ignoring\n");
986 + bphy_err(wiphy, "Buffer is too small: ignoring\n");
987 goto exit;
988 }
989
990 @@ -3346,14 +3377,14 @@ brcmf_notify_sched_scan_results(struct b
991 WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
992 brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
993 if (!result_count) {
994 - brcmf_err("FALSE PNO Event. (pfn_count == 0)\n");
995 + bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n");
996 goto out_err;
997 }
998
999 netinfo_start = brcmf_get_netinfo_array(pfn_result);
1000 datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
1001 if (datalen < result_count * sizeof(*netinfo)) {
1002 - brcmf_err("insufficient event data\n");
1003 + bphy_err(wiphy, "insufficient event data\n");
1004 goto out_err;
1005 }
1006
1007 @@ -3402,8 +3433,8 @@ brcmf_cfg80211_sched_scan_start(struct w
1008 req->n_match_sets, req->n_ssids);
1009
1010 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
1011 - brcmf_err("Scanning suppressed: status (%lu)\n",
1012 - cfg->scan_status);
1013 + bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
1014 + cfg->scan_status);
1015 return -EAGAIN;
1016 }
1017
1018 @@ -3482,6 +3513,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1019 void *data)
1020 {
1021 struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1022 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1023 struct brcmf_pno_scanresults_le *pfn_result;
1024 struct brcmf_pno_net_info_le *netinfo;
1025
1026 @@ -3500,8 +3532,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1027 }
1028
1029 if (le32_to_cpu(pfn_result->count) < 1) {
1030 - brcmf_err("Invalid result count, expected 1 (%d)\n",
1031 - le32_to_cpu(pfn_result->count));
1032 + bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n",
1033 + le32_to_cpu(pfn_result->count));
1034 return -EINVAL;
1035 }
1036
1037 @@ -3538,7 +3570,7 @@ static void brcmf_report_wowl_wakeind(st
1038 err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
1039 sizeof(wake_ind_le));
1040 if (err) {
1041 - brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
1042 + bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
1043 return;
1044 }
1045
1046 @@ -3579,7 +3611,7 @@ static void brcmf_report_wowl_wakeind(st
1047 cfg->wowl.nd_data_completed,
1048 BRCMF_ND_INFO_TIMEOUT);
1049 if (!timeout)
1050 - brcmf_err("No result for wowl net detect\n");
1051 + bphy_err(wiphy, "No result for wowl net detect\n");
1052 else
1053 wakeup_data.net_detect = cfg->wowl.nd_info;
1054 }
1055 @@ -3787,7 +3819,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
1056 cfg->pmk_list.npmk = cpu_to_le32(npmk);
1057 }
1058 } else {
1059 - brcmf_err("Too many PMKSA entries cached %d\n", npmk);
1060 + bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
1061 return -EINVAL;
1062 }
1063
1064 @@ -3833,7 +3865,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
1065 memset(&pmk[i], 0, sizeof(*pmk));
1066 cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
1067 } else {
1068 - brcmf_err("Cache entry not found\n");
1069 + bphy_err(wiphy, "Cache entry not found\n");
1070 return -EINVAL;
1071 }
1072
1073 @@ -3865,24 +3897,25 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
1074
1075 static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
1076 {
1077 + struct wiphy *wiphy = ifp->drvr->wiphy;
1078 s32 err;
1079
1080 /* set auth */
1081 err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
1082 if (err < 0) {
1083 - brcmf_err("auth error %d\n", err);
1084 + bphy_err(wiphy, "auth error %d\n", err);
1085 return err;
1086 }
1087 /* set wsec */
1088 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
1089 if (err < 0) {
1090 - brcmf_err("wsec error %d\n", err);
1091 + bphy_err(wiphy, "wsec error %d\n", err);
1092 return err;
1093 }
1094 /* set upper-layer auth */
1095 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", WPA_AUTH_NONE);
1096 if (err < 0) {
1097 - brcmf_err("wpa_auth error %d\n", err);
1098 + bphy_err(wiphy, "wpa_auth error %d\n", err);
1099 return err;
1100 }
1101
1102 @@ -3902,6 +3935,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1103 const struct brcmf_vs_tlv *wpa_ie,
1104 bool is_rsn_ie)
1105 {
1106 + struct wiphy *wiphy = ifp->drvr->wiphy;
1107 u32 auth = 0; /* d11 open authentication */
1108 u16 count;
1109 s32 err = 0;
1110 @@ -3932,13 +3966,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1111 /* check for multicast cipher suite */
1112 if (offset + WPA_IE_MIN_OUI_LEN > len) {
1113 err = -EINVAL;
1114 - brcmf_err("no multicast cipher suite\n");
1115 + bphy_err(wiphy, "no multicast cipher suite\n");
1116 goto exit;
1117 }
1118
1119 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1120 err = -EINVAL;
1121 - brcmf_err("ivalid OUI\n");
1122 + bphy_err(wiphy, "ivalid OUI\n");
1123 goto exit;
1124 }
1125 offset += TLV_OUI_LEN;
1126 @@ -3960,7 +3994,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1127 break;
1128 default:
1129 err = -EINVAL;
1130 - brcmf_err("Invalid multi cast cipher info\n");
1131 + bphy_err(wiphy, "Invalid multi cast cipher info\n");
1132 goto exit;
1133 }
1134
1135 @@ -3971,13 +4005,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1136 /* Check for unicast suite(s) */
1137 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
1138 err = -EINVAL;
1139 - brcmf_err("no unicast cipher suite\n");
1140 + bphy_err(wiphy, "no unicast cipher suite\n");
1141 goto exit;
1142 }
1143 for (i = 0; i < count; i++) {
1144 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1145 err = -EINVAL;
1146 - brcmf_err("ivalid OUI\n");
1147 + bphy_err(wiphy, "ivalid OUI\n");
1148 goto exit;
1149 }
1150 offset += TLV_OUI_LEN;
1151 @@ -3995,7 +4029,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1152 pval |= AES_ENABLED;
1153 break;
1154 default:
1155 - brcmf_err("Invalid unicast security info\n");
1156 + bphy_err(wiphy, "Invalid unicast security info\n");
1157 }
1158 offset++;
1159 }
1160 @@ -4005,13 +4039,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1161 /* Check for auth key management suite(s) */
1162 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
1163 err = -EINVAL;
1164 - brcmf_err("no auth key mgmt suite\n");
1165 + bphy_err(wiphy, "no auth key mgmt suite\n");
1166 goto exit;
1167 }
1168 for (i = 0; i < count; i++) {
1169 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1170 err = -EINVAL;
1171 - brcmf_err("ivalid OUI\n");
1172 + bphy_err(wiphy, "ivalid OUI\n");
1173 goto exit;
1174 }
1175 offset += TLV_OUI_LEN;
1176 @@ -4039,7 +4073,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1177 wpa_auth |= WPA2_AUTH_1X_SHA256;
1178 break;
1179 default:
1180 - brcmf_err("Invalid key mgmt info\n");
1181 + bphy_err(wiphy, "Invalid key mgmt info\n");
1182 }
1183 offset++;
1184 }
1185 @@ -4081,7 +4115,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1186 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
1187 wme_bss_disable);
1188 if (err < 0) {
1189 - brcmf_err("wme_bss_disable error %d\n", err);
1190 + bphy_err(wiphy, "wme_bss_disable error %d\n", err);
1191 goto exit;
1192 }
1193
1194 @@ -4095,7 +4129,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1195 &data[offset],
1196 WPA_IE_MIN_OUI_LEN);
1197 if (err < 0) {
1198 - brcmf_err("bip error %d\n", err);
1199 + bphy_err(wiphy, "bip error %d\n", err);
1200 goto exit;
1201 }
1202 }
1203 @@ -4106,13 +4140,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1204 /* set auth */
1205 err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
1206 if (err < 0) {
1207 - brcmf_err("auth error %d\n", err);
1208 + bphy_err(wiphy, "auth error %d\n", err);
1209 goto exit;
1210 }
1211 /* set wsec */
1212 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
1213 if (err < 0) {
1214 - brcmf_err("wsec error %d\n", err);
1215 + bphy_err(wiphy, "wsec error %d\n", err);
1216 goto exit;
1217 }
1218 /* Configure MFP, this needs to go after wsec otherwise the wsec command
1219 @@ -4121,14 +4155,14 @@ brcmf_configure_wpaie(struct brcmf_if *i
1220 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
1221 err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
1222 if (err < 0) {
1223 - brcmf_err("mfp error %d\n", err);
1224 + bphy_err(wiphy, "mfp error %d\n", err);
1225 goto exit;
1226 }
1227 }
1228 /* set upper-layer auth */
1229 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
1230 if (err < 0) {
1231 - brcmf_err("wpa_auth error %d\n", err);
1232 + bphy_err(wiphy, "wpa_auth error %d\n", err);
1233 goto exit;
1234 }
1235
1236 @@ -4215,6 +4249,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1237 const u8 *vndr_ie_buf, u32 vndr_ie_len)
1238 {
1239 struct brcmf_if *ifp;
1240 + struct wiphy *wiphy;
1241 struct vif_saved_ie *saved_ie;
1242 s32 err = 0;
1243 u8 *iovar_ie_buf;
1244 @@ -4235,6 +4270,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1245 if (!vif)
1246 return -ENODEV;
1247 ifp = vif->ifp;
1248 + wiphy = ifp->drvr->wiphy;
1249 saved_ie = &vif->saved_ie;
1250
1251 brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
1252 @@ -4266,13 +4302,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1253 break;
1254 default:
1255 err = -EPERM;
1256 - brcmf_err("not suitable type\n");
1257 + bphy_err(wiphy, "not suitable type\n");
1258 goto exit;
1259 }
1260
1261 if (vndr_ie_len > mgmt_ie_buf_len) {
1262 err = -ENOMEM;
1263 - brcmf_err("extra IE size too big\n");
1264 + bphy_err(wiphy, "extra IE size too big\n");
1265 goto exit;
1266 }
1267
1268 @@ -4333,8 +4369,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1269 /* verify remained buf size before copy data */
1270 if (remained_buf_len < (vndrie_info->vndrie.len +
1271 VNDR_IE_VSIE_OFFSET)) {
1272 - brcmf_err("no space in mgmt_ie_buf: len left %d",
1273 - remained_buf_len);
1274 + bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d",
1275 + remained_buf_len);
1276 break;
1277 }
1278 remained_buf_len -= (vndrie_info->ie_len +
1279 @@ -4365,7 +4401,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1280 err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
1281 total_ie_buf_len);
1282 if (err)
1283 - brcmf_err("vndr ie set error : %d\n", err);
1284 + bphy_err(wiphy, "vndr ie set error : %d\n", err);
1285 }
1286
1287 exit:
1288 @@ -4393,13 +4429,14 @@ static s32
1289 brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
1290 struct cfg80211_beacon_data *beacon)
1291 {
1292 + struct wiphy *wiphy = vif->ifp->drvr->wiphy;
1293 s32 err;
1294
1295 /* Set Beacon IEs to FW */
1296 err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
1297 beacon->tail, beacon->tail_len);
1298 if (err) {
1299 - brcmf_err("Set Beacon IE Failed\n");
1300 + bphy_err(wiphy, "Set Beacon IE Failed\n");
1301 return err;
1302 }
1303 brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
1304 @@ -4409,7 +4446,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
1305 beacon->proberesp_ies,
1306 beacon->proberesp_ies_len);
1307 if (err)
1308 - brcmf_err("Set Probe Resp IE Failed\n");
1309 + bphy_err(wiphy, "Set Probe Resp IE Failed\n");
1310 else
1311 brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
1312
1313 @@ -4518,7 +4555,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1314 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
1315 is_11d);
1316 if (err < 0) {
1317 - brcmf_err("Regulatory Set Error, %d\n", err);
1318 + bphy_err(wiphy, "Regulatory Set Error, %d\n",
1319 + err);
1320 goto exit;
1321 }
1322 }
1323 @@ -4526,8 +4564,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1324 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
1325 settings->beacon_interval);
1326 if (err < 0) {
1327 - brcmf_err("Beacon Interval Set Error, %d\n",
1328 - err);
1329 + bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
1330 + err);
1331 goto exit;
1332 }
1333 }
1334 @@ -4535,7 +4573,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1335 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
1336 settings->dtim_period);
1337 if (err < 0) {
1338 - brcmf_err("DTIM Interval Set Error, %d\n", err);
1339 + bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
1340 + err);
1341 goto exit;
1342 }
1343 }
1344 @@ -4545,7 +4584,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1345 !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
1346 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
1347 if (err < 0) {
1348 - brcmf_err("BRCMF_C_DOWN error %d\n", err);
1349 + bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
1350 + err);
1351 goto exit;
1352 }
1353 brcmf_fil_iovar_int_set(ifp, "apsta", 0);
1354 @@ -4553,7 +4593,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1355
1356 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
1357 if (err < 0) {
1358 - brcmf_err("SET INFRA error %d\n", err);
1359 + bphy_err(wiphy, "SET INFRA error %d\n", err);
1360 goto exit;
1361 }
1362 } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
1363 @@ -4569,7 +4609,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1364
1365 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
1366 if (err < 0) {
1367 - brcmf_err("setting AP mode failed %d\n", err);
1368 + bphy_err(wiphy, "setting AP mode failed %d\n",
1369 + err);
1370 goto exit;
1371 }
1372 if (!mbss) {
1373 @@ -4578,14 +4619,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1374 */
1375 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
1376 if (err < 0) {
1377 - brcmf_err("Set Channel failed: chspec=%d, %d\n",
1378 - chanspec, err);
1379 + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1380 + chanspec, err);
1381 goto exit;
1382 }
1383 }
1384 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
1385 if (err < 0) {
1386 - brcmf_err("BRCMF_C_UP error (%d)\n", err);
1387 + bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
1388 goto exit;
1389 }
1390 /* On DOWN the firmware removes the WEP keys, reconfigure
1391 @@ -4600,14 +4641,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1392 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1393 &join_params, sizeof(join_params));
1394 if (err < 0) {
1395 - brcmf_err("SET SSID error (%d)\n", err);
1396 + bphy_err(wiphy, "SET SSID error (%d)\n", err);
1397 goto exit;
1398 }
1399
1400 if (settings->hidden_ssid) {
1401 err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
1402 if (err) {
1403 - brcmf_err("closednet error (%d)\n", err);
1404 + bphy_err(wiphy, "closednet error (%d)\n", err);
1405 goto exit;
1406 }
1407 }
1408 @@ -4616,14 +4657,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1409 } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
1410 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
1411 if (err < 0) {
1412 - brcmf_err("Set Channel failed: chspec=%d, %d\n",
1413 - chanspec, err);
1414 + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1415 + chanspec, err);
1416 goto exit;
1417 }
1418 err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
1419 sizeof(ssid_le));
1420 if (err < 0) {
1421 - brcmf_err("setting ssid failed %d\n", err);
1422 + bphy_err(wiphy, "setting ssid failed %d\n", err);
1423 goto exit;
1424 }
1425 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
1426 @@ -4631,7 +4672,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1427 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1428 sizeof(bss_enable));
1429 if (err < 0) {
1430 - brcmf_err("bss_enable config failed %d\n", err);
1431 + bphy_err(wiphy, "bss_enable config failed %d\n", err);
1432 goto exit;
1433 }
1434
1435 @@ -4679,13 +4720,13 @@ static int brcmf_cfg80211_stop_ap(struct
1436 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1437 &join_params, sizeof(join_params));
1438 if (err < 0)
1439 - brcmf_err("SET SSID error (%d)\n", err);
1440 + bphy_err(wiphy, "SET SSID error (%d)\n", err);
1441 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
1442 if (err < 0)
1443 - brcmf_err("BRCMF_C_DOWN error %d\n", err);
1444 + bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err);
1445 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
1446 if (err < 0)
1447 - brcmf_err("setting AP mode failed %d\n", err);
1448 + bphy_err(wiphy, "setting AP mode failed %d\n", err);
1449 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
1450 brcmf_fil_iovar_int_set(ifp, "mbss", 0);
1451 brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
1452 @@ -4693,7 +4734,7 @@ static int brcmf_cfg80211_stop_ap(struct
1453 /* Bring device back up so it can be used again */
1454 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
1455 if (err < 0)
1456 - brcmf_err("BRCMF_C_UP error %d\n", err);
1457 + bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
1458
1459 brcmf_vif_clear_mgmt_ies(ifp->vif);
1460 } else {
1461 @@ -4702,7 +4743,7 @@ static int brcmf_cfg80211_stop_ap(struct
1462 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1463 sizeof(bss_enable));
1464 if (err < 0)
1465 - brcmf_err("bss_enable config failed %d\n", err);
1466 + bphy_err(wiphy, "bss_enable config failed %d\n", err);
1467 }
1468 brcmf_set_mpc(ifp, 1);
1469 brcmf_configure_arp_nd_offload(ifp, true);
1470 @@ -4750,7 +4791,8 @@ brcmf_cfg80211_del_station(struct wiphy
1471 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
1472 &scbval, sizeof(scbval));
1473 if (err)
1474 - brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err);
1475 + bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
1476 + err);
1477
1478 brcmf_dbg(TRACE, "Exit\n");
1479 return err;
1480 @@ -4780,7 +4822,7 @@ brcmf_cfg80211_change_station(struct wip
1481 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
1482 (void *)mac, ETH_ALEN);
1483 if (err < 0)
1484 - brcmf_err("Setting SCB (de-)authorize failed, %d\n", err);
1485 + bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
1486
1487 return err;
1488 }
1489 @@ -4830,7 +4872,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1490 mgmt = (const struct ieee80211_mgmt *)buf;
1491
1492 if (!ieee80211_is_mgmt(mgmt->frame_control)) {
1493 - brcmf_err("Driver only allows MGMT packet type\n");
1494 + bphy_err(wiphy, "Driver only allows MGMT packet type\n");
1495 return -EPERM;
1496 }
1497
1498 @@ -4861,13 +4903,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1499 GFP_KERNEL);
1500 } else if (ieee80211_is_action(mgmt->frame_control)) {
1501 if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
1502 - brcmf_err("invalid action frame length\n");
1503 + bphy_err(wiphy, "invalid action frame length\n");
1504 err = -EINVAL;
1505 goto exit;
1506 }
1507 af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
1508 if (af_params == NULL) {
1509 - brcmf_err("unable to allocate frame\n");
1510 + bphy_err(wiphy, "unable to allocate frame\n");
1511 err = -ENOMEM;
1512 goto exit;
1513 }
1514 @@ -4925,7 +4967,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
1515
1516 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
1517 if (vif == NULL) {
1518 - brcmf_err("No p2p device available for probe response\n");
1519 + bphy_err(wiphy, "No p2p device available for probe response\n");
1520 err = -ENODEV;
1521 goto exit;
1522 }
1523 @@ -4953,7 +4995,7 @@ static int brcmf_cfg80211_get_channel(st
1524
1525 err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
1526 if (err) {
1527 - brcmf_err("chanspec failed (%d)\n", err);
1528 + bphy_err(wiphy, "chanspec failed (%d)\n", err);
1529 return err;
1530 }
1531
1532 @@ -5092,7 +5134,7 @@ static int brcmf_cfg80211_tdls_oper(stru
1533 ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
1534 &info, sizeof(info));
1535 if (ret < 0)
1536 - brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret);
1537 + bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
1538
1539 return ret;
1540 }
1541 @@ -5113,7 +5155,7 @@ brcmf_cfg80211_update_conn_params(struct
1542 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
1543 sme->ie, sme->ie_len);
1544 if (err)
1545 - brcmf_err("Set Assoc REQ IE Failed\n");
1546 + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
1547 else
1548 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
1549
1550 @@ -5139,7 +5181,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
1551 ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
1552 sizeof(gtk_le));
1553 if (ret < 0)
1554 - brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret);
1555 + bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret);
1556
1557 return ret;
1558 }
1559 @@ -5317,6 +5359,7 @@ static void brcmf_clear_assoc_ies(struct
1560 static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
1561 struct brcmf_if *ifp)
1562 {
1563 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1564 struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
1565 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
1566 u32 req_len;
1567 @@ -5328,7 +5371,7 @@ static s32 brcmf_get_assoc_ies(struct br
1568 err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
1569 cfg->extra_buf, WL_ASSOC_INFO_MAX);
1570 if (err) {
1571 - brcmf_err("could not get assoc info (%d)\n", err);
1572 + bphy_err(wiphy, "could not get assoc info (%d)\n", err);
1573 return err;
1574 }
1575 assoc_info =
1576 @@ -5340,7 +5383,7 @@ static s32 brcmf_get_assoc_ies(struct br
1577 cfg->extra_buf,
1578 WL_ASSOC_INFO_MAX);
1579 if (err) {
1580 - brcmf_err("could not get assoc req (%d)\n", err);
1581 + bphy_err(wiphy, "could not get assoc req (%d)\n", err);
1582 return err;
1583 }
1584 conn_info->req_ie_len = req_len;
1585 @@ -5356,7 +5399,7 @@ static s32 brcmf_get_assoc_ies(struct br
1586 cfg->extra_buf,
1587 WL_ASSOC_INFO_MAX);
1588 if (err) {
1589 - brcmf_err("could not get assoc resp (%d)\n", err);
1590 + bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
1591 return err;
1592 }
1593 conn_info->resp_ie_len = resp_len;
1594 @@ -5475,6 +5518,7 @@ brcmf_notify_connect_status_ap(struct br
1595 struct net_device *ndev,
1596 const struct brcmf_event_msg *e, void *data)
1597 {
1598 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1599 static int generation;
1600 u32 event = e->event_code;
1601 u32 reason = e->reason;
1602 @@ -5493,7 +5537,7 @@ brcmf_notify_connect_status_ap(struct br
1603 (reason == BRCMF_E_STATUS_SUCCESS)) {
1604 memset(&sinfo, 0, sizeof(sinfo));
1605 if (!data) {
1606 - brcmf_err("No IEs present in ASSOC/REASSOC_IND");
1607 + bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
1608 return -EINVAL;
1609 }
1610 sinfo.assoc_req_ies = data;
1611 @@ -5774,6 +5818,7 @@ static void init_vif_event(struct brcmf_
1612
1613 static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
1614 {
1615 + struct wiphy *wiphy = ifp->drvr->wiphy;
1616 s32 err;
1617 u32 bcn_timeout;
1618 __le32 roamtrigger[2];
1619 @@ -5786,7 +5831,7 @@ static s32 brcmf_dongle_roam(struct brcm
1620 bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
1621 err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
1622 if (err) {
1623 - brcmf_err("bcn_timeout error (%d)\n", err);
1624 + bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
1625 goto roam_setup_done;
1626 }
1627
1628 @@ -5798,7 +5843,7 @@ static s32 brcmf_dongle_roam(struct brcm
1629 err = brcmf_fil_iovar_int_set(ifp, "roam_off",
1630 ifp->drvr->settings->roamoff);
1631 if (err) {
1632 - brcmf_err("roam_off error (%d)\n", err);
1633 + bphy_err(wiphy, "roam_off error (%d)\n", err);
1634 goto roam_setup_done;
1635 }
1636
1637 @@ -5807,7 +5852,7 @@ static s32 brcmf_dongle_roam(struct brcm
1638 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
1639 (void *)roamtrigger, sizeof(roamtrigger));
1640 if (err) {
1641 - brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
1642 + bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
1643 goto roam_setup_done;
1644 }
1645
1646 @@ -5816,7 +5861,7 @@ static s32 brcmf_dongle_roam(struct brcm
1647 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
1648 (void *)roam_delta, sizeof(roam_delta));
1649 if (err) {
1650 - brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
1651 + bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err);
1652 goto roam_setup_done;
1653 }
1654
1655 @@ -5827,25 +5872,26 @@ roam_setup_done:
1656 static s32
1657 brcmf_dongle_scantime(struct brcmf_if *ifp)
1658 {
1659 + struct wiphy *wiphy = ifp->drvr->wiphy;
1660 s32 err = 0;
1661
1662 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
1663 BRCMF_SCAN_CHANNEL_TIME);
1664 if (err) {
1665 - brcmf_err("Scan assoc time error (%d)\n", err);
1666 + bphy_err(wiphy, "Scan assoc time error (%d)\n", err);
1667 goto dongle_scantime_out;
1668 }
1669 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
1670 BRCMF_SCAN_UNASSOC_TIME);
1671 if (err) {
1672 - brcmf_err("Scan unassoc time error (%d)\n", err);
1673 + bphy_err(wiphy, "Scan unassoc time error (%d)\n", err);
1674 goto dongle_scantime_out;
1675 }
1676
1677 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
1678 BRCMF_SCAN_PASSIVE_TIME);
1679 if (err) {
1680 - brcmf_err("Scan passive time error (%d)\n", err);
1681 + bphy_err(wiphy, "Scan passive time error (%d)\n", err);
1682 goto dongle_scantime_out;
1683 }
1684
1685 @@ -5877,10 +5923,10 @@ static void brcmf_update_bw40_channel_fl
1686 static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
1687 u32 bw_cap[])
1688 {
1689 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1690 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
1691 struct ieee80211_supported_band *band;
1692 struct ieee80211_channel *channel;
1693 - struct wiphy *wiphy;
1694 struct brcmf_chanspec_list *list;
1695 struct brcmu_chan ch;
1696 int err;
1697 @@ -5899,11 +5945,10 @@ static int brcmf_construct_chaninfo(stru
1698 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
1699 BRCMF_DCMD_MEDLEN);
1700 if (err) {
1701 - brcmf_err("get chanspecs error (%d)\n", err);
1702 + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
1703 goto fail_pbuf;
1704 }
1705
1706 - wiphy = cfg_to_wiphy(cfg);
1707 band = wiphy->bands[NL80211_BAND_2GHZ];
1708 if (band)
1709 for (i = 0; i < band->n_channels; i++)
1710 @@ -5923,7 +5968,8 @@ static int brcmf_construct_chaninfo(stru
1711 } else if (ch.band == BRCMU_CHAN_BAND_5G) {
1712 band = wiphy->bands[NL80211_BAND_5GHZ];
1713 } else {
1714 - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
1715 + bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
1716 + ch.chspec);
1717 continue;
1718 }
1719 if (!band)
1720 @@ -5946,8 +5992,8 @@ static int brcmf_construct_chaninfo(stru
1721 /* It seems firmware supports some channel we never
1722 * considered. Something new in IEEE standard?
1723 */
1724 - brcmf_err("Ignoring unexpected firmware channel %d\n",
1725 - ch.control_ch_num);
1726 + bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n",
1727 + ch.control_ch_num);
1728 continue;
1729 }
1730
1731 @@ -5993,6 +6039,7 @@ fail_pbuf:
1732
1733 static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
1734 {
1735 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1736 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
1737 struct ieee80211_supported_band *band;
1738 struct brcmf_fil_bwcap_le band_bwcap;
1739 @@ -6039,7 +6086,7 @@ static int brcmf_enable_bw40_2g(struct b
1740 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
1741 BRCMF_DCMD_MEDLEN);
1742 if (err) {
1743 - brcmf_err("get chanspecs error (%d)\n", err);
1744 + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
1745 kfree(pbuf);
1746 return err;
1747 }
1748 @@ -6070,6 +6117,7 @@ static int brcmf_enable_bw40_2g(struct b
1749
1750 static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
1751 {
1752 + struct wiphy *wiphy = ifp->drvr->wiphy;
1753 u32 band, mimo_bwcap;
1754 int err;
1755
1756 @@ -6105,7 +6153,7 @@ static void brcmf_get_bwcap(struct brcmf
1757 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
1758 break;
1759 default:
1760 - brcmf_err("invalid mimo_bw_cap value\n");
1761 + bphy_err(wiphy, "invalid mimo_bw_cap value\n");
1762 }
1763 }
1764
1765 @@ -6181,7 +6229,7 @@ static void brcmf_update_vht_cap(struct
1766 static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
1767 {
1768 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
1769 - struct wiphy *wiphy;
1770 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1771 u32 nmode = 0;
1772 u32 vhtmode = 0;
1773 u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
1774 @@ -6197,7 +6245,7 @@ static int brcmf_setup_wiphybands(struct
1775 (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
1776 err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
1777 if (err) {
1778 - brcmf_err("nmode error (%d)\n", err);
1779 + bphy_err(wiphy, "nmode error (%d)\n", err);
1780 } else {
1781 brcmf_get_bwcap(ifp, bw_cap);
1782 }
1783 @@ -6207,7 +6255,7 @@ static int brcmf_setup_wiphybands(struct
1784
1785 err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
1786 if (err) {
1787 - brcmf_err("rxchain error (%d)\n", err);
1788 + bphy_err(wiphy, "rxchain error (%d)\n", err);
1789 nchain = 1;
1790 } else {
1791 for (nchain = 0; rxchain; nchain++)
1792 @@ -6217,7 +6265,7 @@ static int brcmf_setup_wiphybands(struct
1793
1794 err = brcmf_construct_chaninfo(cfg, bw_cap);
1795 if (err) {
1796 - brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err);
1797 + bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
1798 return err;
1799 }
1800
1801 @@ -6229,7 +6277,6 @@ static int brcmf_setup_wiphybands(struct
1802 &txbf_bfr_cap);
1803 }
1804
1805 - wiphy = cfg_to_wiphy(cfg);
1806 for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
1807 band = wiphy->bands[i];
1808 if (band == NULL)
1809 @@ -6440,7 +6487,7 @@ static void brcmf_wiphy_wowl_params(stru
1810 wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
1811 GFP_KERNEL);
1812 if (!wowl) {
1813 - brcmf_err("only support basic wowlan features\n");
1814 + bphy_err(wiphy, "only support basic wowlan features\n");
1815 wiphy->wowlan = &brcmf_wowlan_support;
1816 return;
1817 }
1818 @@ -6528,7 +6575,7 @@ static int brcmf_setup_wiphy(struct wiph
1819 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
1820 sizeof(bandlist));
1821 if (err) {
1822 - brcmf_err("could not obtain band info: err=%d\n", err);
1823 + bphy_err(wiphy, "could not obtain band info: err=%d\n", err);
1824 return err;
1825 }
1826 /* first entry in bandlist is number of bands */
1827 @@ -6800,8 +6847,8 @@ static void brcmf_cfg80211_reg_notifier(
1828 /* ignore non-ISO3166 country codes */
1829 for (i = 0; i < 2; i++)
1830 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
1831 - brcmf_err("not a ISO3166 code (0x%02x 0x%02x)\n",
1832 - req->alpha2[0], req->alpha2[1]);
1833 + bphy_err(wiphy, "not a ISO3166 code (0x%02x 0x%02x)\n",
1834 + req->alpha2[0], req->alpha2[1]);
1835 return;
1836 }
1837
1838 @@ -6810,7 +6857,7 @@ static void brcmf_cfg80211_reg_notifier(
1839
1840 err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
1841 if (err) {
1842 - brcmf_err("Country code iovar returned err = %d\n", err);
1843 + bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
1844 return;
1845 }
1846
1847 @@ -6820,7 +6867,7 @@ static void brcmf_cfg80211_reg_notifier(
1848
1849 err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
1850 if (err) {
1851 - brcmf_err("Firmware rejected country setting\n");
1852 + bphy_err(wiphy, "Firmware rejected country setting\n");
1853 return;
1854 }
1855 brcmf_setup_wiphybands(cfg);
1856 @@ -6866,13 +6913,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1857 u16 *cap = NULL;
1858
1859 if (!ndev) {
1860 - brcmf_err("ndev is invalid\n");
1861 + bphy_err(wiphy, "ndev is invalid\n");
1862 return NULL;
1863 }
1864
1865 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
1866 if (!cfg) {
1867 - brcmf_err("Could not allocate wiphy device\n");
1868 + bphy_err(wiphy, "Could not allocate wiphy device\n");
1869 return NULL;
1870 }
1871
1872 @@ -6893,7 +6940,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1873
1874 err = wl_init_priv(cfg);
1875 if (err) {
1876 - brcmf_err("Failed to init iwm_priv (%d)\n", err);
1877 + bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err);
1878 brcmf_free_vif(vif);
1879 goto wiphy_out;
1880 }
1881 @@ -6902,7 +6949,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1882 /* determine d11 io type before wiphy setup */
1883 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
1884 if (err) {
1885 - brcmf_err("Failed to get D11 version (%d)\n", err);
1886 + bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
1887 goto priv_out;
1888 }
1889 cfg->d11inf.io_type = (u8)io_type;
1890 @@ -6936,13 +6983,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1891 #endif
1892 err = wiphy_register(wiphy);
1893 if (err < 0) {
1894 - brcmf_err("Could not register wiphy device (%d)\n", err);
1895 + bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
1896 goto priv_out;
1897 }
1898
1899 err = brcmf_setup_wiphybands(cfg);
1900 if (err) {
1901 - brcmf_err("Setting wiphy bands failed (%d)\n", err);
1902 + bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err);
1903 goto wiphy_unreg_out;
1904 }
1905
1906 @@ -6960,18 +7007,18 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1907
1908 err = brcmf_fweh_activate_events(ifp);
1909 if (err) {
1910 - brcmf_err("FWEH activation failed (%d)\n", err);
1911 + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
1912 goto wiphy_unreg_out;
1913 }
1914
1915 err = brcmf_p2p_attach(cfg, p2pdev_forced);
1916 if (err) {
1917 - brcmf_err("P2P initialisation failed (%d)\n", err);
1918 + bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
1919 goto wiphy_unreg_out;
1920 }
1921 err = brcmf_btcoex_attach(cfg);
1922 if (err) {
1923 - brcmf_err("BT-coex initialisation failed (%d)\n", err);
1924 + bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err);
1925 brcmf_p2p_detach(&cfg->p2p);
1926 goto wiphy_unreg_out;
1927 }
1928 @@ -6990,7 +7037,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1929 /* (re-) activate FWEH event handling */
1930 err = brcmf_fweh_activate_events(ifp);
1931 if (err) {
1932 - brcmf_err("FWEH activation failed (%d)\n", err);
1933 + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
1934 goto detach;
1935 }
1936
1937 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
1938 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
1939 @@ -62,6 +62,15 @@ void __brcmf_err(struct brcmf_bus *bus,
1940 } while (0)
1941 #endif
1942
1943 +#define bphy_err(wiphy, fmt, ...) \
1944 + do { \
1945 + if (IS_ENABLED(CPTCFG_BRCMDBG) || \
1946 + IS_ENABLED(CPTCFG_BRCM_TRACING) || \
1947 + net_ratelimit()) \
1948 + wiphy_err(wiphy, "%s: " fmt, __func__, \
1949 + ##__VA_ARGS__); \
1950 + } while (0)
1951 +
1952 #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
1953
1954 /* For debug/tracing purposes treat info messages as errors */