1694b42aa44f8b5effa57e4bb29ddccc65f22394
[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 @@ -550,7 +550,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 @@ -567,7 +567,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 @@ -586,6 +586,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 @@ -611,7 +612,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 @@ -619,7 +620,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 @@ -627,7 +628,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                 goto fail;
99         }
100  
101 @@ -658,13 +659,15 @@ static struct wireless_dev *brcmf_cfg802
102                                                      u32 *flags,
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 @@ -689,7 +692,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 @@ -705,13 +708,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 @@ -789,6 +792,7 @@ static int brcmf_cfg80211_del_ap_iface(s
144         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
145         struct net_device *ndev = wdev->netdev;
146         struct brcmf_if *ifp = netdev_priv(ndev);
147 +       struct brcmf_pub *drvr = cfg->pub;
148         int ret;
149         int err;
150  
151 @@ -796,7 +800,7 @@ static int brcmf_cfg80211_del_ap_iface(s
152  
153         err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
154         if (err) {
155 -               bphy_err(wiphy, "interface_remove failed %d\n", err);
156 +               bphy_err(drvr, "interface_remove failed %d\n", err);
157                 goto err_unarm;
158         }
159  
160 @@ -804,7 +808,7 @@ static int brcmf_cfg80211_del_ap_iface(s
161         ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
162                                             BRCMF_VIF_EVENT_TIMEOUT);
163         if (!ret) {
164 -               bphy_err(wiphy, "timeout occurred\n");
165 +               bphy_err(drvr, "timeout occurred\n");
166                 err = -EIO;
167                 goto err_unarm;
168         }
169 @@ -867,6 +871,7 @@ brcmf_cfg80211_change_iface(struct wiphy
170         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
171         struct brcmf_if *ifp = netdev_priv(ndev);
172         struct brcmf_cfg80211_vif *vif = ifp->vif;
173 +       struct brcmf_pub *drvr = cfg->pub;
174         s32 infra = 0;
175         s32 ap = 0;
176         s32 err = 0;
177 @@ -906,13 +911,13 @@ brcmf_cfg80211_change_iface(struct wiphy
178         }
179         err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
180         if (err) {
181 -               bphy_err(wiphy, "iface validation failed: err=%d\n", err);
182 +               bphy_err(drvr, "iface validation failed: err=%d\n", err);
183                 return err;
184         }
185         switch (type) {
186         case NL80211_IFTYPE_MONITOR:
187         case NL80211_IFTYPE_WDS:
188 -               bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
189 +               bphy_err(drvr, "type (%d) : currently we do not support this type\n",
190                          type);
191                 return -EOPNOTSUPP;
192         case NL80211_IFTYPE_ADHOC:
193 @@ -941,7 +946,7 @@ brcmf_cfg80211_change_iface(struct wiphy
194         } else {
195                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
196                 if (err) {
197 -                       bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
198 +                       bphy_err(drvr, "WLC_SET_INFRA error (%d)\n", err);
199                         err = -EAGAIN;
200                         goto done;
201                 }
202 @@ -1043,7 +1048,7 @@ static s32
203  brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
204                 struct cfg80211_scan_request *request)
205  {
206 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
207 +       struct brcmf_pub *drvr = cfg->pub;
208         s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
209                           offsetof(struct brcmf_escan_params_le, params_le);
210         struct brcmf_escan_params_le *params;
211 @@ -1075,7 +1080,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
212                 if (err == -EBUSY)
213                         brcmf_dbg(INFO, "system busy : escan canceled\n");
214                 else
215 -                       bphy_err(wiphy, "error (%d)\n", err);
216 +                       bphy_err(drvr, "error (%d)\n", err);
217         }
218  
219         kfree(params);
220 @@ -1122,6 +1127,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
221  {
222         struct brcmf_if *ifp = vif->ifp;
223         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
224 +       struct brcmf_pub *drvr = cfg->pub;
225         struct cfg80211_ssid *ssids;
226         u32 passive_scan;
227         bool escan_req;
228 @@ -1133,22 +1139,22 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
229         brcmf_dbg(SCAN, "START ESCAN\n");
230  
231         if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
232 -               bphy_err(wiphy, "Scanning already: status (%lu)\n",
233 +               bphy_err(drvr, "Scanning already: status (%lu)\n",
234                          cfg->scan_status);
235                 return -EAGAIN;
236         }
237         if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
238 -               bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
239 +               bphy_err(drvr, "Scanning being aborted: status (%lu)\n",
240                          cfg->scan_status);
241                 return -EAGAIN;
242         }
243         if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
244 -               bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
245 +               bphy_err(drvr, "Scanning suppressed: status (%lu)\n",
246                          cfg->scan_status);
247                 return -EAGAIN;
248         }
249         if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) {
250 -               bphy_err(wiphy, "Connecting: status (%lu)\n",
251 +               bphy_err(drvr, "Connecting: status (%lu)\n",
252                          ifp->vif->sme_state);
253                 return -EAGAIN;
254         }
255 @@ -1230,6 +1236,8 @@ scan_out:
256  static s32
257  brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
258  {
259 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
260 +       struct brcmf_pub *drvr = cfg->pub;
261         struct brcmf_cfg80211_vif *vif;
262         s32 err = 0;
263  
264 @@ -1241,7 +1249,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
265         err = brcmf_cfg80211_escan(wiphy, vif, request, NULL);
266  
267         if (err)
268 -               bphy_err(wiphy, "scan error (%d)\n", err);
269 +               bphy_err(drvr, "scan error (%d)\n", err);
270  
271         brcmf_dbg(TRACE, "Exit\n");
272         return err;
273 @@ -1250,12 +1258,12 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
274  static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
275  {
276         struct brcmf_if *ifp = netdev_priv(ndev);
277 -       struct wiphy *wiphy = ifp->drvr->wiphy;
278 +       struct brcmf_pub *drvr = ifp->drvr;
279         s32 err = 0;
280  
281         err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
282         if (err)
283 -               bphy_err(wiphy, "Error (%d)\n", err);
284 +               bphy_err(drvr, "Error (%d)\n", err);
285  
286         return err;
287  }
288 @@ -1263,13 +1271,13 @@ static s32 brcmf_set_rts(struct net_devi
289  static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
290  {
291         struct brcmf_if *ifp = netdev_priv(ndev);
292 -       struct wiphy *wiphy = ifp->drvr->wiphy;
293 +       struct brcmf_pub *drvr = ifp->drvr;
294         s32 err = 0;
295  
296         err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
297                                       frag_threshold);
298         if (err)
299 -               bphy_err(wiphy, "Error (%d)\n", err);
300 +               bphy_err(drvr, "Error (%d)\n", err);
301  
302         return err;
303  }
304 @@ -1277,13 +1285,13 @@ static s32 brcmf_set_frag(struct net_dev
305  static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
306  {
307         struct brcmf_if *ifp = netdev_priv(ndev);
308 -       struct wiphy *wiphy = ifp->drvr->wiphy;
309 +       struct brcmf_pub *drvr = ifp->drvr;
310         s32 err = 0;
311         u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
312  
313         err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
314         if (err) {
315 -               bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
316 +               bphy_err(drvr, "cmd (%d) , error (%d)\n", cmd, err);
317                 return err;
318         }
319         return err;
320 @@ -1360,7 +1368,7 @@ static u16 brcmf_map_fw_linkdown_reason(
321  static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
322  {
323         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
324 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
325 +       struct brcmf_pub *drvr = cfg->pub;
326         s32 err = 0;
327  
328         brcmf_dbg(TRACE, "Enter\n");
329 @@ -1370,7 +1378,7 @@ static void brcmf_link_down(struct brcmf
330                 err = brcmf_fil_cmd_data_set(vif->ifp,
331                                              BRCMF_C_DISASSOC, NULL, 0);
332                 if (err) {
333 -                       bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
334 +                       bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err);
335                 }
336                 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
337                     (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
338 @@ -1390,6 +1398,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
339         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
340         struct brcmf_if *ifp = netdev_priv(ndev);
341         struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
342 +       struct brcmf_pub *drvr = cfg->pub;
343         struct brcmf_join_params join_params;
344         size_t join_params_size = 0;
345         s32 err = 0;
346 @@ -1454,7 +1463,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
347  
348         err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
349         if (err) {
350 -               bphy_err(wiphy, "wsec failed (%d)\n", err);
351 +               bphy_err(drvr, "wsec failed (%d)\n", err);
352                 goto done;
353         }
354  
355 @@ -1466,7 +1475,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
356  
357         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
358         if (err) {
359 -               bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
360 +               bphy_err(drvr, "WLC_SET_BCNPRD failed (%d)\n", err);
361                 goto done;
362         }
363  
364 @@ -1511,7 +1520,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
365                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
366                                             target_channel);
367                 if (err) {
368 -                       bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
369 +                       bphy_err(drvr, "WLC_SET_CHANNEL failed (%d)\n", err);
370                         goto done;
371                 }
372         } else
373 @@ -1523,7 +1532,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
374         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
375                                      &join_params, join_params_size);
376         if (err) {
377 -               bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
378 +               bphy_err(drvr, "WLC_SET_SSID failed (%d)\n", err);
379                 goto done;
380         }
381  
382 @@ -1560,8 +1569,8 @@ static s32 brcmf_set_wpa_version(struct
383                                  struct cfg80211_connect_params *sme)
384  {
385         struct brcmf_if *ifp = netdev_priv(ndev);
386 -       struct wiphy *wiphy = ifp->drvr->wiphy;
387         struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
388 +       struct brcmf_pub *drvr = ifp->drvr;
389         struct brcmf_cfg80211_security *sec;
390         s32 val = 0;
391         s32 err = 0;
392 @@ -1575,7 +1584,7 @@ static s32 brcmf_set_wpa_version(struct
393         brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
394         err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
395         if (err) {
396 -               bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
397 +               bphy_err(drvr, "set wpa_auth failed (%d)\n", err);
398                 return err;
399         }
400         sec = &profile->sec;
401 @@ -1587,8 +1596,8 @@ static s32 brcmf_set_auth_type(struct ne
402                                struct cfg80211_connect_params *sme)
403  {
404         struct brcmf_if *ifp = netdev_priv(ndev);
405 -       struct wiphy *wiphy = ifp->drvr->wiphy;
406         struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
407 +       struct brcmf_pub *drvr = ifp->drvr;
408         struct brcmf_cfg80211_security *sec;
409         s32 val = 0;
410         s32 err = 0;
411 @@ -1610,7 +1619,7 @@ static s32 brcmf_set_auth_type(struct ne
412  
413         err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
414         if (err) {
415 -               bphy_err(wiphy, "set auth failed (%d)\n", err);
416 +               bphy_err(drvr, "set auth failed (%d)\n", err);
417                 return err;
418         }
419         sec = &profile->sec;
420 @@ -1623,8 +1632,8 @@ brcmf_set_wsec_mode(struct net_device *n
421                     struct cfg80211_connect_params *sme)
422  {
423         struct brcmf_if *ifp = netdev_priv(ndev);
424 -       struct wiphy *wiphy = ifp->drvr->wiphy;
425         struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
426 +       struct brcmf_pub *drvr = ifp->drvr;
427         struct brcmf_cfg80211_security *sec;
428         s32 pval = 0;
429         s32 gval = 0;
430 @@ -1647,7 +1656,7 @@ brcmf_set_wsec_mode(struct net_device *n
431                         pval = AES_ENABLED;
432                         break;
433                 default:
434 -                       bphy_err(wiphy, "invalid cipher pairwise (%d)\n",
435 +                       bphy_err(drvr, "invalid cipher pairwise (%d)\n",
436                                  sme->crypto.ciphers_pairwise[0]);
437                         return -EINVAL;
438                 }
439 @@ -1668,7 +1677,7 @@ brcmf_set_wsec_mode(struct net_device *n
440                         gval = AES_ENABLED;
441                         break;
442                 default:
443 -                       bphy_err(wiphy, "invalid cipher group (%d)\n",
444 +                       bphy_err(drvr, "invalid cipher group (%d)\n",
445                                  sme->crypto.cipher_group);
446                         return -EINVAL;
447                 }
448 @@ -1684,7 +1693,7 @@ brcmf_set_wsec_mode(struct net_device *n
449         wsec = pval | gval;
450         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
451         if (err) {
452 -               bphy_err(wiphy, "error (%d)\n", err);
453 +               bphy_err(drvr, "error (%d)\n", err);
454                 return err;
455         }
456  
457 @@ -1699,7 +1708,7 @@ static s32
458  brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
459  {
460         struct brcmf_if *ifp = netdev_priv(ndev);
461 -       struct wiphy *wiphy = ifp->drvr->wiphy;
462 +       struct brcmf_pub *drvr = ifp->drvr;
463         s32 val;
464         s32 err;
465         const struct brcmf_tlv *rsn_ie;
466 @@ -1715,7 +1724,7 @@ brcmf_set_key_mgmt(struct net_device *nd
467  
468         err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
469         if (err) {
470 -               bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
471 +               bphy_err(drvr, "could not get wpa_auth (%d)\n", err);
472                 return err;
473         }
474         if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
475 @@ -1727,7 +1736,7 @@ brcmf_set_key_mgmt(struct net_device *nd
476                         val = WPA_AUTH_PSK;
477                         break;
478                 default:
479 -                       bphy_err(wiphy, "invalid cipher group (%d)\n",
480 +                       bphy_err(drvr, "invalid cipher group (%d)\n",
481                                  sme->crypto.cipher_group);
482                         return -EINVAL;
483                 }
484 @@ -1746,7 +1755,7 @@ brcmf_set_key_mgmt(struct net_device *nd
485                         val = WPA2_AUTH_PSK;
486                         break;
487                 default:
488 -                       bphy_err(wiphy, "invalid cipher group (%d)\n",
489 +                       bphy_err(drvr, "invalid cipher group (%d)\n",
490                                  sme->crypto.cipher_group);
491                         return -EINVAL;
492                 }
493 @@ -1790,7 +1799,7 @@ skip_mfp_config:
494         brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
495         err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
496         if (err) {
497 -               bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
498 +               bphy_err(drvr, "could not set wpa_auth (%d)\n", err);
499                 return err;
500         }
501  
502 @@ -1802,7 +1811,7 @@ brcmf_set_sharedkey(struct net_device *n
503                     struct cfg80211_connect_params *sme)
504  {
505         struct brcmf_if *ifp = netdev_priv(ndev);
506 -       struct wiphy *wiphy = ifp->drvr->wiphy;
507 +       struct brcmf_pub *drvr = ifp->drvr;
508         struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
509         struct brcmf_cfg80211_security *sec;
510         struct brcmf_wsec_key key;
511 @@ -1829,7 +1838,7 @@ brcmf_set_sharedkey(struct net_device *n
512         key.len = (u32) sme->key_len;
513         key.index = (u32) sme->key_idx;
514         if (key.len > sizeof(key.data)) {
515 -               bphy_err(wiphy, "Too long key length (%u)\n", key.len);
516 +               bphy_err(drvr, "Too long key length (%u)\n", key.len);
517                 return -EINVAL;
518         }
519         memcpy(key.data, sme->key, key.len);
520 @@ -1842,7 +1851,7 @@ brcmf_set_sharedkey(struct net_device *n
521                 key.algo = CRYPTO_ALGO_WEP128;
522                 break;
523         default:
524 -               bphy_err(wiphy, "Invalid algorithm (%d)\n",
525 +               bphy_err(drvr, "Invalid algorithm (%d)\n",
526                          sme->crypto.ciphers_pairwise[0]);
527                 return -EINVAL;
528         }
529 @@ -1859,7 +1868,7 @@ brcmf_set_sharedkey(struct net_device *n
530                 val = WL_AUTH_SHARED_KEY;       /* shared key */
531                 err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
532                 if (err)
533 -                       bphy_err(wiphy, "set auth failed (%d)\n", err);
534 +                       bphy_err(drvr, "set auth failed (%d)\n", err);
535         }
536         return err;
537  }
538 @@ -1879,7 +1888,7 @@ enum nl80211_auth_type brcmf_war_auth_ty
539  static void brcmf_set_join_pref(struct brcmf_if *ifp,
540                                 struct cfg80211_bss_selection *bss_select)
541  {
542 -       struct wiphy *wiphy = ifp->drvr->wiphy;
543 +       struct brcmf_pub *drvr = ifp->drvr;
544         struct brcmf_join_pref_params join_pref_params[2];
545         enum nl80211_band band;
546         int err, i = 0;
547 @@ -1918,7 +1927,7 @@ static void brcmf_set_join_pref(struct b
548         err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
549                                        sizeof(join_pref_params));
550         if (err)
551 -               bphy_err(wiphy, "Set join_pref error (%d)\n", err);
552 +               bphy_err(drvr, "Set join_pref error (%d)\n", err);
553  }
554  
555  static s32
556 @@ -1928,6 +1937,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
557         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
558         struct brcmf_if *ifp = netdev_priv(ndev);
559         struct ieee80211_channel *chan = sme->channel;
560 +       struct brcmf_pub *drvr = ifp->drvr;
561         struct brcmf_join_params join_params;
562         size_t join_params_size;
563         const struct brcmf_tlv *rsn_ie;
564 @@ -1944,7 +1954,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
565                 return -EIO;
566  
567         if (!sme->ssid) {
568 -               bphy_err(wiphy, "Invalid ssid\n");
569 +               bphy_err(drvr, "Invalid ssid\n");
570                 return -EOPNOTSUPP;
571         }
572  
573 @@ -1973,7 +1983,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
574         err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
575                                     sme->ie, sme->ie_len);
576         if (err)
577 -               bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
578 +               bphy_err(drvr, "Set Assoc REQ IE Failed\n");
579         else
580                 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
581  
582 @@ -1994,32 +2004,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
583  
584         err = brcmf_set_wpa_version(ndev, sme);
585         if (err) {
586 -               bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
587 +               bphy_err(drvr, "wl_set_wpa_version failed (%d)\n", err);
588                 goto done;
589         }
590  
591         sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
592         err = brcmf_set_auth_type(ndev, sme);
593         if (err) {
594 -               bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
595 +               bphy_err(drvr, "wl_set_auth_type failed (%d)\n", err);
596                 goto done;
597         }
598  
599         err = brcmf_set_wsec_mode(ndev, sme);
600         if (err) {
601 -               bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
602 +               bphy_err(drvr, "wl_set_set_cipher failed (%d)\n", err);
603                 goto done;
604         }
605  
606         err = brcmf_set_key_mgmt(ndev, sme);
607         if (err) {
608 -               bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
609 +               bphy_err(drvr, "wl_set_key_mgmt failed (%d)\n", err);
610                 goto done;
611         }
612  
613         err = brcmf_set_sharedkey(ndev, sme);
614         if (err) {
615 -               bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
616 +               bphy_err(drvr, "brcmf_set_sharedkey failed (%d)\n", err);
617                 goto done;
618         }
619  
620 @@ -2106,7 +2116,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
621         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
622                                      &join_params, join_params_size);
623         if (err)
624 -               bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
625 +               bphy_err(drvr, "BRCMF_C_SET_SSID failed (%d)\n", err);
626  
627  done:
628         if (err)
629 @@ -2119,8 +2129,10 @@ static s32
630  brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
631                        u16 reason_code)
632  {
633 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
634         struct brcmf_if *ifp = netdev_priv(ndev);
635         struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
636 +       struct brcmf_pub *drvr = cfg->pub;
637         struct brcmf_scb_val_le scbval;
638         s32 err = 0;
639  
640 @@ -2137,7 +2149,7 @@ brcmf_cfg80211_disconnect(struct wiphy *
641         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
642                                      &scbval, sizeof(scbval));
643         if (err)
644 -               bphy_err(wiphy, "error (%d)\n", err);
645 +               bphy_err(drvr, "error (%d)\n", err);
646  
647         brcmf_dbg(TRACE, "Exit\n");
648         return err;
649 @@ -2150,6 +2162,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
650         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
651         struct net_device *ndev = cfg_to_ndev(cfg);
652         struct brcmf_if *ifp = netdev_priv(ndev);
653 +       struct brcmf_pub *drvr = cfg->pub;
654         s32 err;
655         s32 disable;
656         u32 qdbm = 127;
657 @@ -2164,7 +2177,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
658         case NL80211_TX_POWER_LIMITED:
659         case NL80211_TX_POWER_FIXED:
660                 if (mbm < 0) {
661 -                       bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
662 +                       bphy_err(drvr, "TX_POWER_FIXED - dbm is negative\n");
663                         err = -EINVAL;
664                         goto done;
665                 }
666 @@ -2174,7 +2187,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
667                 qdbm |= WL_TXPWR_OVERRIDE;
668                 break;
669         default:
670 -               bphy_err(wiphy, "Unsupported type %d\n", type);
671 +               bphy_err(drvr, "Unsupported type %d\n", type);
672                 err = -EINVAL;
673                 goto done;
674         }
675 @@ -2182,11 +2195,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy
676         disable = WL_RADIO_SW_DISABLE << 16;
677         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
678         if (err)
679 -               bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
680 +               bphy_err(drvr, "WLC_SET_RADIO error (%d)\n", err);
681  
682         err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
683         if (err)
684 -               bphy_err(wiphy, "qtxpower error (%d)\n", err);
685 +               bphy_err(drvr, "qtxpower error (%d)\n", err);
686  
687  done:
688         brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
689 @@ -2197,7 +2210,9 @@ static s32
690  brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
691                             s32 *dbm)
692  {
693 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
694         struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev);
695 +       struct brcmf_pub *drvr = cfg->pub;
696         s32 qdbm = 0;
697         s32 err;
698  
699 @@ -2207,7 +2222,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
700  
701         err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
702         if (err) {
703 -               bphy_err(wiphy, "error (%d)\n", err);
704 +               bphy_err(drvr, "error (%d)\n", err);
705                 goto done;
706         }
707         *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
708 @@ -2222,6 +2237,7 @@ brcmf_cfg80211_config_default_key(struct
709                                   u8 key_idx, bool unicast, bool multicast)
710  {
711         struct brcmf_if *ifp = netdev_priv(ndev);
712 +       struct brcmf_pub *drvr = ifp->drvr;
713         u32 index;
714         u32 wsec;
715         s32 err = 0;
716 @@ -2233,7 +2249,7 @@ brcmf_cfg80211_config_default_key(struct
717  
718         err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
719         if (err) {
720 -               bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
721 +               bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
722                 goto done;
723         }
724  
725 @@ -2243,7 +2259,7 @@ brcmf_cfg80211_config_default_key(struct
726                 err = brcmf_fil_cmd_int_set(ifp,
727                                             BRCMF_C_SET_KEY_PRIMARY, index);
728                 if (err)
729 -                       bphy_err(wiphy, "error (%d)\n", err);
730 +                       bphy_err(drvr, "error (%d)\n", err);
731         }
732  done:
733         brcmf_dbg(TRACE, "Exit\n");
734 @@ -2292,7 +2308,9 @@ brcmf_cfg80211_add_key(struct wiphy *wip
735                        u8 key_idx, bool pairwise, const u8 *mac_addr,
736                        struct key_params *params)
737  {
738 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
739         struct brcmf_if *ifp = netdev_priv(ndev);
740 +       struct brcmf_pub *drvr = cfg->pub;
741         struct brcmf_wsec_key *key;
742         s32 val;
743         s32 wsec;
744 @@ -2307,7 +2325,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
745  
746         if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
747                 /* we ignore this key index in this case */
748 -               bphy_err(wiphy, "invalid key index (%d)\n", key_idx);
749 +               bphy_err(drvr, "invalid key index (%d)\n", key_idx);
750                 return -EINVAL;
751         }
752  
753 @@ -2316,7 +2334,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
754                                               mac_addr);
755  
756         if (params->key_len > sizeof(key->data)) {
757 -               bphy_err(wiphy, "Too long key length (%u)\n", params->key_len);
758 +               bphy_err(drvr, "Too long key length (%u)\n", params->key_len);
759                 return -EINVAL;
760         }
761  
762 @@ -2370,7 +2388,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
763                 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
764                 break;
765         default:
766 -               bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
767 +               bphy_err(drvr, "Invalid cipher (0x%x)\n", params->cipher);
768                 err = -EINVAL;
769                 goto done;
770         }
771 @@ -2381,13 +2399,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
772  
773         err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
774         if (err) {
775 -               bphy_err(wiphy, "get wsec error (%d)\n", err);
776 +               bphy_err(drvr, "get wsec error (%d)\n", err);
777                 goto done;
778         }
779         wsec |= val;
780         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
781         if (err) {
782 -               bphy_err(wiphy, "set wsec error (%d)\n", err);
783 +               bphy_err(drvr, "set wsec error (%d)\n", err);
784                 goto done;
785         }
786  
787 @@ -2402,9 +2420,11 @@ brcmf_cfg80211_get_key(struct wiphy *wip
788                        void (*callback)(void *cookie,
789                                         struct key_params *params))
790  {
791 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
792         struct key_params params;
793         struct brcmf_if *ifp = netdev_priv(ndev);
794         struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
795 +       struct brcmf_pub *drvr = cfg->pub;
796         struct brcmf_cfg80211_security *sec;
797         s32 wsec;
798         s32 err = 0;
799 @@ -2418,7 +2438,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
800  
801         err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
802         if (err) {
803 -               bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
804 +               bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
805                 /* Ignore this error, may happen during DISASSOC */
806                 err = -EAGAIN;
807                 goto done;
808 @@ -2439,7 +2459,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
809                 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
810                 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
811         } else  {
812 -               bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
813 +               bphy_err(drvr, "Invalid algo (0x%x)\n", wsec);
814                 err = -EINVAL;
815                 goto done;
816         }
817 @@ -2469,7 +2489,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
818  static void
819  brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
820  {
821 -       struct wiphy *wiphy = ifp->drvr->wiphy;
822 +       struct brcmf_pub *drvr = ifp->drvr;
823         s32 err;
824         u8 key_idx;
825         struct brcmf_wsec_key *key;
826 @@ -2486,18 +2506,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
827  
828         err = send_key_to_dongle(ifp, key);
829         if (err) {
830 -               bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
831 +               bphy_err(drvr, "Setting WEP key failed (%d)\n", err);
832                 return;
833         }
834         err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
835         if (err) {
836 -               bphy_err(wiphy, "get wsec error (%d)\n", err);
837 +               bphy_err(drvr, "get wsec error (%d)\n", err);
838                 return;
839         }
840         wsec |= WEP_ENABLED;
841         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
842         if (err)
843 -               bphy_err(wiphy, "set wsec error (%d)\n", err);
844 +               bphy_err(drvr, "set wsec error (%d)\n", err);
845  }
846  
847  static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
848 @@ -2523,7 +2543,7 @@ static void brcmf_convert_sta_flags(u32
849  
850  static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
851  {
852 -       struct wiphy *wiphy = ifp->drvr->wiphy;
853 +       struct brcmf_pub *drvr = ifp->drvr;
854         struct {
855                 __le32 len;
856                 struct brcmf_bss_info_le bss_le;
857 @@ -2539,7 +2559,7 @@ static void brcmf_fill_bss_param(struct
858         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
859                                      WL_BSS_INFO_MAX);
860         if (err) {
861 -               bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
862 +               bphy_err(drvr, "Failed to get bss info (%d)\n", err);
863                 goto out_kfree;
864         }
865         si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
866 @@ -2561,7 +2581,7 @@ static s32
867  brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
868                                 struct station_info *sinfo)
869  {
870 -       struct wiphy *wiphy = ifp->drvr->wiphy;
871 +       struct brcmf_pub *drvr = ifp->drvr;
872         struct brcmf_scb_val_le scbval;
873         struct brcmf_pktcnt_le pktcnt;
874         s32 err;
875 @@ -2571,7 +2591,7 @@ brcmf_cfg80211_get_station_ibss(struct b
876         /* Get the current tx rate */
877         err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
878         if (err < 0) {
879 -               bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
880 +               bphy_err(drvr, "BRCMF_C_GET_RATE error (%d)\n", err);
881                 return err;
882         }
883         sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
884 @@ -2581,7 +2601,7 @@ brcmf_cfg80211_get_station_ibss(struct b
885         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
886                                      sizeof(scbval));
887         if (err) {
888 -               bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
889 +               bphy_err(drvr, "BRCMF_C_GET_RSSI error (%d)\n", err);
890                 return err;
891         }
892         rssi = le32_to_cpu(scbval.val);
893 @@ -2591,7 +2611,7 @@ brcmf_cfg80211_get_station_ibss(struct b
894         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
895                                      sizeof(pktcnt));
896         if (err) {
897 -               bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
898 +               bphy_err(drvr, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
899                 return err;
900         }
901         sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS) |
902 @@ -2610,7 +2630,9 @@ static s32
903  brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
904                            const u8 *mac, struct station_info *sinfo)
905  {
906 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
907         struct brcmf_if *ifp = netdev_priv(ndev);
908 +       struct brcmf_pub *drvr = cfg->pub;
909         struct brcmf_scb_val_le scb_val;
910         s32 err = 0;
911         struct brcmf_sta_info_le sta_info_le;
912 @@ -2639,7 +2661,7 @@ brcmf_cfg80211_get_station(struct wiphy
913                                                &sta_info_le,
914                                                sizeof(sta_info_le));
915                 if (err < 0) {
916 -                       bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
917 +                       bphy_err(drvr, "GET STA INFO failed, %d\n", err);
918                         goto done;
919                 }
920         }
921 @@ -2708,7 +2730,7 @@ brcmf_cfg80211_get_station(struct wiphy
922                         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
923                                                      &scb_val, sizeof(scb_val));
924                         if (err) {
925 -                               bphy_err(wiphy, "Could not get rssi (%d)\n",
926 +                               bphy_err(drvr, "Could not get rssi (%d)\n",
927                                          err);
928                                 goto done;
929                         } else {
930 @@ -2730,6 +2752,7 @@ brcmf_cfg80211_dump_station(struct wiphy
931  {
932         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
933         struct brcmf_if *ifp = netdev_priv(ndev);
934 +       struct brcmf_pub *drvr = cfg->pub;
935         s32 err;
936  
937         brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
938 @@ -2740,7 +2763,7 @@ brcmf_cfg80211_dump_station(struct wiphy
939                                              &cfg->assoclist,
940                                              sizeof(cfg->assoclist));
941                 if (err) {
942 -                       bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
943 +                       bphy_err(drvr, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
944                                  err);
945                         cfg->assoclist.count = 0;
946                         return -EOPNOTSUPP;
947 @@ -2761,6 +2784,7 @@ brcmf_cfg80211_set_power_mgmt(struct wip
948         s32 err = 0;
949         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
950         struct brcmf_if *ifp = netdev_priv(ndev);
951 +       struct brcmf_pub *drvr = cfg->pub;
952  
953         brcmf_dbg(TRACE, "Enter\n");
954  
955 @@ -2789,9 +2813,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip
956         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
957         if (err) {
958                 if (err == -ENODEV)
959 -                       bphy_err(wiphy, "net_device is not ready yet\n");
960 +                       bphy_err(drvr, "net_device is not ready yet\n");
961                 else
962 -                       bphy_err(wiphy, "error (%d)\n", err);
963 +                       bphy_err(drvr, "error (%d)\n", err);
964         }
965  done:
966         brcmf_dbg(TRACE, "Exit\n");
967 @@ -2802,6 +2826,7 @@ static s32 brcmf_inform_single_bss(struc
968                                    struct brcmf_bss_info_le *bi)
969  {
970         struct wiphy *wiphy = cfg_to_wiphy(cfg);
971 +       struct brcmf_pub *drvr = cfg->pub;
972         struct ieee80211_channel *notify_channel;
973         struct cfg80211_bss *bss;
974         struct ieee80211_supported_band *band;
975 @@ -2815,7 +2840,7 @@ static s32 brcmf_inform_single_bss(struc
976         s32 notify_signal;
977  
978         if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
979 -               bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n");
980 +               bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
981                 return 0;
982         }
983  
984 @@ -2873,7 +2898,7 @@ next_bss_le(struct brcmf_scan_results *l
985  
986  static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
987  {
988 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
989 +       struct brcmf_pub *drvr = cfg->pub;
990         struct brcmf_scan_results *bss_list;
991         struct brcmf_bss_info_le *bi = NULL;    /* must be initialized */
992         s32 err = 0;
993 @@ -2882,7 +2907,7 @@ static s32 brcmf_inform_bss(struct brcmf
994         bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
995         if (bss_list->count != 0 &&
996             bss_list->version != BRCMF_BSS_INFO_VERSION) {
997 -               bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n",
998 +               bphy_err(drvr, "Version %d != WL_BSS_INFO_VERSION\n",
999                          bss_list->version);
1000                 return -EOPNOTSUPP;
1001         }
1002 @@ -2900,6 +2925,7 @@ static s32 brcmf_inform_ibss(struct brcm
1003                              struct net_device *ndev, const u8 *bssid)
1004  {
1005         struct wiphy *wiphy = cfg_to_wiphy(cfg);
1006 +       struct brcmf_pub *drvr = cfg->pub;
1007         struct ieee80211_channel *notify_channel;
1008         struct brcmf_bss_info_le *bi = NULL;
1009         struct ieee80211_supported_band *band;
1010 @@ -2927,7 +2953,7 @@ static s32 brcmf_inform_ibss(struct brcm
1011         err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
1012                                      buf, WL_BSS_INFO_MAX);
1013         if (err) {
1014 -               bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
1015 +               bphy_err(drvr, "WLC_GET_BSS_INFO failed: %d\n", err);
1016                 goto CleanUp;
1017         }
1018  
1019 @@ -2981,7 +3007,7 @@ CleanUp:
1020  static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
1021                                  struct brcmf_if *ifp)
1022  {
1023 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1024 +       struct brcmf_pub *drvr = cfg->pub;
1025         struct brcmf_bss_info_le *bi;
1026         const struct brcmf_tlv *tim;
1027         u16 beacon_interval;
1028 @@ -2998,7 +3024,7 @@ static s32 brcmf_update_bss_info(struct
1029         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
1030                                      cfg->extra_buf, WL_EXTRA_BUF_MAX);
1031         if (err) {
1032 -               bphy_err(wiphy, "Could not get bss info %d\n", err);
1033 +               bphy_err(drvr, "Could not get bss info %d\n", err);
1034                 goto update_bss_info_out;
1035         }
1036  
1037 @@ -3023,7 +3049,7 @@ static s32 brcmf_update_bss_info(struct
1038                 u32 var;
1039                 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
1040                 if (err) {
1041 -                       bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err);
1042 +                       bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err);
1043                         goto update_bss_info_out;
1044                 }
1045                 dtim_period = (u8)var;
1046 @@ -3061,10 +3087,10 @@ static void brcmf_escan_timeout(unsigned
1047  {
1048         struct brcmf_cfg80211_info *cfg =
1049                         (struct brcmf_cfg80211_info *)data;
1050 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1051 +       struct brcmf_pub *drvr = cfg->pub;
1052  
1053         if (cfg->internal_escan || cfg->scan_request) {
1054 -               bphy_err(wiphy, "timer expired\n");
1055 +               bphy_err(drvr, "timer expired\n");
1056                 schedule_work(&cfg->escan_timeout_work);
1057         }
1058  }
1059 @@ -3112,8 +3138,8 @@ static s32
1060  brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
1061                              const struct brcmf_event_msg *e, void *data)
1062  {
1063 -       struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1064 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1065 +       struct brcmf_pub *drvr = ifp->drvr;
1066 +       struct brcmf_cfg80211_info *cfg = drvr->config;
1067         s32 status;
1068         struct brcmf_escan_result_le *escan_result_le;
1069         u32 escan_buflen;
1070 @@ -3130,7 +3156,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1071                 goto exit;
1072  
1073         if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
1074 -               bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n",
1075 +               bphy_err(drvr, "scan not ready, bsscfgidx=%d\n",
1076                          ifp->bsscfgidx);
1077                 return -EPERM;
1078         }
1079 @@ -3138,24 +3164,24 @@ brcmf_cfg80211_escan_handler(struct brcm
1080         if (status == BRCMF_E_STATUS_PARTIAL) {
1081                 brcmf_dbg(SCAN, "ESCAN Partial result\n");
1082                 if (e->datalen < sizeof(*escan_result_le)) {
1083 -                       bphy_err(wiphy, "invalid event data length\n");
1084 +                       bphy_err(drvr, "invalid event data length\n");
1085                         goto exit;
1086                 }
1087                 escan_result_le = (struct brcmf_escan_result_le *) data;
1088                 if (!escan_result_le) {
1089 -                       bphy_err(wiphy, "Invalid escan result (NULL pointer)\n");
1090 +                       bphy_err(drvr, "Invalid escan result (NULL pointer)\n");
1091                         goto exit;
1092                 }
1093                 escan_buflen = le32_to_cpu(escan_result_le->buflen);
1094                 if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
1095                     escan_buflen > e->datalen ||
1096                     escan_buflen < sizeof(*escan_result_le)) {
1097 -                       bphy_err(wiphy, "Invalid escan buffer length: %d\n",
1098 +                       bphy_err(drvr, "Invalid escan buffer length: %d\n",
1099                                  escan_buflen);
1100                         goto exit;
1101                 }
1102                 if (le16_to_cpu(escan_result_le->bss_count) != 1) {
1103 -                       bphy_err(wiphy, "Invalid bss_count %d: ignoring\n",
1104 +                       bphy_err(drvr, "Invalid bss_count %d: ignoring\n",
1105                                  escan_result_le->bss_count);
1106                         goto exit;
1107                 }
1108 @@ -3171,7 +3197,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1109  
1110                 bi_length = le32_to_cpu(bss_info_le->length);
1111                 if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
1112 -                       bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
1113 +                       bphy_err(drvr, "Ignoring invalid bss_info length: %d\n",
1114                                  bi_length);
1115                         goto exit;
1116                 }
1117 @@ -3180,7 +3206,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1118                                         BIT(NL80211_IFTYPE_ADHOC))) {
1119                         if (le16_to_cpu(bss_info_le->capability) &
1120                                                 WLAN_CAPABILITY_IBSS) {
1121 -                               bphy_err(wiphy, "Ignoring IBSS result\n");
1122 +                               bphy_err(drvr, "Ignoring IBSS result\n");
1123                                 goto exit;
1124                         }
1125                 }
1126 @@ -3188,7 +3214,7 @@ brcmf_cfg80211_escan_handler(struct brcm
1127                 list = (struct brcmf_scan_results *)
1128                                 cfg->escan_info.escan_buf;
1129                 if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
1130 -                       bphy_err(wiphy, "Buffer is too small: ignoring\n");
1131 +                       bphy_err(drvr, "Buffer is too small: ignoring\n");
1132                         goto exit;
1133                 }
1134  
1135 @@ -3345,7 +3371,8 @@ static s32
1136  brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
1137                                 const struct brcmf_event_msg *e, void *data)
1138  {
1139 -       struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1140 +       struct brcmf_pub *drvr = ifp->drvr;
1141 +       struct brcmf_cfg80211_info *cfg = drvr->config;
1142         struct brcmf_pno_net_info_le *netinfo, *netinfo_start;
1143         struct cfg80211_scan_request *request = NULL;
1144         struct wiphy *wiphy = cfg_to_wiphy(cfg);
1145 @@ -3377,14 +3404,14 @@ brcmf_notify_sched_scan_results(struct b
1146         WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
1147         brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
1148         if (!result_count) {
1149 -               bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n");
1150 +               bphy_err(drvr, "FALSE PNO Event. (pfn_count == 0)\n");
1151                 goto out_err;
1152         }
1153  
1154         netinfo_start = brcmf_get_netinfo_array(pfn_result);
1155         datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
1156         if (datalen < result_count * sizeof(*netinfo)) {
1157 -               bphy_err(wiphy, "insufficient event data\n");
1158 +               bphy_err(drvr, "insufficient event data\n");
1159                 goto out_err;
1160         }
1161  
1162 @@ -3428,12 +3455,13 @@ brcmf_cfg80211_sched_scan_start(struct w
1163  {
1164         struct brcmf_if *ifp = netdev_priv(ndev);
1165         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1166 +       struct brcmf_pub *drvr = cfg->pub;
1167  
1168         brcmf_dbg(SCAN, "Enter n_match_sets:%d n_ssids:%d\n",
1169                   req->n_match_sets, req->n_ssids);
1170  
1171         if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
1172 -               bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
1173 +               bphy_err(drvr, "Scanning suppressed: status (%lu)\n",
1174                          cfg->scan_status);
1175                 return -EAGAIN;
1176         }
1177 @@ -3512,8 +3540,8 @@ static s32
1178  brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
1179                       void *data)
1180  {
1181 -       struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
1182 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1183 +       struct brcmf_pub *drvr = ifp->drvr;
1184 +       struct brcmf_cfg80211_info *cfg = drvr->config;
1185         struct brcmf_pno_scanresults_le *pfn_result;
1186         struct brcmf_pno_net_info_le *netinfo;
1187  
1188 @@ -3532,7 +3560,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1189         }
1190  
1191         if (le32_to_cpu(pfn_result->count) < 1) {
1192 -               bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n",
1193 +               bphy_err(drvr, "Invalid result count, expected 1 (%d)\n",
1194                          le32_to_cpu(pfn_result->count));
1195                 return -EINVAL;
1196         }
1197 @@ -3560,6 +3588,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
1198  static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
1199  {
1200         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1201 +       struct brcmf_pub *drvr = cfg->pub;
1202         struct brcmf_wowl_wakeind_le wake_ind_le;
1203         struct cfg80211_wowlan_wakeup wakeup_data;
1204         struct cfg80211_wowlan_wakeup *wakeup;
1205 @@ -3570,7 +3599,7 @@ static void brcmf_report_wowl_wakeind(st
1206         err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
1207                                        sizeof(wake_ind_le));
1208         if (err) {
1209 -               bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
1210 +               bphy_err(drvr, "Get wowl_wakeind failed, err = %d\n", err);
1211                 return;
1212         }
1213  
1214 @@ -3611,7 +3640,7 @@ static void brcmf_report_wowl_wakeind(st
1215                                 cfg->wowl.nd_data_completed,
1216                                 BRCMF_ND_INFO_TIMEOUT);
1217                         if (!timeout)
1218 -                               bphy_err(wiphy, "No result for wowl net detect\n");
1219 +                               bphy_err(drvr, "No result for wowl net detect\n");
1220                         else
1221                                 wakeup_data.net_detect = cfg->wowl.nd_info;
1222                 }
1223 @@ -3800,6 +3829,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
1224         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1225         struct brcmf_if *ifp = netdev_priv(ndev);
1226         struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
1227 +       struct brcmf_pub *drvr = cfg->pub;
1228         s32 err;
1229         u32 npmk, i;
1230  
1231 @@ -3819,7 +3849,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
1232                         cfg->pmk_list.npmk = cpu_to_le32(npmk);
1233                 }
1234         } else {
1235 -               bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
1236 +               bphy_err(drvr, "Too many PMKSA entries cached %d\n", npmk);
1237                 return -EINVAL;
1238         }
1239  
1240 @@ -3842,6 +3872,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
1241         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1242         struct brcmf_if *ifp = netdev_priv(ndev);
1243         struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
1244 +       struct brcmf_pub *drvr = cfg->pub;
1245         s32 err;
1246         u32 npmk, i;
1247  
1248 @@ -3865,7 +3896,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
1249                 memset(&pmk[i], 0, sizeof(*pmk));
1250                 cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
1251         } else {
1252 -               bphy_err(wiphy, "Cache entry not found\n");
1253 +               bphy_err(drvr, "Cache entry not found\n");
1254                 return -EINVAL;
1255         }
1256  
1257 @@ -3897,25 +3928,25 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
1258  
1259  static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
1260  {
1261 -       struct wiphy *wiphy = ifp->drvr->wiphy;
1262 +       struct brcmf_pub *drvr = ifp->drvr;
1263         s32 err;
1264  
1265         /* set auth */
1266         err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
1267         if (err < 0) {
1268 -               bphy_err(wiphy, "auth error %d\n", err);
1269 +               bphy_err(drvr, "auth error %d\n", err);
1270                 return err;
1271         }
1272         /* set wsec */
1273         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
1274         if (err < 0) {
1275 -               bphy_err(wiphy, "wsec error %d\n", err);
1276 +               bphy_err(drvr, "wsec error %d\n", err);
1277                 return err;
1278         }
1279         /* set upper-layer auth */
1280         err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", WPA_AUTH_NONE);
1281         if (err < 0) {
1282 -               bphy_err(wiphy, "wpa_auth error %d\n", err);
1283 +               bphy_err(drvr, "wpa_auth error %d\n", err);
1284                 return err;
1285         }
1286  
1287 @@ -3935,7 +3966,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1288                       const struct brcmf_vs_tlv *wpa_ie,
1289                       bool is_rsn_ie)
1290  {
1291 -       struct wiphy *wiphy = ifp->drvr->wiphy;
1292 +       struct brcmf_pub *drvr = ifp->drvr;
1293         u32 auth = 0; /* d11 open authentication */
1294         u16 count;
1295         s32 err = 0;
1296 @@ -3966,13 +3997,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1297         /* check for multicast cipher suite */
1298         if (offset + WPA_IE_MIN_OUI_LEN > len) {
1299                 err = -EINVAL;
1300 -               bphy_err(wiphy, "no multicast cipher suite\n");
1301 +               bphy_err(drvr, "no multicast cipher suite\n");
1302                 goto exit;
1303         }
1304  
1305         if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1306                 err = -EINVAL;
1307 -               bphy_err(wiphy, "ivalid OUI\n");
1308 +               bphy_err(drvr, "ivalid OUI\n");
1309                 goto exit;
1310         }
1311         offset += TLV_OUI_LEN;
1312 @@ -3994,7 +4025,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1313                 break;
1314         default:
1315                 err = -EINVAL;
1316 -               bphy_err(wiphy, "Invalid multi cast cipher info\n");
1317 +               bphy_err(drvr, "Invalid multi cast cipher info\n");
1318                 goto exit;
1319         }
1320  
1321 @@ -4005,13 +4036,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1322         /* Check for unicast suite(s) */
1323         if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
1324                 err = -EINVAL;
1325 -               bphy_err(wiphy, "no unicast cipher suite\n");
1326 +               bphy_err(drvr, "no unicast cipher suite\n");
1327                 goto exit;
1328         }
1329         for (i = 0; i < count; i++) {
1330                 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1331                         err = -EINVAL;
1332 -                       bphy_err(wiphy, "ivalid OUI\n");
1333 +                       bphy_err(drvr, "ivalid OUI\n");
1334                         goto exit;
1335                 }
1336                 offset += TLV_OUI_LEN;
1337 @@ -4029,7 +4060,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1338                         pval |= AES_ENABLED;
1339                         break;
1340                 default:
1341 -                       bphy_err(wiphy, "Invalid unicast security info\n");
1342 +                       bphy_err(drvr, "Invalid unicast security info\n");
1343                 }
1344                 offset++;
1345         }
1346 @@ -4039,13 +4070,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1347         /* Check for auth key management suite(s) */
1348         if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
1349                 err = -EINVAL;
1350 -               bphy_err(wiphy, "no auth key mgmt suite\n");
1351 +               bphy_err(drvr, "no auth key mgmt suite\n");
1352                 goto exit;
1353         }
1354         for (i = 0; i < count; i++) {
1355                 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
1356                         err = -EINVAL;
1357 -                       bphy_err(wiphy, "ivalid OUI\n");
1358 +                       bphy_err(drvr, "ivalid OUI\n");
1359                         goto exit;
1360                 }
1361                 offset += TLV_OUI_LEN;
1362 @@ -4073,7 +4104,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1363                         wpa_auth |= WPA2_AUTH_1X_SHA256;
1364                         break;
1365                 default:
1366 -                       bphy_err(wiphy, "Invalid key mgmt info\n");
1367 +                       bphy_err(drvr, "Invalid key mgmt info\n");
1368                 }
1369                 offset++;
1370         }
1371 @@ -4115,7 +4146,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1372                 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
1373                                                wme_bss_disable);
1374                 if (err < 0) {
1375 -                       bphy_err(wiphy, "wme_bss_disable error %d\n", err);
1376 +                       bphy_err(drvr, "wme_bss_disable error %d\n", err);
1377                         goto exit;
1378                 }
1379  
1380 @@ -4129,7 +4160,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
1381                                                         &data[offset],
1382                                                         WPA_IE_MIN_OUI_LEN);
1383                         if (err < 0) {
1384 -                               bphy_err(wiphy, "bip error %d\n", err);
1385 +                               bphy_err(drvr, "bip error %d\n", err);
1386                                 goto exit;
1387                         }
1388                 }
1389 @@ -4140,13 +4171,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
1390         /* set auth */
1391         err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
1392         if (err < 0) {
1393 -               bphy_err(wiphy, "auth error %d\n", err);
1394 +               bphy_err(drvr, "auth error %d\n", err);
1395                 goto exit;
1396         }
1397         /* set wsec */
1398         err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
1399         if (err < 0) {
1400 -               bphy_err(wiphy, "wsec error %d\n", err);
1401 +               bphy_err(drvr, "wsec error %d\n", err);
1402                 goto exit;
1403         }
1404         /* Configure MFP, this needs to go after wsec otherwise the wsec command
1405 @@ -4155,14 +4186,14 @@ brcmf_configure_wpaie(struct brcmf_if *i
1406         if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
1407                 err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
1408                 if (err < 0) {
1409 -                       bphy_err(wiphy, "mfp error %d\n", err);
1410 +                       bphy_err(drvr, "mfp error %d\n", err);
1411                         goto exit;
1412                 }
1413         }
1414         /* set upper-layer auth */
1415         err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
1416         if (err < 0) {
1417 -               bphy_err(wiphy, "wpa_auth error %d\n", err);
1418 +               bphy_err(drvr, "wpa_auth error %d\n", err);
1419                 goto exit;
1420         }
1421  
1422 @@ -4248,8 +4279,8 @@ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8
1423  s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
1424                           const u8 *vndr_ie_buf, u32 vndr_ie_len)
1425  {
1426 +       struct brcmf_pub *drvr;
1427         struct brcmf_if *ifp;
1428 -       struct wiphy *wiphy;
1429         struct vif_saved_ie *saved_ie;
1430         s32 err = 0;
1431         u8  *iovar_ie_buf;
1432 @@ -4270,7 +4301,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1433         if (!vif)
1434                 return -ENODEV;
1435         ifp = vif->ifp;
1436 -       wiphy = ifp->drvr->wiphy;
1437 +       drvr = ifp->drvr;
1438         saved_ie = &vif->saved_ie;
1439  
1440         brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
1441 @@ -4302,13 +4333,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1442                 break;
1443         default:
1444                 err = -EPERM;
1445 -               bphy_err(wiphy, "not suitable type\n");
1446 +               bphy_err(drvr, "not suitable type\n");
1447                 goto exit;
1448         }
1449  
1450         if (vndr_ie_len > mgmt_ie_buf_len) {
1451                 err = -ENOMEM;
1452 -               bphy_err(wiphy, "extra IE size too big\n");
1453 +               bphy_err(drvr, "extra IE size too big\n");
1454                 goto exit;
1455         }
1456  
1457 @@ -4369,7 +4400,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1458                         /* verify remained buf size before copy data */
1459                         if (remained_buf_len < (vndrie_info->vndrie.len +
1460                                                         VNDR_IE_VSIE_OFFSET)) {
1461 -                               bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d",
1462 +                               bphy_err(drvr, "no space in mgmt_ie_buf: len left %d",
1463                                          remained_buf_len);
1464                                 break;
1465                         }
1466 @@ -4401,7 +4432,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
1467                 err  = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
1468                                                  total_ie_buf_len);
1469                 if (err)
1470 -                       bphy_err(wiphy, "vndr ie set error : %d\n", err);
1471 +                       bphy_err(drvr, "vndr ie set error : %d\n", err);
1472         }
1473  
1474  exit:
1475 @@ -4429,14 +4460,14 @@ static s32
1476  brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
1477                         struct cfg80211_beacon_data *beacon)
1478  {
1479 -       struct wiphy *wiphy = vif->ifp->drvr->wiphy;
1480 +       struct brcmf_pub *drvr = vif->ifp->drvr;
1481         s32 err;
1482  
1483         /* Set Beacon IEs to FW */
1484         err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
1485                                     beacon->tail, beacon->tail_len);
1486         if (err) {
1487 -               bphy_err(wiphy, "Set Beacon IE Failed\n");
1488 +               bphy_err(drvr, "Set Beacon IE Failed\n");
1489                 return err;
1490         }
1491         brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
1492 @@ -4446,7 +4477,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
1493                                     beacon->proberesp_ies,
1494                                     beacon->proberesp_ies_len);
1495         if (err)
1496 -               bphy_err(wiphy, "Set Probe Resp IE Failed\n");
1497 +               bphy_err(drvr, "Set Probe Resp IE Failed\n");
1498         else
1499                 brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
1500  
1501 @@ -4460,6 +4491,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1502         s32 ie_offset;
1503         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1504         struct brcmf_if *ifp = netdev_priv(ndev);
1505 +       struct brcmf_pub *drvr = cfg->pub;
1506         const struct brcmf_tlv *ssid_ie;
1507         const struct brcmf_tlv *country_ie;
1508         struct brcmf_ssid_le ssid_le;
1509 @@ -4555,7 +4587,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1510                         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
1511                                                     is_11d);
1512                         if (err < 0) {
1513 -                               bphy_err(wiphy, "Regulatory Set Error, %d\n",
1514 +                               bphy_err(drvr, "Regulatory Set Error, %d\n",
1515                                          err);
1516                                 goto exit;
1517                         }
1518 @@ -4564,7 +4596,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1519                         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
1520                                                     settings->beacon_interval);
1521                         if (err < 0) {
1522 -                               bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
1523 +                               bphy_err(drvr, "Beacon Interval Set Error, %d\n",
1524                                          err);
1525                                 goto exit;
1526                         }
1527 @@ -4573,7 +4605,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1528                         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
1529                                                     settings->dtim_period);
1530                         if (err < 0) {
1531 -                               bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
1532 +                               bphy_err(drvr, "DTIM Interval Set Error, %d\n",
1533                                          err);
1534                                 goto exit;
1535                         }
1536 @@ -4584,7 +4616,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1537                      !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
1538                         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
1539                         if (err < 0) {
1540 -                               bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
1541 +                               bphy_err(drvr, "BRCMF_C_DOWN error %d\n",
1542                                          err);
1543                                 goto exit;
1544                         }
1545 @@ -4593,7 +4625,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1546  
1547                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
1548                 if (err < 0) {
1549 -                       bphy_err(wiphy, "SET INFRA error %d\n", err);
1550 +                       bphy_err(drvr, "SET INFRA error %d\n", err);
1551                         goto exit;
1552                 }
1553         } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
1554 @@ -4609,7 +4641,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1555  
1556                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
1557                 if (err < 0) {
1558 -                       bphy_err(wiphy, "setting AP mode failed %d\n",
1559 +                       bphy_err(drvr, "setting AP mode failed %d\n",
1560                                  err);
1561                         goto exit;
1562                 }
1563 @@ -4619,14 +4651,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1564                          */
1565                         err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
1566                         if (err < 0) {
1567 -                               bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1568 +                               bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
1569                                          chanspec, err);
1570                                 goto exit;
1571                         }
1572                 }
1573                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
1574                 if (err < 0) {
1575 -                       bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
1576 +                       bphy_err(drvr, "BRCMF_C_UP error (%d)\n", err);
1577                         goto exit;
1578                 }
1579                 /* On DOWN the firmware removes the WEP keys, reconfigure
1580 @@ -4641,14 +4673,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1581                 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1582                                              &join_params, sizeof(join_params));
1583                 if (err < 0) {
1584 -                       bphy_err(wiphy, "SET SSID error (%d)\n", err);
1585 +                       bphy_err(drvr, "SET SSID error (%d)\n", err);
1586                         goto exit;
1587                 }
1588  
1589                 if (settings->hidden_ssid) {
1590                         err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
1591                         if (err) {
1592 -                               bphy_err(wiphy, "closednet error (%d)\n", err);
1593 +                               bphy_err(drvr, "closednet error (%d)\n", err);
1594                                 goto exit;
1595                         }
1596                 }
1597 @@ -4657,14 +4689,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1598         } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
1599                 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
1600                 if (err < 0) {
1601 -                       bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
1602 +                       bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
1603                                  chanspec, err);
1604                         goto exit;
1605                 }
1606                 err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
1607                                                 sizeof(ssid_le));
1608                 if (err < 0) {
1609 -                       bphy_err(wiphy, "setting ssid failed %d\n", err);
1610 +                       bphy_err(drvr, "setting ssid failed %d\n", err);
1611                         goto exit;
1612                 }
1613                 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
1614 @@ -4672,7 +4704,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
1615                 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1616                                                sizeof(bss_enable));
1617                 if (err < 0) {
1618 -                       bphy_err(wiphy, "bss_enable config failed %d\n", err);
1619 +                       bphy_err(drvr, "bss_enable config failed %d\n", err);
1620                         goto exit;
1621                 }
1622  
1623 @@ -4695,7 +4727,9 @@ exit:
1624  
1625  static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
1626  {
1627 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1628         struct brcmf_if *ifp = netdev_priv(ndev);
1629 +       struct brcmf_pub *drvr = cfg->pub;
1630         s32 err;
1631         struct brcmf_fil_bss_enable_le bss_enable;
1632         struct brcmf_join_params join_params;
1633 @@ -4720,13 +4754,13 @@ static int brcmf_cfg80211_stop_ap(struct
1634                 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1635                                              &join_params, sizeof(join_params));
1636                 if (err < 0)
1637 -                       bphy_err(wiphy, "SET SSID error (%d)\n", err);
1638 +                       bphy_err(drvr, "SET SSID error (%d)\n", err);
1639                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
1640                 if (err < 0)
1641 -                       bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err);
1642 +                       bphy_err(drvr, "BRCMF_C_DOWN error %d\n", err);
1643                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
1644                 if (err < 0)
1645 -                       bphy_err(wiphy, "setting AP mode failed %d\n", err);
1646 +                       bphy_err(drvr, "setting AP mode failed %d\n", err);
1647                 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
1648                         brcmf_fil_iovar_int_set(ifp, "mbss", 0);
1649                 brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
1650 @@ -4734,7 +4768,7 @@ static int brcmf_cfg80211_stop_ap(struct
1651                 /* Bring device back up so it can be used again */
1652                 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
1653                 if (err < 0)
1654 -                       bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
1655 +                       bphy_err(drvr, "BRCMF_C_UP error %d\n", err);
1656  
1657                 brcmf_vif_clear_mgmt_ies(ifp->vif);
1658         } else {
1659 @@ -4743,7 +4777,7 @@ static int brcmf_cfg80211_stop_ap(struct
1660                 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
1661                                                sizeof(bss_enable));
1662                 if (err < 0)
1663 -                       bphy_err(wiphy, "bss_enable config failed %d\n", err);
1664 +                       bphy_err(drvr, "bss_enable config failed %d\n", err);
1665         }
1666         brcmf_set_mpc(ifp, 1);
1667         brcmf_configure_arp_nd_offload(ifp, true);
1668 @@ -4772,6 +4806,7 @@ brcmf_cfg80211_del_station(struct wiphy
1669                            struct station_del_parameters *params)
1670  {
1671         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1672 +       struct brcmf_pub *drvr = cfg->pub;
1673         struct brcmf_scb_val_le scbval;
1674         struct brcmf_if *ifp = netdev_priv(ndev);
1675         s32 err;
1676 @@ -4791,7 +4826,7 @@ brcmf_cfg80211_del_station(struct wiphy
1677         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
1678                                      &scbval, sizeof(scbval));
1679         if (err)
1680 -               bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
1681 +               bphy_err(drvr, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
1682                          err);
1683  
1684         brcmf_dbg(TRACE, "Exit\n");
1685 @@ -4802,7 +4837,9 @@ static int
1686  brcmf_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev,
1687                               const u8 *mac, struct station_parameters *params)
1688  {
1689 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1690         struct brcmf_if *ifp = netdev_priv(ndev);
1691 +       struct brcmf_pub *drvr = cfg->pub;
1692         s32 err;
1693  
1694         brcmf_dbg(TRACE, "Enter, MAC %pM, mask 0x%04x set 0x%04x\n", mac,
1695 @@ -4822,7 +4859,7 @@ brcmf_cfg80211_change_station(struct wip
1696                 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
1697                                              (void *)mac, ETH_ALEN);
1698         if (err < 0)
1699 -               bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
1700 +               bphy_err(drvr, "Setting SCB (de-)authorize failed, %d\n", err);
1701  
1702         return err;
1703  }
1704 @@ -4852,6 +4889,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1705  {
1706         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1707         struct ieee80211_channel *chan = params->chan;
1708 +       struct brcmf_pub *drvr = cfg->pub;
1709         const u8 *buf = params->buf;
1710         size_t len = params->len;
1711         const struct ieee80211_mgmt *mgmt;
1712 @@ -4872,7 +4910,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1713         mgmt = (const struct ieee80211_mgmt *)buf;
1714  
1715         if (!ieee80211_is_mgmt(mgmt->frame_control)) {
1716 -               bphy_err(wiphy, "Driver only allows MGMT packet type\n");
1717 +               bphy_err(drvr, "Driver only allows MGMT packet type\n");
1718                 return -EPERM;
1719         }
1720  
1721 @@ -4903,13 +4941,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
1722                                         GFP_KERNEL);
1723         } else if (ieee80211_is_action(mgmt->frame_control)) {
1724                 if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
1725 -                       bphy_err(wiphy, "invalid action frame length\n");
1726 +                       bphy_err(drvr, "invalid action frame length\n");
1727                         err = -EINVAL;
1728                         goto exit;
1729                 }
1730                 af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
1731                 if (af_params == NULL) {
1732 -                       bphy_err(wiphy, "unable to allocate frame\n");
1733 +                       bphy_err(drvr, "unable to allocate frame\n");
1734                         err = -ENOMEM;
1735                         goto exit;
1736                 }
1737 @@ -4960,6 +4998,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
1738                                         u64 cookie)
1739  {
1740         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1741 +       struct brcmf_pub *drvr = cfg->pub;
1742         struct brcmf_cfg80211_vif *vif;
1743         int err = 0;
1744  
1745 @@ -4967,7 +5006,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
1746  
1747         vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
1748         if (vif == NULL) {
1749 -               bphy_err(wiphy, "No p2p device available for probe response\n");
1750 +               bphy_err(drvr, "No p2p device available for probe response\n");
1751                 err = -ENODEV;
1752                 goto exit;
1753         }
1754 @@ -4982,6 +5021,7 @@ static int brcmf_cfg80211_get_channel(st
1755  {
1756         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1757         struct net_device *ndev = wdev->netdev;
1758 +       struct brcmf_pub *drvr = cfg->pub;
1759         struct brcmf_if *ifp;
1760         struct brcmu_chan ch;
1761         enum nl80211_band band = 0;
1762 @@ -4995,7 +5035,7 @@ static int brcmf_cfg80211_get_channel(st
1763  
1764         err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
1765         if (err) {
1766 -               bphy_err(wiphy, "chanspec failed (%d)\n", err);
1767 +               bphy_err(drvr, "chanspec failed (%d)\n", err);
1768                 return err;
1769         }
1770  
1771 @@ -5117,6 +5157,8 @@ static int brcmf_cfg80211_tdls_oper(stru
1772                                     struct net_device *ndev, const u8 *peer,
1773                                     enum nl80211_tdls_operation oper)
1774  {
1775 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1776 +       struct brcmf_pub *drvr = cfg->pub;
1777         struct brcmf_if *ifp;
1778         struct brcmf_tdls_iovar_le info;
1779         int ret = 0;
1780 @@ -5134,7 +5176,7 @@ static int brcmf_cfg80211_tdls_oper(stru
1781         ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
1782                                        &info, sizeof(info));
1783         if (ret < 0)
1784 -               bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
1785 +               bphy_err(drvr, "tdls_endpoint iovar failed: ret=%d\n", ret);
1786  
1787         return ret;
1788  }
1789 @@ -5145,6 +5187,8 @@ brcmf_cfg80211_update_conn_params(struct
1790                                   struct cfg80211_connect_params *sme,
1791                                   u32 changed)
1792  {
1793 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1794 +       struct brcmf_pub *drvr = cfg->pub;
1795         struct brcmf_if *ifp;
1796         int err;
1797  
1798 @@ -5155,7 +5199,7 @@ brcmf_cfg80211_update_conn_params(struct
1799         err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
1800                                     sme->ie, sme->ie_len);
1801         if (err)
1802 -               bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
1803 +               bphy_err(drvr, "Set Assoc REQ IE Failed\n");
1804         else
1805                 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
1806  
1807 @@ -5167,6 +5211,8 @@ static int
1808  brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
1809                               struct cfg80211_gtk_rekey_data *gtk)
1810  {
1811 +       struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1812 +       struct brcmf_pub *drvr = cfg->pub;
1813         struct brcmf_if *ifp = netdev_priv(ndev);
1814         struct brcmf_gtk_keyinfo_le gtk_le;
1815         int ret;
1816 @@ -5181,7 +5227,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
1817         ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
1818                                        sizeof(gtk_le));
1819         if (ret < 0)
1820 -               bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret);
1821 +               bphy_err(drvr, "gtk_key_info iovar failed: ret=%d\n", ret);
1822  
1823         return ret;
1824  }
1825 @@ -5359,7 +5405,7 @@ static void brcmf_clear_assoc_ies(struct
1826  static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
1827                                struct brcmf_if *ifp)
1828  {
1829 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1830 +       struct brcmf_pub *drvr = cfg->pub;
1831         struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
1832         struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
1833         u32 req_len;
1834 @@ -5371,7 +5417,7 @@ static s32 brcmf_get_assoc_ies(struct br
1835         err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
1836                                        cfg->extra_buf, WL_ASSOC_INFO_MAX);
1837         if (err) {
1838 -               bphy_err(wiphy, "could not get assoc info (%d)\n", err);
1839 +               bphy_err(drvr, "could not get assoc info (%d)\n", err);
1840                 return err;
1841         }
1842         assoc_info =
1843 @@ -5383,7 +5429,7 @@ static s32 brcmf_get_assoc_ies(struct br
1844                                                cfg->extra_buf,
1845                                                WL_ASSOC_INFO_MAX);
1846                 if (err) {
1847 -                       bphy_err(wiphy, "could not get assoc req (%d)\n", err);
1848 +                       bphy_err(drvr, "could not get assoc req (%d)\n", err);
1849                         return err;
1850                 }
1851                 conn_info->req_ie_len = req_len;
1852 @@ -5399,7 +5445,7 @@ static s32 brcmf_get_assoc_ies(struct br
1853                                                cfg->extra_buf,
1854                                                WL_ASSOC_INFO_MAX);
1855                 if (err) {
1856 -                       bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
1857 +                       bphy_err(drvr, "could not get assoc resp (%d)\n", err);
1858                         return err;
1859                 }
1860                 conn_info->resp_ie_len = resp_len;
1861 @@ -5518,7 +5564,7 @@ brcmf_notify_connect_status_ap(struct br
1862                                struct net_device *ndev,
1863                                const struct brcmf_event_msg *e, void *data)
1864  {
1865 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1866 +       struct brcmf_pub *drvr = cfg->pub;
1867         static int generation;
1868         u32 event = e->event_code;
1869         u32 reason = e->reason;
1870 @@ -5537,7 +5583,7 @@ brcmf_notify_connect_status_ap(struct br
1871             (reason == BRCMF_E_STATUS_SUCCESS)) {
1872                 memset(&sinfo, 0, sizeof(sinfo));
1873                 if (!data) {
1874 -                       bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
1875 +                       bphy_err(drvr, "No IEs present in ASSOC/REASSOC_IND\n");
1876                         return -EINVAL;
1877                 }
1878                 sinfo.assoc_req_ies = data;
1879 @@ -5818,7 +5864,7 @@ static void init_vif_event(struct brcmf_
1880  
1881  static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
1882  {
1883 -       struct wiphy *wiphy = ifp->drvr->wiphy;
1884 +       struct brcmf_pub *drvr = ifp->drvr;
1885         s32 err;
1886         u32 bcn_timeout;
1887         __le32 roamtrigger[2];
1888 @@ -5831,7 +5877,7 @@ static s32 brcmf_dongle_roam(struct brcm
1889                 bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
1890         err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
1891         if (err) {
1892 -               bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
1893 +               bphy_err(drvr, "bcn_timeout error (%d)\n", err);
1894                 goto roam_setup_done;
1895         }
1896  
1897 @@ -5843,7 +5889,7 @@ static s32 brcmf_dongle_roam(struct brcm
1898         err = brcmf_fil_iovar_int_set(ifp, "roam_off",
1899                                       ifp->drvr->settings->roamoff);
1900         if (err) {
1901 -               bphy_err(wiphy, "roam_off error (%d)\n", err);
1902 +               bphy_err(drvr, "roam_off error (%d)\n", err);
1903                 goto roam_setup_done;
1904         }
1905  
1906 @@ -5852,7 +5898,7 @@ static s32 brcmf_dongle_roam(struct brcm
1907         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
1908                                      (void *)roamtrigger, sizeof(roamtrigger));
1909         if (err) {
1910 -               bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
1911 +               bphy_err(drvr, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
1912                 goto roam_setup_done;
1913         }
1914  
1915 @@ -5861,7 +5907,7 @@ static s32 brcmf_dongle_roam(struct brcm
1916         err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
1917                                      (void *)roam_delta, sizeof(roam_delta));
1918         if (err) {
1919 -               bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err);
1920 +               bphy_err(drvr, "WLC_SET_ROAM_DELTA error (%d)\n", err);
1921                 goto roam_setup_done;
1922         }
1923  
1924 @@ -5872,26 +5918,26 @@ roam_setup_done:
1925  static s32
1926  brcmf_dongle_scantime(struct brcmf_if *ifp)
1927  {
1928 -       struct wiphy *wiphy = ifp->drvr->wiphy;
1929 +       struct brcmf_pub *drvr = ifp->drvr;
1930         s32 err = 0;
1931  
1932         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
1933                                     BRCMF_SCAN_CHANNEL_TIME);
1934         if (err) {
1935 -               bphy_err(wiphy, "Scan assoc time error (%d)\n", err);
1936 +               bphy_err(drvr, "Scan assoc time error (%d)\n", err);
1937                 goto dongle_scantime_out;
1938         }
1939         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
1940                                     BRCMF_SCAN_UNASSOC_TIME);
1941         if (err) {
1942 -               bphy_err(wiphy, "Scan unassoc time error (%d)\n", err);
1943 +               bphy_err(drvr, "Scan unassoc time error (%d)\n", err);
1944                 goto dongle_scantime_out;
1945         }
1946  
1947         err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
1948                                     BRCMF_SCAN_PASSIVE_TIME);
1949         if (err) {
1950 -               bphy_err(wiphy, "Scan passive time error (%d)\n", err);
1951 +               bphy_err(drvr, "Scan passive time error (%d)\n", err);
1952                 goto dongle_scantime_out;
1953         }
1954  
1955 @@ -5924,7 +5970,8 @@ static int brcmf_construct_chaninfo(stru
1956                                     u32 bw_cap[])
1957  {
1958         struct wiphy *wiphy = cfg_to_wiphy(cfg);
1959 -       struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
1960 +       struct brcmf_pub *drvr = cfg->pub;
1961 +       struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
1962         struct ieee80211_supported_band *band;
1963         struct ieee80211_channel *channel;
1964         struct brcmf_chanspec_list *list;
1965 @@ -5945,7 +5992,7 @@ static int brcmf_construct_chaninfo(stru
1966         err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
1967                                        BRCMF_DCMD_MEDLEN);
1968         if (err) {
1969 -               bphy_err(wiphy, "get chanspecs error (%d)\n", err);
1970 +               bphy_err(drvr, "get chanspecs error (%d)\n", err);
1971                 goto fail_pbuf;
1972         }
1973  
1974 @@ -5968,7 +6015,7 @@ static int brcmf_construct_chaninfo(stru
1975                 } else if (ch.band == BRCMU_CHAN_BAND_5G) {
1976                         band = wiphy->bands[NL80211_BAND_5GHZ];
1977                 } else {
1978 -                       bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
1979 +                       bphy_err(drvr, "Invalid channel Spec. 0x%x.\n",
1980                                  ch.chspec);
1981                         continue;
1982                 }
1983 @@ -5992,7 +6039,7 @@ static int brcmf_construct_chaninfo(stru
1984                         /* It seems firmware supports some channel we never
1985                          * considered. Something new in IEEE standard?
1986                          */
1987 -                       bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n",
1988 +                       bphy_err(drvr, "Ignoring unexpected firmware channel %d\n",
1989                                  ch.control_ch_num);
1990                         continue;
1991                 }
1992 @@ -6049,8 +6096,8 @@ fail_pbuf:
1993  
1994  static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
1995  {
1996 -       struct wiphy *wiphy = cfg_to_wiphy(cfg);
1997 -       struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
1998 +       struct brcmf_pub *drvr = cfg->pub;
1999 +       struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
2000         struct ieee80211_supported_band *band;
2001         struct brcmf_fil_bwcap_le band_bwcap;
2002         struct brcmf_chanspec_list *list;
2003 @@ -6096,7 +6143,7 @@ static int brcmf_enable_bw40_2g(struct b
2004                 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
2005                                                BRCMF_DCMD_MEDLEN);
2006                 if (err) {
2007 -                       bphy_err(wiphy, "get chanspecs error (%d)\n", err);
2008 +                       bphy_err(drvr, "get chanspecs error (%d)\n", err);
2009                         kfree(pbuf);
2010                         return err;
2011                 }
2012 @@ -6127,7 +6174,7 @@ static int brcmf_enable_bw40_2g(struct b
2013  
2014  static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
2015  {
2016 -       struct wiphy *wiphy = ifp->drvr->wiphy;
2017 +       struct brcmf_pub *drvr = ifp->drvr;
2018         u32 band, mimo_bwcap;
2019         int err;
2020  
2021 @@ -6163,7 +6210,7 @@ static void brcmf_get_bwcap(struct brcmf
2022                 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
2023                 break;
2024         default:
2025 -               bphy_err(wiphy, "invalid mimo_bw_cap value\n");
2026 +               bphy_err(drvr, "invalid mimo_bw_cap value\n");
2027         }
2028  }
2029  
2030 @@ -6238,7 +6285,8 @@ static void brcmf_update_vht_cap(struct
2031  
2032  static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
2033  {
2034 -       struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
2035 +       struct brcmf_pub *drvr = cfg->pub;
2036 +       struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
2037         struct wiphy *wiphy = cfg_to_wiphy(cfg);
2038         u32 nmode = 0;
2039         u32 vhtmode = 0;
2040 @@ -6255,7 +6303,7 @@ static int brcmf_setup_wiphybands(struct
2041         (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
2042         err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
2043         if (err) {
2044 -               bphy_err(wiphy, "nmode error (%d)\n", err);
2045 +               bphy_err(drvr, "nmode error (%d)\n", err);
2046         } else {
2047                 brcmf_get_bwcap(ifp, bw_cap);
2048         }
2049 @@ -6265,7 +6313,7 @@ static int brcmf_setup_wiphybands(struct
2050  
2051         err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
2052         if (err) {
2053 -               bphy_err(wiphy, "rxchain error (%d)\n", err);
2054 +               bphy_err(drvr, "rxchain error (%d)\n", err);
2055                 nchain = 1;
2056         } else {
2057                 for (nchain = 0; rxchain; nchain++)
2058 @@ -6275,7 +6323,7 @@ static int brcmf_setup_wiphybands(struct
2059  
2060         err = brcmf_construct_chaninfo(cfg, bw_cap);
2061         if (err) {
2062 -               bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
2063 +               bphy_err(drvr, "brcmf_construct_chaninfo failed (%d)\n", err);
2064                 return err;
2065         }
2066  
2067 @@ -6492,12 +6540,13 @@ static void brcmf_wiphy_wowl_params(stru
2068  {
2069  #ifdef CONFIG_PM
2070         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2071 +       struct brcmf_pub *drvr = cfg->pub;
2072         struct wiphy_wowlan_support *wowl;
2073  
2074         wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
2075                        GFP_KERNEL);
2076         if (!wowl) {
2077 -               bphy_err(wiphy, "only support basic wowlan features\n");
2078 +               bphy_err(drvr, "only support basic wowlan features\n");
2079                 wiphy->wowlan = &brcmf_wowlan_support;
2080                 return;
2081         }
2082 @@ -6585,7 +6634,7 @@ static int brcmf_setup_wiphy(struct wiph
2083         err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
2084                                      sizeof(bandlist));
2085         if (err) {
2086 -               bphy_err(wiphy, "could not obtain band info: err=%d\n", err);
2087 +               bphy_err(drvr, "could not obtain band info: err=%d\n", err);
2088                 return err;
2089         }
2090         /* first entry in bandlist is number of bands */
2091 @@ -6846,6 +6895,7 @@ static void brcmf_cfg80211_reg_notifier(
2092  {
2093         struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2094         struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
2095 +       struct brcmf_pub *drvr = cfg->pub;
2096         struct brcmf_fil_country_le ccreq;
2097         s32 err;
2098         int i;
2099 @@ -6857,7 +6907,7 @@ static void brcmf_cfg80211_reg_notifier(
2100         /* ignore non-ISO3166 country codes */
2101         for (i = 0; i < 2; i++)
2102                 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
2103 -                       bphy_err(wiphy, "not a ISO3166 code (0x%02x 0x%02x)\n",
2104 +                       bphy_err(drvr, "not a ISO3166 code (0x%02x 0x%02x)\n",
2105                                  req->alpha2[0], req->alpha2[1]);
2106                         return;
2107                 }
2108 @@ -6867,7 +6917,7 @@ static void brcmf_cfg80211_reg_notifier(
2109  
2110         err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
2111         if (err) {
2112 -               bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
2113 +               bphy_err(drvr, "Country code iovar returned err = %d\n", err);
2114                 return;
2115         }
2116  
2117 @@ -6877,7 +6927,7 @@ static void brcmf_cfg80211_reg_notifier(
2118  
2119         err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
2120         if (err) {
2121 -               bphy_err(wiphy, "Firmware rejected country setting\n");
2122 +               bphy_err(drvr, "Firmware rejected country setting\n");
2123                 return;
2124         }
2125         brcmf_setup_wiphybands(cfg);
2126 @@ -6923,13 +6973,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2127         u16 *cap = NULL;
2128  
2129         if (!ndev) {
2130 -               bphy_err(wiphy, "ndev is invalid\n");
2131 +               bphy_err(drvr, "ndev is invalid\n");
2132                 return NULL;
2133         }
2134  
2135         cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
2136         if (!cfg) {
2137 -               bphy_err(wiphy, "Could not allocate wiphy device\n");
2138 +               bphy_err(drvr, "Could not allocate wiphy device\n");
2139                 return NULL;
2140         }
2141  
2142 @@ -6950,7 +7000,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2143  
2144         err = wl_init_priv(cfg);
2145         if (err) {
2146 -               bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err);
2147 +               bphy_err(drvr, "Failed to init iwm_priv (%d)\n", err);
2148                 brcmf_free_vif(vif);
2149                 goto wiphy_out;
2150         }
2151 @@ -6959,7 +7009,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2152         /* determine d11 io type before wiphy setup */
2153         err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
2154         if (err) {
2155 -               bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
2156 +               bphy_err(drvr, "Failed to get D11 version (%d)\n", err);
2157                 goto priv_out;
2158         }
2159         cfg->d11inf.io_type = (u8)io_type;
2160 @@ -6993,13 +7043,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2161  #endif
2162         err = wiphy_register(wiphy);
2163         if (err < 0) {
2164 -               bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
2165 +               bphy_err(drvr, "Could not register wiphy device (%d)\n", err);
2166                 goto priv_out;
2167         }
2168  
2169         err = brcmf_setup_wiphybands(cfg);
2170         if (err) {
2171 -               bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err);
2172 +               bphy_err(drvr, "Setting wiphy bands failed (%d)\n", err);
2173                 goto wiphy_unreg_out;
2174         }
2175  
2176 @@ -7017,18 +7067,18 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2177  
2178         err = brcmf_fweh_activate_events(ifp);
2179         if (err) {
2180 -               bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
2181 +               bphy_err(drvr, "FWEH activation failed (%d)\n", err);
2182                 goto wiphy_unreg_out;
2183         }
2184  
2185         err = brcmf_p2p_attach(cfg, p2pdev_forced);
2186         if (err) {
2187 -               bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
2188 +               bphy_err(drvr, "P2P initialisation failed (%d)\n", err);
2189                 goto wiphy_unreg_out;
2190         }
2191         err = brcmf_btcoex_attach(cfg);
2192         if (err) {
2193 -               bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err);
2194 +               bphy_err(drvr, "BT-coex initialisation failed (%d)\n", err);
2195                 brcmf_p2p_detach(&cfg->p2p);
2196                 goto wiphy_unreg_out;
2197         }
2198 @@ -7047,7 +7097,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
2199         /* (re-) activate FWEH event handling */
2200         err = brcmf_fweh_activate_events(ifp);
2201         if (err) {
2202 -               bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
2203 +               bphy_err(drvr, "FWEH activation failed (%d)\n", err);
2204                 goto detach;
2205         }
2206  
2207 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
2208 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
2209 @@ -62,12 +62,12 @@ void __brcmf_err(struct brcmf_bus *bus,
2210         } while (0)
2211  #endif
2212  
2213 -#define bphy_err(wiphy, fmt, ...)                                      \
2214 +#define bphy_err(drvr, fmt, ...)                                       \
2215         do {                                                            \
2216                 if (IS_ENABLED(CPTCFG_BRCMDBG) ||                       \
2217                     IS_ENABLED(CPTCFG_BRCM_TRACING) ||                  \
2218                     net_ratelimit())                                    \
2219 -                       wiphy_err(wiphy, "%s: " fmt, __func__,          \
2220 +                       wiphy_err((drvr)->wiphy, "%s: " fmt, __func__,  \
2221                                   ##__VA_ARGS__);                       \
2222         } while (0)
2223