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
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
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
13 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
14 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
16 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 497 ++++++++++--------
17 .../broadcom/brcm80211/brcmfmac/debug.h | 9 +
18 2 files changed, 282 insertions(+), 224 deletions(-)
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
24 send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
26 + struct wiphy *wiphy = ifp->drvr->wiphy;
28 struct brcmf_wsec_key_le key_le;
30 @@ -468,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
34 - brcmf_err("wsec_key error (%d)\n", err);
35 + bphy_err(wiphy, "wsec_key error (%d)\n", err);
39 @@ -508,6 +509,7 @@ static int brcmf_get_first_free_bsscfgid
41 static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
43 + struct wiphy *wiphy = ifp->drvr->wiphy;
44 struct brcmf_mbss_ssid_le mbss_ssid_le;
47 @@ -524,7 +526,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));
51 - brcmf_err("setting ssid failed %d\n", err);
52 + bphy_err(wiphy, "setting ssid failed %d\n", err);
56 @@ -567,7 +569,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
57 BRCMF_VIF_EVENT_TIMEOUT);
58 brcmf_cfg80211_arm_vif_event(cfg, NULL);
60 - brcmf_err("timeout occurred\n");
61 + bphy_err(wiphy, "timeout occurred\n");
65 @@ -575,7 +577,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
66 /* interface created in firmware */
69 - brcmf_err("no if pointer provided\n");
70 + bphy_err(wiphy, "no if pointer provided\n");
74 @@ -583,7 +585,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);
78 - brcmf_err("Registering netdevice failed\n");
79 + bphy_err(wiphy, "Registering netdevice failed\n");
80 free_netdev(ifp->ndev);
83 @@ -620,7 +622,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);
87 - brcmf_err("iface validation failed: err=%d\n", err);
88 + bphy_err(wiphy, "iface validation failed: err=%d\n", err);
92 @@ -645,8 +647,8 @@ static struct wireless_dev *brcmf_cfg802
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));
101 brcmf_cfg80211_update_proto_addr_mode(wdev);
103 @@ -661,12 +663,13 @@ static void brcmf_scan_config_mpc(struct
105 void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
107 + struct wiphy *wiphy = ifp->drvr->wiphy;
110 if (check_vif_up(ifp->vif)) {
111 err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
113 - brcmf_err("fail to set mpc\n");
114 + bphy_err(wiphy, "fail to set mpc\n");
117 brcmf_dbg(INFO, "MPC : %d\n", mpc);
118 @@ -677,6 +680,7 @@ s32 brcmf_notify_escan_complete(struct b
119 struct brcmf_if *ifp, bool aborted,
122 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
123 struct brcmf_scan_params_le params_le;
124 struct cfg80211_scan_request *scan_request;
126 @@ -711,7 +715,7 @@ s32 brcmf_notify_escan_complete(struct b
127 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
128 ¶ms_le, sizeof(params_le));
130 - brcmf_err("Scan abort failed\n");
131 + bphy_err(wiphy, "Scan abort failed\n");
134 brcmf_scan_config_mpc(ifp, 1);
135 @@ -763,7 +767,7 @@ static int brcmf_cfg80211_del_ap_iface(s
137 err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
139 - brcmf_err("interface_remove failed %d\n", err);
140 + bphy_err(wiphy, "interface_remove failed %d\n", err);
144 @@ -771,7 +775,7 @@ static int brcmf_cfg80211_del_ap_iface(s
145 ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
146 BRCMF_VIF_EVENT_TIMEOUT);
148 - brcmf_err("timeout occurred\n");
149 + bphy_err(wiphy, "timeout occurred\n");
153 @@ -873,14 +877,14 @@ brcmf_cfg80211_change_iface(struct wiphy
155 err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
157 - brcmf_err("iface validation failed: err=%d\n", err);
158 + bphy_err(wiphy, "iface validation failed: err=%d\n", err);
162 case NL80211_IFTYPE_MONITOR:
163 case NL80211_IFTYPE_WDS:
164 - brcmf_err("type (%d) : currently we do not support this type\n",
166 + bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
169 case NL80211_IFTYPE_ADHOC:
171 @@ -908,7 +912,7 @@ brcmf_cfg80211_change_iface(struct wiphy
173 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
175 - brcmf_err("WLC_SET_INFRA error (%d)\n", err);
176 + bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
180 @@ -999,6 +1003,7 @@ static s32
181 brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
182 struct cfg80211_scan_request *request)
184 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
185 s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
186 offsetof(struct brcmf_escan_params_le, params_le);
187 struct brcmf_escan_params_le *params;
188 @@ -1030,7 +1035,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
190 brcmf_dbg(INFO, "system busy : escan canceled\n");
192 - brcmf_err("error (%d)\n", err);
193 + bphy_err(wiphy, "error (%d)\n", err);
197 @@ -1076,21 +1081,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
200 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
201 - brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status);
202 + bphy_err(wiphy, "Scanning already: status (%lu)\n",
206 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
207 - brcmf_err("Scanning being aborted: status (%lu)\n",
209 + bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
213 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
214 - brcmf_err("Scanning suppressed: status (%lu)\n",
216 + bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
220 if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
221 - brcmf_err("Connecting: status (%lu)\n", vif->sme_state);
222 + bphy_err(wiphy, "Connecting: status (%lu)\n", vif->sme_state);
226 @@ -1124,7 +1130,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
230 - brcmf_err("scan error (%d)\n", err);
231 + bphy_err(wiphy, "scan error (%d)\n", err);
232 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
233 cfg->scan_request = NULL;
235 @@ -1132,36 +1138,41 @@ scan_out:
237 static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
239 + struct brcmf_if *ifp = netdev_priv(ndev);
240 + struct wiphy *wiphy = ifp->drvr->wiphy;
243 - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh",
245 + err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
247 - brcmf_err("Error (%d)\n", err);
248 + bphy_err(wiphy, "Error (%d)\n", err);
253 static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
255 + struct brcmf_if *ifp = netdev_priv(ndev);
256 + struct wiphy *wiphy = ifp->drvr->wiphy;
259 - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh",
260 + err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
263 - brcmf_err("Error (%d)\n", err);
264 + bphy_err(wiphy, "Error (%d)\n", err);
269 static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
271 + struct brcmf_if *ifp = netdev_priv(ndev);
272 + struct wiphy *wiphy = ifp->drvr->wiphy;
274 u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
276 - err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry);
277 + err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
279 - brcmf_err("cmd (%d) , error (%d)\n", cmd, err);
280 + bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
284 @@ -1237,6 +1248,7 @@ static u16 brcmf_map_fw_linkdown_reason(
286 static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
288 + struct wiphy *wiphy = ifp->drvr->wiphy;
289 struct brcmf_wsec_pmk_le pmk;
292 @@ -1250,8 +1262,8 @@ static int brcmf_set_pmk(struct brcmf_if
293 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
296 - brcmf_err("failed to change PSK in firmware (len=%u)\n",
298 + bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n",
303 @@ -1259,6 +1271,7 @@ static int brcmf_set_pmk(struct brcmf_if
304 static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
306 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
307 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
310 brcmf_dbg(TRACE, "Enter\n");
311 @@ -1268,7 +1281,7 @@ static void brcmf_link_down(struct brcmf
312 err = brcmf_fil_cmd_data_set(vif->ifp,
313 BRCMF_C_DISASSOC, NULL, 0);
315 - brcmf_err("WLC_DISASSOC failed (%d)\n", err);
316 + bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
318 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
319 (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
320 @@ -1356,7 +1369,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
322 err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
324 - brcmf_err("wsec failed (%d)\n", err);
325 + bphy_err(wiphy, "wsec failed (%d)\n", err);
329 @@ -1368,7 +1381,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
331 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
333 - brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err);
334 + bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
338 @@ -1413,7 +1426,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
339 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
342 - brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err);
343 + bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
347 @@ -1425,7 +1438,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
348 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
349 &join_params, join_params_size);
351 - brcmf_err("WLC_SET_SSID failed (%d)\n", err);
352 + bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
356 @@ -1461,6 +1474,8 @@ brcmf_cfg80211_leave_ibss(struct wiphy *
357 static s32 brcmf_set_wpa_version(struct net_device *ndev,
358 struct cfg80211_connect_params *sme)
360 + struct brcmf_if *ifp = netdev_priv(ndev);
361 + struct wiphy *wiphy = ifp->drvr->wiphy;
362 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
363 struct brcmf_cfg80211_security *sec;
365 @@ -1473,9 +1488,9 @@ static s32 brcmf_set_wpa_version(struct
367 val = WPA_AUTH_DISABLED;
368 brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
369 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
370 + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
372 - brcmf_err("set wpa_auth failed (%d)\n", err);
373 + bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
377 @@ -1486,6 +1501,8 @@ static s32 brcmf_set_wpa_version(struct
378 static s32 brcmf_set_auth_type(struct net_device *ndev,
379 struct cfg80211_connect_params *sme)
381 + struct brcmf_if *ifp = netdev_priv(ndev);
382 + struct wiphy *wiphy = ifp->drvr->wiphy;
383 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
384 struct brcmf_cfg80211_security *sec;
386 @@ -1506,9 +1523,9 @@ static s32 brcmf_set_auth_type(struct ne
390 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
391 + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
393 - brcmf_err("set auth failed (%d)\n", err);
394 + bphy_err(wiphy, "set auth failed (%d)\n", err);
398 @@ -1520,6 +1537,8 @@ static s32
399 brcmf_set_wsec_mode(struct net_device *ndev,
400 struct cfg80211_connect_params *sme)
402 + struct brcmf_if *ifp = netdev_priv(ndev);
403 + struct wiphy *wiphy = ifp->drvr->wiphy;
404 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
405 struct brcmf_cfg80211_security *sec;
407 @@ -1543,8 +1562,8 @@ brcmf_set_wsec_mode(struct net_device *n
411 - brcmf_err("invalid cipher pairwise (%d)\n",
412 - sme->crypto.ciphers_pairwise[0]);
413 + bphy_err(wiphy, "invalid cipher pairwise (%d)\n",
414 + sme->crypto.ciphers_pairwise[0]);
418 @@ -1564,8 +1583,8 @@ brcmf_set_wsec_mode(struct net_device *n
422 - brcmf_err("invalid cipher group (%d)\n",
423 - sme->crypto.cipher_group);
424 + bphy_err(wiphy, "invalid cipher group (%d)\n",
425 + sme->crypto.cipher_group);
429 @@ -1578,9 +1597,9 @@ brcmf_set_wsec_mode(struct net_device *n
433 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
434 + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
436 - brcmf_err("error (%d)\n", err);
437 + bphy_err(wiphy, "error (%d)\n", err);
441 @@ -1595,6 +1614,7 @@ static s32
442 brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
444 struct brcmf_if *ifp = netdev_priv(ndev);
445 + struct wiphy *wiphy = ifp->drvr->wiphy;
446 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
449 @@ -1613,7 +1633,7 @@ brcmf_set_key_mgmt(struct net_device *nd
451 err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
453 - brcmf_err("could not get wpa_auth (%d)\n", err);
454 + bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
457 if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
458 @@ -1627,8 +1647,8 @@ brcmf_set_key_mgmt(struct net_device *nd
462 - brcmf_err("invalid cipher group (%d)\n",
463 - sme->crypto.cipher_group);
464 + bphy_err(wiphy, "invalid cipher group (%d)\n",
465 + sme->crypto.cipher_group);
468 } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
469 @@ -1650,8 +1670,8 @@ brcmf_set_key_mgmt(struct net_device *nd
473 - brcmf_err("invalid cipher group (%d)\n",
474 - sme->crypto.cipher_group);
475 + bphy_err(wiphy, "invalid cipher group (%d)\n",
476 + sme->crypto.cipher_group);
480 @@ -1697,7 +1717,7 @@ skip_mfp_config:
481 brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
482 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
484 - brcmf_err("could not set wpa_auth (%d)\n", err);
485 + bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
489 @@ -1708,6 +1728,8 @@ static s32
490 brcmf_set_sharedkey(struct net_device *ndev,
491 struct cfg80211_connect_params *sme)
493 + struct brcmf_if *ifp = netdev_priv(ndev);
494 + struct wiphy *wiphy = ifp->drvr->wiphy;
495 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
496 struct brcmf_cfg80211_security *sec;
497 struct brcmf_wsec_key key;
498 @@ -1734,7 +1756,7 @@ brcmf_set_sharedkey(struct net_device *n
499 key.len = (u32) sme->key_len;
500 key.index = (u32) sme->key_idx;
501 if (key.len > sizeof(key.data)) {
502 - brcmf_err("Too long key length (%u)\n", key.len);
503 + bphy_err(wiphy, "Too long key length (%u)\n", key.len);
506 memcpy(key.data, sme->key, key.len);
507 @@ -1747,24 +1769,24 @@ brcmf_set_sharedkey(struct net_device *n
508 key.algo = CRYPTO_ALGO_WEP128;
511 - brcmf_err("Invalid algorithm (%d)\n",
512 - sme->crypto.ciphers_pairwise[0]);
513 + bphy_err(wiphy, "Invalid algorithm (%d)\n",
514 + sme->crypto.ciphers_pairwise[0]);
517 /* Set the new key/index */
518 brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n",
519 key.len, key.index, key.algo);
520 brcmf_dbg(CONN, "key \"%s\"\n", key.data);
521 - err = send_key_to_dongle(netdev_priv(ndev), &key);
522 + err = send_key_to_dongle(ifp, &key);
526 if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) {
527 brcmf_dbg(CONN, "set auth_type to shared key\n");
528 val = WL_AUTH_SHARED_KEY; /* shared key */
529 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
530 + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
532 - brcmf_err("set auth failed (%d)\n", err);
533 + bphy_err(wiphy, "set auth failed (%d)\n", err);
537 @@ -1784,6 +1806,7 @@ enum nl80211_auth_type brcmf_war_auth_ty
538 static void brcmf_set_join_pref(struct brcmf_if *ifp,
539 struct cfg80211_bss_selection *bss_select)
541 + struct wiphy *wiphy = ifp->drvr->wiphy;
542 struct brcmf_join_pref_params join_pref_params[2];
543 enum nl80211_band band;
545 @@ -1822,7 +1845,7 @@ static void brcmf_set_join_pref(struct b
546 err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
547 sizeof(join_pref_params));
549 - brcmf_err("Set join_pref error (%d)\n", err);
550 + bphy_err(wiphy, "Set join_pref error (%d)\n", err);
554 @@ -1849,7 +1872,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
558 - brcmf_err("Invalid ssid\n");
559 + bphy_err(wiphy, "Invalid ssid\n");
563 @@ -1878,7 +1901,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
564 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
565 sme->ie, sme->ie_len);
567 - brcmf_err("Set Assoc REQ IE Failed\n");
568 + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
570 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
572 @@ -1899,32 +1922,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
574 err = brcmf_set_wpa_version(ndev, sme);
576 - brcmf_err("wl_set_wpa_version failed (%d)\n", err);
577 + bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
581 sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
582 err = brcmf_set_auth_type(ndev, sme);
584 - brcmf_err("wl_set_auth_type failed (%d)\n", err);
585 + bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
589 err = brcmf_set_wsec_mode(ndev, sme);
591 - brcmf_err("wl_set_set_cipher failed (%d)\n", err);
592 + bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
596 err = brcmf_set_key_mgmt(ndev, sme);
598 - brcmf_err("wl_set_key_mgmt failed (%d)\n", err);
599 + bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
603 err = brcmf_set_sharedkey(ndev, sme);
605 - brcmf_err("brcmf_set_sharedkey failed (%d)\n", err);
606 + bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
610 @@ -1941,7 +1964,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
611 /* enable firmware supplicant for this interface */
612 err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
614 - brcmf_err("failed to enable fw supplicant\n");
615 + bphy_err(wiphy, "failed to enable fw supplicant\n");
619 @@ -2036,7 +2059,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
620 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
621 &join_params, join_params_size);
623 - brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err);
624 + bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
628 @@ -2067,7 +2090,7 @@ brcmf_cfg80211_disconnect(struct wiphy *
629 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
630 &scbval, sizeof(scbval));
632 - brcmf_err("error (%d)\n", err);
633 + bphy_err(wiphy, "error (%d)\n", err);
635 brcmf_dbg(TRACE, "Exit\n");
637 @@ -2094,7 +2117,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
638 case NL80211_TX_POWER_LIMITED:
639 case NL80211_TX_POWER_FIXED:
641 - brcmf_err("TX_POWER_FIXED - dbm is negative\n");
642 + bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
646 @@ -2104,7 +2127,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
647 qdbm |= WL_TXPWR_OVERRIDE;
650 - brcmf_err("Unsupported type %d\n", type);
651 + bphy_err(wiphy, "Unsupported type %d\n", type);
655 @@ -2112,11 +2135,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy
656 disable = WL_RADIO_SW_DISABLE << 16;
657 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
659 - brcmf_err("WLC_SET_RADIO error (%d)\n", err);
660 + bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
662 err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
664 - brcmf_err("qtxpower error (%d)\n", err);
665 + bphy_err(wiphy, "qtxpower error (%d)\n", err);
668 brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
669 @@ -2137,7 +2160,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
671 err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
673 - brcmf_err("error (%d)\n", err);
674 + bphy_err(wiphy, "error (%d)\n", err);
677 *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
678 @@ -2163,7 +2186,7 @@ brcmf_cfg80211_config_default_key(struct
680 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
682 - brcmf_err("WLC_GET_WSEC error (%d)\n", err);
683 + bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
687 @@ -2173,7 +2196,7 @@ brcmf_cfg80211_config_default_key(struct
688 err = brcmf_fil_cmd_int_set(ifp,
689 BRCMF_C_SET_KEY_PRIMARY, index);
691 - brcmf_err("error (%d)\n", err);
692 + bphy_err(wiphy, "error (%d)\n", err);
695 brcmf_dbg(TRACE, "Exit\n");
696 @@ -2237,7 +2260,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
698 if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
699 /* we ignore this key index in this case */
700 - brcmf_err("invalid key index (%d)\n", key_idx);
701 + bphy_err(wiphy, "invalid key index (%d)\n", key_idx);
705 @@ -2246,7 +2269,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
708 if (params->key_len > sizeof(key->data)) {
709 - brcmf_err("Too long key length (%u)\n", params->key_len);
710 + bphy_err(wiphy, "Too long key length (%u)\n", params->key_len);
714 @@ -2300,7 +2323,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
715 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
718 - brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
719 + bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
723 @@ -2311,13 +2334,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
725 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
727 - brcmf_err("get wsec error (%d)\n", err);
728 + bphy_err(wiphy, "get wsec error (%d)\n", err);
732 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
734 - brcmf_err("set wsec error (%d)\n", err);
735 + bphy_err(wiphy, "set wsec error (%d)\n", err);
739 @@ -2348,7 +2371,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
741 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
743 - brcmf_err("WLC_GET_WSEC error (%d)\n", err);
744 + bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
745 /* Ignore this error, may happen during DISASSOC */
748 @@ -2369,7 +2392,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
749 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
750 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
752 - brcmf_err("Invalid algo (0x%x)\n", wsec);
753 + bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
757 @@ -2399,6 +2422,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
759 brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
761 + struct wiphy *wiphy = ifp->drvr->wiphy;
764 struct brcmf_wsec_key *key;
765 @@ -2415,18 +2439,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
767 err = send_key_to_dongle(ifp, key);
769 - brcmf_err("Setting WEP key failed (%d)\n", err);
770 + bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
773 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
775 - brcmf_err("get wsec error (%d)\n", err);
776 + bphy_err(wiphy, "get wsec error (%d)\n", err);
780 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
782 - brcmf_err("set wsec error (%d)\n", err);
783 + bphy_err(wiphy, "set wsec error (%d)\n", err);
786 static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
787 @@ -2452,6 +2476,7 @@ static void brcmf_convert_sta_flags(u32
789 static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
791 + struct wiphy *wiphy = ifp->drvr->wiphy;
794 struct brcmf_bss_info_le bss_le;
795 @@ -2467,7 +2492,7 @@ static void brcmf_fill_bss_param(struct
796 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
799 - brcmf_err("Failed to get bss info (%d)\n", err);
800 + bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
803 si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
804 @@ -2489,6 +2514,7 @@ static s32
805 brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
806 struct station_info *sinfo)
808 + struct wiphy *wiphy = ifp->drvr->wiphy;
809 struct brcmf_scb_val_le scbval;
810 struct brcmf_pktcnt_le pktcnt;
812 @@ -2498,7 +2524,7 @@ brcmf_cfg80211_get_station_ibss(struct b
813 /* Get the current tx rate */
814 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
816 - brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err);
817 + bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
820 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
821 @@ -2508,7 +2534,7 @@ brcmf_cfg80211_get_station_ibss(struct b
822 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
825 - brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err);
826 + bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
829 rssi = le32_to_cpu(scbval.val);
830 @@ -2518,7 +2544,7 @@ brcmf_cfg80211_get_station_ibss(struct b
831 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
834 - brcmf_err("BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
835 + bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
838 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
839 @@ -2566,7 +2592,7 @@ brcmf_cfg80211_get_station(struct wiphy
841 sizeof(sta_info_le));
843 - brcmf_err("GET STA INFO failed, %d\n", err);
844 + bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
848 @@ -2635,7 +2661,8 @@ brcmf_cfg80211_get_station(struct wiphy
849 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
850 &scb_val, sizeof(scb_val));
852 - brcmf_err("Could not get rssi (%d)\n", err);
853 + bphy_err(wiphy, "Could not get rssi (%d)\n",
857 rssi = le32_to_cpu(scb_val.val);
858 @@ -2666,8 +2693,8 @@ brcmf_cfg80211_dump_station(struct wiphy
860 sizeof(cfg->assoclist));
862 - brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
864 + bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
866 cfg->assoclist.count = 0;
869 @@ -2715,9 +2742,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip
870 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
873 - brcmf_err("net_device is not ready yet\n");
874 + bphy_err(wiphy, "net_device is not ready yet\n");
876 - brcmf_err("error (%d)\n", err);
877 + bphy_err(wiphy, "error (%d)\n", err);
880 brcmf_dbg(TRACE, "Exit\n");
881 @@ -2740,7 +2767,7 @@ static s32 brcmf_inform_single_bss(struc
882 struct cfg80211_inform_bss bss_data = {};
884 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
885 - brcmf_err("Bss info is larger than buffer. Discarding\n");
886 + bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n");
890 @@ -2799,6 +2826,7 @@ next_bss_le(struct brcmf_scan_results *l
892 static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
894 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
895 struct brcmf_scan_results *bss_list;
896 struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
898 @@ -2807,8 +2835,8 @@ static s32 brcmf_inform_bss(struct brcmf
899 bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
900 if (bss_list->count != 0 &&
901 bss_list->version != BRCMF_BSS_INFO_VERSION) {
902 - brcmf_err("Version %d != WL_BSS_INFO_VERSION\n",
903 - bss_list->version);
904 + bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n",
905 + bss_list->version);
908 brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count);
909 @@ -2852,7 +2880,7 @@ static s32 brcmf_inform_ibss(struct brcm
910 err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
911 buf, WL_BSS_INFO_MAX);
913 - brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err);
914 + bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
918 @@ -2906,6 +2934,7 @@ CleanUp:
919 static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
920 struct brcmf_if *ifp)
922 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
923 struct brcmf_bss_info_le *bi;
924 const struct brcmf_tlv *tim;
926 @@ -2922,7 +2951,7 @@ static s32 brcmf_update_bss_info(struct
927 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
928 cfg->extra_buf, WL_EXTRA_BUF_MAX);
930 - brcmf_err("Could not get bss info %d\n", err);
931 + bphy_err(wiphy, "Could not get bss info %d\n", err);
932 goto update_bss_info_out;
935 @@ -2947,7 +2976,7 @@ static s32 brcmf_update_bss_info(struct
937 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
939 - brcmf_err("wl dtim_assoc failed (%d)\n", err);
940 + bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err);
941 goto update_bss_info_out;
943 dtim_period = (u8)var;
944 @@ -2985,9 +3014,10 @@ static void brcmf_escan_timeout(struct t
946 struct brcmf_cfg80211_info *cfg =
947 from_timer(cfg, t, escan_timeout);
948 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
950 if (cfg->int_escan_map || cfg->scan_request) {
951 - brcmf_err("timer expired\n");
952 + bphy_err(wiphy, "timer expired\n");
953 schedule_work(&cfg->escan_timeout_work);
956 @@ -3036,6 +3066,7 @@ brcmf_cfg80211_escan_handler(struct brcm
957 const struct brcmf_event_msg *e, void *data)
959 struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
960 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
962 struct brcmf_escan_result_le *escan_result_le;
964 @@ -3052,32 +3083,33 @@ brcmf_cfg80211_escan_handler(struct brcm
967 if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
968 - brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
969 + bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n",
974 if (status == BRCMF_E_STATUS_PARTIAL) {
975 brcmf_dbg(SCAN, "ESCAN Partial result\n");
976 if (e->datalen < sizeof(*escan_result_le)) {
977 - brcmf_err("invalid event data length\n");
978 + bphy_err(wiphy, "invalid event data length\n");
981 escan_result_le = (struct brcmf_escan_result_le *) data;
982 if (!escan_result_le) {
983 - brcmf_err("Invalid escan result (NULL pointer)\n");
984 + bphy_err(wiphy, "Invalid escan result (NULL pointer)\n");
987 escan_buflen = le32_to_cpu(escan_result_le->buflen);
988 if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
989 escan_buflen > e->datalen ||
990 escan_buflen < sizeof(*escan_result_le)) {
991 - brcmf_err("Invalid escan buffer length: %d\n",
993 + bphy_err(wiphy, "Invalid escan buffer length: %d\n",
997 if (le16_to_cpu(escan_result_le->bss_count) != 1) {
998 - brcmf_err("Invalid bss_count %d: ignoring\n",
999 - escan_result_le->bss_count);
1000 + bphy_err(wiphy, "Invalid bss_count %d: ignoring\n",
1001 + escan_result_le->bss_count);
1004 bss_info_le = &escan_result_le->bss_info_le;
1005 @@ -3092,8 +3124,8 @@ brcmf_cfg80211_escan_handler(struct brcm
1007 bi_length = le32_to_cpu(bss_info_le->length);
1008 if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
1009 - brcmf_err("Ignoring invalid bss_info length: %d\n",
1011 + bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
1016 @@ -3101,7 +3133,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1017 BIT(NL80211_IFTYPE_ADHOC))) {
1018 if (le16_to_cpu(bss_info_le->capability) &
1019 WLAN_CAPABILITY_IBSS) {
1020 - brcmf_err("Ignoring IBSS result\n");
1021 + bphy_err(wiphy, "Ignoring IBSS result\n");
1025 @@ -3109,7 +3141,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1026 list = (struct brcmf_scan_results *)
1027 cfg->escan_info.escan_buf;
1028 if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
1029 - brcmf_err("Buffer is too small: ignoring\n");
1030 + bphy_err(wiphy, "Buffer is too small: ignoring\n");
1034 @@ -3301,14 +3333,14 @@ brcmf_notify_sched_scan_results(struct b
1035 WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
1036 brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
1037 if (!result_count) {
1038 - brcmf_err("FALSE PNO Event. (pfn_count == 0)\n");
1039 + bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n");
1043 netinfo_start = brcmf_get_netinfo_array(pfn_result);
1044 datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
1045 if (datalen < result_count * sizeof(*netinfo)) {
1046 - brcmf_err("insufficient event data\n");
1047 + bphy_err(wiphy, "insufficient event data\n");
1051 @@ -3362,8 +3394,8 @@ brcmf_cfg80211_sched_scan_start(struct w
1052 req->n_match_sets, req->n_ssids);
1054 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
1055 - brcmf_err("Scanning suppressed: status=%lu\n",
1056 - cfg->scan_status);
1057 + bphy_err(wiphy, "Scanning suppressed: status=%lu\n",
1058 + cfg->scan_status);
1062 @@ -3442,6 +3474,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1065 struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1066 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1067 struct brcmf_pno_scanresults_le *pfn_result;
1068 struct brcmf_pno_net_info_le *netinfo;
1070 @@ -3460,8 +3493,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1073 if (le32_to_cpu(pfn_result->count) < 1) {
1074 - brcmf_err("Invalid result count, expected 1 (%d)\n",
1075 - le32_to_cpu(pfn_result->count));
1076 + bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n",
1077 + le32_to_cpu(pfn_result->count));
1081 @@ -3498,7 +3531,7 @@ static void brcmf_report_wowl_wakeind(st
1082 err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
1083 sizeof(wake_ind_le));
1085 - brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
1086 + bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
1090 @@ -3539,7 +3572,7 @@ static void brcmf_report_wowl_wakeind(st
1091 cfg->wowl.nd_data_completed,
1092 BRCMF_ND_INFO_TIMEOUT);
1094 - brcmf_err("No result for wowl net detect\n");
1095 + bphy_err(wiphy, "No result for wowl net detect\n");
1097 wakeup_data.net_detect = cfg->wowl.nd_info;
1099 @@ -3747,7 +3780,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
1100 cfg->pmk_list.npmk = cpu_to_le32(npmk);
1103 - brcmf_err("Too many PMKSA entries cached %d\n", npmk);
1104 + bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
1108 @@ -3793,7 +3826,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
1109 memset(&pmk[i], 0, sizeof(*pmk));
1110 cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
1112 - brcmf_err("Cache entry not found\n");
1113 + bphy_err(wiphy, "Cache entry not found\n");
1117 @@ -3825,19 +3858,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
1119 static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
1121 + struct wiphy *wiphy = ifp->drvr->wiphy;
1126 err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
1128 - brcmf_err("auth error %d\n", err);
1129 + bphy_err(wiphy, "auth error %d\n", err);
1133 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
1135 - brcmf_err("wsec error %d\n", err);
1136 + bphy_err(wiphy, "wsec error %d\n", err);
1139 /* set upper-layer auth */
1140 @@ -3847,7 +3881,7 @@ static s32 brcmf_configure_opensecurity(
1141 wpa_val = WPA_AUTH_DISABLED;
1142 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val);
1144 - brcmf_err("wpa_auth error %d\n", err);
1145 + bphy_err(wiphy, "wpa_auth error %d\n", err);
1149 @@ -3867,6 +3901,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1150 const struct brcmf_vs_tlv *wpa_ie,
1153 + struct wiphy *wiphy = ifp->drvr->wiphy;
1154 u32 auth = 0; /* d11 open authentication */
1157 @@ -3897,13 +3932,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1158 /* check for multicast cipher suite */
1159 if (offset + WPA_IE_MIN_OUI_LEN > len) {
1161 - brcmf_err("no multicast cipher suite\n");
1162 + bphy_err(wiphy, "no multicast cipher suite\n");
1166 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1168 - brcmf_err("ivalid OUI\n");
1169 + bphy_err(wiphy, "ivalid OUI\n");
1172 offset += TLV_OUI_LEN;
1173 @@ -3925,7 +3960,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1177 - brcmf_err("Invalid multi cast cipher info\n");
1178 + bphy_err(wiphy, "Invalid multi cast cipher info\n");
1182 @@ -3936,13 +3971,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1183 /* Check for unicast suite(s) */
1184 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
1186 - brcmf_err("no unicast cipher suite\n");
1187 + bphy_err(wiphy, "no unicast cipher suite\n");
1190 for (i = 0; i < count; i++) {
1191 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1193 - brcmf_err("ivalid OUI\n");
1194 + bphy_err(wiphy, "ivalid OUI\n");
1197 offset += TLV_OUI_LEN;
1198 @@ -3960,7 +3995,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1199 pval |= AES_ENABLED;
1202 - brcmf_err("Invalid unicast security info\n");
1203 + bphy_err(wiphy, "Invalid unicast security info\n");
1207 @@ -3970,13 +4005,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1208 /* Check for auth key management suite(s) */
1209 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
1211 - brcmf_err("no auth key mgmt suite\n");
1212 + bphy_err(wiphy, "no auth key mgmt suite\n");
1215 for (i = 0; i < count; i++) {
1216 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1218 - brcmf_err("ivalid OUI\n");
1219 + bphy_err(wiphy, "ivalid OUI\n");
1222 offset += TLV_OUI_LEN;
1223 @@ -4004,7 +4039,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1224 wpa_auth |= WPA2_AUTH_1X_SHA256;
1227 - brcmf_err("Invalid key mgmt info\n");
1228 + bphy_err(wiphy, "Invalid key mgmt info\n");
1232 @@ -4046,7 +4081,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1233 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
1236 - brcmf_err("wme_bss_disable error %d\n", err);
1237 + bphy_err(wiphy, "wme_bss_disable error %d\n", err);
1241 @@ -4060,7 +4095,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1243 WPA_IE_MIN_OUI_LEN);
1245 - brcmf_err("bip error %d\n", err);
1246 + bphy_err(wiphy, "bip error %d\n", err);
1250 @@ -4071,13 +4106,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1252 err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
1254 - brcmf_err("auth error %d\n", err);
1255 + bphy_err(wiphy, "auth error %d\n", err);
1259 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
1261 - brcmf_err("wsec error %d\n", err);
1262 + bphy_err(wiphy, "wsec error %d\n", err);
1265 /* Configure MFP, this needs to go after wsec otherwise the wsec command
1266 @@ -4086,14 +4121,14 @@ brcmf_configure_wpaie(struct brcmf_if *i
1267 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
1268 err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
1270 - brcmf_err("mfp error %d\n", err);
1271 + bphy_err(wiphy, "mfp error %d\n", err);
1275 /* set upper-layer auth */
1276 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
1278 - brcmf_err("wpa_auth error %d\n", err);
1279 + bphy_err(wiphy, "wpa_auth error %d\n", err);
1283 @@ -4180,6 +4215,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1284 const u8 *vndr_ie_buf, u32 vndr_ie_len)
1286 struct brcmf_if *ifp;
1287 + struct wiphy *wiphy;
1288 struct vif_saved_ie *saved_ie;
1291 @@ -4200,6 +4236,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1295 + wiphy = ifp->drvr->wiphy;
1296 saved_ie = &vif->saved_ie;
1298 brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
1299 @@ -4231,13 +4268,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1303 - brcmf_err("not suitable type\n");
1304 + bphy_err(wiphy, "not suitable type\n");
1308 if (vndr_ie_len > mgmt_ie_buf_len) {
1310 - brcmf_err("extra IE size too big\n");
1311 + bphy_err(wiphy, "extra IE size too big\n");
1315 @@ -4298,8 +4335,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1316 /* verify remained buf size before copy data */
1317 if (remained_buf_len < (vndrie_info->vndrie.len +
1318 VNDR_IE_VSIE_OFFSET)) {
1319 - brcmf_err("no space in mgmt_ie_buf: len left %d",
1320 - remained_buf_len);
1321 + bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d",
1322 + remained_buf_len);
1325 remained_buf_len -= (vndrie_info->ie_len +
1326 @@ -4330,7 +4367,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1327 err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
1330 - brcmf_err("vndr ie set error : %d\n", err);
1331 + bphy_err(wiphy, "vndr ie set error : %d\n", err);
1335 @@ -4358,13 +4395,14 @@ static s32
1336 brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
1337 struct cfg80211_beacon_data *beacon)
1339 + struct wiphy *wiphy = vif->ifp->drvr->wiphy;
1342 /* Set Beacon IEs to FW */
1343 err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
1344 beacon->tail, beacon->tail_len);
1346 - brcmf_err("Set Beacon IE Failed\n");
1347 + bphy_err(wiphy, "Set Beacon IE Failed\n");
1350 brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
1351 @@ -4374,7 +4412,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
1352 beacon->proberesp_ies,
1353 beacon->proberesp_ies_len);
1355 - brcmf_err("Set Probe Resp IE Failed\n");
1356 + bphy_err(wiphy, "Set Probe Resp IE Failed\n");
1358 brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
1360 @@ -4483,7 +4521,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1361 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
1364 - brcmf_err("Regulatory Set Error, %d\n", err);
1365 + bphy_err(wiphy, "Regulatory Set Error, %d\n",
1370 @@ -4491,8 +4530,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1371 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
1372 settings->beacon_interval);
1374 - brcmf_err("Beacon Interval Set Error, %d\n",
1376 + bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
1381 @@ -4500,7 +4539,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1382 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
1383 settings->dtim_period);
1385 - brcmf_err("DTIM Interval Set Error, %d\n", err);
1386 + bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
1391 @@ -4510,7 +4550,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1392 !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
1393 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
1395 - brcmf_err("BRCMF_C_DOWN error %d\n", err);
1396 + bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
1400 brcmf_fil_iovar_int_set(ifp, "apsta", 0);
1401 @@ -4518,7 +4559,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1403 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
1405 - brcmf_err("SET INFRA error %d\n", err);
1406 + bphy_err(wiphy, "SET INFRA error %d\n", err);
1409 } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
1410 @@ -4534,7 +4575,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1412 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
1414 - brcmf_err("setting AP mode failed %d\n", err);
1415 + bphy_err(wiphy, "setting AP mode failed %d\n",
1420 @@ -4543,14 +4585,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1422 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
1424 - brcmf_err("Set Channel failed: chspec=%d, %d\n",
1426 + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1431 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
1433 - brcmf_err("BRCMF_C_UP error (%d)\n", err);
1434 + bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
1437 /* On DOWN the firmware removes the WEP keys, reconfigure
1438 @@ -4565,14 +4607,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1439 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1440 &join_params, sizeof(join_params));
1442 - brcmf_err("SET SSID error (%d)\n", err);
1443 + bphy_err(wiphy, "SET SSID error (%d)\n", err);
1447 if (settings->hidden_ssid) {
1448 err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
1450 - brcmf_err("closednet error (%d)\n", err);
1451 + bphy_err(wiphy, "closednet error (%d)\n", err);
1455 @@ -4581,14 +4623,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1456 } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
1457 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
1459 - brcmf_err("Set Channel failed: chspec=%d, %d\n",
1461 + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1465 err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
1468 - brcmf_err("setting ssid failed %d\n", err);
1469 + bphy_err(wiphy, "setting ssid failed %d\n", err);
1472 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
1473 @@ -4596,7 +4638,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1474 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1475 sizeof(bss_enable));
1477 - brcmf_err("bss_enable config failed %d\n", err);
1478 + bphy_err(wiphy, "bss_enable config failed %d\n", err);
1482 @@ -4644,13 +4686,13 @@ static int brcmf_cfg80211_stop_ap(struct
1483 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1484 &join_params, sizeof(join_params));
1486 - brcmf_err("SET SSID error (%d)\n", err);
1487 + bphy_err(wiphy, "SET SSID error (%d)\n", err);
1488 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
1490 - brcmf_err("BRCMF_C_DOWN error %d\n", err);
1491 + bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err);
1492 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
1494 - brcmf_err("setting AP mode failed %d\n", err);
1495 + bphy_err(wiphy, "setting AP mode failed %d\n", err);
1496 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
1497 brcmf_fil_iovar_int_set(ifp, "mbss", 0);
1498 brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
1499 @@ -4658,7 +4700,7 @@ static int brcmf_cfg80211_stop_ap(struct
1500 /* Bring device back up so it can be used again */
1501 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
1503 - brcmf_err("BRCMF_C_UP error %d\n", err);
1504 + bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
1506 brcmf_vif_clear_mgmt_ies(ifp->vif);
1508 @@ -4667,7 +4709,7 @@ static int brcmf_cfg80211_stop_ap(struct
1509 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1510 sizeof(bss_enable));
1512 - brcmf_err("bss_enable config failed %d\n", err);
1513 + bphy_err(wiphy, "bss_enable config failed %d\n", err);
1515 brcmf_set_mpc(ifp, 1);
1516 brcmf_configure_arp_nd_offload(ifp, true);
1517 @@ -4715,7 +4757,8 @@ brcmf_cfg80211_del_station(struct wiphy
1518 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
1519 &scbval, sizeof(scbval));
1521 - brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err);
1522 + bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
1525 brcmf_dbg(TRACE, "Exit\n");
1527 @@ -4745,7 +4788,7 @@ brcmf_cfg80211_change_station(struct wip
1528 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
1529 (void *)mac, ETH_ALEN);
1531 - brcmf_err("Setting SCB (de-)authorize failed, %d\n", err);
1532 + bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
1536 @@ -4795,7 +4838,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1537 mgmt = (const struct ieee80211_mgmt *)buf;
1539 if (!ieee80211_is_mgmt(mgmt->frame_control)) {
1540 - brcmf_err("Driver only allows MGMT packet type\n");
1541 + bphy_err(wiphy, "Driver only allows MGMT packet type\n");
1545 @@ -4826,13 +4869,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1547 } else if (ieee80211_is_action(mgmt->frame_control)) {
1548 if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
1549 - brcmf_err("invalid action frame length\n");
1550 + bphy_err(wiphy, "invalid action frame length\n");
1554 af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
1555 if (af_params == NULL) {
1556 - brcmf_err("unable to allocate frame\n");
1557 + bphy_err(wiphy, "unable to allocate frame\n");
1561 @@ -4890,7 +4933,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
1563 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
1565 - brcmf_err("No p2p device available for probe response\n");
1566 + bphy_err(wiphy, "No p2p device available for probe response\n");
1570 @@ -4918,7 +4961,7 @@ static int brcmf_cfg80211_get_channel(st
1572 err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
1574 - brcmf_err("chanspec failed (%d)\n", err);
1575 + bphy_err(wiphy, "chanspec failed (%d)\n", err);
1579 @@ -5057,7 +5100,7 @@ static int brcmf_cfg80211_tdls_oper(stru
1580 ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
1581 &info, sizeof(info));
1583 - brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret);
1584 + bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
1588 @@ -5078,7 +5121,7 @@ brcmf_cfg80211_update_conn_params(struct
1589 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
1590 sme->ie, sme->ie_len);
1592 - brcmf_err("Set Assoc REQ IE Failed\n");
1593 + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
1595 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
1597 @@ -5104,7 +5147,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
1598 ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", >k_le,
1601 - brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret);
1602 + bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret);
1606 @@ -5336,6 +5379,7 @@ static void brcmf_clear_assoc_ies(struct
1607 static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
1608 struct brcmf_if *ifp)
1610 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1611 struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
1612 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
1614 @@ -5347,7 +5391,7 @@ static s32 brcmf_get_assoc_ies(struct br
1615 err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
1616 cfg->extra_buf, WL_ASSOC_INFO_MAX);
1618 - brcmf_err("could not get assoc info (%d)\n", err);
1619 + bphy_err(wiphy, "could not get assoc info (%d)\n", err);
1623 @@ -5359,7 +5403,7 @@ static s32 brcmf_get_assoc_ies(struct br
1627 - brcmf_err("could not get assoc req (%d)\n", err);
1628 + bphy_err(wiphy, "could not get assoc req (%d)\n", err);
1631 conn_info->req_ie_len = req_len;
1632 @@ -5375,7 +5419,7 @@ static s32 brcmf_get_assoc_ies(struct br
1636 - brcmf_err("could not get assoc resp (%d)\n", err);
1637 + bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
1640 conn_info->resp_ie_len = resp_len;
1641 @@ -5502,6 +5546,7 @@ brcmf_notify_connect_status_ap(struct br
1642 struct net_device *ndev,
1643 const struct brcmf_event_msg *e, void *data)
1645 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1646 static int generation;
1647 u32 event = e->event_code;
1648 u32 reason = e->reason;
1649 @@ -5519,7 +5564,7 @@ brcmf_notify_connect_status_ap(struct br
1650 if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) &&
1651 (reason == BRCMF_E_STATUS_SUCCESS)) {
1653 - brcmf_err("No IEs present in ASSOC/REASSOC_IND");
1654 + bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
1658 @@ -5811,6 +5856,7 @@ static void init_vif_event(struct brcmf_
1660 static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
1662 + struct wiphy *wiphy = ifp->drvr->wiphy;
1665 __le32 roamtrigger[2];
1666 @@ -5823,7 +5869,7 @@ static s32 brcmf_dongle_roam(struct brcm
1667 bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
1668 err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
1670 - brcmf_err("bcn_timeout error (%d)\n", err);
1671 + bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
1672 goto roam_setup_done;
1675 @@ -5835,7 +5881,7 @@ static s32 brcmf_dongle_roam(struct brcm
1676 err = brcmf_fil_iovar_int_set(ifp, "roam_off",
1677 ifp->drvr->settings->roamoff);
1679 - brcmf_err("roam_off error (%d)\n", err);
1680 + bphy_err(wiphy, "roam_off error (%d)\n", err);
1681 goto roam_setup_done;
1684 @@ -5844,7 +5890,7 @@ static s32 brcmf_dongle_roam(struct brcm
1685 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
1686 (void *)roamtrigger, sizeof(roamtrigger));
1688 - brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
1689 + bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
1690 goto roam_setup_done;
1693 @@ -5853,7 +5899,7 @@ static s32 brcmf_dongle_roam(struct brcm
1694 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
1695 (void *)roam_delta, sizeof(roam_delta));
1697 - brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
1698 + bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err);
1699 goto roam_setup_done;
1702 @@ -5864,25 +5910,26 @@ roam_setup_done:
1704 brcmf_dongle_scantime(struct brcmf_if *ifp)
1706 + struct wiphy *wiphy = ifp->drvr->wiphy;
1709 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
1710 BRCMF_SCAN_CHANNEL_TIME);
1712 - brcmf_err("Scan assoc time error (%d)\n", err);
1713 + bphy_err(wiphy, "Scan assoc time error (%d)\n", err);
1714 goto dongle_scantime_out;
1716 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
1717 BRCMF_SCAN_UNASSOC_TIME);
1719 - brcmf_err("Scan unassoc time error (%d)\n", err);
1720 + bphy_err(wiphy, "Scan unassoc time error (%d)\n", err);
1721 goto dongle_scantime_out;
1724 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
1725 BRCMF_SCAN_PASSIVE_TIME);
1727 - brcmf_err("Scan passive time error (%d)\n", err);
1728 + bphy_err(wiphy, "Scan passive time error (%d)\n", err);
1729 goto dongle_scantime_out;
1732 @@ -5914,10 +5961,10 @@ static void brcmf_update_bw40_channel_fl
1733 static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
1736 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1737 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
1738 struct ieee80211_supported_band *band;
1739 struct ieee80211_channel *channel;
1740 - struct wiphy *wiphy;
1741 struct brcmf_chanspec_list *list;
1742 struct brcmu_chan ch;
1744 @@ -5936,11 +5983,10 @@ static int brcmf_construct_chaninfo(stru
1745 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
1748 - brcmf_err("get chanspecs error (%d)\n", err);
1749 + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
1753 - wiphy = cfg_to_wiphy(cfg);
1754 band = wiphy->bands[NL80211_BAND_2GHZ];
1756 for (i = 0; i < band->n_channels; i++)
1757 @@ -5960,7 +6006,8 @@ static int brcmf_construct_chaninfo(stru
1758 } else if (ch.band == BRCMU_CHAN_BAND_5G) {
1759 band = wiphy->bands[NL80211_BAND_5GHZ];
1761 - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
1762 + bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
1767 @@ -5983,8 +6030,8 @@ static int brcmf_construct_chaninfo(stru
1768 /* It seems firmware supports some channel we never
1769 * considered. Something new in IEEE standard?
1771 - brcmf_err("Ignoring unexpected firmware channel %d\n",
1772 - ch.control_ch_num);
1773 + bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n",
1774 + ch.control_ch_num);
1778 @@ -6030,6 +6077,7 @@ fail_pbuf:
1780 static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
1782 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1783 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
1784 struct ieee80211_supported_band *band;
1785 struct brcmf_fil_bwcap_le band_bwcap;
1786 @@ -6076,7 +6124,7 @@ static int brcmf_enable_bw40_2g(struct b
1787 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
1790 - brcmf_err("get chanspecs error (%d)\n", err);
1791 + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
1795 @@ -6107,6 +6155,7 @@ static int brcmf_enable_bw40_2g(struct b
1797 static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
1799 + struct wiphy *wiphy = ifp->drvr->wiphy;
1800 u32 band, mimo_bwcap;
1803 @@ -6142,7 +6191,7 @@ static void brcmf_get_bwcap(struct brcmf
1804 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
1807 - brcmf_err("invalid mimo_bw_cap value\n");
1808 + bphy_err(wiphy, "invalid mimo_bw_cap value\n");
1812 @@ -6218,7 +6267,7 @@ static void brcmf_update_vht_cap(struct
1813 static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
1815 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
1816 - struct wiphy *wiphy;
1817 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1820 u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
1821 @@ -6234,7 +6283,7 @@ static int brcmf_setup_wiphybands(struct
1822 (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
1823 err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
1825 - brcmf_err("nmode error (%d)\n", err);
1826 + bphy_err(wiphy, "nmode error (%d)\n", err);
1828 brcmf_get_bwcap(ifp, bw_cap);
1830 @@ -6244,7 +6293,7 @@ static int brcmf_setup_wiphybands(struct
1832 err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
1834 - brcmf_err("rxchain error (%d)\n", err);
1835 + bphy_err(wiphy, "rxchain error (%d)\n", err);
1838 for (nchain = 0; rxchain; nchain++)
1839 @@ -6254,7 +6303,7 @@ static int brcmf_setup_wiphybands(struct
1841 err = brcmf_construct_chaninfo(cfg, bw_cap);
1843 - brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err);
1844 + bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
1848 @@ -6266,7 +6315,6 @@ static int brcmf_setup_wiphybands(struct
1852 - wiphy = cfg_to_wiphy(cfg);
1853 for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
1854 band = wiphy->bands[i];
1856 @@ -6467,7 +6515,7 @@ static void brcmf_wiphy_wowl_params(stru
1857 wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
1860 - brcmf_err("only support basic wowlan features\n");
1861 + bphy_err(wiphy, "only support basic wowlan features\n");
1862 wiphy->wowlan = &brcmf_wowlan_support;
1865 @@ -6564,7 +6612,7 @@ static int brcmf_setup_wiphy(struct wiph
1866 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
1869 - brcmf_err("could not obtain band info: err=%d\n", err);
1870 + bphy_err(wiphy, "could not obtain band info: err=%d\n", err);
1873 /* first entry in bandlist is number of bands */
1874 @@ -6613,6 +6661,7 @@ static int brcmf_setup_wiphy(struct wiph
1876 static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
1878 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1879 struct net_device *ndev;
1880 struct wireless_dev *wdev;
1881 struct brcmf_if *ifp;
1882 @@ -6650,7 +6699,7 @@ static s32 brcmf_config_dongle(struct br
1884 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
1886 - brcmf_err("failed to set frameburst mode\n");
1887 + bphy_err(wiphy, "failed to set frameburst mode\n");
1888 goto default_conf_out;
1891 @@ -6842,8 +6891,8 @@ static void brcmf_cfg80211_reg_notifier(
1892 /* ignore non-ISO3166 country codes */
1893 for (i = 0; i < 2; i++)
1894 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
1895 - brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n",
1896 - req->alpha2[0], req->alpha2[1]);
1897 + bphy_err(wiphy, "not an ISO3166 code (0x%02x 0x%02x)\n",
1898 + req->alpha2[0], req->alpha2[1]);
1902 @@ -6852,7 +6901,7 @@ static void brcmf_cfg80211_reg_notifier(
1904 err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
1906 - brcmf_err("Country code iovar returned err = %d\n", err);
1907 + bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
1911 @@ -6862,7 +6911,7 @@ static void brcmf_cfg80211_reg_notifier(
1913 err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
1915 - brcmf_err("Firmware rejected country setting\n");
1916 + bphy_err(wiphy, "Firmware rejected country setting\n");
1919 brcmf_setup_wiphybands(cfg);
1920 @@ -6908,13 +6957,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1924 - brcmf_err("ndev is invalid\n");
1925 + bphy_err(wiphy, "ndev is invalid\n");
1929 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
1931 - brcmf_err("Could not allocate wiphy device\n");
1932 + bphy_err(wiphy, "Could not allocate wiphy device\n");
1936 @@ -6935,7 +6984,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1938 err = wl_init_priv(cfg);
1940 - brcmf_err("Failed to init iwm_priv (%d)\n", err);
1941 + bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err);
1942 brcmf_free_vif(vif);
1945 @@ -6944,7 +6993,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1946 /* determine d11 io type before wiphy setup */
1947 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
1949 - brcmf_err("Failed to get D11 version (%d)\n", err);
1950 + bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
1953 cfg->d11inf.io_type = (u8)io_type;
1954 @@ -6978,13 +7027,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1956 err = wiphy_register(wiphy);
1958 - brcmf_err("Could not register wiphy device (%d)\n", err);
1959 + bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
1963 err = brcmf_setup_wiphybands(cfg);
1965 - brcmf_err("Setting wiphy bands failed (%d)\n", err);
1966 + bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err);
1967 goto wiphy_unreg_out;
1970 @@ -7002,24 +7051,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1972 err = brcmf_fweh_activate_events(ifp);
1974 - brcmf_err("FWEH activation failed (%d)\n", err);
1975 + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
1976 goto wiphy_unreg_out;
1979 err = brcmf_p2p_attach(cfg, p2pdev_forced);
1981 - brcmf_err("P2P initialisation failed (%d)\n", err);
1982 + bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
1983 goto wiphy_unreg_out;
1985 err = brcmf_btcoex_attach(cfg);
1987 - brcmf_err("BT-coex initialisation failed (%d)\n", err);
1988 + bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err);
1989 brcmf_p2p_detach(&cfg->p2p);
1990 goto wiphy_unreg_out;
1992 err = brcmf_pno_attach(cfg);
1994 - brcmf_err("PNO initialisation failed (%d)\n", err);
1995 + bphy_err(wiphy, "PNO initialisation failed (%d)\n", err);
1996 brcmf_btcoex_detach(cfg);
1997 brcmf_p2p_detach(&cfg->p2p);
1998 goto wiphy_unreg_out;
1999 @@ -7039,7 +7088,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2000 /* (re-) activate FWEH event handling */
2001 err = brcmf_fweh_activate_events(ifp);
2003 - brcmf_err("FWEH activation failed (%d)\n", err);
2004 + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
2008 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
2009 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
2010 @@ -62,6 +62,15 @@ void __brcmf_err(struct brcmf_bus *bus,
2014 +#define bphy_err(wiphy, fmt, ...) \
2016 + if (IS_ENABLED(CPTCFG_BRCMDBG) || \
2017 + IS_ENABLED(CPTCFG_BRCM_TRACING) || \
2018 + net_ratelimit()) \
2019 + wiphy_err(wiphy, "%s: " fmt, __func__, \
2023 #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
2025 /* For debug/tracing purposes treat info messages as errors */