27931db84061cba235d0da7b066abf00f00fb89a
[oweals/openwrt.git] /
1 From 16e646768396339b3d354985b99bcd3f1f195a7d Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Fri, 15 Feb 2019 15:45:54 +0100
4 Subject: [PATCH] brcmfmac: rework bphy_err() to take struct brcmf_pub argument
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This macro will be used in more places not just the cfg80211.c. It makes
10 sense to pass some common struct to it as "struct wiphy" is mostly
11 referenced in cfg80211 code only.
12
13 A very common one (used above the bus abstraction layer) is struct
14 brcmf_pub. Many functions already keep reference to it which will make
15 using bphy_err() simpler. It should also allow extending that macro's
16 logic if it's ever needed.
17
18 This improves code recently added in the commit 3ef005b82e2a ("brcmfmac:
19 add bphy_err() and use it in the cfg80211.c").
20
21 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
22 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
23 ---
24  .../broadcom/brcm80211/brcmfmac/cfg80211.c    | 510 ++++++++++--------
25  .../broadcom/brcm80211/brcmfmac/debug.h       |   4 +-
26  2 files changed, 281 insertions(+), 233 deletions(-)
27
28 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
29 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
30 @@ -457,7 +457,7 @@ static void convert_key_from_CPU(struct
31  static int
32  send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
33  {
34 -       struct wiphy *wiphy = ifp->drvr->wiphy;
35 +       struct brcmf_pub *drvr = ifp->drvr;
36         int err;
37         struct brcmf_wsec_key_le key_le;
38  
39 @@ -469,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
40                                         sizeof(key_le));
41  
42         if (err)
43 -               bphy_err(wiphy, "wsec_key error (%d)\n", err);
44 +               bphy_err(drvr, "wsec_key error (%d)\n", err);
45         return err;
46  }
47  
48 @@ -509,7 +509,7 @@ static int brcmf_get_first_free_bsscfgid
49  
50  static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
51  {
52 -       struct wiphy *wiphy = ifp->drvr->wiphy;
53 +       struct brcmf_pub *drvr = ifp->drvr;
54         struct brcmf_mbss_ssid_le mbss_ssid_le;
55         int bsscfgidx;
56         int err;
57 @@ -526,7 +526,7 @@ static int brcmf_cfg80211_request_ap_if(
58         err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
59                                         sizeof(mbss_ssid_le));
60         if (err < 0)
61 -               bphy_err(wiphy, "setting ssid failed %d\n", err);
62 +               bphy_err(drvr, "setting ssid failed %d\n", err);
63  
64         return err;
65  }
66 @@ -544,6 +544,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
67  {
68         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
69         struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
70 +       struct brcmf_pub *drvr = cfg->pub;
71         struct brcmf_cfg80211_vif *vif;
72         int err;
73  
74 @@ -569,7 +570,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
75                                             BRCMF_VIF_EVENT_TIMEOUT);
76         brcmf_cfg80211_arm_vif_event(cfg, NULL);
77         if (!err) {
78 -               bphy_err(wiphy, "timeout occurred\n");
79 +               bphy_err(drvr, "timeout occurred\n");
80                 err = -EIO;
81                 goto fail;
82         }
83 @@ -577,7 +578,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
84         /* interface created in firmware */
85         ifp = vif->ifp;
86         if (!ifp) {
87 -               bphy_err(wiphy, "no if pointer provided\n");
88 +               bphy_err(drvr, "no if pointer provided\n");
89                 err = -ENOENT;
90                 goto fail;
91         }
92 @@ -585,7 +586,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
93         strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1);
94         err = brcmf_net_attach(ifp, true);
95         if (err) {
96 -               bphy_err(wiphy, "Registering netdevice failed\n");
97 +               bphy_err(drvr, "Registering netdevice failed\n");
98                 free_netdev(ifp->ndev);
99                 goto fail;
100         }
101 @@ -616,13 +617,15 @@ static struct wireless_dev *brcmf_cfg802
102                                                      enum nl80211_iftype type,
103                                                      struct vif_params *params)
104  {
105 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
106 +       struct brcmf_pub *drvr = cfg->pub;
107         struct wireless_dev *wdev;
108         int err;
109  
110         brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
111         err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
112         if (err) {
113 -               bphy_err(wiphy, "iface validation failed: err=%d\n", err);
114 +               bphy_err(drvr, "iface validation failed: err=%d\n", err);
115                 return ERR_PTR(err);
116         }
117         switch (type) {
118 @@ -647,7 +650,7 @@ static struct wireless_dev *brcmf_cfg802
119         }
120  
121         if (IS_ERR(wdev))
122 -               bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name,
123 +               bphy_err(drvr, "add iface %s type %d failed: err=%d\n", name,
124                          type, (int)PTR_ERR(wdev));
125         else
126                 brcmf_cfg80211_update_proto_addr_mode(wdev);
127 @@ -663,13 +666,13 @@ static void brcmf_scan_config_mpc(struct
128  
129  void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
130  {
131 -       struct wiphy *wiphy = ifp->drvr->wiphy;
132 +       struct brcmf_pub *drvr = ifp->drvr;
133         s32 err = 0;
134  
135         if (check_vif_up(ifp->vif)) {
136                 err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
137                 if (err) {
138 -                       bphy_err(wiphy, "fail to set mpc\n");
139 +                       bphy_err(drvr, "fail to set mpc\n");
140                         return;
141                 }
142                 brcmf_dbg(INFO, "MPC : %d\n", mpc);
143 @@ -680,7 +683,7 @@ s32 brcmf_notify_escan_complete(struct b
144                                 struct brcmf_if *ifp, bool aborted,
145                                 bool fw_abort)
146  {
147 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
148 +       struct brcmf_pub *drvr = cfg->pub;
149         struct brcmf_scan_params_le params_le;
150         struct cfg80211_scan_request *scan_request;
151         u64 reqid;
152 @@ -715,7 +718,7 @@ s32 brcmf_notify_escan_complete(struct b
153                 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
154                                              &params_le, sizeof(params_le));
155                 if (err)
156 -                       bphy_err(wiphy, "Scan abort failed\n");
157 +                       bphy_err(drvr, "Scan abort failed\n");
158         }
159  
160         brcmf_scan_config_mpc(ifp, 1);
161 @@ -760,6 +763,7 @@ static int brcmf_cfg80211_del_ap_iface(s
162         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
163         struct net_device *ndev = wdev->netdev;
164         struct brcmf_if *ifp = netdev_priv(ndev);
165 +       struct brcmf_pub *drvr = cfg->pub;
166         int ret;
167         int err;
168  
169 @@ -767,7 +771,7 @@ static int brcmf_cfg80211_del_ap_iface(s
170  
171         err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
172         if (err) {
173 -               bphy_err(wiphy, "interface_remove failed %d\n", err);
174 +               bphy_err(drvr, "interface_remove failed %d\n", err);
175                 goto err_unarm;
176         }
177  
178 @@ -775,7 +779,7 @@ static int brcmf_cfg80211_del_ap_iface(s
179         ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
180                                             BRCMF_VIF_EVENT_TIMEOUT);
181         if (!ret) {
182 -               bphy_err(wiphy, "timeout occurred\n");
183 +               bphy_err(drvr, "timeout occurred\n");
184                 err = -EIO;
185                 goto err_unarm;
186         }
187 @@ -838,6 +842,7 @@ brcmf_cfg80211_change_iface(struct wiphy
188         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
189         struct brcmf_if *ifp = netdev_priv(ndev);
190         struct brcmf_cfg80211_vif *vif = ifp->vif;
191 +       struct brcmf_pub *drvr = cfg->pub;
192         s32 infra = 0;
193         s32 ap = 0;
194         s32 err = 0;
195 @@ -877,13 +882,13 @@ brcmf_cfg80211_change_iface(struct wiphy
196         }
197         err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
198         if (err) {
199 -               bphy_err(wiphy, "iface validation failed: err=%d\n", err);
200 +               bphy_err(drvr, "iface validation failed: err=%d\n", err);
201                 return err;
202         }
203         switch (type) {
204         case NL80211_IFTYPE_MONITOR:
205         case NL80211_IFTYPE_WDS:
206 -               bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
207 +               bphy_err(drvr, "type (%d) : currently we do not support this type\n",
208                          type);
209                 return -EOPNOTSUPP;
210         case NL80211_IFTYPE_ADHOC:
211 @@ -912,7 +917,7 @@ brcmf_cfg80211_change_iface(struct wiphy
212         } else {
213                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
214                 if (err) {
215 -                       bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
216 +                       bphy_err(drvr, "WLC_SET_INFRA error (%d)\n", err);
217                         err = -EAGAIN;
218                         goto done;
219                 }
220 @@ -1003,7 +1008,7 @@ static s32
221  brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
222                 struct cfg80211_scan_request *request)
223  {
224 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
225 +       struct brcmf_pub *drvr = cfg->pub;
226         s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
227                           offsetof(struct brcmf_escan_params_le, params_le);
228         struct brcmf_escan_params_le *params;
229 @@ -1035,7 +1040,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
230                 if (err == -EBUSY)
231                         brcmf_dbg(INFO, "system busy : escan canceled\n");
232                 else
233 -                       bphy_err(wiphy, "error (%d)\n", err);
234 +                       bphy_err(drvr, "error (%d)\n", err);
235         }
236  
237         kfree(params);
238 @@ -1072,6 +1077,7 @@ static s32
239  brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
240  {
241         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
242 +       struct brcmf_pub *drvr = cfg->pub;
243         struct brcmf_cfg80211_vif *vif;
244         s32 err = 0;
245  
246 @@ -1081,22 +1087,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
247                 return -EIO;
248  
249         if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
250 -               bphy_err(wiphy, "Scanning already: status (%lu)\n",
251 +               bphy_err(drvr, "Scanning already: status (%lu)\n",
252                          cfg->scan_status);
253                 return -EAGAIN;
254         }
255         if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
256 -               bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
257 +               bphy_err(drvr, "Scanning being aborted: status (%lu)\n",
258                          cfg->scan_status);
259                 return -EAGAIN;
260         }
261         if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
262 -               bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
263 +               bphy_err(drvr, "Scanning suppressed: status (%lu)\n",
264                          cfg->scan_status);
265                 return -EAGAIN;
266         }
267         if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
268 -               bphy_err(wiphy, "Connecting: status (%lu)\n", vif->sme_state);
269 +               bphy_err(drvr, "Connecting: status (%lu)\n", vif->sme_state);
270                 return -EAGAIN;
271         }
272  
273 @@ -1130,7 +1136,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
274         return 0;
275  
276  scan_out:
277 -       bphy_err(wiphy, "scan error (%d)\n", err);
278 +       bphy_err(drvr, "scan error (%d)\n", err);
279         clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
280         cfg->scan_request = NULL;
281         return err;
282 @@ -1139,12 +1145,12 @@ scan_out:
283  static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
284  {
285         struct brcmf_if *ifp = netdev_priv(ndev);
286 -       struct wiphy *wiphy = ifp->drvr->wiphy;
287 +       struct brcmf_pub *drvr = ifp->drvr;
288         s32 err = 0;
289  
290         err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
291         if (err)
292 -               bphy_err(wiphy, "Error (%d)\n", err);
293 +               bphy_err(drvr, "Error (%d)\n", err);
294  
295         return err;
296  }
297 @@ -1152,13 +1158,13 @@ static s32 brcmf_set_rts(struct net_devi
298  static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
299  {
300         struct brcmf_if *ifp = netdev_priv(ndev);
301 -       struct wiphy *wiphy = ifp->drvr->wiphy;
302 +       struct brcmf_pub *drvr = ifp->drvr;
303         s32 err = 0;
304  
305         err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
306                                       frag_threshold);
307         if (err)
308 -               bphy_err(wiphy, "Error (%d)\n", err);
309 +               bphy_err(drvr, "Error (%d)\n", err);
310  
311         return err;
312  }
313 @@ -1166,13 +1172,13 @@ static s32 brcmf_set_frag(struct net_dev
314  static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
315  {
316         struct brcmf_if *ifp = netdev_priv(ndev);
317 -       struct wiphy *wiphy = ifp->drvr->wiphy;
318 +       struct brcmf_pub *drvr = ifp->drvr;
319         s32 err = 0;
320         u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
321  
322         err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
323         if (err) {
324 -               bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
325 +               bphy_err(drvr, "cmd (%d) , error (%d)\n", cmd, err);
326                 return err;
327         }
328         return err;
329 @@ -1248,7 +1254,7 @@ static u16 brcmf_map_fw_linkdown_reason(
330  
331  static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
332  {
333 -       struct wiphy *wiphy = ifp->drvr->wiphy;
334 +       struct brcmf_pub *drvr = ifp->drvr;
335         struct brcmf_wsec_pmk_le pmk;
336         int i, err;
337  
338 @@ -1262,7 +1268,7 @@ static int brcmf_set_pmk(struct brcmf_if
339         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
340                                      &pmk, sizeof(pmk));
341         if (err < 0)
342 -               bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n",
343 +               bphy_err(drvr, "failed to change PSK in firmware (len=%u)\n",
344                          pmk_len);
345  
346         return err;
347 @@ -1271,7 +1277,7 @@ static int brcmf_set_pmk(struct brcmf_if
348  static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
349  {
350         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
351 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
352 +       struct brcmf_pub *drvr = cfg->pub;
353         s32 err = 0;
354  
355         brcmf_dbg(TRACE, "Enter\n");
356 @@ -1281,7 +1287,7 @@ static void brcmf_link_down(struct brcmf
357                 err = brcmf_fil_cmd_data_set(vif->ifp,
358                                              BRCMF_C_DISASSOC, NULL, 0);
359                 if (err) {
360 -                       bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
361 +                       bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err);
362                 }
363                 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
364                     (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
365 @@ -1305,6 +1311,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
366         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
367         struct brcmf_if *ifp = netdev_priv(ndev);
368         struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
369 +       struct brcmf_pub *drvr = cfg->pub;
370         struct brcmf_join_params join_params;
371         size_t join_params_size = 0;
372         s32 err = 0;
373 @@ -1369,7 +1376,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
374  
375         err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
376         if (err) {
377 -               bphy_err(wiphy, "wsec failed (%d)\n", err);
378 +               bphy_err(drvr, "wsec failed (%d)\n", err);
379                 goto done;
380         }
381  
382 @@ -1381,7 +1388,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
383  
384         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
385         if (err) {
386 -               bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
387 +               bphy_err(drvr, "WLC_SET_BCNPRD failed (%d)\n", err);
388                 goto done;
389         }
390  
391 @@ -1426,7 +1433,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
392                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
393                                             target_channel);
394                 if (err) {
395 -                       bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
396 +                       bphy_err(drvr, "WLC_SET_CHANNEL failed (%d)\n", err);
397                         goto done;
398                 }
399         } else
400 @@ -1438,7 +1445,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
401         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
402                                      &join_params, join_params_size);
403         if (err) {
404 -               bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
405 +               bphy_err(drvr, "WLC_SET_SSID failed (%d)\n", err);
406                 goto done;
407         }
408  
409 @@ -1475,8 +1482,8 @@ static s32 brcmf_set_wpa_version(struct
410                                  struct cfg80211_connect_params *sme)
411  {
412         struct brcmf_if *ifp = netdev_priv(ndev);
413 -       struct wiphy *wiphy = ifp->drvr->wiphy;
414         struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
415 +       struct brcmf_pub *drvr = ifp->drvr;
416         struct brcmf_cfg80211_security *sec;
417         s32 val = 0;
418         s32 err = 0;
419 @@ -1490,7 +1497,7 @@ static s32 brcmf_set_wpa_version(struct
420         brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
421         err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
422         if (err) {
423 -               bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
424 +               bphy_err(drvr, "set wpa_auth failed (%d)\n", err);
425                 return err;
426         }
427         sec = &profile->sec;
428 @@ -1502,8 +1509,8 @@ static s32 brcmf_set_auth_type(struct ne
429                                struct cfg80211_connect_params *sme)
430  {
431         struct brcmf_if *ifp = netdev_priv(ndev);
432 -       struct wiphy *wiphy = ifp->drvr->wiphy;
433         struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
434 +       struct brcmf_pub *drvr = ifp->drvr;
435         struct brcmf_cfg80211_security *sec;
436         s32 val = 0;
437         s32 err = 0;
438 @@ -1525,7 +1532,7 @@ static s32 brcmf_set_auth_type(struct ne
439  
440         err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
441         if (err) {
442 -               bphy_err(wiphy, "set auth failed (%d)\n", err);
443 +               bphy_err(drvr, "set auth failed (%d)\n", err);
444                 return err;
445         }
446         sec = &profile->sec;
447 @@ -1538,8 +1545,8 @@ brcmf_set_wsec_mode(struct net_device *n
448                     struct cfg80211_connect_params *sme)
449  {
450         struct brcmf_if *ifp = netdev_priv(ndev);
451 -       struct wiphy *wiphy = ifp->drvr->wiphy;
452         struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
453 +       struct brcmf_pub *drvr = ifp->drvr;
454         struct brcmf_cfg80211_security *sec;
455         s32 pval = 0;
456         s32 gval = 0;
457 @@ -1562,7 +1569,7 @@ brcmf_set_wsec_mode(struct net_device *n
458                         pval = AES_ENABLED;
459                         break;
460                 default:
461 -                       bphy_err(wiphy, "invalid cipher pairwise (%d)\n",
462 +                       bphy_err(drvr, "invalid cipher pairwise (%d)\n",
463                                  sme->crypto.ciphers_pairwise[0]);
464                         return -EINVAL;
465                 }
466 @@ -1583,7 +1590,7 @@ brcmf_set_wsec_mode(struct net_device *n
467                         gval = AES_ENABLED;
468                         break;
469                 default:
470 -                       bphy_err(wiphy, "invalid cipher group (%d)\n",
471 +                       bphy_err(drvr, "invalid cipher group (%d)\n",
472                                  sme->crypto.cipher_group);
473                         return -EINVAL;
474                 }
475 @@ -1599,7 +1606,7 @@ brcmf_set_wsec_mode(struct net_device *n
476         wsec = pval | gval;
477         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
478         if (err) {
479 -               bphy_err(wiphy, "error (%d)\n", err);
480 +               bphy_err(drvr, "error (%d)\n", err);
481                 return err;
482         }
483  
484 @@ -1614,8 +1621,8 @@ static s32
485  brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
486  {
487         struct brcmf_if *ifp = netdev_priv(ndev);
488 -       struct wiphy *wiphy = ifp->drvr->wiphy;
489         struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
490 +       struct brcmf_pub *drvr = ifp->drvr;
491         s32 val;
492         s32 err;
493         const struct brcmf_tlv *rsn_ie;
494 @@ -1633,7 +1640,7 @@ brcmf_set_key_mgmt(struct net_device *nd
495  
496         err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
497         if (err) {
498 -               bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
499 +               bphy_err(drvr, "could not get wpa_auth (%d)\n", err);
500                 return err;
501         }
502         if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
503 @@ -1647,7 +1654,7 @@ brcmf_set_key_mgmt(struct net_device *nd
504                         val = WPA_AUTH_PSK;
505                         break;
506                 default:
507 -                       bphy_err(wiphy, "invalid cipher group (%d)\n",
508 +                       bphy_err(drvr, "invalid cipher group (%d)\n",
509                                  sme->crypto.cipher_group);
510                         return -EINVAL;
511                 }
512 @@ -1670,7 +1677,7 @@ brcmf_set_key_mgmt(struct net_device *nd
513                         val = WPA2_AUTH_PSK;
514                         break;
515                 default:
516 -                       bphy_err(wiphy, "invalid cipher group (%d)\n",
517 +                       bphy_err(drvr, "invalid cipher group (%d)\n",
518                                  sme->crypto.cipher_group);
519                         return -EINVAL;
520                 }
521 @@ -1717,7 +1724,7 @@ skip_mfp_config:
522         brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
523         err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
524         if (err) {
525 -               bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
526 +               bphy_err(drvr, "could not set wpa_auth (%d)\n", err);
527                 return err;
528         }
529  
530 @@ -1729,7 +1736,7 @@ brcmf_set_sharedkey(struct net_device *n
531                     struct cfg80211_connect_params *sme)
532  {
533         struct brcmf_if *ifp = netdev_priv(ndev);
534 -       struct wiphy *wiphy = ifp->drvr->wiphy;
535 +       struct brcmf_pub *drvr = ifp->drvr;
536         struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
537         struct brcmf_cfg80211_security *sec;
538         struct brcmf_wsec_key key;
539 @@ -1756,7 +1763,7 @@ brcmf_set_sharedkey(struct net_device *n
540         key.len = (u32) sme->key_len;
541         key.index = (u32) sme->key_idx;
542         if (key.len > sizeof(key.data)) {
543 -               bphy_err(wiphy, "Too long key length (%u)\n", key.len);
544 +               bphy_err(drvr, "Too long key length (%u)\n", key.len);
545                 return -EINVAL;
546         }
547         memcpy(key.data, sme->key, key.len);
548 @@ -1769,7 +1776,7 @@ brcmf_set_sharedkey(struct net_device *n
549                 key.algo = CRYPTO_ALGO_WEP128;
550                 break;
551         default:
552 -               bphy_err(wiphy, "Invalid algorithm (%d)\n",
553 +               bphy_err(drvr, "Invalid algorithm (%d)\n",
554                          sme->crypto.ciphers_pairwise[0]);
555                 return -EINVAL;
556         }
557 @@ -1786,7 +1793,7 @@ brcmf_set_sharedkey(struct net_device *n
558                 val = WL_AUTH_SHARED_KEY;       /* shared key */
559                 err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
560                 if (err)
561 -                       bphy_err(wiphy, "set auth failed (%d)\n", err);
562 +                       bphy_err(drvr, "set auth failed (%d)\n", err);
563         }
564         return err;
565  }
566 @@ -1806,7 +1813,7 @@ enum nl80211_auth_type brcmf_war_auth_ty
567  static void brcmf_set_join_pref(struct brcmf_if *ifp,
568                                 struct cfg80211_bss_selection *bss_select)
569  {
570 -       struct wiphy *wiphy = ifp->drvr->wiphy;
571 +       struct brcmf_pub *drvr = ifp->drvr;
572         struct brcmf_join_pref_params join_pref_params[2];
573         enum nl80211_band band;
574         int err, i = 0;
575 @@ -1845,7 +1852,7 @@ static void brcmf_set_join_pref(struct b
576         err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
577                                        sizeof(join_pref_params));
578         if (err)
579 -               bphy_err(wiphy, "Set join_pref error (%d)\n", err);
580 +               bphy_err(drvr, "Set join_pref error (%d)\n", err);
581  }
582  
583  static s32
584 @@ -1856,6 +1863,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
585         struct brcmf_if *ifp = netdev_priv(ndev);
586         struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
587         struct ieee80211_channel *chan = sme->channel;
588 +       struct brcmf_pub *drvr = ifp->drvr;
589         struct brcmf_join_params join_params;
590         size_t join_params_size;
591         const struct brcmf_tlv *rsn_ie;
592 @@ -1872,7 +1880,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
593                 return -EIO;
594  
595         if (!sme->ssid) {
596 -               bphy_err(wiphy, "Invalid ssid\n");
597 +               bphy_err(drvr, "Invalid ssid\n");
598                 return -EOPNOTSUPP;
599         }
600  
601 @@ -1901,7 +1909,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
602         err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
603                                     sme->ie, sme->ie_len);
604         if (err)
605 -               bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
606 +               bphy_err(drvr, "Set Assoc REQ IE Failed\n");
607         else
608                 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
609  
610 @@ -1922,32 +1930,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
611  
612         err = brcmf_set_wpa_version(ndev, sme);
613         if (err) {
614 -               bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
615 +               bphy_err(drvr, "wl_set_wpa_version failed (%d)\n", err);
616                 goto done;
617         }
618  
619         sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
620         err = brcmf_set_auth_type(ndev, sme);
621         if (err) {
622 -               bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
623 +               bphy_err(drvr, "wl_set_auth_type failed (%d)\n", err);
624                 goto done;
625         }
626  
627         err = brcmf_set_wsec_mode(ndev, sme);
628         if (err) {
629 -               bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
630 +               bphy_err(drvr, "wl_set_set_cipher failed (%d)\n", err);
631                 goto done;
632         }
633  
634         err = brcmf_set_key_mgmt(ndev, sme);
635         if (err) {
636 -               bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
637 +               bphy_err(drvr, "wl_set_key_mgmt failed (%d)\n", err);
638                 goto done;
639         }
640  
641         err = brcmf_set_sharedkey(ndev, sme);
642         if (err) {
643 -               bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
644 +               bphy_err(drvr, "brcmf_set_sharedkey failed (%d)\n", err);
645                 goto done;
646         }
647  
648 @@ -1964,7 +1972,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
649                 /* enable firmware supplicant for this interface */
650                 err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
651                 if (err < 0) {
652 -                       bphy_err(wiphy, "failed to enable fw supplicant\n");
653 +                       bphy_err(drvr, "failed to enable fw supplicant\n");
654                         goto done;
655                 }
656         }
657 @@ -2059,7 +2067,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
658         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
659                                      &join_params, join_params_size);
660         if (err)
661 -               bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
662 +               bphy_err(drvr, "BRCMF_C_SET_SSID failed (%d)\n", err);
663  
664  done:
665         if (err)
666 @@ -2072,8 +2080,10 @@ static s32
667  brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
668                        u16 reason_code)
669  {
670 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
671         struct brcmf_if *ifp = netdev_priv(ndev);
672         struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
673 +       struct brcmf_pub *drvr = cfg->pub;
674         struct brcmf_scb_val_le scbval;
675         s32 err = 0;
676  
677 @@ -2090,7 +2100,7 @@ brcmf_cfg80211_disconnect(struct wiphy *
678         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
679                                      &scbval, sizeof(scbval));
680         if (err)
681 -               bphy_err(wiphy, "error (%d)\n", err);
682 +               bphy_err(drvr, "error (%d)\n", err);
683  
684         brcmf_dbg(TRACE, "Exit\n");
685         return err;
686 @@ -2103,6 +2113,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
687         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
688         struct net_device *ndev = cfg_to_ndev(cfg);
689         struct brcmf_if *ifp = netdev_priv(ndev);
690 +       struct brcmf_pub *drvr = cfg->pub;
691         s32 err;
692         s32 disable;
693         u32 qdbm = 127;
694 @@ -2117,7 +2128,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
695         case NL80211_TX_POWER_LIMITED:
696         case NL80211_TX_POWER_FIXED:
697                 if (mbm < 0) {
698 -                       bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
699 +                       bphy_err(drvr, "TX_POWER_FIXED - dbm is negative\n");
700                         err = -EINVAL;
701                         goto done;
702                 }
703 @@ -2127,7 +2138,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
704                 qdbm |= WL_TXPWR_OVERRIDE;
705                 break;
706         default:
707 -               bphy_err(wiphy, "Unsupported type %d\n", type);
708 +               bphy_err(drvr, "Unsupported type %d\n", type);
709                 err = -EINVAL;
710                 goto done;
711         }
712 @@ -2135,11 +2146,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy
713         disable = WL_RADIO_SW_DISABLE << 16;
714         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
715         if (err)
716 -               bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
717 +               bphy_err(drvr, "WLC_SET_RADIO error (%d)\n", err);
718  
719         err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
720         if (err)
721 -               bphy_err(wiphy, "qtxpower error (%d)\n", err);
722 +               bphy_err(drvr, "qtxpower error (%d)\n", err);
723  
724  done:
725         brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
726 @@ -2150,7 +2161,9 @@ static s32
727  brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
728                             s32 *dbm)
729  {
730 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
731         struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev);
732 +       struct brcmf_pub *drvr = cfg->pub;
733         s32 qdbm = 0;
734         s32 err;
735  
736 @@ -2160,7 +2173,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
737  
738         err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
739         if (err) {
740 -               bphy_err(wiphy, "error (%d)\n", err);
741 +               bphy_err(drvr, "error (%d)\n", err);
742                 goto done;
743         }
744         *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
745 @@ -2175,6 +2188,7 @@ brcmf_cfg80211_config_default_key(struct
746                                   u8 key_idx, bool unicast, bool multicast)
747  {
748         struct brcmf_if *ifp = netdev_priv(ndev);
749 +       struct brcmf_pub *drvr = ifp->drvr;
750         u32 index;
751         u32 wsec;
752         s32 err = 0;
753 @@ -2186,7 +2200,7 @@ brcmf_cfg80211_config_default_key(struct
754  
755         err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
756         if (err) {
757 -               bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
758 +               bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
759                 goto done;
760         }
761  
762 @@ -2196,7 +2210,7 @@ brcmf_cfg80211_config_default_key(struct
763                 err = brcmf_fil_cmd_int_set(ifp,
764                                             BRCMF_C_SET_KEY_PRIMARY, index);
765                 if (err)
766 -                       bphy_err(wiphy, "error (%d)\n", err);
767 +                       bphy_err(drvr, "error (%d)\n", err);
768         }
769  done:
770         brcmf_dbg(TRACE, "Exit\n");
771 @@ -2245,7 +2259,9 @@ brcmf_cfg80211_add_key(struct wiphy *wip
772                        u8 key_idx, bool pairwise, const u8 *mac_addr,
773                        struct key_params *params)
774  {
775 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
776         struct brcmf_if *ifp = netdev_priv(ndev);
777 +       struct brcmf_pub *drvr = cfg->pub;
778         struct brcmf_wsec_key *key;
779         s32 val;
780         s32 wsec;
781 @@ -2260,7 +2276,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
782  
783         if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
784                 /* we ignore this key index in this case */
785 -               bphy_err(wiphy, "invalid key index (%d)\n", key_idx);
786 +               bphy_err(drvr, "invalid key index (%d)\n", key_idx);
787                 return -EINVAL;
788         }
789  
790 @@ -2269,7 +2285,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
791                                               mac_addr);
792  
793         if (params->key_len > sizeof(key->data)) {
794 -               bphy_err(wiphy, "Too long key length (%u)\n", params->key_len);
795 +               bphy_err(drvr, "Too long key length (%u)\n", params->key_len);
796                 return -EINVAL;
797         }
798  
799 @@ -2323,7 +2339,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
800                 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
801                 break;
802         default:
803 -               bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
804 +               bphy_err(drvr, "Invalid cipher (0x%x)\n", params->cipher);
805                 err = -EINVAL;
806                 goto done;
807         }
808 @@ -2334,13 +2350,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
809  
810         err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
811         if (err) {
812 -               bphy_err(wiphy, "get wsec error (%d)\n", err);
813 +               bphy_err(drvr, "get wsec error (%d)\n", err);
814                 goto done;
815         }
816         wsec |= val;
817         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
818         if (err) {
819 -               bphy_err(wiphy, "set wsec error (%d)\n", err);
820 +               bphy_err(drvr, "set wsec error (%d)\n", err);
821                 goto done;
822         }
823  
824 @@ -2355,9 +2371,11 @@ brcmf_cfg80211_get_key(struct wiphy *wip
825                        void (*callback)(void *cookie,
826                                         struct key_params *params))
827  {
828 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
829         struct key_params params;
830         struct brcmf_if *ifp = netdev_priv(ndev);
831         struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
832 +       struct brcmf_pub *drvr = cfg->pub;
833         struct brcmf_cfg80211_security *sec;
834         s32 wsec;
835         s32 err = 0;
836 @@ -2371,7 +2389,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
837  
838         err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
839         if (err) {
840 -               bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
841 +               bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
842                 /* Ignore this error, may happen during DISASSOC */
843                 err = -EAGAIN;
844                 goto done;
845 @@ -2392,7 +2410,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
846                 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
847                 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
848         } else  {
849 -               bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
850 +               bphy_err(drvr, "Invalid algo (0x%x)\n", wsec);
851                 err = -EINVAL;
852                 goto done;
853         }
854 @@ -2422,7 +2440,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
855  static void
856  brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
857  {
858 -       struct wiphy *wiphy = ifp->drvr->wiphy;
859 +       struct brcmf_pub *drvr = ifp->drvr;
860         s32 err;
861         u8 key_idx;
862         struct brcmf_wsec_key *key;
863 @@ -2439,18 +2457,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
864  
865         err = send_key_to_dongle(ifp, key);
866         if (err) {
867 -               bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
868 +               bphy_err(drvr, "Setting WEP key failed (%d)\n", err);
869                 return;
870         }
871         err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
872         if (err) {
873 -               bphy_err(wiphy, "get wsec error (%d)\n", err);
874 +               bphy_err(drvr, "get wsec error (%d)\n", err);
875                 return;
876         }
877         wsec |= WEP_ENABLED;
878         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
879         if (err)
880 -               bphy_err(wiphy, "set wsec error (%d)\n", err);
881 +               bphy_err(drvr, "set wsec error (%d)\n", err);
882  }
883  
884  static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
885 @@ -2476,7 +2494,7 @@ static void brcmf_convert_sta_flags(u32
886  
887  static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
888  {
889 -       struct wiphy *wiphy = ifp->drvr->wiphy;
890 +       struct brcmf_pub *drvr = ifp->drvr;
891         struct {
892                 __le32 len;
893                 struct brcmf_bss_info_le bss_le;
894 @@ -2492,7 +2510,7 @@ static void brcmf_fill_bss_param(struct
895         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
896                                      WL_BSS_INFO_MAX);
897         if (err) {
898 -               bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
899 +               bphy_err(drvr, "Failed to get bss info (%d)\n", err);
900                 goto out_kfree;
901         }
902         si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
903 @@ -2514,7 +2532,7 @@ static s32
904  brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
905                                 struct station_info *sinfo)
906  {
907 -       struct wiphy *wiphy = ifp->drvr->wiphy;
908 +       struct brcmf_pub *drvr = ifp->drvr;
909         struct brcmf_scb_val_le scbval;
910         struct brcmf_pktcnt_le pktcnt;
911         s32 err;
912 @@ -2524,7 +2542,7 @@ brcmf_cfg80211_get_station_ibss(struct b
913         /* Get the current tx rate */
914         err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
915         if (err < 0) {
916 -               bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
917 +               bphy_err(drvr, "BRCMF_C_GET_RATE error (%d)\n", err);
918                 return err;
919         }
920         sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
921 @@ -2534,7 +2552,7 @@ brcmf_cfg80211_get_station_ibss(struct b
922         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
923                                      sizeof(scbval));
924         if (err) {
925 -               bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
926 +               bphy_err(drvr, "BRCMF_C_GET_RSSI error (%d)\n", err);
927                 return err;
928         }
929         rssi = le32_to_cpu(scbval.val);
930 @@ -2544,7 +2562,7 @@ brcmf_cfg80211_get_station_ibss(struct b
931         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
932                                      sizeof(pktcnt));
933         if (err) {
934 -               bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
935 +               bphy_err(drvr, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
936                 return err;
937         }
938         sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
939 @@ -2563,7 +2581,9 @@ static s32
940  brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
941                            const u8 *mac, struct station_info *sinfo)
942  {
943 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
944         struct brcmf_if *ifp = netdev_priv(ndev);
945 +       struct brcmf_pub *drvr = cfg->pub;
946         struct brcmf_scb_val_le scb_val;
947         s32 err = 0;
948         struct brcmf_sta_info_le sta_info_le;
949 @@ -2592,7 +2612,7 @@ brcmf_cfg80211_get_station(struct wiphy
950                                                &sta_info_le,
951                                                sizeof(sta_info_le));
952                 if (err < 0) {
953 -                       bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
954 +                       bphy_err(drvr, "GET STA INFO failed, %d\n", err);
955                         goto done;
956                 }
957         }
958 @@ -2661,7 +2681,7 @@ brcmf_cfg80211_get_station(struct wiphy
959                         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
960                                                      &scb_val, sizeof(scb_val));
961                         if (err) {
962 -                               bphy_err(wiphy, "Could not get rssi (%d)\n",
963 +                               bphy_err(drvr, "Could not get rssi (%d)\n",
964                                          err);
965                                 goto done;
966                         } else {
967 @@ -2683,6 +2703,7 @@ brcmf_cfg80211_dump_station(struct wiphy
968  {
969         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
970         struct brcmf_if *ifp = netdev_priv(ndev);
971 +       struct brcmf_pub *drvr = cfg->pub;
972         s32 err;
973  
974         brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
975 @@ -2693,7 +2714,7 @@ brcmf_cfg80211_dump_station(struct wiphy
976                                              &cfg->assoclist,
977                                              sizeof(cfg->assoclist));
978                 if (err) {
979 -                       bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
980 +                       bphy_err(drvr, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
981                                  err);
982                         cfg->assoclist.count = 0;
983                         return -EOPNOTSUPP;
984 @@ -2714,6 +2735,7 @@ brcmf_cfg80211_set_power_mgmt(struct wip
985         s32 err = 0;
986         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
987         struct brcmf_if *ifp = netdev_priv(ndev);
988 +       struct brcmf_pub *drvr = cfg->pub;
989  
990         brcmf_dbg(TRACE, "Enter\n");
991  
992 @@ -2742,9 +2764,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip
993         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
994         if (err) {
995                 if (err == -ENODEV)
996 -                       bphy_err(wiphy, "net_device is not ready yet\n");
997 +                       bphy_err(drvr, "net_device is not ready yet\n");
998                 else
999 -                       bphy_err(wiphy, "error (%d)\n", err);
1000 +                       bphy_err(drvr, "error (%d)\n", err);
1001         }
1002  done:
1003         brcmf_dbg(TRACE, "Exit\n");
1004 @@ -2755,6 +2777,7 @@ static s32 brcmf_inform_single_bss(struc
1005                                    struct brcmf_bss_info_le *bi)
1006  {
1007         struct wiphy *wiphy = cfg_to_wiphy(cfg);
1008 +       struct brcmf_pub *drvr = cfg->pub;
1009         struct cfg80211_bss *bss;
1010         enum nl80211_band band;
1011         struct brcmu_chan ch;
1012 @@ -2767,7 +2790,7 @@ static s32 brcmf_inform_single_bss(struc
1013         struct cfg80211_inform_bss bss_data = {};
1014  
1015         if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
1016 -               bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n");
1017 +               bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
1018                 return 0;
1019         }
1020  
1021 @@ -2826,7 +2849,7 @@ next_bss_le(struct brcmf_scan_results *l
1022  
1023  static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
1024  {
1025 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1026 +       struct brcmf_pub *drvr = cfg->pub;
1027         struct brcmf_scan_results *bss_list;
1028         struct brcmf_bss_info_le *bi = NULL;    /* must be initialized */
1029         s32 err = 0;
1030 @@ -2835,7 +2858,7 @@ static s32 brcmf_inform_bss(struct brcmf
1031         bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
1032         if (bss_list->count != 0 &&
1033             bss_list->version != BRCMF_BSS_INFO_VERSION) {
1034 -               bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n",
1035 +               bphy_err(drvr, "Version %d != WL_BSS_INFO_VERSION\n",
1036                          bss_list->version);
1037                 return -EOPNOTSUPP;
1038         }
1039 @@ -2853,6 +2876,7 @@ static s32 brcmf_inform_ibss(struct brcm
1040                              struct net_device *ndev, const u8 *bssid)
1041  {
1042         struct wiphy *wiphy = cfg_to_wiphy(cfg);
1043 +       struct brcmf_pub *drvr = cfg->pub;
1044         struct ieee80211_channel *notify_channel;
1045         struct brcmf_bss_info_le *bi = NULL;
1046         struct ieee80211_supported_band *band;
1047 @@ -2880,7 +2904,7 @@ static s32 brcmf_inform_ibss(struct brcm
1048         err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
1049                                      buf, WL_BSS_INFO_MAX);
1050         if (err) {
1051 -               bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
1052 +               bphy_err(drvr, "WLC_GET_BSS_INFO failed: %d\n", err);
1053                 goto CleanUp;
1054         }
1055  
1056 @@ -2934,7 +2958,7 @@ CleanUp:
1057  static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
1058                                  struct brcmf_if *ifp)
1059  {
1060 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1061 +       struct brcmf_pub *drvr = cfg->pub;
1062         struct brcmf_bss_info_le *bi;
1063         const struct brcmf_tlv *tim;
1064         u16 beacon_interval;
1065 @@ -2951,7 +2975,7 @@ static s32 brcmf_update_bss_info(struct
1066         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
1067                                      cfg->extra_buf, WL_EXTRA_BUF_MAX);
1068         if (err) {
1069 -               bphy_err(wiphy, "Could not get bss info %d\n", err);
1070 +               bphy_err(drvr, "Could not get bss info %d\n", err);
1071                 goto update_bss_info_out;
1072         }
1073  
1074 @@ -2976,7 +3000,7 @@ static s32 brcmf_update_bss_info(struct
1075                 u32 var;
1076                 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
1077                 if (err) {
1078 -                       bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err);
1079 +                       bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err);
1080                         goto update_bss_info_out;
1081                 }
1082                 dtim_period = (u8)var;
1083 @@ -3014,10 +3038,10 @@ static void brcmf_escan_timeout(struct t
1084  {
1085         struct brcmf_cfg80211_info *cfg =
1086                         from_timer(cfg, t, escan_timeout);
1087 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1088 +       struct brcmf_pub *drvr = cfg->pub;
1089  
1090         if (cfg->int_escan_map || cfg->scan_request) {
1091 -               bphy_err(wiphy, "timer expired\n");
1092 +               bphy_err(drvr, "timer expired\n");
1093                 schedule_work(&cfg->escan_timeout_work);
1094         }
1095  }
1096 @@ -3065,8 +3089,8 @@ static s32
1097  brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
1098                              const struct brcmf_event_msg *e, void *data)
1099  {
1100 -       struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1101 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1102 +       struct brcmf_pub *drvr = ifp->drvr;
1103 +       struct brcmf_cfg80211_info *cfg = drvr->config;
1104         s32 status;
1105         struct brcmf_escan_result_le *escan_result_le;
1106         u32 escan_buflen;
1107 @@ -3083,7 +3107,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1108                 goto exit;
1109  
1110         if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
1111 -               bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n",
1112 +               bphy_err(drvr, "scan not ready, bsscfgidx=%d\n",
1113                          ifp->bsscfgidx);
1114                 return -EPERM;
1115         }
1116 @@ -3091,24 +3115,24 @@ brcmf_cfg80211_escan_handler(struct brcm
1117         if (status == BRCMF_E_STATUS_PARTIAL) {
1118                 brcmf_dbg(SCAN, "ESCAN Partial result\n");
1119                 if (e->datalen < sizeof(*escan_result_le)) {
1120 -                       bphy_err(wiphy, "invalid event data length\n");
1121 +                       bphy_err(drvr, "invalid event data length\n");
1122                         goto exit;
1123                 }
1124                 escan_result_le = (struct brcmf_escan_result_le *) data;
1125                 if (!escan_result_le) {
1126 -                       bphy_err(wiphy, "Invalid escan result (NULL pointer)\n");
1127 +                       bphy_err(drvr, "Invalid escan result (NULL pointer)\n");
1128                         goto exit;
1129                 }
1130                 escan_buflen = le32_to_cpu(escan_result_le->buflen);
1131                 if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
1132                     escan_buflen > e->datalen ||
1133                     escan_buflen < sizeof(*escan_result_le)) {
1134 -                       bphy_err(wiphy, "Invalid escan buffer length: %d\n",
1135 +                       bphy_err(drvr, "Invalid escan buffer length: %d\n",
1136                                  escan_buflen);
1137                         goto exit;
1138                 }
1139                 if (le16_to_cpu(escan_result_le->bss_count) != 1) {
1140 -                       bphy_err(wiphy, "Invalid bss_count %d: ignoring\n",
1141 +                       bphy_err(drvr, "Invalid bss_count %d: ignoring\n",
1142                                  escan_result_le->bss_count);
1143                         goto exit;
1144                 }
1145 @@ -3124,7 +3148,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1146  
1147                 bi_length = le32_to_cpu(bss_info_le->length);
1148                 if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
1149 -                       bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
1150 +                       bphy_err(drvr, "Ignoring invalid bss_info length: %d\n",
1151                                  bi_length);
1152                         goto exit;
1153                 }
1154 @@ -3133,7 +3157,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1155                                         BIT(NL80211_IFTYPE_ADHOC))) {
1156                         if (le16_to_cpu(bss_info_le->capability) &
1157                                                 WLAN_CAPABILITY_IBSS) {
1158 -                               bphy_err(wiphy, "Ignoring IBSS result\n");
1159 +                               bphy_err(drvr, "Ignoring IBSS result\n");
1160                                 goto exit;
1161                         }
1162                 }
1163 @@ -3141,7 +3165,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1164                 list = (struct brcmf_scan_results *)
1165                                 cfg->escan_info.escan_buf;
1166                 if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
1167 -                       bphy_err(wiphy, "Buffer is too small: ignoring\n");
1168 +                       bphy_err(drvr, "Buffer is too small: ignoring\n");
1169                         goto exit;
1170                 }
1171  
1172 @@ -3300,7 +3324,8 @@ static s32
1173  brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
1174                                 const struct brcmf_event_msg *e, void *data)
1175  {
1176 -       struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1177 +       struct brcmf_pub *drvr = ifp->drvr;
1178 +       struct brcmf_cfg80211_info *cfg = drvr->config;
1179         struct brcmf_pno_net_info_le *netinfo, *netinfo_start;
1180         struct cfg80211_scan_request *request = NULL;
1181         struct wiphy *wiphy = cfg_to_wiphy(cfg);
1182 @@ -3333,14 +3358,14 @@ brcmf_notify_sched_scan_results(struct b
1183         WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
1184         brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
1185         if (!result_count) {
1186 -               bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n");
1187 +               bphy_err(drvr, "FALSE PNO Event. (pfn_count == 0)\n");
1188                 goto out_err;
1189         }
1190  
1191         netinfo_start = brcmf_get_netinfo_array(pfn_result);
1192         datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
1193         if (datalen < result_count * sizeof(*netinfo)) {
1194 -               bphy_err(wiphy, "insufficient event data\n");
1195 +               bphy_err(drvr, "insufficient event data\n");
1196                 goto out_err;
1197         }
1198  
1199 @@ -3387,14 +3412,15 @@ brcmf_cfg80211_sched_scan_start(struct w
1200                                 struct net_device *ndev,
1201                                 struct cfg80211_sched_scan_request *req)
1202  {
1203 -       struct brcmf_if *ifp = netdev_priv(ndev);
1204         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1205 +       struct brcmf_if *ifp = netdev_priv(ndev);
1206 +       struct brcmf_pub *drvr = cfg->pub;
1207  
1208         brcmf_dbg(SCAN, "Enter: n_match_sets=%d n_ssids=%d\n",
1209                   req->n_match_sets, req->n_ssids);
1210  
1211         if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
1212 -               bphy_err(wiphy, "Scanning suppressed: status=%lu\n",
1213 +               bphy_err(drvr, "Scanning suppressed: status=%lu\n",
1214                          cfg->scan_status);
1215                 return -EAGAIN;
1216         }
1217 @@ -3473,8 +3499,8 @@ static s32
1218  brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
1219                       void *data)
1220  {
1221 -       struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1222 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1223 +       struct brcmf_pub *drvr = ifp->drvr;
1224 +       struct brcmf_cfg80211_info *cfg = drvr->config;
1225         struct brcmf_pno_scanresults_le *pfn_result;
1226         struct brcmf_pno_net_info_le *netinfo;
1227  
1228 @@ -3493,7 +3519,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1229         }
1230  
1231         if (le32_to_cpu(pfn_result->count) < 1) {
1232 -               bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n",
1233 +               bphy_err(drvr, "Invalid result count, expected 1 (%d)\n",
1234                          le32_to_cpu(pfn_result->count));
1235                 return -EINVAL;
1236         }
1237 @@ -3523,6 +3549,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1238  static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
1239  {
1240         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1241 +       struct brcmf_pub *drvr = cfg->pub;
1242         struct brcmf_wowl_wakeind_le wake_ind_le;
1243         struct cfg80211_wowlan_wakeup wakeup_data;
1244         struct cfg80211_wowlan_wakeup *wakeup;
1245 @@ -3533,7 +3560,7 @@ static void brcmf_report_wowl_wakeind(st
1246         err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
1247                                        sizeof(wake_ind_le));
1248         if (err) {
1249 -               bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
1250 +               bphy_err(drvr, "Get wowl_wakeind failed, err = %d\n", err);
1251                 return;
1252         }
1253  
1254 @@ -3574,7 +3601,7 @@ static void brcmf_report_wowl_wakeind(st
1255                                 cfg->wowl.nd_data_completed,
1256                                 BRCMF_ND_INFO_TIMEOUT);
1257                         if (!timeout)
1258 -                               bphy_err(wiphy, "No result for wowl net detect\n");
1259 +                               bphy_err(drvr, "No result for wowl net detect\n");
1260                         else
1261                                 wakeup_data.net_detect = cfg->wowl.nd_info;
1262                 }
1263 @@ -3763,6 +3790,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
1264         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1265         struct brcmf_if *ifp = netdev_priv(ndev);
1266         struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
1267 +       struct brcmf_pub *drvr = cfg->pub;
1268         s32 err;
1269         u32 npmk, i;
1270  
1271 @@ -3782,7 +3810,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
1272                         cfg->pmk_list.npmk = cpu_to_le32(npmk);
1273                 }
1274         } else {
1275 -               bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
1276 +               bphy_err(drvr, "Too many PMKSA entries cached %d\n", npmk);
1277                 return -EINVAL;
1278         }
1279  
1280 @@ -3805,6 +3833,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
1281         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1282         struct brcmf_if *ifp = netdev_priv(ndev);
1283         struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
1284 +       struct brcmf_pub *drvr = cfg->pub;
1285         s32 err;
1286         u32 npmk, i;
1287  
1288 @@ -3828,7 +3857,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
1289                 memset(&pmk[i], 0, sizeof(*pmk));
1290                 cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
1291         } else {
1292 -               bphy_err(wiphy, "Cache entry not found\n");
1293 +               bphy_err(drvr, "Cache entry not found\n");
1294                 return -EINVAL;
1295         }
1296  
1297 @@ -3860,20 +3889,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
1298  
1299  static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
1300  {
1301 -       struct wiphy *wiphy = ifp->drvr->wiphy;
1302 +       struct brcmf_pub *drvr = ifp->drvr;
1303         s32 err;
1304         s32 wpa_val;
1305  
1306         /* set auth */
1307         err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
1308         if (err < 0) {
1309 -               bphy_err(wiphy, "auth error %d\n", err);
1310 +               bphy_err(drvr, "auth error %d\n", err);
1311                 return err;
1312         }
1313         /* set wsec */
1314         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
1315         if (err < 0) {
1316 -               bphy_err(wiphy, "wsec error %d\n", err);
1317 +               bphy_err(drvr, "wsec error %d\n", err);
1318                 return err;
1319         }
1320         /* set upper-layer auth */
1321 @@ -3883,7 +3912,7 @@ static s32 brcmf_configure_opensecurity(
1322                 wpa_val = WPA_AUTH_DISABLED;
1323         err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val);
1324         if (err < 0) {
1325 -               bphy_err(wiphy, "wpa_auth error %d\n", err);
1326 +               bphy_err(drvr, "wpa_auth error %d\n", err);
1327                 return err;
1328         }
1329  
1330 @@ -3903,7 +3932,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1331                       const struct brcmf_vs_tlv *wpa_ie,
1332                       bool is_rsn_ie)
1333  {
1334 -       struct wiphy *wiphy = ifp->drvr->wiphy;
1335 +       struct brcmf_pub *drvr = ifp->drvr;
1336         u32 auth = 0; /* d11 open authentication */
1337         u16 count;
1338         s32 err = 0;
1339 @@ -3934,13 +3963,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1340         /* check for multicast cipher suite */
1341         if (offset + WPA_IE_MIN_OUI_LEN > len) {
1342                 err = -EINVAL;
1343 -               bphy_err(wiphy, "no multicast cipher suite\n");
1344 +               bphy_err(drvr, "no multicast cipher suite\n");
1345                 goto exit;
1346         }
1347  
1348         if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1349                 err = -EINVAL;
1350 -               bphy_err(wiphy, "ivalid OUI\n");
1351 +               bphy_err(drvr, "ivalid OUI\n");
1352                 goto exit;
1353         }
1354         offset += TLV_OUI_LEN;
1355 @@ -3962,7 +3991,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1356                 break;
1357         default:
1358                 err = -EINVAL;
1359 -               bphy_err(wiphy, "Invalid multi cast cipher info\n");
1360 +               bphy_err(drvr, "Invalid multi cast cipher info\n");
1361                 goto exit;
1362         }
1363  
1364 @@ -3973,13 +4002,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1365         /* Check for unicast suite(s) */
1366         if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
1367                 err = -EINVAL;
1368 -               bphy_err(wiphy, "no unicast cipher suite\n");
1369 +               bphy_err(drvr, "no unicast cipher suite\n");
1370                 goto exit;
1371         }
1372         for (i = 0; i < count; i++) {
1373                 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1374                         err = -EINVAL;
1375 -                       bphy_err(wiphy, "ivalid OUI\n");
1376 +                       bphy_err(drvr, "ivalid OUI\n");
1377                         goto exit;
1378                 }
1379                 offset += TLV_OUI_LEN;
1380 @@ -3997,7 +4026,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1381                         pval |= AES_ENABLED;
1382                         break;
1383                 default:
1384 -                       bphy_err(wiphy, "Invalid unicast security info\n");
1385 +                       bphy_err(drvr, "Invalid unicast security info\n");
1386                 }
1387                 offset++;
1388         }
1389 @@ -4007,13 +4036,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1390         /* Check for auth key management suite(s) */
1391         if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
1392                 err = -EINVAL;
1393 -               bphy_err(wiphy, "no auth key mgmt suite\n");
1394 +               bphy_err(drvr, "no auth key mgmt suite\n");
1395                 goto exit;
1396         }
1397         for (i = 0; i < count; i++) {
1398                 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1399                         err = -EINVAL;
1400 -                       bphy_err(wiphy, "ivalid OUI\n");
1401 +                       bphy_err(drvr, "ivalid OUI\n");
1402                         goto exit;
1403                 }
1404                 offset += TLV_OUI_LEN;
1405 @@ -4041,7 +4070,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1406                         wpa_auth |= WPA2_AUTH_1X_SHA256;
1407                         break;
1408                 default:
1409 -                       bphy_err(wiphy, "Invalid key mgmt info\n");
1410 +                       bphy_err(drvr, "Invalid key mgmt info\n");
1411                 }
1412                 offset++;
1413         }
1414 @@ -4083,7 +4112,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1415                 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
1416                                                wme_bss_disable);
1417                 if (err < 0) {
1418 -                       bphy_err(wiphy, "wme_bss_disable error %d\n", err);
1419 +                       bphy_err(drvr, "wme_bss_disable error %d\n", err);
1420                         goto exit;
1421                 }
1422  
1423 @@ -4097,7 +4126,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1424                                                         &data[offset],
1425                                                         WPA_IE_MIN_OUI_LEN);
1426                         if (err < 0) {
1427 -                               bphy_err(wiphy, "bip error %d\n", err);
1428 +                               bphy_err(drvr, "bip error %d\n", err);
1429                                 goto exit;
1430                         }
1431                 }
1432 @@ -4108,13 +4137,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1433         /* set auth */
1434         err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
1435         if (err < 0) {
1436 -               bphy_err(wiphy, "auth error %d\n", err);
1437 +               bphy_err(drvr, "auth error %d\n", err);
1438                 goto exit;
1439         }
1440         /* set wsec */
1441         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
1442         if (err < 0) {
1443 -               bphy_err(wiphy, "wsec error %d\n", err);
1444 +               bphy_err(drvr, "wsec error %d\n", err);
1445                 goto exit;
1446         }
1447         /* Configure MFP, this needs to go after wsec otherwise the wsec command
1448 @@ -4123,14 +4152,14 @@ brcmf_configure_wpaie(struct brcmf_if *i
1449         if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
1450                 err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
1451                 if (err < 0) {
1452 -                       bphy_err(wiphy, "mfp error %d\n", err);
1453 +                       bphy_err(drvr, "mfp error %d\n", err);
1454                         goto exit;
1455                 }
1456         }
1457         /* set upper-layer auth */
1458         err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
1459         if (err < 0) {
1460 -               bphy_err(wiphy, "wpa_auth error %d\n", err);
1461 +               bphy_err(drvr, "wpa_auth error %d\n", err);
1462                 goto exit;
1463         }
1464  
1465 @@ -4216,8 +4245,8 @@ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8
1466  s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
1467                           const u8 *vndr_ie_buf, u32 vndr_ie_len)
1468  {
1469 +       struct brcmf_pub *drvr;
1470         struct brcmf_if *ifp;
1471 -       struct wiphy *wiphy;
1472         struct vif_saved_ie *saved_ie;
1473         s32 err = 0;
1474         u8  *iovar_ie_buf;
1475 @@ -4238,7 +4267,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1476         if (!vif)
1477                 return -ENODEV;
1478         ifp = vif->ifp;
1479 -       wiphy = ifp->drvr->wiphy;
1480 +       drvr = ifp->drvr;
1481         saved_ie = &vif->saved_ie;
1482  
1483         brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
1484 @@ -4270,13 +4299,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1485                 break;
1486         default:
1487                 err = -EPERM;
1488 -               bphy_err(wiphy, "not suitable type\n");
1489 +               bphy_err(drvr, "not suitable type\n");
1490                 goto exit;
1491         }
1492  
1493         if (vndr_ie_len > mgmt_ie_buf_len) {
1494                 err = -ENOMEM;
1495 -               bphy_err(wiphy, "extra IE size too big\n");
1496 +               bphy_err(drvr, "extra IE size too big\n");
1497                 goto exit;
1498         }
1499  
1500 @@ -4337,7 +4366,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1501                         /* verify remained buf size before copy data */
1502                         if (remained_buf_len < (vndrie_info->vndrie.len +
1503                                                         VNDR_IE_VSIE_OFFSET)) {
1504 -                               bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d",
1505 +                               bphy_err(drvr, "no space in mgmt_ie_buf: len left %d",
1506                                          remained_buf_len);
1507                                 break;
1508                         }
1509 @@ -4369,7 +4398,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1510                 err  = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
1511                                                  total_ie_buf_len);
1512                 if (err)
1513 -                       bphy_err(wiphy, "vndr ie set error : %d\n", err);
1514 +                       bphy_err(drvr, "vndr ie set error : %d\n", err);
1515         }
1516  
1517  exit:
1518 @@ -4397,14 +4426,14 @@ static s32
1519  brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
1520                         struct cfg80211_beacon_data *beacon)
1521  {
1522 -       struct wiphy *wiphy = vif->ifp->drvr->wiphy;
1523 +       struct brcmf_pub *drvr = vif->ifp->drvr;
1524         s32 err;
1525  
1526         /* Set Beacon IEs to FW */
1527         err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
1528                                     beacon->tail, beacon->tail_len);
1529         if (err) {
1530 -               bphy_err(wiphy, "Set Beacon IE Failed\n");
1531 +               bphy_err(drvr, "Set Beacon IE Failed\n");
1532                 return err;
1533         }
1534         brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
1535 @@ -4414,7 +4443,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
1536                                     beacon->proberesp_ies,
1537                                     beacon->proberesp_ies_len);
1538         if (err)
1539 -               bphy_err(wiphy, "Set Probe Resp IE Failed\n");
1540 +               bphy_err(drvr, "Set Probe Resp IE Failed\n");
1541         else
1542                 brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
1543  
1544 @@ -4428,6 +4457,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1545         s32 ie_offset;
1546         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1547         struct brcmf_if *ifp = netdev_priv(ndev);
1548 +       struct brcmf_pub *drvr = cfg->pub;
1549         const struct brcmf_tlv *ssid_ie;
1550         const struct brcmf_tlv *country_ie;
1551         struct brcmf_ssid_le ssid_le;
1552 @@ -4523,7 +4553,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1553                         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
1554                                                     is_11d);
1555                         if (err < 0) {
1556 -                               bphy_err(wiphy, "Regulatory Set Error, %d\n",
1557 +                               bphy_err(drvr, "Regulatory Set Error, %d\n",
1558                                          err);
1559                                 goto exit;
1560                         }
1561 @@ -4532,7 +4562,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1562                         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
1563                                                     settings->beacon_interval);
1564                         if (err < 0) {
1565 -                               bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
1566 +                               bphy_err(drvr, "Beacon Interval Set Error, %d\n",
1567                                          err);
1568                                 goto exit;
1569                         }
1570 @@ -4541,7 +4571,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1571                         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
1572                                                     settings->dtim_period);
1573                         if (err < 0) {
1574 -                               bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
1575 +                               bphy_err(drvr, "DTIM Interval Set Error, %d\n",
1576                                          err);
1577                                 goto exit;
1578                         }
1579 @@ -4552,7 +4582,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1580                      !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
1581                         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
1582                         if (err < 0) {
1583 -                               bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
1584 +                               bphy_err(drvr, "BRCMF_C_DOWN error %d\n",
1585                                          err);
1586                                 goto exit;
1587                         }
1588 @@ -4561,7 +4591,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1589  
1590                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
1591                 if (err < 0) {
1592 -                       bphy_err(wiphy, "SET INFRA error %d\n", err);
1593 +                       bphy_err(drvr, "SET INFRA error %d\n", err);
1594                         goto exit;
1595                 }
1596         } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
1597 @@ -4577,7 +4607,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1598  
1599                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
1600                 if (err < 0) {
1601 -                       bphy_err(wiphy, "setting AP mode failed %d\n",
1602 +                       bphy_err(drvr, "setting AP mode failed %d\n",
1603                                  err);
1604                         goto exit;
1605                 }
1606 @@ -4587,14 +4617,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1607                          */
1608                         err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
1609                         if (err < 0) {
1610 -                               bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1611 +                               bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
1612                                          chanspec, err);
1613                                 goto exit;
1614                         }
1615                 }
1616                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
1617                 if (err < 0) {
1618 -                       bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
1619 +                       bphy_err(drvr, "BRCMF_C_UP error (%d)\n", err);
1620                         goto exit;
1621                 }
1622                 /* On DOWN the firmware removes the WEP keys, reconfigure
1623 @@ -4609,14 +4639,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1624                 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1625                                              &join_params, sizeof(join_params));
1626                 if (err < 0) {
1627 -                       bphy_err(wiphy, "SET SSID error (%d)\n", err);
1628 +                       bphy_err(drvr, "SET SSID error (%d)\n", err);
1629                         goto exit;
1630                 }
1631  
1632                 if (settings->hidden_ssid) {
1633                         err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
1634                         if (err) {
1635 -                               bphy_err(wiphy, "closednet error (%d)\n", err);
1636 +                               bphy_err(drvr, "closednet error (%d)\n", err);
1637                                 goto exit;
1638                         }
1639                 }
1640 @@ -4625,14 +4655,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1641         } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
1642                 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
1643                 if (err < 0) {
1644 -                       bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1645 +                       bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
1646                                  chanspec, err);
1647                         goto exit;
1648                 }
1649                 err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
1650                                                 sizeof(ssid_le));
1651                 if (err < 0) {
1652 -                       bphy_err(wiphy, "setting ssid failed %d\n", err);
1653 +                       bphy_err(drvr, "setting ssid failed %d\n", err);
1654                         goto exit;
1655                 }
1656                 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
1657 @@ -4640,7 +4670,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1658                 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1659                                                sizeof(bss_enable));
1660                 if (err < 0) {
1661 -                       bphy_err(wiphy, "bss_enable config failed %d\n", err);
1662 +                       bphy_err(drvr, "bss_enable config failed %d\n", err);
1663                         goto exit;
1664                 }
1665  
1666 @@ -4663,7 +4693,9 @@ exit:
1667  
1668  static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
1669  {
1670 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1671         struct brcmf_if *ifp = netdev_priv(ndev);
1672 +       struct brcmf_pub *drvr = cfg->pub;
1673         s32 err;
1674         struct brcmf_fil_bss_enable_le bss_enable;
1675         struct brcmf_join_params join_params;
1676 @@ -4688,13 +4720,13 @@ static int brcmf_cfg80211_stop_ap(struct
1677                 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1678                                              &join_params, sizeof(join_params));
1679                 if (err < 0)
1680 -                       bphy_err(wiphy, "SET SSID error (%d)\n", err);
1681 +                       bphy_err(drvr, "SET SSID error (%d)\n", err);
1682                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
1683                 if (err < 0)
1684 -                       bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err);
1685 +                       bphy_err(drvr, "BRCMF_C_DOWN error %d\n", err);
1686                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
1687                 if (err < 0)
1688 -                       bphy_err(wiphy, "setting AP mode failed %d\n", err);
1689 +                       bphy_err(drvr, "setting AP mode failed %d\n", err);
1690                 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
1691                         brcmf_fil_iovar_int_set(ifp, "mbss", 0);
1692                 brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
1693 @@ -4702,7 +4734,7 @@ static int brcmf_cfg80211_stop_ap(struct
1694                 /* Bring device back up so it can be used again */
1695                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
1696                 if (err < 0)
1697 -                       bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
1698 +                       bphy_err(drvr, "BRCMF_C_UP error %d\n", err);
1699  
1700                 brcmf_vif_clear_mgmt_ies(ifp->vif);
1701         } else {
1702 @@ -4711,7 +4743,7 @@ static int brcmf_cfg80211_stop_ap(struct
1703                 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1704                                                sizeof(bss_enable));
1705                 if (err < 0)
1706 -                       bphy_err(wiphy, "bss_enable config failed %d\n", err);
1707 +                       bphy_err(drvr, "bss_enable config failed %d\n", err);
1708         }
1709         brcmf_set_mpc(ifp, 1);
1710         brcmf_configure_arp_nd_offload(ifp, true);
1711 @@ -4740,6 +4772,7 @@ brcmf_cfg80211_del_station(struct wiphy
1712                            struct station_del_parameters *params)
1713  {
1714         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1715 +       struct brcmf_pub *drvr = cfg->pub;
1716         struct brcmf_scb_val_le scbval;
1717         struct brcmf_if *ifp = netdev_priv(ndev);
1718         s32 err;
1719 @@ -4759,7 +4792,7 @@ brcmf_cfg80211_del_station(struct wiphy
1720         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
1721                                      &scbval, sizeof(scbval));
1722         if (err)
1723 -               bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
1724 +               bphy_err(drvr, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
1725                          err);
1726  
1727         brcmf_dbg(TRACE, "Exit\n");
1728 @@ -4770,6 +4803,8 @@ static int
1729  brcmf_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev,
1730                               const u8 *mac, struct station_parameters *params)
1731  {
1732 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1733 +       struct brcmf_pub *drvr = cfg->pub;
1734         struct brcmf_if *ifp = netdev_priv(ndev);
1735         s32 err;
1736  
1737 @@ -4790,7 +4825,7 @@ brcmf_cfg80211_change_station(struct wip
1738                 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
1739                                              (void *)mac, ETH_ALEN);
1740         if (err < 0)
1741 -               bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
1742 +               bphy_err(drvr, "Setting SCB (de-)authorize failed, %d\n", err);
1743  
1744         return err;
1745  }
1746 @@ -4820,6 +4855,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1747  {
1748         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1749         struct ieee80211_channel *chan = params->chan;
1750 +       struct brcmf_pub *drvr = cfg->pub;
1751         const u8 *buf = params->buf;
1752         size_t len = params->len;
1753         const struct ieee80211_mgmt *mgmt;
1754 @@ -4840,7 +4876,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1755         mgmt = (const struct ieee80211_mgmt *)buf;
1756  
1757         if (!ieee80211_is_mgmt(mgmt->frame_control)) {
1758 -               bphy_err(wiphy, "Driver only allows MGMT packet type\n");
1759 +               bphy_err(drvr, "Driver only allows MGMT packet type\n");
1760                 return -EPERM;
1761         }
1762  
1763 @@ -4871,13 +4907,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1764                                         GFP_KERNEL);
1765         } else if (ieee80211_is_action(mgmt->frame_control)) {
1766                 if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
1767 -                       bphy_err(wiphy, "invalid action frame length\n");
1768 +                       bphy_err(drvr, "invalid action frame length\n");
1769                         err = -EINVAL;
1770                         goto exit;
1771                 }
1772                 af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
1773                 if (af_params == NULL) {
1774 -                       bphy_err(wiphy, "unable to allocate frame\n");
1775 +                       bphy_err(drvr, "unable to allocate frame\n");
1776                         err = -ENOMEM;
1777                         goto exit;
1778                 }
1779 @@ -4928,6 +4964,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
1780                                         u64 cookie)
1781  {
1782         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1783 +       struct brcmf_pub *drvr = cfg->pub;
1784         struct brcmf_cfg80211_vif *vif;
1785         int err = 0;
1786  
1787 @@ -4935,7 +4972,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
1788  
1789         vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
1790         if (vif == NULL) {
1791 -               bphy_err(wiphy, "No p2p device available for probe response\n");
1792 +               bphy_err(drvr, "No p2p device available for probe response\n");
1793                 err = -ENODEV;
1794                 goto exit;
1795         }
1796 @@ -4950,6 +4987,7 @@ static int brcmf_cfg80211_get_channel(st
1797  {
1798         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1799         struct net_device *ndev = wdev->netdev;
1800 +       struct brcmf_pub *drvr = cfg->pub;
1801         struct brcmf_if *ifp;
1802         struct brcmu_chan ch;
1803         enum nl80211_band band = 0;
1804 @@ -4963,7 +5001,7 @@ static int brcmf_cfg80211_get_channel(st
1805  
1806         err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
1807         if (err) {
1808 -               bphy_err(wiphy, "chanspec failed (%d)\n", err);
1809 +               bphy_err(drvr, "chanspec failed (%d)\n", err);
1810                 return err;
1811         }
1812  
1813 @@ -5085,6 +5123,8 @@ static int brcmf_cfg80211_tdls_oper(stru
1814                                     struct net_device *ndev, const u8 *peer,
1815                                     enum nl80211_tdls_operation oper)
1816  {
1817 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1818 +       struct brcmf_pub *drvr = cfg->pub;
1819         struct brcmf_if *ifp;
1820         struct brcmf_tdls_iovar_le info;
1821         int ret = 0;
1822 @@ -5102,7 +5142,7 @@ static int brcmf_cfg80211_tdls_oper(stru
1823         ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
1824                                        &info, sizeof(info));
1825         if (ret < 0)
1826 -               bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
1827 +               bphy_err(drvr, "tdls_endpoint iovar failed: ret=%d\n", ret);
1828  
1829         return ret;
1830  }
1831 @@ -5113,6 +5153,8 @@ brcmf_cfg80211_update_conn_params(struct
1832                                   struct cfg80211_connect_params *sme,
1833                                   u32 changed)
1834  {
1835 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1836 +       struct brcmf_pub *drvr = cfg->pub;
1837         struct brcmf_if *ifp;
1838         int err;
1839  
1840 @@ -5123,7 +5165,7 @@ brcmf_cfg80211_update_conn_params(struct
1841         err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
1842                                     sme->ie, sme->ie_len);
1843         if (err)
1844 -               bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
1845 +               bphy_err(drvr, "Set Assoc REQ IE Failed\n");
1846         else
1847                 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
1848  
1849 @@ -5135,6 +5177,8 @@ static int
1850  brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
1851                               struct cfg80211_gtk_rekey_data *gtk)
1852  {
1853 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1854 +       struct brcmf_pub *drvr = cfg->pub;
1855         struct brcmf_if *ifp = netdev_priv(ndev);
1856         struct brcmf_gtk_keyinfo_le gtk_le;
1857         int ret;
1858 @@ -5149,7 +5193,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
1859         ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
1860                                        sizeof(gtk_le));
1861         if (ret < 0)
1862 -               bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret);
1863 +               bphy_err(drvr, "gtk_key_info iovar failed: ret=%d\n", ret);
1864  
1865         return ret;
1866  }
1867 @@ -5381,7 +5425,7 @@ static void brcmf_clear_assoc_ies(struct
1868  static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
1869                                struct brcmf_if *ifp)
1870  {
1871 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1872 +       struct brcmf_pub *drvr = cfg->pub;
1873         struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
1874         struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
1875         u32 req_len;
1876 @@ -5393,7 +5437,7 @@ static s32 brcmf_get_assoc_ies(struct br
1877         err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
1878                                        cfg->extra_buf, WL_ASSOC_INFO_MAX);
1879         if (err) {
1880 -               bphy_err(wiphy, "could not get assoc info (%d)\n", err);
1881 +               bphy_err(drvr, "could not get assoc info (%d)\n", err);
1882                 return err;
1883         }
1884         assoc_info =
1885 @@ -5405,7 +5449,7 @@ static s32 brcmf_get_assoc_ies(struct br
1886                                                cfg->extra_buf,
1887                                                WL_ASSOC_INFO_MAX);
1888                 if (err) {
1889 -                       bphy_err(wiphy, "could not get assoc req (%d)\n", err);
1890 +                       bphy_err(drvr, "could not get assoc req (%d)\n", err);
1891                         return err;
1892                 }
1893                 conn_info->req_ie_len = req_len;
1894 @@ -5421,7 +5465,7 @@ static s32 brcmf_get_assoc_ies(struct br
1895                                                cfg->extra_buf,
1896                                                WL_ASSOC_INFO_MAX);
1897                 if (err) {
1898 -                       bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
1899 +                       bphy_err(drvr, "could not get assoc resp (%d)\n", err);
1900                         return err;
1901                 }
1902                 conn_info->resp_ie_len = resp_len;
1903 @@ -5548,7 +5592,7 @@ brcmf_notify_connect_status_ap(struct br
1904                                struct net_device *ndev,
1905                                const struct brcmf_event_msg *e, void *data)
1906  {
1907 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1908 +       struct brcmf_pub *drvr = cfg->pub;
1909         static int generation;
1910         u32 event = e->event_code;
1911         u32 reason = e->reason;
1912 @@ -5566,7 +5610,7 @@ brcmf_notify_connect_status_ap(struct br
1913         if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) &&
1914             (reason == BRCMF_E_STATUS_SUCCESS)) {
1915                 if (!data) {
1916 -                       bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
1917 +                       bphy_err(drvr, "No IEs present in ASSOC/REASSOC_IND\n");
1918                         return -EINVAL;
1919                 }
1920  
1921 @@ -5858,7 +5902,7 @@ static void init_vif_event(struct brcmf_
1922  
1923  static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
1924  {
1925 -       struct wiphy *wiphy = ifp->drvr->wiphy;
1926 +       struct brcmf_pub *drvr = ifp->drvr;
1927         s32 err;
1928         u32 bcn_timeout;
1929         __le32 roamtrigger[2];
1930 @@ -5871,7 +5915,7 @@ static s32 brcmf_dongle_roam(struct brcm
1931                 bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
1932         err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
1933         if (err) {
1934 -               bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
1935 +               bphy_err(drvr, "bcn_timeout error (%d)\n", err);
1936                 goto roam_setup_done;
1937         }
1938  
1939 @@ -5883,7 +5927,7 @@ static s32 brcmf_dongle_roam(struct brcm
1940         err = brcmf_fil_iovar_int_set(ifp, "roam_off",
1941                                       ifp->drvr->settings->roamoff);
1942         if (err) {
1943 -               bphy_err(wiphy, "roam_off error (%d)\n", err);
1944 +               bphy_err(drvr, "roam_off error (%d)\n", err);
1945                 goto roam_setup_done;
1946         }
1947  
1948 @@ -5892,7 +5936,7 @@ static s32 brcmf_dongle_roam(struct brcm
1949         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
1950                                      (void *)roamtrigger, sizeof(roamtrigger));
1951         if (err) {
1952 -               bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
1953 +               bphy_err(drvr, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
1954                 goto roam_setup_done;
1955         }
1956  
1957 @@ -5901,7 +5945,7 @@ static s32 brcmf_dongle_roam(struct brcm
1958         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
1959                                      (void *)roam_delta, sizeof(roam_delta));
1960         if (err) {
1961 -               bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err);
1962 +               bphy_err(drvr, "WLC_SET_ROAM_DELTA error (%d)\n", err);
1963                 goto roam_setup_done;
1964         }
1965  
1966 @@ -5912,26 +5956,26 @@ roam_setup_done:
1967  static s32
1968  brcmf_dongle_scantime(struct brcmf_if *ifp)
1969  {
1970 -       struct wiphy *wiphy = ifp->drvr->wiphy;
1971 +       struct brcmf_pub *drvr = ifp->drvr;
1972         s32 err = 0;
1973  
1974         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
1975                                     BRCMF_SCAN_CHANNEL_TIME);
1976         if (err) {
1977 -               bphy_err(wiphy, "Scan assoc time error (%d)\n", err);
1978 +               bphy_err(drvr, "Scan assoc time error (%d)\n", err);
1979                 goto dongle_scantime_out;
1980         }
1981         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
1982                                     BRCMF_SCAN_UNASSOC_TIME);
1983         if (err) {
1984 -               bphy_err(wiphy, "Scan unassoc time error (%d)\n", err);
1985 +               bphy_err(drvr, "Scan unassoc time error (%d)\n", err);
1986                 goto dongle_scantime_out;
1987         }
1988  
1989         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
1990                                     BRCMF_SCAN_PASSIVE_TIME);
1991         if (err) {
1992 -               bphy_err(wiphy, "Scan passive time error (%d)\n", err);
1993 +               bphy_err(drvr, "Scan passive time error (%d)\n", err);
1994                 goto dongle_scantime_out;
1995         }
1996  
1997 @@ -5964,7 +6008,8 @@ static int brcmf_construct_chaninfo(stru
1998                                     u32 bw_cap[])
1999  {
2000         struct wiphy *wiphy = cfg_to_wiphy(cfg);
2001 -       struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
2002 +       struct brcmf_pub *drvr = cfg->pub;
2003 +       struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
2004         struct ieee80211_supported_band *band;
2005         struct ieee80211_channel *channel;
2006         struct brcmf_chanspec_list *list;
2007 @@ -5985,7 +6030,7 @@ static int brcmf_construct_chaninfo(stru
2008         err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
2009                                        BRCMF_DCMD_MEDLEN);
2010         if (err) {
2011 -               bphy_err(wiphy, "get chanspecs error (%d)\n", err);
2012 +               bphy_err(drvr, "get chanspecs error (%d)\n", err);
2013                 goto fail_pbuf;
2014         }
2015  
2016 @@ -6008,7 +6053,7 @@ static int brcmf_construct_chaninfo(stru
2017                 } else if (ch.band == BRCMU_CHAN_BAND_5G) {
2018                         band = wiphy->bands[NL80211_BAND_5GHZ];
2019                 } else {
2020 -                       bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
2021 +                       bphy_err(drvr, "Invalid channel Spec. 0x%x.\n",
2022                                  ch.chspec);
2023                         continue;
2024                 }
2025 @@ -6032,7 +6077,7 @@ static int brcmf_construct_chaninfo(stru
2026                         /* It seems firmware supports some channel we never
2027                          * considered. Something new in IEEE standard?
2028                          */
2029 -                       bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n",
2030 +                       bphy_err(drvr, "Ignoring unexpected firmware channel %d\n",
2031                                  ch.control_ch_num);
2032                         continue;
2033                 }
2034 @@ -6089,8 +6134,8 @@ fail_pbuf:
2035  
2036  static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
2037  {
2038 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
2039 -       struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
2040 +       struct brcmf_pub *drvr = cfg->pub;
2041 +       struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
2042         struct ieee80211_supported_band *band;
2043         struct brcmf_fil_bwcap_le band_bwcap;
2044         struct brcmf_chanspec_list *list;
2045 @@ -6136,7 +6181,7 @@ static int brcmf_enable_bw40_2g(struct b
2046                 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
2047                                                BRCMF_DCMD_MEDLEN);
2048                 if (err) {
2049 -                       bphy_err(wiphy, "get chanspecs error (%d)\n", err);
2050 +                       bphy_err(drvr, "get chanspecs error (%d)\n", err);
2051                         kfree(pbuf);
2052                         return err;
2053                 }
2054 @@ -6167,7 +6212,7 @@ static int brcmf_enable_bw40_2g(struct b
2055  
2056  static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
2057  {
2058 -       struct wiphy *wiphy = ifp->drvr->wiphy;
2059 +       struct brcmf_pub *drvr = ifp->drvr;
2060         u32 band, mimo_bwcap;
2061         int err;
2062  
2063 @@ -6203,7 +6248,7 @@ static void brcmf_get_bwcap(struct brcmf
2064                 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
2065                 break;
2066         default:
2067 -               bphy_err(wiphy, "invalid mimo_bw_cap value\n");
2068 +               bphy_err(drvr, "invalid mimo_bw_cap value\n");
2069         }
2070  }
2071  
2072 @@ -6278,7 +6323,8 @@ static void brcmf_update_vht_cap(struct
2073  
2074  static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
2075  {
2076 -       struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
2077 +       struct brcmf_pub *drvr = cfg->pub;
2078 +       struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
2079         struct wiphy *wiphy = cfg_to_wiphy(cfg);
2080         u32 nmode = 0;
2081         u32 vhtmode = 0;
2082 @@ -6295,7 +6341,7 @@ static int brcmf_setup_wiphybands(struct
2083         (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
2084         err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
2085         if (err) {
2086 -               bphy_err(wiphy, "nmode error (%d)\n", err);
2087 +               bphy_err(drvr, "nmode error (%d)\n", err);
2088         } else {
2089                 brcmf_get_bwcap(ifp, bw_cap);
2090         }
2091 @@ -6305,7 +6351,7 @@ static int brcmf_setup_wiphybands(struct
2092  
2093         err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
2094         if (err) {
2095 -               bphy_err(wiphy, "rxchain error (%d)\n", err);
2096 +               bphy_err(drvr, "rxchain error (%d)\n", err);
2097                 nchain = 1;
2098         } else {
2099                 for (nchain = 0; rxchain; nchain++)
2100 @@ -6315,7 +6361,7 @@ static int brcmf_setup_wiphybands(struct
2101  
2102         err = brcmf_construct_chaninfo(cfg, bw_cap);
2103         if (err) {
2104 -               bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
2105 +               bphy_err(drvr, "brcmf_construct_chaninfo failed (%d)\n", err);
2106                 return err;
2107         }
2108  
2109 @@ -6522,12 +6568,13 @@ static void brcmf_wiphy_wowl_params(stru
2110  {
2111  #ifdef CONFIG_PM
2112         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2113 +       struct brcmf_pub *drvr = cfg->pub;
2114         struct wiphy_wowlan_support *wowl;
2115  
2116         wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
2117                        GFP_KERNEL);
2118         if (!wowl) {
2119 -               bphy_err(wiphy, "only support basic wowlan features\n");
2120 +               bphy_err(drvr, "only support basic wowlan features\n");
2121                 wiphy->wowlan = &brcmf_wowlan_support;
2122                 return;
2123         }
2124 @@ -6624,7 +6671,7 @@ static int brcmf_setup_wiphy(struct wiph
2125         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
2126                                      sizeof(bandlist));
2127         if (err) {
2128 -               bphy_err(wiphy, "could not obtain band info: err=%d\n", err);
2129 +               bphy_err(drvr, "could not obtain band info: err=%d\n", err);
2130                 return err;
2131         }
2132         /* first entry in bandlist is number of bands */
2133 @@ -6673,7 +6720,7 @@ static int brcmf_setup_wiphy(struct wiph
2134  
2135  static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
2136  {
2137 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
2138 +       struct brcmf_pub *drvr = cfg->pub;
2139         struct net_device *ndev;
2140         struct wireless_dev *wdev;
2141         struct brcmf_if *ifp;
2142 @@ -6711,7 +6758,7 @@ static s32 brcmf_config_dongle(struct br
2143  
2144         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
2145         if (err) {
2146 -               bphy_err(wiphy, "failed to set frameburst mode\n");
2147 +               bphy_err(drvr, "failed to set frameburst mode\n");
2148                 goto default_conf_out;
2149         }
2150  
2151 @@ -6892,6 +6939,7 @@ static void brcmf_cfg80211_reg_notifier(
2152  {
2153         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2154         struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
2155 +       struct brcmf_pub *drvr = cfg->pub;
2156         struct brcmf_fil_country_le ccreq;
2157         s32 err;
2158         int i;
2159 @@ -6903,7 +6951,7 @@ static void brcmf_cfg80211_reg_notifier(
2160         /* ignore non-ISO3166 country codes */
2161         for (i = 0; i < 2; i++)
2162                 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
2163 -                       bphy_err(wiphy, "not an ISO3166 code (0x%02x 0x%02x)\n",
2164 +                       bphy_err(drvr, "not an ISO3166 code (0x%02x 0x%02x)\n",
2165                                  req->alpha2[0], req->alpha2[1]);
2166                         return;
2167                 }
2168 @@ -6913,7 +6961,7 @@ static void brcmf_cfg80211_reg_notifier(
2169  
2170         err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
2171         if (err) {
2172 -               bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
2173 +               bphy_err(drvr, "Country code iovar returned err = %d\n", err);
2174                 return;
2175         }
2176  
2177 @@ -6923,7 +6971,7 @@ static void brcmf_cfg80211_reg_notifier(
2178  
2179         err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
2180         if (err) {
2181 -               bphy_err(wiphy, "Firmware rejected country setting\n");
2182 +               bphy_err(drvr, "Firmware rejected country setting\n");
2183                 return;
2184         }
2185         brcmf_setup_wiphybands(cfg);
2186 @@ -6969,13 +7017,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2187         u16 *cap = NULL;
2188  
2189         if (!ndev) {
2190 -               bphy_err(wiphy, "ndev is invalid\n");
2191 +               bphy_err(drvr, "ndev is invalid\n");
2192                 return NULL;
2193         }
2194  
2195         cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
2196         if (!cfg) {
2197 -               bphy_err(wiphy, "Could not allocate wiphy device\n");
2198 +               bphy_err(drvr, "Could not allocate wiphy device\n");
2199                 return NULL;
2200         }
2201  
2202 @@ -6996,7 +7044,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2203  
2204         err = wl_init_priv(cfg);
2205         if (err) {
2206 -               bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err);
2207 +               bphy_err(drvr, "Failed to init iwm_priv (%d)\n", err);
2208                 brcmf_free_vif(vif);
2209                 goto wiphy_out;
2210         }
2211 @@ -7005,7 +7053,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2212         /* determine d11 io type before wiphy setup */
2213         err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
2214         if (err) {
2215 -               bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
2216 +               bphy_err(drvr, "Failed to get D11 version (%d)\n", err);
2217                 goto priv_out;
2218         }
2219         cfg->d11inf.io_type = (u8)io_type;
2220 @@ -7039,13 +7087,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2221  #endif
2222         err = wiphy_register(wiphy);
2223         if (err < 0) {
2224 -               bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
2225 +               bphy_err(drvr, "Could not register wiphy device (%d)\n", err);
2226                 goto priv_out;
2227         }
2228  
2229         err = brcmf_setup_wiphybands(cfg);
2230         if (err) {
2231 -               bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err);
2232 +               bphy_err(drvr, "Setting wiphy bands failed (%d)\n", err);
2233                 goto wiphy_unreg_out;
2234         }
2235  
2236 @@ -7063,24 +7111,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2237  
2238         err = brcmf_fweh_activate_events(ifp);
2239         if (err) {
2240 -               bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
2241 +               bphy_err(drvr, "FWEH activation failed (%d)\n", err);
2242                 goto wiphy_unreg_out;
2243         }
2244  
2245         err = brcmf_p2p_attach(cfg, p2pdev_forced);
2246         if (err) {
2247 -               bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
2248 +               bphy_err(drvr, "P2P initialisation failed (%d)\n", err);
2249                 goto wiphy_unreg_out;
2250         }
2251         err = brcmf_btcoex_attach(cfg);
2252         if (err) {
2253 -               bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err);
2254 +               bphy_err(drvr, "BT-coex initialisation failed (%d)\n", err);
2255                 brcmf_p2p_detach(&cfg->p2p);
2256                 goto wiphy_unreg_out;
2257         }
2258         err = brcmf_pno_attach(cfg);
2259         if (err) {
2260 -               bphy_err(wiphy, "PNO initialisation failed (%d)\n", err);
2261 +               bphy_err(drvr, "PNO initialisation failed (%d)\n", err);
2262                 brcmf_btcoex_detach(cfg);
2263                 brcmf_p2p_detach(&cfg->p2p);
2264                 goto wiphy_unreg_out;
2265 @@ -7100,7 +7148,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2266         /* (re-) activate FWEH event handling */
2267         err = brcmf_fweh_activate_events(ifp);
2268         if (err) {
2269 -               bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
2270 +               bphy_err(drvr, "FWEH activation failed (%d)\n", err);
2271                 goto detach;
2272         }
2273  
2274 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
2275 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
2276 @@ -62,12 +62,12 @@ void __brcmf_err(struct brcmf_bus *bus,
2277         } while (0)
2278  #endif
2279  
2280 -#define bphy_err(wiphy, fmt, ...)                                      \
2281 +#define bphy_err(drvr, fmt, ...)                                       \
2282         do {                                                            \
2283                 if (IS_ENABLED(CPTCFG_BRCMDBG) ||                       \
2284                     IS_ENABLED(CPTCFG_BRCM_TRACING) ||                  \
2285                     net_ratelimit())                                    \
2286 -                       wiphy_err(wiphy, "%s: " fmt, __func__,          \
2287 +                       wiphy_err((drvr)->wiphy, "%s: " fmt, __func__,  \
2288                                   ##__VA_ARGS__);                       \
2289         } while (0)
2290