8858b186a79949db9a8302ceda751fd2c0e3aea4
[openwrt/staging/blocktrron.git] /
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 @@ -508,6 +509,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 @@ -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));
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 @@ -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);
59 if (!err) {
60 - brcmf_err("timeout occurred\n");
61 + bphy_err(wiphy, "timeout occurred\n");
62 err = -EIO;
63 goto fail;
64 }
65 @@ -575,7 +577,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 @@ -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);
77 if (err) {
78 - brcmf_err("Registering netdevice failed\n");
79 + bphy_err(wiphy, "Registering netdevice failed\n");
80 free_netdev(ifp->ndev);
81 goto fail;
82 }
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);
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 @@ -645,8 +647,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 @@ -661,12 +663,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 @@ -677,6 +680,7 @@ s32 brcmf_notify_escan_complete(struct b
119 struct brcmf_if *ifp, bool aborted,
120 bool fw_abort)
121 {
122 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
123 struct brcmf_scan_params_le params_le;
124 struct cfg80211_scan_request *scan_request;
125 u64 reqid;
126 @@ -711,7 +715,7 @@ s32 brcmf_notify_escan_complete(struct b
127 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
128 &params_le, sizeof(params_le));
129 if (err)
130 - brcmf_err("Scan abort failed\n");
131 + bphy_err(wiphy, "Scan abort failed\n");
132 }
133
134 brcmf_scan_config_mpc(ifp, 1);
135 @@ -763,7 +767,7 @@ static int brcmf_cfg80211_del_ap_iface(s
136
137 err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
138 if (err) {
139 - brcmf_err("interface_remove failed %d\n", err);
140 + bphy_err(wiphy, "interface_remove failed %d\n", err);
141 goto err_unarm;
142 }
143
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);
147 if (!ret) {
148 - brcmf_err("timeout occurred\n");
149 + bphy_err(wiphy, "timeout occurred\n");
150 err = -EIO;
151 goto err_unarm;
152 }
153 @@ -873,14 +877,14 @@ brcmf_cfg80211_change_iface(struct wiphy
154 }
155 err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
156 if (err) {
157 - brcmf_err("iface validation failed: err=%d\n", err);
158 + bphy_err(wiphy, "iface validation failed: err=%d\n", err);
159 return err;
160 }
161 switch (type) {
162 case NL80211_IFTYPE_MONITOR:
163 case NL80211_IFTYPE_WDS:
164 - brcmf_err("type (%d) : currently we do not support this type\n",
165 - type);
166 + bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
167 + type);
168 return -EOPNOTSUPP;
169 case NL80211_IFTYPE_ADHOC:
170 infra = 0;
171 @@ -908,7 +912,7 @@ brcmf_cfg80211_change_iface(struct wiphy
172 } else {
173 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
174 if (err) {
175 - brcmf_err("WLC_SET_INFRA error (%d)\n", err);
176 + bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
177 err = -EAGAIN;
178 goto done;
179 }
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)
183 {
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
189 if (err == -EBUSY)
190 brcmf_dbg(INFO, "system busy : escan canceled\n");
191 else
192 - brcmf_err("error (%d)\n", err);
193 + bphy_err(wiphy, "error (%d)\n", err);
194 }
195
196 kfree(params);
197 @@ -1076,21 +1081,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
198 return -EIO;
199
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",
203 + cfg->scan_status);
204 return -EAGAIN;
205 }
206 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
207 - brcmf_err("Scanning being aborted: status (%lu)\n",
208 - cfg->scan_status);
209 + bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
210 + cfg->scan_status);
211 return -EAGAIN;
212 }
213 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
214 - brcmf_err("Scanning suppressed: status (%lu)\n",
215 - cfg->scan_status);
216 + bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
217 + cfg->scan_status);
218 return -EAGAIN;
219 }
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);
223 return -EAGAIN;
224 }
225
226 @@ -1124,7 +1130,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
227 return 0;
228
229 scan_out:
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;
234 return err;
235 @@ -1132,36 +1138,41 @@ scan_out:
236
237 static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_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), "rtsthresh",
244 - rts_threshold);
245 + err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_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_frag(struct net_device *ndev, u32 frag_threshold)
254 {
255 + struct brcmf_if *ifp = netdev_priv(ndev);
256 + struct wiphy *wiphy = ifp->drvr->wiphy;
257 s32 err = 0;
258
259 - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh",
260 + err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
261 frag_threshold);
262 if (err)
263 - brcmf_err("Error (%d)\n", err);
264 + bphy_err(wiphy, "Error (%d)\n", err);
265
266 return err;
267 }
268
269 static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
270 {
271 + struct brcmf_if *ifp = netdev_priv(ndev);
272 + struct wiphy *wiphy = ifp->drvr->wiphy;
273 s32 err = 0;
274 u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
275
276 - err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry);
277 + err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
278 if (err) {
279 - brcmf_err("cmd (%d) , error (%d)\n", cmd, err);
280 + bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
281 return err;
282 }
283 return err;
284 @@ -1237,6 +1248,7 @@ static u16 brcmf_map_fw_linkdown_reason(
285
286 static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
287 {
288 + struct wiphy *wiphy = ifp->drvr->wiphy;
289 struct brcmf_wsec_pmk_le pmk;
290 int i, err;
291
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,
294 &pmk, sizeof(pmk));
295 if (err < 0)
296 - brcmf_err("failed to change PSK in firmware (len=%u)\n",
297 - pmk_len);
298 + bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n",
299 + pmk_len);
300
301 return err;
302 }
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)
305 {
306 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
307 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
308 s32 err = 0;
309
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);
314 if (err) {
315 - brcmf_err("WLC_DISASSOC failed (%d)\n", err);
316 + bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
317 }
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
321
322 err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
323 if (err) {
324 - brcmf_err("wsec failed (%d)\n", err);
325 + bphy_err(wiphy, "wsec failed (%d)\n", err);
326 goto done;
327 }
328
329 @@ -1368,7 +1381,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
330
331 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
332 if (err) {
333 - brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err);
334 + bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
335 goto done;
336 }
337
338 @@ -1413,7 +1426,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
339 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
340 target_channel);
341 if (err) {
342 - brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err);
343 + bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
344 goto done;
345 }
346 } else
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);
350 if (err) {
351 - brcmf_err("WLC_SET_SSID failed (%d)\n", err);
352 + bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
353 goto done;
354 }
355
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)
359 {
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;
364 s32 val = 0;
365 @@ -1473,9 +1488,9 @@ static s32 brcmf_set_wpa_version(struct
366 else
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);
371 if (err) {
372 - brcmf_err("set wpa_auth failed (%d)\n", err);
373 + bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
374 return err;
375 }
376 sec = &profile->sec;
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)
380 {
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;
385 s32 val = 0;
386 @@ -1506,9 +1523,9 @@ static s32 brcmf_set_auth_type(struct ne
387 break;
388 }
389
390 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
391 + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
392 if (err) {
393 - brcmf_err("set auth failed (%d)\n", err);
394 + bphy_err(wiphy, "set auth failed (%d)\n", err);
395 return err;
396 }
397 sec = &profile->sec;
398 @@ -1520,6 +1537,8 @@ static s32
399 brcmf_set_wsec_mode(struct net_device *ndev,
400 struct cfg80211_connect_params *sme)
401 {
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;
406 s32 pval = 0;
407 @@ -1543,8 +1562,8 @@ brcmf_set_wsec_mode(struct net_device *n
408 pval = AES_ENABLED;
409 break;
410 default:
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]);
415 return -EINVAL;
416 }
417 }
418 @@ -1564,8 +1583,8 @@ brcmf_set_wsec_mode(struct net_device *n
419 gval = AES_ENABLED;
420 break;
421 default:
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);
426 return -EINVAL;
427 }
428 }
429 @@ -1578,9 +1597,9 @@ brcmf_set_wsec_mode(struct net_device *n
430 pval = AES_ENABLED;
431
432 wsec = pval | gval;
433 - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
434 + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
435 if (err) {
436 - brcmf_err("error (%d)\n", err);
437 + bphy_err(wiphy, "error (%d)\n", err);
438 return err;
439 }
440
441 @@ -1595,6 +1614,7 @@ static s32
442 brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
443 {
444 struct brcmf_if *ifp = netdev_priv(ndev);
445 + struct wiphy *wiphy = ifp->drvr->wiphy;
446 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
447 s32 val;
448 s32 err;
449 @@ -1613,7 +1633,7 @@ brcmf_set_key_mgmt(struct net_device *nd
450
451 err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
452 if (err) {
453 - brcmf_err("could not get wpa_auth (%d)\n", err);
454 + bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
455 return err;
456 }
457 if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
458 @@ -1627,8 +1647,8 @@ brcmf_set_key_mgmt(struct net_device *nd
459 val = WPA_AUTH_PSK;
460 break;
461 default:
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);
466 return -EINVAL;
467 }
468 } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
469 @@ -1650,8 +1670,8 @@ brcmf_set_key_mgmt(struct net_device *nd
470 val = WPA2_AUTH_PSK;
471 break;
472 default:
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);
477 return -EINVAL;
478 }
479 }
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);
483 if (err) {
484 - brcmf_err("could not set wpa_auth (%d)\n", err);
485 + bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
486 return err;
487 }
488
489 @@ -1708,6 +1728,8 @@ static s32
490 brcmf_set_sharedkey(struct net_device *ndev,
491 struct cfg80211_connect_params *sme)
492 {
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);
504 return -EINVAL;
505 }
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;
509 break;
510 default:
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]);
515 return -EINVAL;
516 }
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);
523 if (err)
524 return err;
525
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);
531 if (err)
532 - brcmf_err("set auth failed (%d)\n", err);
533 + bphy_err(wiphy, "set auth failed (%d)\n", err);
534 }
535 return err;
536 }
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)
540 {
541 + struct wiphy *wiphy = ifp->drvr->wiphy;
542 struct brcmf_join_pref_params join_pref_params[2];
543 enum nl80211_band band;
544 int err, i = 0;
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));
548 if (err)
549 - brcmf_err("Set join_pref error (%d)\n", err);
550 + bphy_err(wiphy, "Set join_pref error (%d)\n", err);
551 }
552
553 static s32
554 @@ -1849,7 +1872,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
555 return -EIO;
556
557 if (!sme->ssid) {
558 - brcmf_err("Invalid ssid\n");
559 + bphy_err(wiphy, "Invalid ssid\n");
560 return -EOPNOTSUPP;
561 }
562
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);
566 if (err)
567 - brcmf_err("Set Assoc REQ IE Failed\n");
568 + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
569 else
570 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
571
572 @@ -1899,32 +1922,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
573
574 err = brcmf_set_wpa_version(ndev, sme);
575 if (err) {
576 - brcmf_err("wl_set_wpa_version failed (%d)\n", err);
577 + bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
578 goto done;
579 }
580
581 sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
582 err = brcmf_set_auth_type(ndev, sme);
583 if (err) {
584 - brcmf_err("wl_set_auth_type failed (%d)\n", err);
585 + bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
586 goto done;
587 }
588
589 err = brcmf_set_wsec_mode(ndev, sme);
590 if (err) {
591 - brcmf_err("wl_set_set_cipher failed (%d)\n", err);
592 + bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
593 goto done;
594 }
595
596 err = brcmf_set_key_mgmt(ndev, sme);
597 if (err) {
598 - brcmf_err("wl_set_key_mgmt failed (%d)\n", err);
599 + bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
600 goto done;
601 }
602
603 err = brcmf_set_sharedkey(ndev, sme);
604 if (err) {
605 - brcmf_err("brcmf_set_sharedkey failed (%d)\n", err);
606 + bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
607 goto done;
608 }
609
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);
613 if (err < 0) {
614 - brcmf_err("failed to enable fw supplicant\n");
615 + bphy_err(wiphy, "failed to enable fw supplicant\n");
616 goto done;
617 }
618 }
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);
622 if (err)
623 - brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err);
624 + bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
625
626 done:
627 if (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));
631 if (err)
632 - brcmf_err("error (%d)\n", err);
633 + bphy_err(wiphy, "error (%d)\n", err);
634
635 brcmf_dbg(TRACE, "Exit\n");
636 return err;
637 @@ -2094,7 +2117,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
638 case NL80211_TX_POWER_LIMITED:
639 case NL80211_TX_POWER_FIXED:
640 if (mbm < 0) {
641 - brcmf_err("TX_POWER_FIXED - dbm is negative\n");
642 + bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
643 err = -EINVAL;
644 goto done;
645 }
646 @@ -2104,7 +2127,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
647 qdbm |= WL_TXPWR_OVERRIDE;
648 break;
649 default:
650 - brcmf_err("Unsupported type %d\n", type);
651 + bphy_err(wiphy, "Unsupported type %d\n", type);
652 err = -EINVAL;
653 goto done;
654 }
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);
658 if (err)
659 - brcmf_err("WLC_SET_RADIO error (%d)\n", err);
660 + bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
661
662 err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
663 if (err)
664 - brcmf_err("qtxpower error (%d)\n", err);
665 + bphy_err(wiphy, "qtxpower error (%d)\n", err);
666
667 done:
668 brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
669 @@ -2137,7 +2160,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
670
671 err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
672 if (err) {
673 - brcmf_err("error (%d)\n", err);
674 + bphy_err(wiphy, "error (%d)\n", err);
675 goto done;
676 }
677 *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
678 @@ -2163,7 +2186,7 @@ brcmf_cfg80211_config_default_key(struct
679
680 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
681 if (err) {
682 - brcmf_err("WLC_GET_WSEC error (%d)\n", err);
683 + bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
684 goto done;
685 }
686
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);
690 if (err)
691 - brcmf_err("error (%d)\n", err);
692 + bphy_err(wiphy, "error (%d)\n", err);
693 }
694 done:
695 brcmf_dbg(TRACE, "Exit\n");
696 @@ -2237,7 +2260,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
697
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);
702 return -EINVAL;
703 }
704
705 @@ -2246,7 +2269,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
706 mac_addr);
707
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);
711 return -EINVAL;
712 }
713
714 @@ -2300,7 +2323,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
715 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
716 break;
717 default:
718 - brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
719 + bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
720 err = -EINVAL;
721 goto done;
722 }
723 @@ -2311,13 +2334,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
724
725 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
726 if (err) {
727 - brcmf_err("get wsec error (%d)\n", err);
728 + bphy_err(wiphy, "get wsec error (%d)\n", err);
729 goto done;
730 }
731 wsec |= val;
732 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
733 if (err) {
734 - brcmf_err("set wsec error (%d)\n", err);
735 + bphy_err(wiphy, "set wsec error (%d)\n", err);
736 goto done;
737 }
738
739 @@ -2348,7 +2371,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
740
741 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
742 if (err) {
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 */
746 err = -EAGAIN;
747 goto done;
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");
751 } else {
752 - brcmf_err("Invalid algo (0x%x)\n", wsec);
753 + bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
754 err = -EINVAL;
755 goto done;
756 }
757 @@ -2399,6 +2422,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
758 static void
759 brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
760 {
761 + struct wiphy *wiphy = ifp->drvr->wiphy;
762 s32 err;
763 u8 key_idx;
764 struct brcmf_wsec_key *key;
765 @@ -2415,18 +2439,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
766
767 err = send_key_to_dongle(ifp, key);
768 if (err) {
769 - brcmf_err("Setting WEP key failed (%d)\n", err);
770 + bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
771 return;
772 }
773 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
774 if (err) {
775 - brcmf_err("get wsec error (%d)\n", err);
776 + bphy_err(wiphy, "get wsec error (%d)\n", err);
777 return;
778 }
779 wsec |= WEP_ENABLED;
780 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
781 if (err)
782 - brcmf_err("set wsec error (%d)\n", err);
783 + bphy_err(wiphy, "set wsec error (%d)\n", err);
784 }
785
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
788
789 static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
790 {
791 + struct wiphy *wiphy = ifp->drvr->wiphy;
792 struct {
793 __le32 len;
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,
797 WL_BSS_INFO_MAX);
798 if (err) {
799 - brcmf_err("Failed to get bss info (%d)\n", err);
800 + bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
801 goto out_kfree;
802 }
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)
807 {
808 + struct wiphy *wiphy = ifp->drvr->wiphy;
809 struct brcmf_scb_val_le scbval;
810 struct brcmf_pktcnt_le pktcnt;
811 s32 err;
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);
815 if (err < 0) {
816 - brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err);
817 + bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
818 return err;
819 }
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,
823 sizeof(scbval));
824 if (err) {
825 - brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err);
826 + bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
827 return err;
828 }
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,
832 sizeof(pktcnt));
833 if (err) {
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);
836 return err;
837 }
838 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
839 @@ -2566,7 +2592,7 @@ brcmf_cfg80211_get_station(struct wiphy
840 &sta_info_le,
841 sizeof(sta_info_le));
842 if (err < 0) {
843 - brcmf_err("GET STA INFO failed, %d\n", err);
844 + bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
845 goto done;
846 }
847 }
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));
851 if (err) {
852 - brcmf_err("Could not get rssi (%d)\n", err);
853 + bphy_err(wiphy, "Could not get rssi (%d)\n",
854 + err);
855 goto done;
856 } else {
857 rssi = le32_to_cpu(scb_val.val);
858 @@ -2666,8 +2693,8 @@ brcmf_cfg80211_dump_station(struct wiphy
859 &cfg->assoclist,
860 sizeof(cfg->assoclist));
861 if (err) {
862 - brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
863 - err);
864 + bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
865 + err);
866 cfg->assoclist.count = 0;
867 return -EOPNOTSUPP;
868 }
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);
871 if (err) {
872 if (err == -ENODEV)
873 - brcmf_err("net_device is not ready yet\n");
874 + bphy_err(wiphy, "net_device is not ready yet\n");
875 else
876 - brcmf_err("error (%d)\n", err);
877 + bphy_err(wiphy, "error (%d)\n", err);
878 }
879 done:
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 = {};
883
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");
887 return 0;
888 }
889
890 @@ -2799,6 +2826,7 @@ next_bss_le(struct brcmf_scan_results *l
891
892 static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
893 {
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 */
897 s32 err = 0;
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);
906 return -EOPNOTSUPP;
907 }
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);
912 if (err) {
913 - brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err);
914 + bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
915 goto CleanUp;
916 }
917
918 @@ -2906,6 +2934,7 @@ CleanUp:
919 static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
920 struct brcmf_if *ifp)
921 {
922 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
923 struct brcmf_bss_info_le *bi;
924 const struct brcmf_tlv *tim;
925 u16 beacon_interval;
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);
929 if (err) {
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;
933 }
934
935 @@ -2947,7 +2976,7 @@ static s32 brcmf_update_bss_info(struct
936 u32 var;
937 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
938 if (err) {
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;
942 }
943 dtim_period = (u8)var;
944 @@ -2985,9 +3014,10 @@ static void brcmf_escan_timeout(struct t
945 {
946 struct brcmf_cfg80211_info *cfg =
947 from_timer(cfg, t, escan_timeout);
948 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
949
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);
954 }
955 }
956 @@ -3036,6 +3066,7 @@ brcmf_cfg80211_escan_handler(struct brcm
957 const struct brcmf_event_msg *e, void *data)
958 {
959 struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
960 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
961 s32 status;
962 struct brcmf_escan_result_le *escan_result_le;
963 u32 escan_buflen;
964 @@ -3052,32 +3083,33 @@ brcmf_cfg80211_escan_handler(struct brcm
965 goto exit;
966
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",
970 + ifp->bsscfgidx);
971 return -EPERM;
972 }
973
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");
979 goto exit;
980 }
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");
985 goto exit;
986 }
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",
992 - escan_buflen);
993 + bphy_err(wiphy, "Invalid escan buffer length: %d\n",
994 + escan_buflen);
995 goto exit;
996 }
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);
1002 goto exit;
1003 }
1004 bss_info_le = &escan_result_le->bss_info_le;
1005 @@ -3092,8 +3124,8 @@ brcmf_cfg80211_escan_handler(struct brcm
1006
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",
1010 - bi_length);
1011 + bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
1012 + bi_length);
1013 goto exit;
1014 }
1015
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");
1022 goto exit;
1023 }
1024 }
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");
1031 goto exit;
1032 }
1033
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");
1040 goto out_err;
1041 }
1042
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");
1048 goto out_err;
1049 }
1050
1051 @@ -3362,8 +3394,8 @@ brcmf_cfg80211_sched_scan_start(struct w
1052 req->n_match_sets, req->n_ssids);
1053
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);
1059 return -EAGAIN;
1060 }
1061
1062 @@ -3442,6 +3474,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1063 void *data)
1064 {
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;
1069
1070 @@ -3460,8 +3493,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1071 }
1072
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));
1078 return -EINVAL;
1079 }
1080
1081 @@ -3500,7 +3533,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));
1084 if (err) {
1085 - brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
1086 + bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
1087 return;
1088 }
1089
1090 @@ -3541,7 +3574,7 @@ static void brcmf_report_wowl_wakeind(st
1091 cfg->wowl.nd_data_completed,
1092 BRCMF_ND_INFO_TIMEOUT);
1093 if (!timeout)
1094 - brcmf_err("No result for wowl net detect\n");
1095 + bphy_err(wiphy, "No result for wowl net detect\n");
1096 else
1097 wakeup_data.net_detect = cfg->wowl.nd_info;
1098 }
1099 @@ -3749,7 +3782,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
1100 cfg->pmk_list.npmk = cpu_to_le32(npmk);
1101 }
1102 } else {
1103 - brcmf_err("Too many PMKSA entries cached %d\n", npmk);
1104 + bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
1105 return -EINVAL;
1106 }
1107
1108 @@ -3795,7 +3828,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);
1111 } else {
1112 - brcmf_err("Cache entry not found\n");
1113 + bphy_err(wiphy, "Cache entry not found\n");
1114 return -EINVAL;
1115 }
1116
1117 @@ -3827,19 +3860,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
1118
1119 static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
1120 {
1121 + struct wiphy *wiphy = ifp->drvr->wiphy;
1122 s32 err;
1123 s32 wpa_val;
1124
1125 /* set auth */
1126 err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
1127 if (err < 0) {
1128 - brcmf_err("auth error %d\n", err);
1129 + bphy_err(wiphy, "auth error %d\n", err);
1130 return err;
1131 }
1132 /* set wsec */
1133 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
1134 if (err < 0) {
1135 - brcmf_err("wsec error %d\n", err);
1136 + bphy_err(wiphy, "wsec error %d\n", err);
1137 return err;
1138 }
1139 /* set upper-layer auth */
1140 @@ -3849,7 +3883,7 @@ static s32 brcmf_configure_opensecurity(
1141 wpa_val = WPA_AUTH_DISABLED;
1142 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val);
1143 if (err < 0) {
1144 - brcmf_err("wpa_auth error %d\n", err);
1145 + bphy_err(wiphy, "wpa_auth error %d\n", err);
1146 return err;
1147 }
1148
1149 @@ -3869,6 +3903,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1150 const struct brcmf_vs_tlv *wpa_ie,
1151 bool is_rsn_ie)
1152 {
1153 + struct wiphy *wiphy = ifp->drvr->wiphy;
1154 u32 auth = 0; /* d11 open authentication */
1155 u16 count;
1156 s32 err = 0;
1157 @@ -3899,13 +3934,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1158 /* check for multicast cipher suite */
1159 if (offset + WPA_IE_MIN_OUI_LEN > len) {
1160 err = -EINVAL;
1161 - brcmf_err("no multicast cipher suite\n");
1162 + bphy_err(wiphy, "no multicast cipher suite\n");
1163 goto exit;
1164 }
1165
1166 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1167 err = -EINVAL;
1168 - brcmf_err("ivalid OUI\n");
1169 + bphy_err(wiphy, "ivalid OUI\n");
1170 goto exit;
1171 }
1172 offset += TLV_OUI_LEN;
1173 @@ -3927,7 +3962,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1174 break;
1175 default:
1176 err = -EINVAL;
1177 - brcmf_err("Invalid multi cast cipher info\n");
1178 + bphy_err(wiphy, "Invalid multi cast cipher info\n");
1179 goto exit;
1180 }
1181
1182 @@ -3938,13 +3973,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1183 /* Check for unicast suite(s) */
1184 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
1185 err = -EINVAL;
1186 - brcmf_err("no unicast cipher suite\n");
1187 + bphy_err(wiphy, "no unicast cipher suite\n");
1188 goto exit;
1189 }
1190 for (i = 0; i < count; i++) {
1191 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1192 err = -EINVAL;
1193 - brcmf_err("ivalid OUI\n");
1194 + bphy_err(wiphy, "ivalid OUI\n");
1195 goto exit;
1196 }
1197 offset += TLV_OUI_LEN;
1198 @@ -3962,7 +3997,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1199 pval |= AES_ENABLED;
1200 break;
1201 default:
1202 - brcmf_err("Invalid unicast security info\n");
1203 + bphy_err(wiphy, "Invalid unicast security info\n");
1204 }
1205 offset++;
1206 }
1207 @@ -3972,13 +4007,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) {
1210 err = -EINVAL;
1211 - brcmf_err("no auth key mgmt suite\n");
1212 + bphy_err(wiphy, "no auth key mgmt suite\n");
1213 goto exit;
1214 }
1215 for (i = 0; i < count; i++) {
1216 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1217 err = -EINVAL;
1218 - brcmf_err("ivalid OUI\n");
1219 + bphy_err(wiphy, "ivalid OUI\n");
1220 goto exit;
1221 }
1222 offset += TLV_OUI_LEN;
1223 @@ -4006,7 +4041,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1224 wpa_auth |= WPA2_AUTH_1X_SHA256;
1225 break;
1226 default:
1227 - brcmf_err("Invalid key mgmt info\n");
1228 + bphy_err(wiphy, "Invalid key mgmt info\n");
1229 }
1230 offset++;
1231 }
1232 @@ -4048,7 +4083,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1233 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
1234 wme_bss_disable);
1235 if (err < 0) {
1236 - brcmf_err("wme_bss_disable error %d\n", err);
1237 + bphy_err(wiphy, "wme_bss_disable error %d\n", err);
1238 goto exit;
1239 }
1240
1241 @@ -4062,7 +4097,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1242 &data[offset],
1243 WPA_IE_MIN_OUI_LEN);
1244 if (err < 0) {
1245 - brcmf_err("bip error %d\n", err);
1246 + bphy_err(wiphy, "bip error %d\n", err);
1247 goto exit;
1248 }
1249 }
1250 @@ -4073,13 +4108,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1251 /* set auth */
1252 err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
1253 if (err < 0) {
1254 - brcmf_err("auth error %d\n", err);
1255 + bphy_err(wiphy, "auth error %d\n", err);
1256 goto exit;
1257 }
1258 /* set wsec */
1259 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
1260 if (err < 0) {
1261 - brcmf_err("wsec error %d\n", err);
1262 + bphy_err(wiphy, "wsec error %d\n", err);
1263 goto exit;
1264 }
1265 /* Configure MFP, this needs to go after wsec otherwise the wsec command
1266 @@ -4088,14 +4123,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);
1269 if (err < 0) {
1270 - brcmf_err("mfp error %d\n", err);
1271 + bphy_err(wiphy, "mfp error %d\n", err);
1272 goto exit;
1273 }
1274 }
1275 /* set upper-layer auth */
1276 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
1277 if (err < 0) {
1278 - brcmf_err("wpa_auth error %d\n", err);
1279 + bphy_err(wiphy, "wpa_auth error %d\n", err);
1280 goto exit;
1281 }
1282
1283 @@ -4182,6 +4217,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1284 const u8 *vndr_ie_buf, u32 vndr_ie_len)
1285 {
1286 struct brcmf_if *ifp;
1287 + struct wiphy *wiphy;
1288 struct vif_saved_ie *saved_ie;
1289 s32 err = 0;
1290 u8 *iovar_ie_buf;
1291 @@ -4202,6 +4238,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1292 if (!vif)
1293 return -ENODEV;
1294 ifp = vif->ifp;
1295 + wiphy = ifp->drvr->wiphy;
1296 saved_ie = &vif->saved_ie;
1297
1298 brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
1299 @@ -4233,13 +4270,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1300 break;
1301 default:
1302 err = -EPERM;
1303 - brcmf_err("not suitable type\n");
1304 + bphy_err(wiphy, "not suitable type\n");
1305 goto exit;
1306 }
1307
1308 if (vndr_ie_len > mgmt_ie_buf_len) {
1309 err = -ENOMEM;
1310 - brcmf_err("extra IE size too big\n");
1311 + bphy_err(wiphy, "extra IE size too big\n");
1312 goto exit;
1313 }
1314
1315 @@ -4300,8 +4337,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);
1323 break;
1324 }
1325 remained_buf_len -= (vndrie_info->ie_len +
1326 @@ -4332,7 +4369,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1327 err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
1328 total_ie_buf_len);
1329 if (err)
1330 - brcmf_err("vndr ie set error : %d\n", err);
1331 + bphy_err(wiphy, "vndr ie set error : %d\n", err);
1332 }
1333
1334 exit:
1335 @@ -4360,13 +4397,14 @@ static s32
1336 brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
1337 struct cfg80211_beacon_data *beacon)
1338 {
1339 + struct wiphy *wiphy = vif->ifp->drvr->wiphy;
1340 s32 err;
1341
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);
1345 if (err) {
1346 - brcmf_err("Set Beacon IE Failed\n");
1347 + bphy_err(wiphy, "Set Beacon IE Failed\n");
1348 return err;
1349 }
1350 brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
1351 @@ -4376,7 +4414,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
1352 beacon->proberesp_ies,
1353 beacon->proberesp_ies_len);
1354 if (err)
1355 - brcmf_err("Set Probe Resp IE Failed\n");
1356 + bphy_err(wiphy, "Set Probe Resp IE Failed\n");
1357 else
1358 brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
1359
1360 @@ -4485,7 +4523,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1361 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
1362 is_11d);
1363 if (err < 0) {
1364 - brcmf_err("Regulatory Set Error, %d\n", err);
1365 + bphy_err(wiphy, "Regulatory Set Error, %d\n",
1366 + err);
1367 goto exit;
1368 }
1369 }
1370 @@ -4493,8 +4532,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1371 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
1372 settings->beacon_interval);
1373 if (err < 0) {
1374 - brcmf_err("Beacon Interval Set Error, %d\n",
1375 - err);
1376 + bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
1377 + err);
1378 goto exit;
1379 }
1380 }
1381 @@ -4502,7 +4541,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1382 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
1383 settings->dtim_period);
1384 if (err < 0) {
1385 - brcmf_err("DTIM Interval Set Error, %d\n", err);
1386 + bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
1387 + err);
1388 goto exit;
1389 }
1390 }
1391 @@ -4512,7 +4552,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);
1394 if (err < 0) {
1395 - brcmf_err("BRCMF_C_DOWN error %d\n", err);
1396 + bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
1397 + err);
1398 goto exit;
1399 }
1400 brcmf_fil_iovar_int_set(ifp, "apsta", 0);
1401 @@ -4520,7 +4561,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1402
1403 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
1404 if (err < 0) {
1405 - brcmf_err("SET INFRA error %d\n", err);
1406 + bphy_err(wiphy, "SET INFRA error %d\n", err);
1407 goto exit;
1408 }
1409 } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
1410 @@ -4536,7 +4577,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1411
1412 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
1413 if (err < 0) {
1414 - brcmf_err("setting AP mode failed %d\n", err);
1415 + bphy_err(wiphy, "setting AP mode failed %d\n",
1416 + err);
1417 goto exit;
1418 }
1419 if (!mbss) {
1420 @@ -4545,14 +4587,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1421 */
1422 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
1423 if (err < 0) {
1424 - brcmf_err("Set Channel failed: chspec=%d, %d\n",
1425 - chanspec, err);
1426 + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1427 + chanspec, err);
1428 goto exit;
1429 }
1430 }
1431 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
1432 if (err < 0) {
1433 - brcmf_err("BRCMF_C_UP error (%d)\n", err);
1434 + bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
1435 goto exit;
1436 }
1437 /* On DOWN the firmware removes the WEP keys, reconfigure
1438 @@ -4567,14 +4609,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));
1441 if (err < 0) {
1442 - brcmf_err("SET SSID error (%d)\n", err);
1443 + bphy_err(wiphy, "SET SSID error (%d)\n", err);
1444 goto exit;
1445 }
1446
1447 if (settings->hidden_ssid) {
1448 err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
1449 if (err) {
1450 - brcmf_err("closednet error (%d)\n", err);
1451 + bphy_err(wiphy, "closednet error (%d)\n", err);
1452 goto exit;
1453 }
1454 }
1455 @@ -4583,14 +4625,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);
1458 if (err < 0) {
1459 - brcmf_err("Set Channel failed: chspec=%d, %d\n",
1460 - chanspec, err);
1461 + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1462 + chanspec, err);
1463 goto exit;
1464 }
1465 err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
1466 sizeof(ssid_le));
1467 if (err < 0) {
1468 - brcmf_err("setting ssid failed %d\n", err);
1469 + bphy_err(wiphy, "setting ssid failed %d\n", err);
1470 goto exit;
1471 }
1472 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
1473 @@ -4598,7 +4640,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1474 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1475 sizeof(bss_enable));
1476 if (err < 0) {
1477 - brcmf_err("bss_enable config failed %d\n", err);
1478 + bphy_err(wiphy, "bss_enable config failed %d\n", err);
1479 goto exit;
1480 }
1481
1482 @@ -4646,13 +4688,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));
1485 if (err < 0)
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);
1489 if (err < 0)
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);
1493 if (err < 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 @@ -4660,7 +4702,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);
1502 if (err < 0)
1503 - brcmf_err("BRCMF_C_UP error %d\n", err);
1504 + bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
1505
1506 brcmf_vif_clear_mgmt_ies(ifp->vif);
1507 } else {
1508 @@ -4669,7 +4711,7 @@ static int brcmf_cfg80211_stop_ap(struct
1509 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1510 sizeof(bss_enable));
1511 if (err < 0)
1512 - brcmf_err("bss_enable config failed %d\n", err);
1513 + bphy_err(wiphy, "bss_enable config failed %d\n", err);
1514 }
1515 brcmf_set_mpc(ifp, 1);
1516 brcmf_configure_arp_nd_offload(ifp, true);
1517 @@ -4717,7 +4759,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));
1520 if (err)
1521 - brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err);
1522 + bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
1523 + err);
1524
1525 brcmf_dbg(TRACE, "Exit\n");
1526 return err;
1527 @@ -4747,7 +4790,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);
1530 if (err < 0)
1531 - brcmf_err("Setting SCB (de-)authorize failed, %d\n", err);
1532 + bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
1533
1534 return err;
1535 }
1536 @@ -4797,7 +4840,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1537 mgmt = (const struct ieee80211_mgmt *)buf;
1538
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");
1542 return -EPERM;
1543 }
1544
1545 @@ -4828,13 +4871,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1546 GFP_KERNEL);
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");
1551 err = -EINVAL;
1552 goto exit;
1553 }
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");
1558 err = -ENOMEM;
1559 goto exit;
1560 }
1561 @@ -4892,7 +4935,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
1562
1563 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
1564 if (vif == NULL) {
1565 - brcmf_err("No p2p device available for probe response\n");
1566 + bphy_err(wiphy, "No p2p device available for probe response\n");
1567 err = -ENODEV;
1568 goto exit;
1569 }
1570 @@ -4920,7 +4963,7 @@ static int brcmf_cfg80211_get_channel(st
1571
1572 err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
1573 if (err) {
1574 - brcmf_err("chanspec failed (%d)\n", err);
1575 + bphy_err(wiphy, "chanspec failed (%d)\n", err);
1576 return err;
1577 }
1578
1579 @@ -5059,7 +5102,7 @@ static int brcmf_cfg80211_tdls_oper(stru
1580 ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
1581 &info, sizeof(info));
1582 if (ret < 0)
1583 - brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret);
1584 + bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
1585
1586 return ret;
1587 }
1588 @@ -5080,7 +5123,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);
1591 if (err)
1592 - brcmf_err("Set Assoc REQ IE Failed\n");
1593 + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
1594 else
1595 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
1596
1597 @@ -5106,7 +5149,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
1598 ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
1599 sizeof(gtk_le));
1600 if (ret < 0)
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);
1603
1604 return ret;
1605 }
1606 @@ -5338,6 +5381,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)
1609 {
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);
1613 u32 req_len;
1614 @@ -5349,7 +5393,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);
1617 if (err) {
1618 - brcmf_err("could not get assoc info (%d)\n", err);
1619 + bphy_err(wiphy, "could not get assoc info (%d)\n", err);
1620 return err;
1621 }
1622 assoc_info =
1623 @@ -5361,7 +5405,7 @@ static s32 brcmf_get_assoc_ies(struct br
1624 cfg->extra_buf,
1625 WL_ASSOC_INFO_MAX);
1626 if (err) {
1627 - brcmf_err("could not get assoc req (%d)\n", err);
1628 + bphy_err(wiphy, "could not get assoc req (%d)\n", err);
1629 return err;
1630 }
1631 conn_info->req_ie_len = req_len;
1632 @@ -5379,7 +5423,7 @@ static s32 brcmf_get_assoc_ies(struct br
1633 cfg->extra_buf,
1634 WL_ASSOC_INFO_MAX);
1635 if (err) {
1636 - brcmf_err("could not get assoc resp (%d)\n", err);
1637 + bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
1638 return err;
1639 }
1640 conn_info->resp_ie_len = resp_len;
1641 @@ -5508,6 +5552,7 @@ brcmf_notify_connect_status_ap(struct br
1642 struct net_device *ndev,
1643 const struct brcmf_event_msg *e, void *data)
1644 {
1645 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1646 static int generation;
1647 u32 event = e->event_code;
1648 u32 reason = e->reason;
1649 @@ -5525,7 +5570,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)) {
1652 if (!data) {
1653 - brcmf_err("No IEs present in ASSOC/REASSOC_IND");
1654 + bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
1655 return -EINVAL;
1656 }
1657
1658 @@ -5817,6 +5862,7 @@ static void init_vif_event(struct brcmf_
1659
1660 static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
1661 {
1662 + struct wiphy *wiphy = ifp->drvr->wiphy;
1663 s32 err;
1664 u32 bcn_timeout;
1665 __le32 roamtrigger[2];
1666 @@ -5829,7 +5875,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);
1669 if (err) {
1670 - brcmf_err("bcn_timeout error (%d)\n", err);
1671 + bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
1672 goto roam_setup_done;
1673 }
1674
1675 @@ -5841,7 +5887,7 @@ static s32 brcmf_dongle_roam(struct brcm
1676 err = brcmf_fil_iovar_int_set(ifp, "roam_off",
1677 ifp->drvr->settings->roamoff);
1678 if (err) {
1679 - brcmf_err("roam_off error (%d)\n", err);
1680 + bphy_err(wiphy, "roam_off error (%d)\n", err);
1681 goto roam_setup_done;
1682 }
1683
1684 @@ -5850,7 +5896,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));
1687 if (err) {
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;
1691 }
1692
1693 @@ -5859,7 +5905,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));
1696 if (err) {
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;
1700 }
1701
1702 @@ -5870,25 +5916,26 @@ roam_setup_done:
1703 static s32
1704 brcmf_dongle_scantime(struct brcmf_if *ifp)
1705 {
1706 + struct wiphy *wiphy = ifp->drvr->wiphy;
1707 s32 err = 0;
1708
1709 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
1710 BRCMF_SCAN_CHANNEL_TIME);
1711 if (err) {
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;
1715 }
1716 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
1717 BRCMF_SCAN_UNASSOC_TIME);
1718 if (err) {
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;
1722 }
1723
1724 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
1725 BRCMF_SCAN_PASSIVE_TIME);
1726 if (err) {
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;
1730 }
1731
1732 @@ -5920,10 +5967,10 @@ static void brcmf_update_bw40_channel_fl
1733 static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
1734 u32 bw_cap[])
1735 {
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;
1743 int err;
1744 @@ -5942,11 +5989,10 @@ static int brcmf_construct_chaninfo(stru
1745 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
1746 BRCMF_DCMD_MEDLEN);
1747 if (err) {
1748 - brcmf_err("get chanspecs error (%d)\n", err);
1749 + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
1750 goto fail_pbuf;
1751 }
1752
1753 - wiphy = cfg_to_wiphy(cfg);
1754 band = wiphy->bands[NL80211_BAND_2GHZ];
1755 if (band)
1756 for (i = 0; i < band->n_channels; i++)
1757 @@ -5966,7 +6012,8 @@ static int brcmf_construct_chaninfo(stru
1758 } else if (ch.band == BRCMU_CHAN_BAND_5G) {
1759 band = wiphy->bands[NL80211_BAND_5GHZ];
1760 } else {
1761 - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
1762 + bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
1763 + ch.chspec);
1764 continue;
1765 }
1766 if (!band)
1767 @@ -5989,8 +6036,8 @@ static int brcmf_construct_chaninfo(stru
1768 /* It seems firmware supports some channel we never
1769 * considered. Something new in IEEE standard?
1770 */
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);
1775 continue;
1776 }
1777
1778 @@ -6036,6 +6083,7 @@ fail_pbuf:
1779
1780 static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
1781 {
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 @@ -6082,7 +6130,7 @@ static int brcmf_enable_bw40_2g(struct b
1787 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
1788 BRCMF_DCMD_MEDLEN);
1789 if (err) {
1790 - brcmf_err("get chanspecs error (%d)\n", err);
1791 + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
1792 kfree(pbuf);
1793 return err;
1794 }
1795 @@ -6113,6 +6161,7 @@ static int brcmf_enable_bw40_2g(struct b
1796
1797 static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
1798 {
1799 + struct wiphy *wiphy = ifp->drvr->wiphy;
1800 u32 band, mimo_bwcap;
1801 int err;
1802
1803 @@ -6148,7 +6197,7 @@ static void brcmf_get_bwcap(struct brcmf
1804 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
1805 break;
1806 default:
1807 - brcmf_err("invalid mimo_bw_cap value\n");
1808 + bphy_err(wiphy, "invalid mimo_bw_cap value\n");
1809 }
1810 }
1811
1812 @@ -6224,7 +6273,7 @@ static void brcmf_update_vht_cap(struct
1813 static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
1814 {
1815 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
1816 - struct wiphy *wiphy;
1817 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1818 u32 nmode = 0;
1819 u32 vhtmode = 0;
1820 u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
1821 @@ -6240,7 +6289,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);
1824 if (err) {
1825 - brcmf_err("nmode error (%d)\n", err);
1826 + bphy_err(wiphy, "nmode error (%d)\n", err);
1827 } else {
1828 brcmf_get_bwcap(ifp, bw_cap);
1829 }
1830 @@ -6250,7 +6299,7 @@ static int brcmf_setup_wiphybands(struct
1831
1832 err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
1833 if (err) {
1834 - brcmf_err("rxchain error (%d)\n", err);
1835 + bphy_err(wiphy, "rxchain error (%d)\n", err);
1836 nchain = 1;
1837 } else {
1838 for (nchain = 0; rxchain; nchain++)
1839 @@ -6260,7 +6309,7 @@ static int brcmf_setup_wiphybands(struct
1840
1841 err = brcmf_construct_chaninfo(cfg, bw_cap);
1842 if (err) {
1843 - brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err);
1844 + bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
1845 return err;
1846 }
1847
1848 @@ -6272,7 +6321,6 @@ static int brcmf_setup_wiphybands(struct
1849 &txbf_bfr_cap);
1850 }
1851
1852 - wiphy = cfg_to_wiphy(cfg);
1853 for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
1854 band = wiphy->bands[i];
1855 if (band == NULL)
1856 @@ -6473,7 +6521,7 @@ static void brcmf_wiphy_wowl_params(stru
1857 wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
1858 GFP_KERNEL);
1859 if (!wowl) {
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;
1863 return;
1864 }
1865 @@ -6570,7 +6618,7 @@ static int brcmf_setup_wiphy(struct wiph
1866 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
1867 sizeof(bandlist));
1868 if (err) {
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);
1871 return err;
1872 }
1873 /* first entry in bandlist is number of bands */
1874 @@ -6619,6 +6667,7 @@ static int brcmf_setup_wiphy(struct wiph
1875
1876 static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
1877 {
1878 + struct wiphy *wiphy = cfg_to_wiphy(cfg);
1879 struct net_device *ndev;
1880 struct wireless_dev *wdev;
1881 struct brcmf_if *ifp;
1882 @@ -6656,7 +6705,7 @@ static s32 brcmf_config_dongle(struct br
1883
1884 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
1885 if (err) {
1886 - brcmf_err("failed to set frameburst mode\n");
1887 + bphy_err(wiphy, "failed to set frameburst mode\n");
1888 goto default_conf_out;
1889 }
1890
1891 @@ -6848,8 +6897,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]);
1899 return;
1900 }
1901
1902 @@ -6858,7 +6907,7 @@ static void brcmf_cfg80211_reg_notifier(
1903
1904 err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
1905 if (err) {
1906 - brcmf_err("Country code iovar returned err = %d\n", err);
1907 + bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
1908 return;
1909 }
1910
1911 @@ -6868,7 +6917,7 @@ static void brcmf_cfg80211_reg_notifier(
1912
1913 err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
1914 if (err) {
1915 - brcmf_err("Firmware rejected country setting\n");
1916 + bphy_err(wiphy, "Firmware rejected country setting\n");
1917 return;
1918 }
1919 brcmf_setup_wiphybands(cfg);
1920 @@ -6914,13 +6963,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1921 u16 *cap = NULL;
1922
1923 if (!ndev) {
1924 - brcmf_err("ndev is invalid\n");
1925 + bphy_err(wiphy, "ndev is invalid\n");
1926 return NULL;
1927 }
1928
1929 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
1930 if (!cfg) {
1931 - brcmf_err("Could not allocate wiphy device\n");
1932 + bphy_err(wiphy, "Could not allocate wiphy device\n");
1933 return NULL;
1934 }
1935
1936 @@ -6941,7 +6990,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1937
1938 err = wl_init_priv(cfg);
1939 if (err) {
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);
1943 goto wiphy_out;
1944 }
1945 @@ -6950,7 +6999,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);
1948 if (err) {
1949 - brcmf_err("Failed to get D11 version (%d)\n", err);
1950 + bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
1951 goto priv_out;
1952 }
1953 cfg->d11inf.io_type = (u8)io_type;
1954 @@ -6984,13 +7033,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1955 #endif
1956 err = wiphy_register(wiphy);
1957 if (err < 0) {
1958 - brcmf_err("Could not register wiphy device (%d)\n", err);
1959 + bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
1960 goto priv_out;
1961 }
1962
1963 err = brcmf_setup_wiphybands(cfg);
1964 if (err) {
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;
1968 }
1969
1970 @@ -7008,24 +7057,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802
1971
1972 err = brcmf_fweh_activate_events(ifp);
1973 if (err) {
1974 - brcmf_err("FWEH activation failed (%d)\n", err);
1975 + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
1976 goto wiphy_unreg_out;
1977 }
1978
1979 err = brcmf_p2p_attach(cfg, p2pdev_forced);
1980 if (err) {
1981 - brcmf_err("P2P initialisation failed (%d)\n", err);
1982 + bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
1983 goto wiphy_unreg_out;
1984 }
1985 err = brcmf_btcoex_attach(cfg);
1986 if (err) {
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;
1991 }
1992 err = brcmf_pno_attach(cfg);
1993 if (err) {
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 @@ -7045,7 +7094,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2000 /* (re-) activate FWEH event handling */
2001 err = brcmf_fweh_activate_events(ifp);
2002 if (err) {
2003 - brcmf_err("FWEH activation failed (%d)\n", err);
2004 + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
2005 goto detach;
2006 }
2007
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,
2011 } while (0)
2012 #endif
2013
2014 +#define bphy_err(wiphy, fmt, ...) \
2015 + do { \
2016 + if (IS_ENABLED(CPTCFG_BRCMDBG) || \
2017 + IS_ENABLED(CPTCFG_BRCM_TRACING) || \
2018 + net_ratelimit()) \
2019 + wiphy_err(wiphy, "%s: " fmt, __func__, \
2020 + ##__VA_ARGS__); \
2021 + } while (0)
2022 +
2023 #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
2024
2025 /* For debug/tracing purposes treat info messages as errors */