--- /dev/null
+From 16e646768396339b3d354985b99bcd3f1f195a7d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Fri, 15 Feb 2019 15:45:54 +0100
+Subject: [PATCH] brcmfmac: rework bphy_err() to take struct brcmf_pub argument
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This macro will be used in more places not just the cfg80211.c. It makes
+sense to pass some common struct to it as "struct wiphy" is mostly
+referenced in cfg80211 code only.
+
+A very common one (used above the bus abstraction layer) is struct
+brcmf_pub. Many functions already keep reference to it which will make
+using bphy_err() simpler. It should also allow extending that macro's
+logic if it's ever needed.
+
+This improves code recently added in the commit 3ef005b82e2a ("brcmfmac:
+add bphy_err() and use it in the cfg80211.c").
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../broadcom/brcm80211/brcmfmac/cfg80211.c | 510 ++++++++++--------
+ .../broadcom/brcm80211/brcmfmac/debug.h | 4 +-
+ 2 files changed, 281 insertions(+), 233 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+@@ -457,7 +457,7 @@ static void convert_key_from_CPU(struct
+ static int
+ send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ int err;
+ struct brcmf_wsec_key_le key_le;
+
+@@ -469,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
+ sizeof(key_le));
+
+ if (err)
+- bphy_err(wiphy, "wsec_key error (%d)\n", err);
++ bphy_err(drvr, "wsec_key error (%d)\n", err);
+ return err;
+ }
+
+@@ -509,7 +509,7 @@ static int brcmf_get_first_free_bsscfgid
+
+ static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_mbss_ssid_le mbss_ssid_le;
+ int bsscfgidx;
+ int err;
+@@ -526,7 +526,7 @@ static int brcmf_cfg80211_request_ap_if(
+ err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
+ sizeof(mbss_ssid_le));
+ if (err < 0)
+- bphy_err(wiphy, "setting ssid failed %d\n", err);
++ bphy_err(drvr, "setting ssid failed %d\n", err);
+
+ return err;
+ }
+@@ -544,6 +544,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_cfg80211_vif *vif;
+ int err;
+
+@@ -569,7 +570,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
+ BRCMF_VIF_EVENT_TIMEOUT);
+ brcmf_cfg80211_arm_vif_event(cfg, NULL);
+ if (!err) {
+- bphy_err(wiphy, "timeout occurred\n");
++ bphy_err(drvr, "timeout occurred\n");
+ err = -EIO;
+ goto fail;
+ }
+@@ -577,7 +578,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
+ /* interface created in firmware */
+ ifp = vif->ifp;
+ if (!ifp) {
+- bphy_err(wiphy, "no if pointer provided\n");
++ bphy_err(drvr, "no if pointer provided\n");
+ err = -ENOENT;
+ goto fail;
+ }
+@@ -585,7 +586,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
+ strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1);
+ err = brcmf_net_attach(ifp, true);
+ if (err) {
+- bphy_err(wiphy, "Registering netdevice failed\n");
++ bphy_err(drvr, "Registering netdevice failed\n");
+ free_netdev(ifp->ndev);
+ goto fail;
+ }
+@@ -616,13 +617,15 @@ static struct wireless_dev *brcmf_cfg802
+ enum nl80211_iftype type,
+ struct vif_params *params)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct wireless_dev *wdev;
+ int err;
+
+ brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
+ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
+ if (err) {
+- bphy_err(wiphy, "iface validation failed: err=%d\n", err);
++ bphy_err(drvr, "iface validation failed: err=%d\n", err);
+ return ERR_PTR(err);
+ }
+ switch (type) {
+@@ -647,7 +650,7 @@ static struct wireless_dev *brcmf_cfg802
+ }
+
+ if (IS_ERR(wdev))
+- bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name,
++ bphy_err(drvr, "add iface %s type %d failed: err=%d\n", name,
+ type, (int)PTR_ERR(wdev));
+ else
+ brcmf_cfg80211_update_proto_addr_mode(wdev);
+@@ -663,13 +666,13 @@ static void brcmf_scan_config_mpc(struct
+
+ void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 err = 0;
+
+ if (check_vif_up(ifp->vif)) {
+ err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
+ if (err) {
+- bphy_err(wiphy, "fail to set mpc\n");
++ bphy_err(drvr, "fail to set mpc\n");
+ return;
+ }
+ brcmf_dbg(INFO, "MPC : %d\n", mpc);
+@@ -680,7 +683,7 @@ s32 brcmf_notify_escan_complete(struct b
+ struct brcmf_if *ifp, bool aborted,
+ bool fw_abort)
+ {
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_scan_params_le params_le;
+ struct cfg80211_scan_request *scan_request;
+ u64 reqid;
+@@ -715,7 +718,7 @@ s32 brcmf_notify_escan_complete(struct b
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
+ ¶ms_le, sizeof(params_le));
+ if (err)
+- bphy_err(wiphy, "Scan abort failed\n");
++ bphy_err(drvr, "Scan abort failed\n");
+ }
+
+ brcmf_scan_config_mpc(ifp, 1);
+@@ -760,6 +763,7 @@ static int brcmf_cfg80211_del_ap_iface(s
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct net_device *ndev = wdev->netdev;
+ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = cfg->pub;
+ int ret;
+ int err;
+
+@@ -767,7 +771,7 @@ static int brcmf_cfg80211_del_ap_iface(s
+
+ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
+ if (err) {
+- bphy_err(wiphy, "interface_remove failed %d\n", err);
++ bphy_err(drvr, "interface_remove failed %d\n", err);
+ goto err_unarm;
+ }
+
+@@ -775,7 +779,7 @@ static int brcmf_cfg80211_del_ap_iface(s
+ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
+ BRCMF_VIF_EVENT_TIMEOUT);
+ if (!ret) {
+- bphy_err(wiphy, "timeout occurred\n");
++ bphy_err(drvr, "timeout occurred\n");
+ err = -EIO;
+ goto err_unarm;
+ }
+@@ -838,6 +842,7 @@ brcmf_cfg80211_change_iface(struct wiphy
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ struct brcmf_cfg80211_vif *vif = ifp->vif;
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 infra = 0;
+ s32 ap = 0;
+ s32 err = 0;
+@@ -877,13 +882,13 @@ brcmf_cfg80211_change_iface(struct wiphy
+ }
+ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
+ if (err) {
+- bphy_err(wiphy, "iface validation failed: err=%d\n", err);
++ bphy_err(drvr, "iface validation failed: err=%d\n", err);
+ return err;
+ }
+ switch (type) {
+ case NL80211_IFTYPE_MONITOR:
+ case NL80211_IFTYPE_WDS:
+- bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
++ bphy_err(drvr, "type (%d) : currently we do not support this type\n",
+ type);
+ return -EOPNOTSUPP;
+ case NL80211_IFTYPE_ADHOC:
+@@ -912,7 +917,7 @@ brcmf_cfg80211_change_iface(struct wiphy
+ } else {
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
+ if (err) {
+- bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
++ bphy_err(drvr, "WLC_SET_INFRA error (%d)\n", err);
+ err = -EAGAIN;
+ goto done;
+ }
+@@ -1003,7 +1008,7 @@ static s32
+ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
+ struct cfg80211_scan_request *request)
+ {
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
+ offsetof(struct brcmf_escan_params_le, params_le);
+ struct brcmf_escan_params_le *params;
+@@ -1035,7 +1040,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
+ if (err == -EBUSY)
+ brcmf_dbg(INFO, "system busy : escan canceled\n");
+ else
+- bphy_err(wiphy, "error (%d)\n", err);
++ bphy_err(drvr, "error (%d)\n", err);
+ }
+
+ kfree(params);
+@@ -1072,6 +1077,7 @@ static s32
+ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_cfg80211_vif *vif;
+ s32 err = 0;
+
+@@ -1081,22 +1087,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
+ return -EIO;
+
+ if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
+- bphy_err(wiphy, "Scanning already: status (%lu)\n",
++ bphy_err(drvr, "Scanning already: status (%lu)\n",
+ cfg->scan_status);
+ return -EAGAIN;
+ }
+ if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
+- bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
++ bphy_err(drvr, "Scanning being aborted: status (%lu)\n",
+ cfg->scan_status);
+ return -EAGAIN;
+ }
+ if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
+- bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
++ bphy_err(drvr, "Scanning suppressed: status (%lu)\n",
+ cfg->scan_status);
+ return -EAGAIN;
+ }
+ if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
+- bphy_err(wiphy, "Connecting: status (%lu)\n", vif->sme_state);
++ bphy_err(drvr, "Connecting: status (%lu)\n", vif->sme_state);
+ return -EAGAIN;
+ }
+
+@@ -1130,7 +1136,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
+ return 0;
+
+ scan_out:
+- bphy_err(wiphy, "scan error (%d)\n", err);
++ bphy_err(drvr, "scan error (%d)\n", err);
+ clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
+ cfg->scan_request = NULL;
+ return err;
+@@ -1139,12 +1145,12 @@ scan_out:
+ static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 err = 0;
+
+ err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
+ if (err)
+- bphy_err(wiphy, "Error (%d)\n", err);
++ bphy_err(drvr, "Error (%d)\n", err);
+
+ return err;
+ }
+@@ -1152,13 +1158,13 @@ static s32 brcmf_set_rts(struct net_devi
+ static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 err = 0;
+
+ err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
+ frag_threshold);
+ if (err)
+- bphy_err(wiphy, "Error (%d)\n", err);
++ bphy_err(drvr, "Error (%d)\n", err);
+
+ return err;
+ }
+@@ -1166,13 +1172,13 @@ static s32 brcmf_set_frag(struct net_dev
+ static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 err = 0;
+ u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
+
+ err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
+ if (err) {
+- bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
++ bphy_err(drvr, "cmd (%d) , error (%d)\n", cmd, err);
+ return err;
+ }
+ return err;
+@@ -1248,7 +1254,7 @@ static u16 brcmf_map_fw_linkdown_reason(
+
+ static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_wsec_pmk_le pmk;
+ int i, err;
+
+@@ -1262,7 +1268,7 @@ static int brcmf_set_pmk(struct brcmf_if
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
+ &pmk, sizeof(pmk));
+ if (err < 0)
+- bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n",
++ bphy_err(drvr, "failed to change PSK in firmware (len=%u)\n",
+ pmk_len);
+
+ return err;
+@@ -1271,7 +1277,7 @@ static int brcmf_set_pmk(struct brcmf_if
+ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 err = 0;
+
+ brcmf_dbg(TRACE, "Enter\n");
+@@ -1281,7 +1287,7 @@ static void brcmf_link_down(struct brcmf
+ err = brcmf_fil_cmd_data_set(vif->ifp,
+ BRCMF_C_DISASSOC, NULL, 0);
+ if (err) {
+- bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
++ bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err);
+ }
+ if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
+ (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
+@@ -1305,6 +1311,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_join_params join_params;
+ size_t join_params_size = 0;
+ s32 err = 0;
+@@ -1369,7 +1376,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
+
+ err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
+ if (err) {
+- bphy_err(wiphy, "wsec failed (%d)\n", err);
++ bphy_err(drvr, "wsec failed (%d)\n", err);
+ goto done;
+ }
+
+@@ -1381,7 +1388,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
+
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
+ if (err) {
+- bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
++ bphy_err(drvr, "WLC_SET_BCNPRD failed (%d)\n", err);
+ goto done;
+ }
+
+@@ -1426,7 +1433,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
+ target_channel);
+ if (err) {
+- bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
++ bphy_err(drvr, "WLC_SET_CHANNEL failed (%d)\n", err);
+ goto done;
+ }
+ } else
+@@ -1438,7 +1445,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
+ &join_params, join_params_size);
+ if (err) {
+- bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
++ bphy_err(drvr, "WLC_SET_SSID failed (%d)\n", err);
+ goto done;
+ }
+
+@@ -1475,8 +1482,8 @@ static s32 brcmf_set_wpa_version(struct
+ struct cfg80211_connect_params *sme)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+- struct wiphy *wiphy = ifp->drvr->wiphy;
+ struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_cfg80211_security *sec;
+ s32 val = 0;
+ s32 err = 0;
+@@ -1490,7 +1497,7 @@ static s32 brcmf_set_wpa_version(struct
+ brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
+ err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
+ if (err) {
+- bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
++ bphy_err(drvr, "set wpa_auth failed (%d)\n", err);
+ return err;
+ }
+ sec = &profile->sec;
+@@ -1502,8 +1509,8 @@ static s32 brcmf_set_auth_type(struct ne
+ struct cfg80211_connect_params *sme)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+- struct wiphy *wiphy = ifp->drvr->wiphy;
+ struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_cfg80211_security *sec;
+ s32 val = 0;
+ s32 err = 0;
+@@ -1525,7 +1532,7 @@ static s32 brcmf_set_auth_type(struct ne
+
+ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
+ if (err) {
+- bphy_err(wiphy, "set auth failed (%d)\n", err);
++ bphy_err(drvr, "set auth failed (%d)\n", err);
+ return err;
+ }
+ sec = &profile->sec;
+@@ -1538,8 +1545,8 @@ brcmf_set_wsec_mode(struct net_device *n
+ struct cfg80211_connect_params *sme)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+- struct wiphy *wiphy = ifp->drvr->wiphy;
+ struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_cfg80211_security *sec;
+ s32 pval = 0;
+ s32 gval = 0;
+@@ -1562,7 +1569,7 @@ brcmf_set_wsec_mode(struct net_device *n
+ pval = AES_ENABLED;
+ break;
+ default:
+- bphy_err(wiphy, "invalid cipher pairwise (%d)\n",
++ bphy_err(drvr, "invalid cipher pairwise (%d)\n",
+ sme->crypto.ciphers_pairwise[0]);
+ return -EINVAL;
+ }
+@@ -1583,7 +1590,7 @@ brcmf_set_wsec_mode(struct net_device *n
+ gval = AES_ENABLED;
+ break;
+ default:
+- bphy_err(wiphy, "invalid cipher group (%d)\n",
++ bphy_err(drvr, "invalid cipher group (%d)\n",
+ sme->crypto.cipher_group);
+ return -EINVAL;
+ }
+@@ -1599,7 +1606,7 @@ brcmf_set_wsec_mode(struct net_device *n
+ wsec = pval | gval;
+ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
+ if (err) {
+- bphy_err(wiphy, "error (%d)\n", err);
++ bphy_err(drvr, "error (%d)\n", err);
+ return err;
+ }
+
+@@ -1614,8 +1621,8 @@ static s32
+ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+- struct wiphy *wiphy = ifp->drvr->wiphy;
+ struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 val;
+ s32 err;
+ const struct brcmf_tlv *rsn_ie;
+@@ -1633,7 +1640,7 @@ brcmf_set_key_mgmt(struct net_device *nd
+
+ err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
+ if (err) {
+- bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
++ bphy_err(drvr, "could not get wpa_auth (%d)\n", err);
+ return err;
+ }
+ if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
+@@ -1647,7 +1654,7 @@ brcmf_set_key_mgmt(struct net_device *nd
+ val = WPA_AUTH_PSK;
+ break;
+ default:
+- bphy_err(wiphy, "invalid cipher group (%d)\n",
++ bphy_err(drvr, "invalid cipher group (%d)\n",
+ sme->crypto.cipher_group);
+ return -EINVAL;
+ }
+@@ -1670,7 +1677,7 @@ brcmf_set_key_mgmt(struct net_device *nd
+ val = WPA2_AUTH_PSK;
+ break;
+ default:
+- bphy_err(wiphy, "invalid cipher group (%d)\n",
++ bphy_err(drvr, "invalid cipher group (%d)\n",
+ sme->crypto.cipher_group);
+ return -EINVAL;
+ }
+@@ -1717,7 +1724,7 @@ skip_mfp_config:
+ brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
+ err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
+ if (err) {
+- bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
++ bphy_err(drvr, "could not set wpa_auth (%d)\n", err);
+ return err;
+ }
+
+@@ -1729,7 +1736,7 @@ brcmf_set_sharedkey(struct net_device *n
+ struct cfg80211_connect_params *sme)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
+ struct brcmf_cfg80211_security *sec;
+ struct brcmf_wsec_key key;
+@@ -1756,7 +1763,7 @@ brcmf_set_sharedkey(struct net_device *n
+ key.len = (u32) sme->key_len;
+ key.index = (u32) sme->key_idx;
+ if (key.len > sizeof(key.data)) {
+- bphy_err(wiphy, "Too long key length (%u)\n", key.len);
++ bphy_err(drvr, "Too long key length (%u)\n", key.len);
+ return -EINVAL;
+ }
+ memcpy(key.data, sme->key, key.len);
+@@ -1769,7 +1776,7 @@ brcmf_set_sharedkey(struct net_device *n
+ key.algo = CRYPTO_ALGO_WEP128;
+ break;
+ default:
+- bphy_err(wiphy, "Invalid algorithm (%d)\n",
++ bphy_err(drvr, "Invalid algorithm (%d)\n",
+ sme->crypto.ciphers_pairwise[0]);
+ return -EINVAL;
+ }
+@@ -1786,7 +1793,7 @@ brcmf_set_sharedkey(struct net_device *n
+ val = WL_AUTH_SHARED_KEY; /* shared key */
+ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
+ if (err)
+- bphy_err(wiphy, "set auth failed (%d)\n", err);
++ bphy_err(drvr, "set auth failed (%d)\n", err);
+ }
+ return err;
+ }
+@@ -1806,7 +1813,7 @@ enum nl80211_auth_type brcmf_war_auth_ty
+ static void brcmf_set_join_pref(struct brcmf_if *ifp,
+ struct cfg80211_bss_selection *bss_select)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_join_pref_params join_pref_params[2];
+ enum nl80211_band band;
+ int err, i = 0;
+@@ -1845,7 +1852,7 @@ static void brcmf_set_join_pref(struct b
+ err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
+ sizeof(join_pref_params));
+ if (err)
+- bphy_err(wiphy, "Set join_pref error (%d)\n", err);
++ bphy_err(drvr, "Set join_pref error (%d)\n", err);
+ }
+
+ static s32
+@@ -1856,6 +1863,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
+ struct ieee80211_channel *chan = sme->channel;
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_join_params join_params;
+ size_t join_params_size;
+ const struct brcmf_tlv *rsn_ie;
+@@ -1872,7 +1880,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
+ return -EIO;
+
+ if (!sme->ssid) {
+- bphy_err(wiphy, "Invalid ssid\n");
++ bphy_err(drvr, "Invalid ssid\n");
+ return -EOPNOTSUPP;
+ }
+
+@@ -1901,7 +1909,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
+ err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
+ sme->ie, sme->ie_len);
+ if (err)
+- bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
++ bphy_err(drvr, "Set Assoc REQ IE Failed\n");
+ else
+ brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
+
+@@ -1922,32 +1930,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
+
+ err = brcmf_set_wpa_version(ndev, sme);
+ if (err) {
+- bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
++ bphy_err(drvr, "wl_set_wpa_version failed (%d)\n", err);
+ goto done;
+ }
+
+ sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
+ err = brcmf_set_auth_type(ndev, sme);
+ if (err) {
+- bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
++ bphy_err(drvr, "wl_set_auth_type failed (%d)\n", err);
+ goto done;
+ }
+
+ err = brcmf_set_wsec_mode(ndev, sme);
+ if (err) {
+- bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
++ bphy_err(drvr, "wl_set_set_cipher failed (%d)\n", err);
+ goto done;
+ }
+
+ err = brcmf_set_key_mgmt(ndev, sme);
+ if (err) {
+- bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
++ bphy_err(drvr, "wl_set_key_mgmt failed (%d)\n", err);
+ goto done;
+ }
+
+ err = brcmf_set_sharedkey(ndev, sme);
+ if (err) {
+- bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
++ bphy_err(drvr, "brcmf_set_sharedkey failed (%d)\n", err);
+ goto done;
+ }
+
+@@ -1964,7 +1972,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
+ /* enable firmware supplicant for this interface */
+ err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
+ if (err < 0) {
+- bphy_err(wiphy, "failed to enable fw supplicant\n");
++ bphy_err(drvr, "failed to enable fw supplicant\n");
+ goto done;
+ }
+ }
+@@ -2059,7 +2067,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
+ &join_params, join_params_size);
+ if (err)
+- bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
++ bphy_err(drvr, "BRCMF_C_SET_SSID failed (%d)\n", err);
+
+ done:
+ if (err)
+@@ -2072,8 +2080,10 @@ static s32
+ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
+ u16 reason_code)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_scb_val_le scbval;
+ s32 err = 0;
+
+@@ -2090,7 +2100,7 @@ brcmf_cfg80211_disconnect(struct wiphy *
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
+ &scbval, sizeof(scbval));
+ if (err)
+- bphy_err(wiphy, "error (%d)\n", err);
++ bphy_err(drvr, "error (%d)\n", err);
+
+ brcmf_dbg(TRACE, "Exit\n");
+ return err;
+@@ -2103,6 +2113,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct net_device *ndev = cfg_to_ndev(cfg);
+ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 err;
+ s32 disable;
+ u32 qdbm = 127;
+@@ -2117,7 +2128,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
+ case NL80211_TX_POWER_LIMITED:
+ case NL80211_TX_POWER_FIXED:
+ if (mbm < 0) {
+- bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
++ bphy_err(drvr, "TX_POWER_FIXED - dbm is negative\n");
+ err = -EINVAL;
+ goto done;
+ }
+@@ -2127,7 +2138,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
+ qdbm |= WL_TXPWR_OVERRIDE;
+ break;
+ default:
+- bphy_err(wiphy, "Unsupported type %d\n", type);
++ bphy_err(drvr, "Unsupported type %d\n", type);
+ err = -EINVAL;
+ goto done;
+ }
+@@ -2135,11 +2146,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy
+ disable = WL_RADIO_SW_DISABLE << 16;
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
+ if (err)
+- bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
++ bphy_err(drvr, "WLC_SET_RADIO error (%d)\n", err);
+
+ err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
+ if (err)
+- bphy_err(wiphy, "qtxpower error (%d)\n", err);
++ bphy_err(drvr, "qtxpower error (%d)\n", err);
+
+ done:
+ brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
+@@ -2150,7 +2161,9 @@ static s32
+ brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
+ s32 *dbm)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev);
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 qdbm = 0;
+ s32 err;
+
+@@ -2160,7 +2173,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
+
+ err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
+ if (err) {
+- bphy_err(wiphy, "error (%d)\n", err);
++ bphy_err(drvr, "error (%d)\n", err);
+ goto done;
+ }
+ *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
+@@ -2175,6 +2188,7 @@ brcmf_cfg80211_config_default_key(struct
+ u8 key_idx, bool unicast, bool multicast)
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = ifp->drvr;
+ u32 index;
+ u32 wsec;
+ s32 err = 0;
+@@ -2186,7 +2200,7 @@ brcmf_cfg80211_config_default_key(struct
+
+ err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
+ if (err) {
+- bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
++ bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
+ goto done;
+ }
+
+@@ -2196,7 +2210,7 @@ brcmf_cfg80211_config_default_key(struct
+ err = brcmf_fil_cmd_int_set(ifp,
+ BRCMF_C_SET_KEY_PRIMARY, index);
+ if (err)
+- bphy_err(wiphy, "error (%d)\n", err);
++ bphy_err(drvr, "error (%d)\n", err);
+ }
+ done:
+ brcmf_dbg(TRACE, "Exit\n");
+@@ -2245,7 +2259,9 @@ brcmf_cfg80211_add_key(struct wiphy *wip
+ u8 key_idx, bool pairwise, const u8 *mac_addr,
+ struct key_params *params)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_wsec_key *key;
+ s32 val;
+ s32 wsec;
+@@ -2260,7 +2276,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
+
+ if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
+ /* we ignore this key index in this case */
+- bphy_err(wiphy, "invalid key index (%d)\n", key_idx);
++ bphy_err(drvr, "invalid key index (%d)\n", key_idx);
+ return -EINVAL;
+ }
+
+@@ -2269,7 +2285,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
+ mac_addr);
+
+ if (params->key_len > sizeof(key->data)) {
+- bphy_err(wiphy, "Too long key length (%u)\n", params->key_len);
++ bphy_err(drvr, "Too long key length (%u)\n", params->key_len);
+ return -EINVAL;
+ }
+
+@@ -2323,7 +2339,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
+ brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
+ break;
+ default:
+- bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
++ bphy_err(drvr, "Invalid cipher (0x%x)\n", params->cipher);
+ err = -EINVAL;
+ goto done;
+ }
+@@ -2334,13 +2350,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
+
+ err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
+ if (err) {
+- bphy_err(wiphy, "get wsec error (%d)\n", err);
++ bphy_err(drvr, "get wsec error (%d)\n", err);
+ goto done;
+ }
+ wsec |= val;
+ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
+ if (err) {
+- bphy_err(wiphy, "set wsec error (%d)\n", err);
++ bphy_err(drvr, "set wsec error (%d)\n", err);
+ goto done;
+ }
+
+@@ -2355,9 +2371,11 @@ brcmf_cfg80211_get_key(struct wiphy *wip
+ void (*callback)(void *cookie,
+ struct key_params *params))
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct key_params params;
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_cfg80211_security *sec;
+ s32 wsec;
+ s32 err = 0;
+@@ -2371,7 +2389,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
+
+ err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
+ if (err) {
+- bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
++ bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
+ /* Ignore this error, may happen during DISASSOC */
+ err = -EAGAIN;
+ goto done;
+@@ -2392,7 +2410,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
+ params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
+ brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
+ } else {
+- bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
++ bphy_err(drvr, "Invalid algo (0x%x)\n", wsec);
+ err = -EINVAL;
+ goto done;
+ }
+@@ -2422,7 +2440,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
+ static void
+ brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 err;
+ u8 key_idx;
+ struct brcmf_wsec_key *key;
+@@ -2439,18 +2457,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
+
+ err = send_key_to_dongle(ifp, key);
+ if (err) {
+- bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
++ bphy_err(drvr, "Setting WEP key failed (%d)\n", err);
+ return;
+ }
+ err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
+ if (err) {
+- bphy_err(wiphy, "get wsec error (%d)\n", err);
++ bphy_err(drvr, "get wsec error (%d)\n", err);
+ return;
+ }
+ wsec |= WEP_ENABLED;
+ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
+ if (err)
+- bphy_err(wiphy, "set wsec error (%d)\n", err);
++ bphy_err(drvr, "set wsec error (%d)\n", err);
+ }
+
+ static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
+@@ -2476,7 +2494,7 @@ static void brcmf_convert_sta_flags(u32
+
+ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct {
+ __le32 len;
+ struct brcmf_bss_info_le bss_le;
+@@ -2492,7 +2510,7 @@ static void brcmf_fill_bss_param(struct
+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
+ WL_BSS_INFO_MAX);
+ if (err) {
+- bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
++ bphy_err(drvr, "Failed to get bss info (%d)\n", err);
+ goto out_kfree;
+ }
+ si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
+@@ -2514,7 +2532,7 @@ static s32
+ brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
+ struct station_info *sinfo)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_scb_val_le scbval;
+ struct brcmf_pktcnt_le pktcnt;
+ s32 err;
+@@ -2524,7 +2542,7 @@ brcmf_cfg80211_get_station_ibss(struct b
+ /* Get the current tx rate */
+ err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
+ if (err < 0) {
+- bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
++ bphy_err(drvr, "BRCMF_C_GET_RATE error (%d)\n", err);
+ return err;
+ }
+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
+@@ -2534,7 +2552,7 @@ brcmf_cfg80211_get_station_ibss(struct b
+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
+ sizeof(scbval));
+ if (err) {
+- bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
++ bphy_err(drvr, "BRCMF_C_GET_RSSI error (%d)\n", err);
+ return err;
+ }
+ rssi = le32_to_cpu(scbval.val);
+@@ -2544,7 +2562,7 @@ brcmf_cfg80211_get_station_ibss(struct b
+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
+ sizeof(pktcnt));
+ if (err) {
+- bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
++ bphy_err(drvr, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
+ return err;
+ }
+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
+@@ -2563,7 +2581,9 @@ static s32
+ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
+ const u8 *mac, struct station_info *sinfo)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_scb_val_le scb_val;
+ s32 err = 0;
+ struct brcmf_sta_info_le sta_info_le;
+@@ -2592,7 +2612,7 @@ brcmf_cfg80211_get_station(struct wiphy
+ &sta_info_le,
+ sizeof(sta_info_le));
+ if (err < 0) {
+- bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
++ bphy_err(drvr, "GET STA INFO failed, %d\n", err);
+ goto done;
+ }
+ }
+@@ -2661,7 +2681,7 @@ brcmf_cfg80211_get_station(struct wiphy
+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
+ &scb_val, sizeof(scb_val));
+ if (err) {
+- bphy_err(wiphy, "Could not get rssi (%d)\n",
++ bphy_err(drvr, "Could not get rssi (%d)\n",
+ err);
+ goto done;
+ } else {
+@@ -2683,6 +2703,7 @@ brcmf_cfg80211_dump_station(struct wiphy
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 err;
+
+ brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
+@@ -2693,7 +2714,7 @@ brcmf_cfg80211_dump_station(struct wiphy
+ &cfg->assoclist,
+ sizeof(cfg->assoclist));
+ if (err) {
+- bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
++ bphy_err(drvr, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
+ err);
+ cfg->assoclist.count = 0;
+ return -EOPNOTSUPP;
+@@ -2714,6 +2735,7 @@ brcmf_cfg80211_set_power_mgmt(struct wip
+ s32 err = 0;
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = cfg->pub;
+
+ brcmf_dbg(TRACE, "Enter\n");
+
+@@ -2742,9 +2764,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
+ if (err) {
+ if (err == -ENODEV)
+- bphy_err(wiphy, "net_device is not ready yet\n");
++ bphy_err(drvr, "net_device is not ready yet\n");
+ else
+- bphy_err(wiphy, "error (%d)\n", err);
++ bphy_err(drvr, "error (%d)\n", err);
+ }
+ done:
+ brcmf_dbg(TRACE, "Exit\n");
+@@ -2755,6 +2777,7 @@ static s32 brcmf_inform_single_bss(struc
+ struct brcmf_bss_info_le *bi)
+ {
+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct cfg80211_bss *bss;
+ enum nl80211_band band;
+ struct brcmu_chan ch;
+@@ -2767,7 +2790,7 @@ static s32 brcmf_inform_single_bss(struc
+ struct cfg80211_inform_bss bss_data = {};
+
+ if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
+- bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n");
++ bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
+ return 0;
+ }
+
+@@ -2826,7 +2849,7 @@ next_bss_le(struct brcmf_scan_results *l
+
+ static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
+ {
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_scan_results *bss_list;
+ struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
+ s32 err = 0;
+@@ -2835,7 +2858,7 @@ static s32 brcmf_inform_bss(struct brcmf
+ bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
+ if (bss_list->count != 0 &&
+ bss_list->version != BRCMF_BSS_INFO_VERSION) {
+- bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n",
++ bphy_err(drvr, "Version %d != WL_BSS_INFO_VERSION\n",
+ bss_list->version);
+ return -EOPNOTSUPP;
+ }
+@@ -2853,6 +2876,7 @@ static s32 brcmf_inform_ibss(struct brcm
+ struct net_device *ndev, const u8 *bssid)
+ {
+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct ieee80211_channel *notify_channel;
+ struct brcmf_bss_info_le *bi = NULL;
+ struct ieee80211_supported_band *band;
+@@ -2880,7 +2904,7 @@ static s32 brcmf_inform_ibss(struct brcm
+ err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
+ buf, WL_BSS_INFO_MAX);
+ if (err) {
+- bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
++ bphy_err(drvr, "WLC_GET_BSS_INFO failed: %d\n", err);
+ goto CleanUp;
+ }
+
+@@ -2934,7 +2958,7 @@ CleanUp:
+ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
+ struct brcmf_if *ifp)
+ {
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_bss_info_le *bi;
+ const struct brcmf_tlv *tim;
+ u16 beacon_interval;
+@@ -2951,7 +2975,7 @@ static s32 brcmf_update_bss_info(struct
+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
+ cfg->extra_buf, WL_EXTRA_BUF_MAX);
+ if (err) {
+- bphy_err(wiphy, "Could not get bss info %d\n", err);
++ bphy_err(drvr, "Could not get bss info %d\n", err);
+ goto update_bss_info_out;
+ }
+
+@@ -2976,7 +3000,7 @@ static s32 brcmf_update_bss_info(struct
+ u32 var;
+ err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
+ if (err) {
+- bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err);
++ bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err);
+ goto update_bss_info_out;
+ }
+ dtim_period = (u8)var;
+@@ -3014,10 +3038,10 @@ static void brcmf_escan_timeout(struct t
+ {
+ struct brcmf_cfg80211_info *cfg =
+ from_timer(cfg, t, escan_timeout);
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+
+ if (cfg->int_escan_map || cfg->scan_request) {
+- bphy_err(wiphy, "timer expired\n");
++ bphy_err(drvr, "timer expired\n");
+ schedule_work(&cfg->escan_timeout_work);
+ }
+ }
+@@ -3065,8 +3089,8 @@ static s32
+ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
+ const struct brcmf_event_msg *e, void *data)
+ {
+- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = ifp->drvr;
++ struct brcmf_cfg80211_info *cfg = drvr->config;
+ s32 status;
+ struct brcmf_escan_result_le *escan_result_le;
+ u32 escan_buflen;
+@@ -3083,7 +3107,7 @@ brcmf_cfg80211_escan_handler(struct brcm
+ goto exit;
+
+ if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
+- bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n",
++ bphy_err(drvr, "scan not ready, bsscfgidx=%d\n",
+ ifp->bsscfgidx);
+ return -EPERM;
+ }
+@@ -3091,24 +3115,24 @@ brcmf_cfg80211_escan_handler(struct brcm
+ if (status == BRCMF_E_STATUS_PARTIAL) {
+ brcmf_dbg(SCAN, "ESCAN Partial result\n");
+ if (e->datalen < sizeof(*escan_result_le)) {
+- bphy_err(wiphy, "invalid event data length\n");
++ bphy_err(drvr, "invalid event data length\n");
+ goto exit;
+ }
+ escan_result_le = (struct brcmf_escan_result_le *) data;
+ if (!escan_result_le) {
+- bphy_err(wiphy, "Invalid escan result (NULL pointer)\n");
++ bphy_err(drvr, "Invalid escan result (NULL pointer)\n");
+ goto exit;
+ }
+ escan_buflen = le32_to_cpu(escan_result_le->buflen);
+ if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
+ escan_buflen > e->datalen ||
+ escan_buflen < sizeof(*escan_result_le)) {
+- bphy_err(wiphy, "Invalid escan buffer length: %d\n",
++ bphy_err(drvr, "Invalid escan buffer length: %d\n",
+ escan_buflen);
+ goto exit;
+ }
+ if (le16_to_cpu(escan_result_le->bss_count) != 1) {
+- bphy_err(wiphy, "Invalid bss_count %d: ignoring\n",
++ bphy_err(drvr, "Invalid bss_count %d: ignoring\n",
+ escan_result_le->bss_count);
+ goto exit;
+ }
+@@ -3124,7 +3148,7 @@ brcmf_cfg80211_escan_handler(struct brcm
+
+ bi_length = le32_to_cpu(bss_info_le->length);
+ if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
+- bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
++ bphy_err(drvr, "Ignoring invalid bss_info length: %d\n",
+ bi_length);
+ goto exit;
+ }
+@@ -3133,7 +3157,7 @@ brcmf_cfg80211_escan_handler(struct brcm
+ BIT(NL80211_IFTYPE_ADHOC))) {
+ if (le16_to_cpu(bss_info_le->capability) &
+ WLAN_CAPABILITY_IBSS) {
+- bphy_err(wiphy, "Ignoring IBSS result\n");
++ bphy_err(drvr, "Ignoring IBSS result\n");
+ goto exit;
+ }
+ }
+@@ -3141,7 +3165,7 @@ brcmf_cfg80211_escan_handler(struct brcm
+ list = (struct brcmf_scan_results *)
+ cfg->escan_info.escan_buf;
+ if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
+- bphy_err(wiphy, "Buffer is too small: ignoring\n");
++ bphy_err(drvr, "Buffer is too small: ignoring\n");
+ goto exit;
+ }
+
+@@ -3300,7 +3324,8 @@ static s32
+ brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
+ const struct brcmf_event_msg *e, void *data)
+ {
+- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
++ struct brcmf_pub *drvr = ifp->drvr;
++ struct brcmf_cfg80211_info *cfg = drvr->config;
+ struct brcmf_pno_net_info_le *netinfo, *netinfo_start;
+ struct cfg80211_scan_request *request = NULL;
+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
+@@ -3333,14 +3358,14 @@ brcmf_notify_sched_scan_results(struct b
+ WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
+ brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
+ if (!result_count) {
+- bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n");
++ bphy_err(drvr, "FALSE PNO Event. (pfn_count == 0)\n");
+ goto out_err;
+ }
+
+ netinfo_start = brcmf_get_netinfo_array(pfn_result);
+ datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
+ if (datalen < result_count * sizeof(*netinfo)) {
+- bphy_err(wiphy, "insufficient event data\n");
++ bphy_err(drvr, "insufficient event data\n");
+ goto out_err;
+ }
+
+@@ -3387,14 +3412,15 @@ brcmf_cfg80211_sched_scan_start(struct w
+ struct net_device *ndev,
+ struct cfg80211_sched_scan_request *req)
+ {
+- struct brcmf_if *ifp = netdev_priv(ndev);
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = cfg->pub;
+
+ brcmf_dbg(SCAN, "Enter: n_match_sets=%d n_ssids=%d\n",
+ req->n_match_sets, req->n_ssids);
+
+ if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
+- bphy_err(wiphy, "Scanning suppressed: status=%lu\n",
++ bphy_err(drvr, "Scanning suppressed: status=%lu\n",
+ cfg->scan_status);
+ return -EAGAIN;
+ }
+@@ -3473,8 +3499,8 @@ static s32
+ brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
+ void *data)
+ {
+- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = ifp->drvr;
++ struct brcmf_cfg80211_info *cfg = drvr->config;
+ struct brcmf_pno_scanresults_le *pfn_result;
+ struct brcmf_pno_net_info_le *netinfo;
+
+@@ -3493,7 +3519,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
+ }
+
+ if (le32_to_cpu(pfn_result->count) < 1) {
+- bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n",
++ bphy_err(drvr, "Invalid result count, expected 1 (%d)\n",
+ le32_to_cpu(pfn_result->count));
+ return -EINVAL;
+ }
+@@ -3523,6 +3549,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
+ static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_wowl_wakeind_le wake_ind_le;
+ struct cfg80211_wowlan_wakeup wakeup_data;
+ struct cfg80211_wowlan_wakeup *wakeup;
+@@ -3533,7 +3560,7 @@ static void brcmf_report_wowl_wakeind(st
+ err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
+ sizeof(wake_ind_le));
+ if (err) {
+- bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
++ bphy_err(drvr, "Get wowl_wakeind failed, err = %d\n", err);
+ return;
+ }
+
+@@ -3574,7 +3601,7 @@ static void brcmf_report_wowl_wakeind(st
+ cfg->wowl.nd_data_completed,
+ BRCMF_ND_INFO_TIMEOUT);
+ if (!timeout)
+- bphy_err(wiphy, "No result for wowl net detect\n");
++ bphy_err(drvr, "No result for wowl net detect\n");
+ else
+ wakeup_data.net_detect = cfg->wowl.nd_info;
+ }
+@@ -3763,6 +3790,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 err;
+ u32 npmk, i;
+
+@@ -3782,7 +3810,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
+ cfg->pmk_list.npmk = cpu_to_le32(npmk);
+ }
+ } else {
+- bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
++ bphy_err(drvr, "Too many PMKSA entries cached %d\n", npmk);
+ return -EINVAL;
+ }
+
+@@ -3805,6 +3833,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 err;
+ u32 npmk, i;
+
+@@ -3828,7 +3857,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
+ memset(&pmk[i], 0, sizeof(*pmk));
+ cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
+ } else {
+- bphy_err(wiphy, "Cache entry not found\n");
++ bphy_err(drvr, "Cache entry not found\n");
+ return -EINVAL;
+ }
+
+@@ -3860,20 +3889,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
+
+ static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 err;
+ s32 wpa_val;
+
+ /* set auth */
+ err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
+ if (err < 0) {
+- bphy_err(wiphy, "auth error %d\n", err);
++ bphy_err(drvr, "auth error %d\n", err);
+ return err;
+ }
+ /* set wsec */
+ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
+ if (err < 0) {
+- bphy_err(wiphy, "wsec error %d\n", err);
++ bphy_err(drvr, "wsec error %d\n", err);
+ return err;
+ }
+ /* set upper-layer auth */
+@@ -3883,7 +3912,7 @@ static s32 brcmf_configure_opensecurity(
+ wpa_val = WPA_AUTH_DISABLED;
+ err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val);
+ if (err < 0) {
+- bphy_err(wiphy, "wpa_auth error %d\n", err);
++ bphy_err(drvr, "wpa_auth error %d\n", err);
+ return err;
+ }
+
+@@ -3903,7 +3932,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ const struct brcmf_vs_tlv *wpa_ie,
+ bool is_rsn_ie)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ u32 auth = 0; /* d11 open authentication */
+ u16 count;
+ s32 err = 0;
+@@ -3934,13 +3963,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ /* check for multicast cipher suite */
+ if (offset + WPA_IE_MIN_OUI_LEN > len) {
+ err = -EINVAL;
+- bphy_err(wiphy, "no multicast cipher suite\n");
++ bphy_err(drvr, "no multicast cipher suite\n");
+ goto exit;
+ }
+
+ if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
+ err = -EINVAL;
+- bphy_err(wiphy, "ivalid OUI\n");
++ bphy_err(drvr, "ivalid OUI\n");
+ goto exit;
+ }
+ offset += TLV_OUI_LEN;
+@@ -3962,7 +3991,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ break;
+ default:
+ err = -EINVAL;
+- bphy_err(wiphy, "Invalid multi cast cipher info\n");
++ bphy_err(drvr, "Invalid multi cast cipher info\n");
+ goto exit;
+ }
+
+@@ -3973,13 +4002,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ /* Check for unicast suite(s) */
+ if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
+ err = -EINVAL;
+- bphy_err(wiphy, "no unicast cipher suite\n");
++ bphy_err(drvr, "no unicast cipher suite\n");
+ goto exit;
+ }
+ for (i = 0; i < count; i++) {
+ if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
+ err = -EINVAL;
+- bphy_err(wiphy, "ivalid OUI\n");
++ bphy_err(drvr, "ivalid OUI\n");
+ goto exit;
+ }
+ offset += TLV_OUI_LEN;
+@@ -3997,7 +4026,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ pval |= AES_ENABLED;
+ break;
+ default:
+- bphy_err(wiphy, "Invalid unicast security info\n");
++ bphy_err(drvr, "Invalid unicast security info\n");
+ }
+ offset++;
+ }
+@@ -4007,13 +4036,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ /* Check for auth key management suite(s) */
+ if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
+ err = -EINVAL;
+- bphy_err(wiphy, "no auth key mgmt suite\n");
++ bphy_err(drvr, "no auth key mgmt suite\n");
+ goto exit;
+ }
+ for (i = 0; i < count; i++) {
+ if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
+ err = -EINVAL;
+- bphy_err(wiphy, "ivalid OUI\n");
++ bphy_err(drvr, "ivalid OUI\n");
+ goto exit;
+ }
+ offset += TLV_OUI_LEN;
+@@ -4041,7 +4070,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ wpa_auth |= WPA2_AUTH_1X_SHA256;
+ break;
+ default:
+- bphy_err(wiphy, "Invalid key mgmt info\n");
++ bphy_err(drvr, "Invalid key mgmt info\n");
+ }
+ offset++;
+ }
+@@ -4083,7 +4112,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
+ wme_bss_disable);
+ if (err < 0) {
+- bphy_err(wiphy, "wme_bss_disable error %d\n", err);
++ bphy_err(drvr, "wme_bss_disable error %d\n", err);
+ goto exit;
+ }
+
+@@ -4097,7 +4126,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ &data[offset],
+ WPA_IE_MIN_OUI_LEN);
+ if (err < 0) {
+- bphy_err(wiphy, "bip error %d\n", err);
++ bphy_err(drvr, "bip error %d\n", err);
+ goto exit;
+ }
+ }
+@@ -4108,13 +4137,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ /* set auth */
+ err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
+ if (err < 0) {
+- bphy_err(wiphy, "auth error %d\n", err);
++ bphy_err(drvr, "auth error %d\n", err);
+ goto exit;
+ }
+ /* set wsec */
+ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
+ if (err < 0) {
+- bphy_err(wiphy, "wsec error %d\n", err);
++ bphy_err(drvr, "wsec error %d\n", err);
+ goto exit;
+ }
+ /* Configure MFP, this needs to go after wsec otherwise the wsec command
+@@ -4123,14 +4152,14 @@ brcmf_configure_wpaie(struct brcmf_if *i
+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
+ err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
+ if (err < 0) {
+- bphy_err(wiphy, "mfp error %d\n", err);
++ bphy_err(drvr, "mfp error %d\n", err);
+ goto exit;
+ }
+ }
+ /* set upper-layer auth */
+ err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
+ if (err < 0) {
+- bphy_err(wiphy, "wpa_auth error %d\n", err);
++ bphy_err(drvr, "wpa_auth error %d\n", err);
+ goto exit;
+ }
+
+@@ -4216,8 +4245,8 @@ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8
+ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
+ const u8 *vndr_ie_buf, u32 vndr_ie_len)
+ {
++ struct brcmf_pub *drvr;
+ struct brcmf_if *ifp;
+- struct wiphy *wiphy;
+ struct vif_saved_ie *saved_ie;
+ s32 err = 0;
+ u8 *iovar_ie_buf;
+@@ -4238,7 +4267,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
+ if (!vif)
+ return -ENODEV;
+ ifp = vif->ifp;
+- wiphy = ifp->drvr->wiphy;
++ drvr = ifp->drvr;
+ saved_ie = &vif->saved_ie;
+
+ brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
+@@ -4270,13 +4299,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
+ break;
+ default:
+ err = -EPERM;
+- bphy_err(wiphy, "not suitable type\n");
++ bphy_err(drvr, "not suitable type\n");
+ goto exit;
+ }
+
+ if (vndr_ie_len > mgmt_ie_buf_len) {
+ err = -ENOMEM;
+- bphy_err(wiphy, "extra IE size too big\n");
++ bphy_err(drvr, "extra IE size too big\n");
+ goto exit;
+ }
+
+@@ -4337,7 +4366,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
+ /* verify remained buf size before copy data */
+ if (remained_buf_len < (vndrie_info->vndrie.len +
+ VNDR_IE_VSIE_OFFSET)) {
+- bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d",
++ bphy_err(drvr, "no space in mgmt_ie_buf: len left %d",
+ remained_buf_len);
+ break;
+ }
+@@ -4369,7 +4398,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
+ err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
+ total_ie_buf_len);
+ if (err)
+- bphy_err(wiphy, "vndr ie set error : %d\n", err);
++ bphy_err(drvr, "vndr ie set error : %d\n", err);
+ }
+
+ exit:
+@@ -4397,14 +4426,14 @@ static s32
+ brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
+ struct cfg80211_beacon_data *beacon)
+ {
+- struct wiphy *wiphy = vif->ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = vif->ifp->drvr;
+ s32 err;
+
+ /* Set Beacon IEs to FW */
+ err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
+ beacon->tail, beacon->tail_len);
+ if (err) {
+- bphy_err(wiphy, "Set Beacon IE Failed\n");
++ bphy_err(drvr, "Set Beacon IE Failed\n");
+ return err;
+ }
+ brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
+@@ -4414,7 +4443,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
+ beacon->proberesp_ies,
+ beacon->proberesp_ies_len);
+ if (err)
+- bphy_err(wiphy, "Set Probe Resp IE Failed\n");
++ bphy_err(drvr, "Set Probe Resp IE Failed\n");
+ else
+ brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
+
+@@ -4428,6 +4457,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+ s32 ie_offset;
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = cfg->pub;
+ const struct brcmf_tlv *ssid_ie;
+ const struct brcmf_tlv *country_ie;
+ struct brcmf_ssid_le ssid_le;
+@@ -4523,7 +4553,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
+ is_11d);
+ if (err < 0) {
+- bphy_err(wiphy, "Regulatory Set Error, %d\n",
++ bphy_err(drvr, "Regulatory Set Error, %d\n",
+ err);
+ goto exit;
+ }
+@@ -4532,7 +4562,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
+ settings->beacon_interval);
+ if (err < 0) {
+- bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
++ bphy_err(drvr, "Beacon Interval Set Error, %d\n",
+ err);
+ goto exit;
+ }
+@@ -4541,7 +4571,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
+ settings->dtim_period);
+ if (err < 0) {
+- bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
++ bphy_err(drvr, "DTIM Interval Set Error, %d\n",
+ err);
+ goto exit;
+ }
+@@ -4552,7 +4582,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+ !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
+ if (err < 0) {
+- bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
++ bphy_err(drvr, "BRCMF_C_DOWN error %d\n",
+ err);
+ goto exit;
+ }
+@@ -4561,7 +4591,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
+ if (err < 0) {
+- bphy_err(wiphy, "SET INFRA error %d\n", err);
++ bphy_err(drvr, "SET INFRA error %d\n", err);
+ goto exit;
+ }
+ } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
+@@ -4577,7 +4607,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
+ if (err < 0) {
+- bphy_err(wiphy, "setting AP mode failed %d\n",
++ bphy_err(drvr, "setting AP mode failed %d\n",
+ err);
+ goto exit;
+ }
+@@ -4587,14 +4617,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+ */
+ err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
+ if (err < 0) {
+- bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
++ bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
+ chanspec, err);
+ goto exit;
+ }
+ }
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
+ if (err < 0) {
+- bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
++ bphy_err(drvr, "BRCMF_C_UP error (%d)\n", err);
+ goto exit;
+ }
+ /* On DOWN the firmware removes the WEP keys, reconfigure
+@@ -4609,14 +4639,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
+ &join_params, sizeof(join_params));
+ if (err < 0) {
+- bphy_err(wiphy, "SET SSID error (%d)\n", err);
++ bphy_err(drvr, "SET SSID error (%d)\n", err);
+ goto exit;
+ }
+
+ if (settings->hidden_ssid) {
+ err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
+ if (err) {
+- bphy_err(wiphy, "closednet error (%d)\n", err);
++ bphy_err(drvr, "closednet error (%d)\n", err);
+ goto exit;
+ }
+ }
+@@ -4625,14 +4655,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+ } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
+ err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
+ if (err < 0) {
+- bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
++ bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
+ chanspec, err);
+ goto exit;
+ }
+ err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
+ sizeof(ssid_le));
+ if (err < 0) {
+- bphy_err(wiphy, "setting ssid failed %d\n", err);
++ bphy_err(drvr, "setting ssid failed %d\n", err);
+ goto exit;
+ }
+ bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
+@@ -4640,7 +4670,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
+ err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
+ sizeof(bss_enable));
+ if (err < 0) {
+- bphy_err(wiphy, "bss_enable config failed %d\n", err);
++ bphy_err(drvr, "bss_enable config failed %d\n", err);
+ goto exit;
+ }
+
+@@ -4663,7 +4693,9 @@ exit:
+
+ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(ndev);
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 err;
+ struct brcmf_fil_bss_enable_le bss_enable;
+ struct brcmf_join_params join_params;
+@@ -4688,13 +4720,13 @@ static int brcmf_cfg80211_stop_ap(struct
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
+ &join_params, sizeof(join_params));
+ if (err < 0)
+- bphy_err(wiphy, "SET SSID error (%d)\n", err);
++ bphy_err(drvr, "SET SSID error (%d)\n", err);
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
+ if (err < 0)
+- bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err);
++ bphy_err(drvr, "BRCMF_C_DOWN error %d\n", err);
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
+ if (err < 0)
+- bphy_err(wiphy, "setting AP mode failed %d\n", err);
++ bphy_err(drvr, "setting AP mode failed %d\n", err);
+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
+ brcmf_fil_iovar_int_set(ifp, "mbss", 0);
+ brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
+@@ -4702,7 +4734,7 @@ static int brcmf_cfg80211_stop_ap(struct
+ /* Bring device back up so it can be used again */
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
+ if (err < 0)
+- bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
++ bphy_err(drvr, "BRCMF_C_UP error %d\n", err);
+
+ brcmf_vif_clear_mgmt_ies(ifp->vif);
+ } else {
+@@ -4711,7 +4743,7 @@ static int brcmf_cfg80211_stop_ap(struct
+ err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
+ sizeof(bss_enable));
+ if (err < 0)
+- bphy_err(wiphy, "bss_enable config failed %d\n", err);
++ bphy_err(drvr, "bss_enable config failed %d\n", err);
+ }
+ brcmf_set_mpc(ifp, 1);
+ brcmf_configure_arp_nd_offload(ifp, true);
+@@ -4740,6 +4772,7 @@ brcmf_cfg80211_del_station(struct wiphy
+ struct station_del_parameters *params)
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_scb_val_le scbval;
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ s32 err;
+@@ -4759,7 +4792,7 @@ brcmf_cfg80211_del_station(struct wiphy
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
+ &scbval, sizeof(scbval));
+ if (err)
+- bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
++ bphy_err(drvr, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
+ err);
+
+ brcmf_dbg(TRACE, "Exit\n");
+@@ -4770,6 +4803,8 @@ static int
+ brcmf_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev,
+ const u8 *mac, struct station_parameters *params)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ s32 err;
+
+@@ -4790,7 +4825,7 @@ brcmf_cfg80211_change_station(struct wip
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
+ (void *)mac, ETH_ALEN);
+ if (err < 0)
+- bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
++ bphy_err(drvr, "Setting SCB (de-)authorize failed, %d\n", err);
+
+ return err;
+ }
+@@ -4820,6 +4855,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct ieee80211_channel *chan = params->chan;
++ struct brcmf_pub *drvr = cfg->pub;
+ const u8 *buf = params->buf;
+ size_t len = params->len;
+ const struct ieee80211_mgmt *mgmt;
+@@ -4840,7 +4876,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
+ mgmt = (const struct ieee80211_mgmt *)buf;
+
+ if (!ieee80211_is_mgmt(mgmt->frame_control)) {
+- bphy_err(wiphy, "Driver only allows MGMT packet type\n");
++ bphy_err(drvr, "Driver only allows MGMT packet type\n");
+ return -EPERM;
+ }
+
+@@ -4871,13 +4907,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
+ GFP_KERNEL);
+ } else if (ieee80211_is_action(mgmt->frame_control)) {
+ if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
+- bphy_err(wiphy, "invalid action frame length\n");
++ bphy_err(drvr, "invalid action frame length\n");
+ err = -EINVAL;
+ goto exit;
+ }
+ af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
+ if (af_params == NULL) {
+- bphy_err(wiphy, "unable to allocate frame\n");
++ bphy_err(drvr, "unable to allocate frame\n");
+ err = -ENOMEM;
+ goto exit;
+ }
+@@ -4928,6 +4964,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
+ u64 cookie)
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_cfg80211_vif *vif;
+ int err = 0;
+
+@@ -4935,7 +4972,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
+
+ vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
+ if (vif == NULL) {
+- bphy_err(wiphy, "No p2p device available for probe response\n");
++ bphy_err(drvr, "No p2p device available for probe response\n");
+ err = -ENODEV;
+ goto exit;
+ }
+@@ -4950,6 +4987,7 @@ static int brcmf_cfg80211_get_channel(st
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct net_device *ndev = wdev->netdev;
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_if *ifp;
+ struct brcmu_chan ch;
+ enum nl80211_band band = 0;
+@@ -4963,7 +5001,7 @@ static int brcmf_cfg80211_get_channel(st
+
+ err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
+ if (err) {
+- bphy_err(wiphy, "chanspec failed (%d)\n", err);
++ bphy_err(drvr, "chanspec failed (%d)\n", err);
+ return err;
+ }
+
+@@ -5085,6 +5123,8 @@ static int brcmf_cfg80211_tdls_oper(stru
+ struct net_device *ndev, const u8 *peer,
+ enum nl80211_tdls_operation oper)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_if *ifp;
+ struct brcmf_tdls_iovar_le info;
+ int ret = 0;
+@@ -5102,7 +5142,7 @@ static int brcmf_cfg80211_tdls_oper(stru
+ ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
+ &info, sizeof(info));
+ if (ret < 0)
+- bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
++ bphy_err(drvr, "tdls_endpoint iovar failed: ret=%d\n", ret);
+
+ return ret;
+ }
+@@ -5113,6 +5153,8 @@ brcmf_cfg80211_update_conn_params(struct
+ struct cfg80211_connect_params *sme,
+ u32 changed)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_if *ifp;
+ int err;
+
+@@ -5123,7 +5165,7 @@ brcmf_cfg80211_update_conn_params(struct
+ err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
+ sme->ie, sme->ie_len);
+ if (err)
+- bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
++ bphy_err(drvr, "Set Assoc REQ IE Failed\n");
+ else
+ brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
+
+@@ -5135,6 +5177,8 @@ static int
+ brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
+ struct cfg80211_gtk_rekey_data *gtk)
+ {
++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ struct brcmf_gtk_keyinfo_le gtk_le;
+ int ret;
+@@ -5149,7 +5193,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
+ ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", >k_le,
+ sizeof(gtk_le));
+ if (ret < 0)
+- bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret);
++ bphy_err(drvr, "gtk_key_info iovar failed: ret=%d\n", ret);
+
+ return ret;
+ }
+@@ -5381,7 +5425,7 @@ static void brcmf_clear_assoc_ies(struct
+ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
+ struct brcmf_if *ifp)
+ {
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
+ struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
+ u32 req_len;
+@@ -5393,7 +5437,7 @@ static s32 brcmf_get_assoc_ies(struct br
+ err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
+ cfg->extra_buf, WL_ASSOC_INFO_MAX);
+ if (err) {
+- bphy_err(wiphy, "could not get assoc info (%d)\n", err);
++ bphy_err(drvr, "could not get assoc info (%d)\n", err);
+ return err;
+ }
+ assoc_info =
+@@ -5405,7 +5449,7 @@ static s32 brcmf_get_assoc_ies(struct br
+ cfg->extra_buf,
+ WL_ASSOC_INFO_MAX);
+ if (err) {
+- bphy_err(wiphy, "could not get assoc req (%d)\n", err);
++ bphy_err(drvr, "could not get assoc req (%d)\n", err);
+ return err;
+ }
+ conn_info->req_ie_len = req_len;
+@@ -5421,7 +5465,7 @@ static s32 brcmf_get_assoc_ies(struct br
+ cfg->extra_buf,
+ WL_ASSOC_INFO_MAX);
+ if (err) {
+- bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
++ bphy_err(drvr, "could not get assoc resp (%d)\n", err);
+ return err;
+ }
+ conn_info->resp_ie_len = resp_len;
+@@ -5548,7 +5592,7 @@ brcmf_notify_connect_status_ap(struct br
+ struct net_device *ndev,
+ const struct brcmf_event_msg *e, void *data)
+ {
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ static int generation;
+ u32 event = e->event_code;
+ u32 reason = e->reason;
+@@ -5566,7 +5610,7 @@ brcmf_notify_connect_status_ap(struct br
+ if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) &&
+ (reason == BRCMF_E_STATUS_SUCCESS)) {
+ if (!data) {
+- bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
++ bphy_err(drvr, "No IEs present in ASSOC/REASSOC_IND\n");
+ return -EINVAL;
+ }
+
+@@ -5858,7 +5902,7 @@ static void init_vif_event(struct brcmf_
+
+ static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 err;
+ u32 bcn_timeout;
+ __le32 roamtrigger[2];
+@@ -5871,7 +5915,7 @@ static s32 brcmf_dongle_roam(struct brcm
+ bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
+ err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
+ if (err) {
+- bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
++ bphy_err(drvr, "bcn_timeout error (%d)\n", err);
+ goto roam_setup_done;
+ }
+
+@@ -5883,7 +5927,7 @@ static s32 brcmf_dongle_roam(struct brcm
+ err = brcmf_fil_iovar_int_set(ifp, "roam_off",
+ ifp->drvr->settings->roamoff);
+ if (err) {
+- bphy_err(wiphy, "roam_off error (%d)\n", err);
++ bphy_err(drvr, "roam_off error (%d)\n", err);
+ goto roam_setup_done;
+ }
+
+@@ -5892,7 +5936,7 @@ static s32 brcmf_dongle_roam(struct brcm
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
+ (void *)roamtrigger, sizeof(roamtrigger));
+ if (err) {
+- bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
++ bphy_err(drvr, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
+ goto roam_setup_done;
+ }
+
+@@ -5901,7 +5945,7 @@ static s32 brcmf_dongle_roam(struct brcm
+ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
+ (void *)roam_delta, sizeof(roam_delta));
+ if (err) {
+- bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err);
++ bphy_err(drvr, "WLC_SET_ROAM_DELTA error (%d)\n", err);
+ goto roam_setup_done;
+ }
+
+@@ -5912,26 +5956,26 @@ roam_setup_done:
+ static s32
+ brcmf_dongle_scantime(struct brcmf_if *ifp)
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 err = 0;
+
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
+ BRCMF_SCAN_CHANNEL_TIME);
+ if (err) {
+- bphy_err(wiphy, "Scan assoc time error (%d)\n", err);
++ bphy_err(drvr, "Scan assoc time error (%d)\n", err);
+ goto dongle_scantime_out;
+ }
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
+ BRCMF_SCAN_UNASSOC_TIME);
+ if (err) {
+- bphy_err(wiphy, "Scan unassoc time error (%d)\n", err);
++ bphy_err(drvr, "Scan unassoc time error (%d)\n", err);
+ goto dongle_scantime_out;
+ }
+
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
+ BRCMF_SCAN_PASSIVE_TIME);
+ if (err) {
+- bphy_err(wiphy, "Scan passive time error (%d)\n", err);
++ bphy_err(drvr, "Scan passive time error (%d)\n", err);
+ goto dongle_scantime_out;
+ }
+
+@@ -5964,7 +6008,8 @@ static int brcmf_construct_chaninfo(stru
+ u32 bw_cap[])
+ {
+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
+- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
++ struct brcmf_pub *drvr = cfg->pub;
++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
+ struct ieee80211_supported_band *band;
+ struct ieee80211_channel *channel;
+ struct brcmf_chanspec_list *list;
+@@ -5985,7 +6030,7 @@ static int brcmf_construct_chaninfo(stru
+ err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
+ BRCMF_DCMD_MEDLEN);
+ if (err) {
+- bphy_err(wiphy, "get chanspecs error (%d)\n", err);
++ bphy_err(drvr, "get chanspecs error (%d)\n", err);
+ goto fail_pbuf;
+ }
+
+@@ -6008,7 +6053,7 @@ static int brcmf_construct_chaninfo(stru
+ } else if (ch.band == BRCMU_CHAN_BAND_5G) {
+ band = wiphy->bands[NL80211_BAND_5GHZ];
+ } else {
+- bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
++ bphy_err(drvr, "Invalid channel Spec. 0x%x.\n",
+ ch.chspec);
+ continue;
+ }
+@@ -6032,7 +6077,7 @@ static int brcmf_construct_chaninfo(stru
+ /* It seems firmware supports some channel we never
+ * considered. Something new in IEEE standard?
+ */
+- bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n",
++ bphy_err(drvr, "Ignoring unexpected firmware channel %d\n",
+ ch.control_ch_num);
+ continue;
+ }
+@@ -6089,8 +6134,8 @@ fail_pbuf:
+
+ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
+ {
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
+- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
++ struct brcmf_pub *drvr = cfg->pub;
++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
+ struct ieee80211_supported_band *band;
+ struct brcmf_fil_bwcap_le band_bwcap;
+ struct brcmf_chanspec_list *list;
+@@ -6136,7 +6181,7 @@ static int brcmf_enable_bw40_2g(struct b
+ err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
+ BRCMF_DCMD_MEDLEN);
+ if (err) {
+- bphy_err(wiphy, "get chanspecs error (%d)\n", err);
++ bphy_err(drvr, "get chanspecs error (%d)\n", err);
+ kfree(pbuf);
+ return err;
+ }
+@@ -6167,7 +6212,7 @@ static int brcmf_enable_bw40_2g(struct b
+
+ static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
+ {
+- struct wiphy *wiphy = ifp->drvr->wiphy;
++ struct brcmf_pub *drvr = ifp->drvr;
+ u32 band, mimo_bwcap;
+ int err;
+
+@@ -6203,7 +6248,7 @@ static void brcmf_get_bwcap(struct brcmf
+ bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
+ break;
+ default:
+- bphy_err(wiphy, "invalid mimo_bw_cap value\n");
++ bphy_err(drvr, "invalid mimo_bw_cap value\n");
+ }
+ }
+
+@@ -6278,7 +6323,8 @@ static void brcmf_update_vht_cap(struct
+
+ static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
+ {
+- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
++ struct brcmf_pub *drvr = cfg->pub;
++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
+ struct wiphy *wiphy = cfg_to_wiphy(cfg);
+ u32 nmode = 0;
+ u32 vhtmode = 0;
+@@ -6295,7 +6341,7 @@ static int brcmf_setup_wiphybands(struct
+ (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
+ err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
+ if (err) {
+- bphy_err(wiphy, "nmode error (%d)\n", err);
++ bphy_err(drvr, "nmode error (%d)\n", err);
+ } else {
+ brcmf_get_bwcap(ifp, bw_cap);
+ }
+@@ -6305,7 +6351,7 @@ static int brcmf_setup_wiphybands(struct
+
+ err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
+ if (err) {
+- bphy_err(wiphy, "rxchain error (%d)\n", err);
++ bphy_err(drvr, "rxchain error (%d)\n", err);
+ nchain = 1;
+ } else {
+ for (nchain = 0; rxchain; nchain++)
+@@ -6315,7 +6361,7 @@ static int brcmf_setup_wiphybands(struct
+
+ err = brcmf_construct_chaninfo(cfg, bw_cap);
+ if (err) {
+- bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
++ bphy_err(drvr, "brcmf_construct_chaninfo failed (%d)\n", err);
+ return err;
+ }
+
+@@ -6522,12 +6568,13 @@ static void brcmf_wiphy_wowl_params(stru
+ {
+ #ifdef CONFIG_PM
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct wiphy_wowlan_support *wowl;
+
+ wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
+ GFP_KERNEL);
+ if (!wowl) {
+- bphy_err(wiphy, "only support basic wowlan features\n");
++ bphy_err(drvr, "only support basic wowlan features\n");
+ wiphy->wowlan = &brcmf_wowlan_support;
+ return;
+ }
+@@ -6624,7 +6671,7 @@ static int brcmf_setup_wiphy(struct wiph
+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
+ sizeof(bandlist));
+ if (err) {
+- bphy_err(wiphy, "could not obtain band info: err=%d\n", err);
++ bphy_err(drvr, "could not obtain band info: err=%d\n", err);
+ return err;
+ }
+ /* first entry in bandlist is number of bands */
+@@ -6673,7 +6720,7 @@ static int brcmf_setup_wiphy(struct wiph
+
+ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
+ {
+- struct wiphy *wiphy = cfg_to_wiphy(cfg);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct net_device *ndev;
+ struct wireless_dev *wdev;
+ struct brcmf_if *ifp;
+@@ -6711,7 +6758,7 @@ static s32 brcmf_config_dongle(struct br
+
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
+ if (err) {
+- bphy_err(wiphy, "failed to set frameburst mode\n");
++ bphy_err(drvr, "failed to set frameburst mode\n");
+ goto default_conf_out;
+ }
+
+@@ -6892,6 +6939,7 @@ static void brcmf_cfg80211_reg_notifier(
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_fil_country_le ccreq;
+ s32 err;
+ int i;
+@@ -6903,7 +6951,7 @@ static void brcmf_cfg80211_reg_notifier(
+ /* ignore non-ISO3166 country codes */
+ for (i = 0; i < 2; i++)
+ if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
+- bphy_err(wiphy, "not an ISO3166 code (0x%02x 0x%02x)\n",
++ bphy_err(drvr, "not an ISO3166 code (0x%02x 0x%02x)\n",
+ req->alpha2[0], req->alpha2[1]);
+ return;
+ }
+@@ -6913,7 +6961,7 @@ static void brcmf_cfg80211_reg_notifier(
+
+ err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
+ if (err) {
+- bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
++ bphy_err(drvr, "Country code iovar returned err = %d\n", err);
+ return;
+ }
+
+@@ -6923,7 +6971,7 @@ static void brcmf_cfg80211_reg_notifier(
+
+ err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
+ if (err) {
+- bphy_err(wiphy, "Firmware rejected country setting\n");
++ bphy_err(drvr, "Firmware rejected country setting\n");
+ return;
+ }
+ brcmf_setup_wiphybands(cfg);
+@@ -6969,13 +7017,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+ u16 *cap = NULL;
+
+ if (!ndev) {
+- bphy_err(wiphy, "ndev is invalid\n");
++ bphy_err(drvr, "ndev is invalid\n");
+ return NULL;
+ }
+
+ cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
+ if (!cfg) {
+- bphy_err(wiphy, "Could not allocate wiphy device\n");
++ bphy_err(drvr, "Could not allocate wiphy device\n");
+ return NULL;
+ }
+
+@@ -6996,7 +7044,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+
+ err = wl_init_priv(cfg);
+ if (err) {
+- bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err);
++ bphy_err(drvr, "Failed to init iwm_priv (%d)\n", err);
+ brcmf_free_vif(vif);
+ goto wiphy_out;
+ }
+@@ -7005,7 +7053,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+ /* determine d11 io type before wiphy setup */
+ err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
+ if (err) {
+- bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
++ bphy_err(drvr, "Failed to get D11 version (%d)\n", err);
+ goto priv_out;
+ }
+ cfg->d11inf.io_type = (u8)io_type;
+@@ -7039,13 +7087,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+ #endif
+ err = wiphy_register(wiphy);
+ if (err < 0) {
+- bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
++ bphy_err(drvr, "Could not register wiphy device (%d)\n", err);
+ goto priv_out;
+ }
+
+ err = brcmf_setup_wiphybands(cfg);
+ if (err) {
+- bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err);
++ bphy_err(drvr, "Setting wiphy bands failed (%d)\n", err);
+ goto wiphy_unreg_out;
+ }
+
+@@ -7063,24 +7111,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+
+ err = brcmf_fweh_activate_events(ifp);
+ if (err) {
+- bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
++ bphy_err(drvr, "FWEH activation failed (%d)\n", err);
+ goto wiphy_unreg_out;
+ }
+
+ err = brcmf_p2p_attach(cfg, p2pdev_forced);
+ if (err) {
+- bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
++ bphy_err(drvr, "P2P initialisation failed (%d)\n", err);
+ goto wiphy_unreg_out;
+ }
+ err = brcmf_btcoex_attach(cfg);
+ if (err) {
+- bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err);
++ bphy_err(drvr, "BT-coex initialisation failed (%d)\n", err);
+ brcmf_p2p_detach(&cfg->p2p);
+ goto wiphy_unreg_out;
+ }
+ err = brcmf_pno_attach(cfg);
+ if (err) {
+- bphy_err(wiphy, "PNO initialisation failed (%d)\n", err);
++ bphy_err(drvr, "PNO initialisation failed (%d)\n", err);
+ brcmf_btcoex_detach(cfg);
+ brcmf_p2p_detach(&cfg->p2p);
+ goto wiphy_unreg_out;
+@@ -7100,7 +7148,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+ /* (re-) activate FWEH event handling */
+ err = brcmf_fweh_activate_events(ifp);
+ if (err) {
+- bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
++ bphy_err(drvr, "FWEH activation failed (%d)\n", err);
+ goto detach;
+ }
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
+@@ -62,12 +62,12 @@ void __brcmf_err(struct brcmf_bus *bus,
+ } while (0)
+ #endif
+
+-#define bphy_err(wiphy, fmt, ...) \
++#define bphy_err(drvr, fmt, ...) \
+ do { \
+ if (IS_ENABLED(CPTCFG_BRCMDBG) || \
+ IS_ENABLED(CPTCFG_BRCM_TRACING) || \
+ net_ratelimit()) \
+- wiphy_err(wiphy, "%s: " fmt, __func__, \
++ wiphy_err((drvr)->wiphy, "%s: " fmt, __func__, \
+ ##__VA_ARGS__); \
+ } while (0)
+
--- /dev/null
+From dcb1471bc6d0541d636c7ecd9239573304842884 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Tue, 19 Feb 2019 23:42:19 +0100
+Subject: [PATCH] brcmfmac: use bphy_err() in all wiphy-related code
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This recently added macro provides more meaningful error messages thanks
+to identifying a specific wiphy. It's especially important on systems
+with few cards supported by the same (brcmfmac) driver.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../broadcom/brcm80211/brcmfmac/bcdc.c | 22 ++---
+ .../broadcom/brcm80211/brcmfmac/common.c | 39 ++++----
+ .../broadcom/brcm80211/brcmfmac/core.c | 74 ++++++++--------
+ .../broadcom/brcm80211/brcmfmac/feature.c | 8 +-
+ .../broadcom/brcm80211/brcmfmac/fweh.c | 25 +++---
+ .../broadcom/brcm80211/brcmfmac/fwil.c | 10 +--
+ .../broadcom/brcm80211/brcmfmac/fwsignal.c | 38 ++++----
+ .../broadcom/brcm80211/brcmfmac/msgbuf.c | 65 ++++++++------
+ .../broadcom/brcm80211/brcmfmac/p2p.c | 88 +++++++++++--------
+ .../broadcom/brcm80211/brcmfmac/pno.c | 22 +++--
+ .../broadcom/brcm80211/brcmfmac/proto.c | 6 +-
+ 11 files changed, 224 insertions(+), 173 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
+@@ -178,8 +178,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf
+ *fwerr = 0;
+ ret = brcmf_proto_bcdc_msg(drvr, ifidx, cmd, buf, len, false);
+ if (ret < 0) {
+- brcmf_err("brcmf_proto_bcdc_msg failed w/status %d\n",
+- ret);
++ bphy_err(drvr, "brcmf_proto_bcdc_msg failed w/status %d\n",
++ ret);
+ goto done;
+ }
+
+@@ -195,9 +195,9 @@ retry:
+ if ((id < bcdc->reqid) && (++retries < RETRIES))
+ goto retry;
+ if (id != bcdc->reqid) {
+- brcmf_err("%s: unexpected request id %d (expected %d)\n",
+- brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
+- bcdc->reqid);
++ bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n",
++ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
++ bcdc->reqid);
+ ret = -EINVAL;
+ goto done;
+ }
+@@ -245,9 +245,9 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
+ id = (flags & BCDC_DCMD_ID_MASK) >> BCDC_DCMD_ID_SHIFT;
+
+ if (id != bcdc->reqid) {
+- brcmf_err("%s: unexpected request id %d (expected %d)\n",
+- brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
+- bcdc->reqid);
++ bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n",
++ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
++ bcdc->reqid);
+ ret = -EINVAL;
+ goto done;
+ }
+@@ -312,8 +312,8 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
+ }
+ if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
+ BCDC_PROTO_VER) {
+- brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
+- brcmf_ifname(tmp_if), h->flags);
++ bphy_err(drvr, "%s: non-BCDC packet received, flags 0x%x\n",
++ brcmf_ifname(tmp_if), h->flags);
+ return -EBADE;
+ }
+
+@@ -460,7 +460,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
+
+ /* ensure that the msg buf directly follows the cdc msg struct */
+ if ((unsigned long)(&bcdc->msg + 1) != (unsigned long)bcdc->buf) {
+- brcmf_err("struct brcmf_proto_bcdc is not correctly defined\n");
++ bphy_err(drvr, "struct brcmf_proto_bcdc is not correctly defined\n");
+ goto fail;
+ }
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+@@ -90,6 +90,7 @@ struct brcmf_mp_global_t brcmf_mp_global
+
+ void brcmf_c_set_joinpref_default(struct brcmf_if *ifp)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_join_pref_params join_pref_params[2];
+ int err;
+
+@@ -106,7 +107,7 @@ void brcmf_c_set_joinpref_default(struct
+ err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
+ sizeof(join_pref_params));
+ if (err)
+- brcmf_err("Set join_pref error (%d)\n", err);
++ bphy_err(drvr, "Set join_pref error (%d)\n", err);
+ }
+
+ static int brcmf_c_download(struct brcmf_if *ifp, u16 flag,
+@@ -129,7 +130,8 @@ static int brcmf_c_download(struct brcmf
+
+ static int brcmf_c_process_clm_blob(struct brcmf_if *ifp)
+ {
+- struct brcmf_bus *bus = ifp->drvr->bus_if;
++ struct brcmf_pub *drvr = ifp->drvr;
++ struct brcmf_bus *bus = drvr->bus_if;
+ struct brcmf_dload_data_le *chunk_buf;
+ const struct firmware *clm = NULL;
+ u8 clm_name[BRCMF_FW_NAME_LEN];
+@@ -145,7 +147,7 @@ static int brcmf_c_process_clm_blob(stru
+ memset(clm_name, 0, sizeof(clm_name));
+ err = brcmf_bus_get_fwname(bus, ".clm_blob", clm_name);
+ if (err) {
+- brcmf_err("get CLM blob file name failed (%d)\n", err);
++ bphy_err(drvr, "get CLM blob file name failed (%d)\n", err);
+ return err;
+ }
+
+@@ -182,12 +184,12 @@ static int brcmf_c_process_clm_blob(stru
+ } while ((datalen > 0) && (err == 0));
+
+ if (err) {
+- brcmf_err("clmload (%zu byte file) failed (%d); ",
+- clm->size, err);
++ bphy_err(drvr, "clmload (%zu byte file) failed (%d)\n",
++ clm->size, err);
+ /* Retrieve clmload_status and print */
+ err = brcmf_fil_iovar_int_get(ifp, "clmload_status", &status);
+ if (err)
+- brcmf_err("get clmload_status failed (%d)\n", err);
++ bphy_err(drvr, "get clmload_status failed (%d)\n", err);
+ else
+ brcmf_dbg(INFO, "clmload_status=%d\n", status);
+ err = -EIO;
+@@ -201,6 +203,7 @@ done:
+
+ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ s8 eventmask[BRCMF_EVENTING_MASK_LEN];
+ u8 buf[BRCMF_DCMD_SMLEN];
+ struct brcmf_bus *bus;
+@@ -214,7 +217,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
+ err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr,
+ sizeof(ifp->mac_addr));
+ if (err < 0) {
+- brcmf_err("Retrieving cur_etheraddr failed, %d\n", err);
++ bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err);
+ goto done;
+ }
+ memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN);
+@@ -226,7 +229,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO,
+ &revinfo, sizeof(revinfo));
+ if (err < 0) {
+- brcmf_err("retrieving revision info failed, %d\n", err);
++ bphy_err(drvr, "retrieving revision info failed, %d\n", err);
+ strlcpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname));
+ } else {
+ ri->vendorid = le32_to_cpu(revinfo.vendorid);
+@@ -260,7 +263,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
+ /* Do any CLM downloading */
+ err = brcmf_c_process_clm_blob(ifp);
+ if (err < 0) {
+- brcmf_err("download CLM blob file failed, %d\n", err);
++ bphy_err(drvr, "download CLM blob file failed, %d\n", err);
+ goto done;
+ }
+
+@@ -269,8 +272,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
+ strcpy(buf, "ver");
+ err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf));
+ if (err < 0) {
+- brcmf_err("Retrieving version information failed, %d\n",
+- err);
++ bphy_err(drvr, "Retrieving version information failed, %d\n",
++ err);
+ goto done;
+ }
+ ptr = (char *)buf;
+@@ -304,7 +307,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
+ /* set mpc */
+ err = brcmf_fil_iovar_int_set(ifp, "mpc", 1);
+ if (err) {
+- brcmf_err("failed setting mpc\n");
++ bphy_err(drvr, "failed setting mpc\n");
+ goto done;
+ }
+
+@@ -314,14 +317,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
+ err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask,
+ BRCMF_EVENTING_MASK_LEN);
+ if (err) {
+- brcmf_err("Get event_msgs error (%d)\n", err);
++ bphy_err(drvr, "Get event_msgs error (%d)\n", err);
+ goto done;
+ }
+ setbit(eventmask, BRCMF_E_IF);
+ err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask,
+ BRCMF_EVENTING_MASK_LEN);
+ if (err) {
+- brcmf_err("Set event_msgs error (%d)\n", err);
++ bphy_err(drvr, "Set event_msgs error (%d)\n", err);
+ goto done;
+ }
+
+@@ -329,8 +332,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
+ BRCMF_DEFAULT_SCAN_CHANNEL_TIME);
+ if (err) {
+- brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n",
+- err);
++ bphy_err(drvr, "BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n",
++ err);
+ goto done;
+ }
+
+@@ -338,8 +341,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
+ BRCMF_DEFAULT_SCAN_UNASSOC_TIME);
+ if (err) {
+- brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n",
+- err);
++ bphy_err(drvr, "BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n",
++ err);
+ goto done;
+ }
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -90,7 +90,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
+ s32 bsscfgidx;
+
+ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
+- brcmf_err("ifidx %d out of range\n", ifidx);
++ bphy_err(drvr, "ifidx %d out of range\n", ifidx);
+ return NULL;
+ }
+
+@@ -141,7 +141,9 @@ void brcmf_configure_arp_nd_offload(stru
+
+ static void _brcmf_set_multicast_list(struct work_struct *work)
+ {
+- struct brcmf_if *ifp;
++ struct brcmf_if *ifp = container_of(work, struct brcmf_if,
++ multicast_work);
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct net_device *ndev;
+ struct netdev_hw_addr *ha;
+ u32 cmd_value, cnt;
+@@ -150,8 +152,6 @@ static void _brcmf_set_multicast_list(st
+ u32 buflen;
+ s32 err;
+
+- ifp = container_of(work, struct brcmf_if, multicast_work);
+-
+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
+
+ ndev = ifp->ndev;
+@@ -181,7 +181,7 @@ static void _brcmf_set_multicast_list(st
+
+ err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen);
+ if (err < 0) {
+- brcmf_err("Setting mcast_list failed, %d\n", err);
++ bphy_err(drvr, "Setting mcast_list failed, %d\n", err);
+ cmd_value = cnt ? true : cmd_value;
+ }
+
+@@ -194,25 +194,25 @@ static void _brcmf_set_multicast_list(st
+ */
+ err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value);
+ if (err < 0)
+- brcmf_err("Setting allmulti failed, %d\n", err);
++ bphy_err(drvr, "Setting allmulti failed, %d\n", err);
+
+ /*Finally, pick up the PROMISC flag */
+ cmd_value = (ndev->flags & IFF_PROMISC) ? true : false;
+ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value);
+ if (err < 0)
+- brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n",
+- err);
++ bphy_err(drvr, "Setting BRCMF_C_SET_PROMISC failed, %d\n",
++ err);
+ brcmf_configure_arp_nd_offload(ifp, !cmd_value);
+ }
+
+ #if IS_ENABLED(CONFIG_IPV6)
+ static void _brcmf_update_ndtable(struct work_struct *work)
+ {
+- struct brcmf_if *ifp;
++ struct brcmf_if *ifp = container_of(work, struct brcmf_if,
++ ndoffload_work);
++ struct brcmf_pub *drvr = ifp->drvr;
+ int i, ret;
+
+- ifp = container_of(work, struct brcmf_if, ndoffload_work);
+-
+ /* clear the table in firmware */
+ ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0);
+ if (ret) {
+@@ -225,7 +225,7 @@ static void _brcmf_update_ndtable(struct
+ &ifp->ipv6_addr_tbl[i],
+ sizeof(struct in6_addr));
+ if (ret)
+- brcmf_err("add nd ip err %d\n", ret);
++ bphy_err(drvr, "add nd ip err %d\n", ret);
+ }
+ }
+ #else
+@@ -238,6 +238,7 @@ static int brcmf_netdev_set_mac_address(
+ {
+ struct brcmf_if *ifp = netdev_priv(ndev);
+ struct sockaddr *sa = (struct sockaddr *)addr;
++ struct brcmf_pub *drvr = ifp->drvr;
+ int err;
+
+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
+@@ -245,7 +246,7 @@ static int brcmf_netdev_set_mac_address(
+ err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data,
+ ETH_ALEN);
+ if (err < 0) {
+- brcmf_err("Setting cur_etheraddr failed, %d\n", err);
++ bphy_err(drvr, "Setting cur_etheraddr failed, %d\n", err);
+ } else {
+ brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
+ memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN);
+@@ -305,7 +306,7 @@ static netdev_tx_t brcmf_netdev_start_xm
+
+ /* Can the device send data? */
+ if (drvr->bus_if->state != BRCMF_BUS_UP) {
+- brcmf_err("xmit rejected state=%d\n", drvr->bus_if->state);
++ bphy_err(drvr, "xmit rejected state=%d\n", drvr->bus_if->state);
+ netif_stop_queue(ndev);
+ dev_kfree_skb(skb);
+ ret = -ENODEV;
+@@ -339,8 +340,8 @@ static netdev_tx_t brcmf_netdev_start_xm
+ ret = pskb_expand_head(skb, ALIGN(head_delta, NET_SKB_PAD), 0,
+ GFP_ATOMIC);
+ if (ret < 0) {
+- brcmf_err("%s: failed to expand headroom\n",
+- brcmf_ifname(ifp));
++ bphy_err(drvr, "%s: failed to expand headroom\n",
++ brcmf_ifname(ifp));
+ atomic_inc(&drvr->bus_if->stats.pktcow_failed);
+ goto done;
+ }
+@@ -607,7 +608,7 @@ static int brcmf_netdev_open(struct net_
+
+ /* If bus is not ready, can't continue */
+ if (bus_if->state != BRCMF_BUS_UP) {
+- brcmf_err("failed bus is not ready\n");
++ bphy_err(drvr, "failed bus is not ready\n");
+ return -EAGAIN;
+ }
+
+@@ -621,7 +622,7 @@ static int brcmf_netdev_open(struct net_
+ ndev->features &= ~NETIF_F_IP_CSUM;
+
+ if (brcmf_cfg80211_up(ndev)) {
+- brcmf_err("failed to bring up cfg80211\n");
++ bphy_err(drvr, "failed to bring up cfg80211\n");
+ return -EIO;
+ }
+
+@@ -683,7 +684,7 @@ int brcmf_net_attach(struct brcmf_if *if
+ else
+ err = register_netdev(ndev);
+ if (err != 0) {
+- brcmf_err("couldn't register the net device\n");
++ bphy_err(drvr, "couldn't register the net device\n");
+ goto fail;
+ }
+
+@@ -760,6 +761,7 @@ static const struct net_device_ops brcmf
+
+ static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct net_device *ndev;
+
+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
+@@ -772,7 +774,7 @@ static int brcmf_net_p2p_attach(struct b
+ memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
+
+ if (register_netdev(ndev) != 0) {
+- brcmf_err("couldn't register the p2p net device\n");
++ bphy_err(drvr, "couldn't register the p2p net device\n");
+ goto fail;
+ }
+
+@@ -801,8 +803,8 @@ struct brcmf_if *brcmf_add_if(struct brc
+ */
+ if (ifp) {
+ if (ifidx) {
+- brcmf_err("ERROR: netdev:%s already exists\n",
+- ifp->ndev->name);
++ bphy_err(drvr, "ERROR: netdev:%s already exists\n",
++ ifp->ndev->name);
+ netif_stop_queue(ifp->ndev);
+ brcmf_net_detach(ifp->ndev, false);
+ drvr->iflist[bsscfgidx] = NULL;
+@@ -864,7 +866,7 @@ static void brcmf_del_if(struct brcmf_pu
+ ifp = drvr->iflist[bsscfgidx];
+ drvr->iflist[bsscfgidx] = NULL;
+ if (!ifp) {
+- brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx);
++ bphy_err(drvr, "Null interface, bsscfgidx=%d\n", bsscfgidx);
+ return;
+ }
+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx,
+@@ -914,16 +916,17 @@ static int brcmf_psm_watchdog_notify(str
+ const struct brcmf_event_msg *evtmsg,
+ void *data)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ int err;
+
+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
+
+- brcmf_err("PSM's watchdog has fired!\n");
++ bphy_err(drvr, "PSM's watchdog has fired!\n");
+
+ err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
+ evtmsg->datalen);
+ if (err)
+- brcmf_err("Failed to get memory dump, %d\n", err);
++ bphy_err(drvr, "Failed to get memory dump, %d\n", err);
+
+ return err;
+ }
+@@ -967,7 +970,7 @@ static int brcmf_inetaddr_changed(struct
+ ret = brcmf_fil_iovar_data_get(ifp, "arp_hostip", addr_table,
+ sizeof(addr_table));
+ if (ret) {
+- brcmf_err("fail to get arp ip table err:%d\n", ret);
++ bphy_err(drvr, "fail to get arp ip table err:%d\n", ret);
+ return NOTIFY_OK;
+ }
+
+@@ -984,7 +987,7 @@ static int brcmf_inetaddr_changed(struct
+ ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
+ &ifa->ifa_address, sizeof(ifa->ifa_address));
+ if (ret)
+- brcmf_err("add arp ip err %d\n", ret);
++ bphy_err(drvr, "add arp ip err %d\n", ret);
+ }
+ break;
+ case NETDEV_DOWN:
+@@ -996,8 +999,8 @@ static int brcmf_inetaddr_changed(struct
+ ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear",
+ NULL, 0);
+ if (ret) {
+- brcmf_err("fail to clear arp ip table err:%d\n",
+- ret);
++ bphy_err(drvr, "fail to clear arp ip table err:%d\n",
++ ret);
+ return NOTIFY_OK;
+ }
+ for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
+@@ -1007,8 +1010,8 @@ static int brcmf_inetaddr_changed(struct
+ &addr_table[i],
+ sizeof(addr_table[i]));
+ if (ret)
+- brcmf_err("add arp ip err %d\n",
+- ret);
++ bphy_err(drvr, "add arp ip err %d\n",
++ ret);
+ }
+ }
+ break;
+@@ -1182,7 +1185,7 @@ static int brcmf_bus_started(struct brcm
+ return 0;
+
+ fail:
+- brcmf_err("failed: %d\n", ret);
++ bphy_err(drvr, "failed: %d\n", ret);
+ if (drvr->config) {
+ brcmf_cfg80211_detach(drvr->config);
+ drvr->config = NULL;
+@@ -1234,7 +1237,7 @@ int brcmf_attach(struct device *dev, str
+ /* Attach and link in the protocol */
+ ret = brcmf_proto_attach(drvr);
+ if (ret != 0) {
+- brcmf_err("brcmf_prot_attach failed\n");
++ bphy_err(drvr, "brcmf_prot_attach failed\n");
+ goto fail;
+ }
+
+@@ -1247,7 +1250,7 @@ int brcmf_attach(struct device *dev, str
+
+ ret = brcmf_bus_started(drvr, ops);
+ if (ret != 0) {
+- brcmf_err("dongle is not responding: err=%d\n", ret);
++ bphy_err(drvr, "dongle is not responding: err=%d\n", ret);
+ goto fail;
+ }
+
+@@ -1347,6 +1350,7 @@ static int brcmf_get_pend_8021x_cnt(stru
+
+ int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ int err;
+
+ err = wait_event_timeout(ifp->pend_8021x_wait,
+@@ -1354,7 +1358,7 @@ int brcmf_netdev_wait_pend8021x(struct b
+ MAX_WAIT_FOR_8021X_TX);
+
+ if (!err)
+- brcmf_err("Timed out waiting for no pending 802.1x packets\n");
++ bphy_err(drvr, "Timed out waiting for no pending 802.1x packets\n");
+
+ return !err;
+ }
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
+@@ -185,13 +185,14 @@ static void brcmf_feat_iovar_data_set(st
+ #define MAX_CAPS_BUFFER_SIZE 768
+ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ char caps[MAX_CAPS_BUFFER_SIZE];
+ enum brcmf_feat_id id;
+ int i, err;
+
+ err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
+ if (err) {
+- brcmf_err("could not get firmware cap (%d)\n", err);
++ bphy_err(drvr, "could not get firmware cap (%d)\n", err);
+ return;
+ }
+
+@@ -216,14 +217,15 @@ static void brcmf_feat_firmware_capabili
+ static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
+ {
+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
+- struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0);
++ struct brcmf_pub *drvr = bus_if->drvr;
++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
+ char caps[MAX_CAPS_BUFFER_SIZE + 1] = { };
+ char *tmp;
+ int err;
+
+ err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
+ if (err) {
+- brcmf_err("could not get firmware cap (%d)\n", err);
++ bphy_err(drvr, "could not get firmware cap (%d)\n", err);
+ return err;
+ }
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
+@@ -102,7 +102,8 @@ static void brcmf_fweh_queue_event(struc
+ schedule_work(&fweh->event_work);
+ }
+
+-static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp,
++static int brcmf_fweh_call_event_handler(struct brcmf_pub *drvr,
++ struct brcmf_if *ifp,
+ enum brcmf_fweh_event_code code,
+ struct brcmf_event_msg *emsg,
+ void *data)
+@@ -117,9 +118,9 @@ static int brcmf_fweh_call_event_handler
+ if (fweh->evt_handler[code])
+ err = fweh->evt_handler[code](ifp, emsg, data);
+ else
+- brcmf_err("unhandled event %d ignored\n", code);
++ bphy_err(drvr, "unhandled event %d ignored\n", code);
+ } else {
+- brcmf_err("no interface object\n");
++ bphy_err(drvr, "no interface object\n");
+ }
+ return err;
+ }
+@@ -158,7 +159,7 @@ static void brcmf_fweh_handle_if_event(s
+ return;
+ }
+ if (ifevent->ifidx >= BRCMF_MAX_IFS) {
+- brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
++ bphy_err(drvr, "invalid interface index: %u\n", ifevent->ifidx);
+ return;
+ }
+
+@@ -181,7 +182,8 @@ static void brcmf_fweh_handle_if_event(s
+ if (ifp && ifevent->action == BRCMF_E_IF_CHANGE)
+ brcmf_proto_reset_if(drvr, ifp);
+
+- err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
++ err = brcmf_fweh_call_event_handler(drvr, ifp, emsg->event_code, emsg,
++ data);
+
+ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
+ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
+@@ -268,11 +270,11 @@ static void brcmf_fweh_event_worker(stru
+ ifp = drvr->iflist[0];
+ else
+ ifp = drvr->iflist[emsg.bsscfgidx];
+- err = brcmf_fweh_call_event_handler(ifp, event->code, &emsg,
+- event->data);
++ err = brcmf_fweh_call_event_handler(drvr, ifp, event->code,
++ &emsg, event->data);
+ if (err) {
+- brcmf_err("event handler failed (%d)\n",
+- event->code);
++ bphy_err(drvr, "event handler failed (%d)\n",
++ event->code);
+ err = 0;
+ }
+ event_free:
+@@ -339,7 +341,7 @@ int brcmf_fweh_register(struct brcmf_pub
+ brcmf_fweh_handler_t handler)
+ {
+ if (drvr->fweh.evt_handler[code]) {
+- brcmf_err("event code %d already registered\n", code);
++ bphy_err(drvr, "event code %d already registered\n", code);
+ return -ENOSPC;
+ }
+ drvr->fweh.evt_handler[code] = handler;
+@@ -369,6 +371,7 @@ void brcmf_fweh_unregister(struct brcmf_
+ */
+ int brcmf_fweh_activate_events(struct brcmf_if *ifp)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ int i, err;
+ s8 eventmask[BRCMF_EVENTING_MASK_LEN];
+
+@@ -388,7 +391,7 @@ int brcmf_fweh_activate_events(struct br
+ err = brcmf_fil_iovar_data_set(ifp, "event_msgs",
+ eventmask, BRCMF_EVENTING_MASK_LEN);
+ if (err)
+- brcmf_err("Set event_msgs error (%d)\n", err);
++ bphy_err(drvr, "Set event_msgs error (%d)\n", err);
+
+ return err;
+ }
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
+@@ -110,7 +110,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp,
+ s32 err, fwerr;
+
+ if (drvr->bus_if->state != BRCMF_BUS_UP) {
+- brcmf_err("bus is down. we have nothing to do.\n");
++ bphy_err(drvr, "bus is down. we have nothing to do.\n");
+ return -EIO;
+ }
+
+@@ -242,7 +242,7 @@ brcmf_fil_iovar_data_set(struct brcmf_if
+ buflen, true);
+ } else {
+ err = -EPERM;
+- brcmf_err("Creating iovar failed\n");
++ bphy_err(drvr, "Creating iovar failed\n");
+ }
+
+ mutex_unlock(&drvr->proto_block);
+@@ -268,7 +268,7 @@ brcmf_fil_iovar_data_get(struct brcmf_if
+ memcpy(data, drvr->proto_buf, len);
+ } else {
+ err = -EPERM;
+- brcmf_err("Creating iovar failed\n");
++ bphy_err(drvr, "Creating iovar failed\n");
+ }
+
+ brcmf_dbg(FIL, "ifidx=%d, name=%s, len=%d\n", ifp->ifidx, name, len);
+@@ -366,7 +366,7 @@ brcmf_fil_bsscfg_data_set(struct brcmf_i
+ buflen, true);
+ } else {
+ err = -EPERM;
+- brcmf_err("Creating bsscfg failed\n");
++ bphy_err(drvr, "Creating bsscfg failed\n");
+ }
+
+ mutex_unlock(&drvr->proto_block);
+@@ -392,7 +392,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i
+ memcpy(data, drvr->proto_buf, len);
+ } else {
+ err = -EPERM;
+- brcmf_err("Creating bsscfg failed\n");
++ bphy_err(drvr, "Creating bsscfg failed\n");
+ }
+ brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
+ ifp->bsscfgidx, name, len);
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
+@@ -1255,6 +1255,7 @@ static int brcmf_fws_enq(struct brcmf_fw
+ enum brcmf_fws_skb_state state, int fifo,
+ struct sk_buff *p)
+ {
++ struct brcmf_pub *drvr = fws->drvr;
+ int prec = 2 * fifo;
+ u32 *qfull_stat = &fws->stats.delayq_full_error;
+ struct brcmf_fws_mac_descriptor *entry;
+@@ -1267,7 +1268,7 @@ static int brcmf_fws_enq(struct brcmf_fw
+
+ entry = brcmf_skbcb(p)->mac;
+ if (entry == NULL) {
+- brcmf_err("no mac descriptor found for skb %p\n", p);
++ bphy_err(drvr, "no mac descriptor found for skb %p\n", p);
+ return -ENOENT;
+ }
+
+@@ -1457,6 +1458,7 @@ static int
+ brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot,
+ u32 genbit, u16 seq, u8 compcnt)
+ {
++ struct brcmf_pub *drvr = fws->drvr;
+ u32 fifo;
+ u8 cnt = 0;
+ int ret;
+@@ -1481,14 +1483,14 @@ brcmf_fws_txs_process(struct brcmf_fws_i
+ else if (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED)
+ fws->stats.txs_host_tossed += compcnt;
+ else
+- brcmf_err("unexpected txstatus\n");
++ bphy_err(drvr, "unexpected txstatus\n");
+
+ while (cnt < compcnt) {
+ ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb,
+ remove_from_hanger);
+ if (ret != 0) {
+- brcmf_err("no packet in hanger slot: hslot=%d\n",
+- hslot);
++ bphy_err(drvr, "no packet in hanger slot: hslot=%d\n",
++ hslot);
+ goto cont;
+ }
+
+@@ -1612,12 +1614,13 @@ static int brcmf_fws_notify_credit_map(s
+ const struct brcmf_event_msg *e,
+ void *data)
+ {
+- struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
++ struct brcmf_pub *drvr = ifp->drvr;
++ struct brcmf_fws_info *fws = drvr_to_fws(drvr);
+ int i;
+ u8 *credits = data;
+
+ if (e->datalen < BRCMF_FWS_FIFO_COUNT) {
+- brcmf_err("event payload too small (%d)\n", e->datalen);
++ bphy_err(drvr, "event payload too small (%d)\n", e->datalen);
+ return -EINVAL;
+ }
+
+@@ -1681,6 +1684,7 @@ static void brcmf_rxreorder_get_skb_list
+
+ void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ u8 *reorder_data;
+ u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
+ struct brcmf_ampdu_rx_reorder *rfi;
+@@ -1695,7 +1699,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
+
+ /* validate flags and flow id */
+ if (flags == 0xFF) {
+- brcmf_err("invalid flags...so ignore this packet\n");
++ bphy_err(drvr, "invalid flags...so ignore this packet\n");
+ brcmf_netif_rx(ifp, pkt);
+ return;
+ }
+@@ -1732,7 +1736,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
+ flow_id, max_idx);
+ rfi = kzalloc(buf_size, GFP_ATOMIC);
+ if (rfi == NULL) {
+- brcmf_err("failed to alloc buffer\n");
++ bphy_err(drvr, "failed to alloc buffer\n");
+ brcmf_netif_rx(ifp, pkt);
+ return;
+ }
+@@ -1996,6 +2000,7 @@ static u8 brcmf_fws_precommit_skb(struct
+ static void brcmf_fws_rollback_toq(struct brcmf_fws_info *fws,
+ struct sk_buff *skb, int fifo)
+ {
++ struct brcmf_pub *drvr = fws->drvr;
+ struct brcmf_fws_mac_descriptor *entry;
+ struct sk_buff *pktout;
+ int qidx, hslot;
+@@ -2009,11 +2014,11 @@ static void brcmf_fws_rollback_toq(struc
+
+ pktout = brcmu_pktq_penq_head(&entry->psq, qidx, skb);
+ if (pktout == NULL) {
+- brcmf_err("%s queue %d full\n", entry->name, qidx);
++ bphy_err(drvr, "%s queue %d full\n", entry->name, qidx);
+ rc = -ENOSPC;
+ }
+ } else {
+- brcmf_err("%s entry removed\n", entry->name);
++ bphy_err(drvr, "%s entry removed\n", entry->name);
+ rc = -ENOENT;
+ }
+
+@@ -2118,7 +2123,8 @@ static int brcmf_fws_assign_htod(struct
+
+ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
+ {
+- struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
++ struct brcmf_pub *drvr = ifp->drvr;
++ struct brcmf_fws_info *fws = drvr_to_fws(drvr);
+ struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb);
+ struct ethhdr *eh = (struct ethhdr *)(skb->data);
+ int fifo = BRCMF_FWS_FIFO_BCMC;
+@@ -2146,7 +2152,7 @@ int brcmf_fws_process_skb(struct brcmf_i
+ brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb);
+ brcmf_fws_schedule_deq(fws);
+ } else {
+- brcmf_err("drop skb: no hanger slot\n");
++ bphy_err(drvr, "drop skb: no hanger slot\n");
+ brcmf_txfinalize(ifp, skb, false);
+ rc = -ENOMEM;
+ }
+@@ -2365,7 +2371,7 @@ struct brcmf_fws_info *brcmf_fws_attach(
+
+ fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq");
+ if (fws->fws_wq == NULL) {
+- brcmf_err("workqueue creation failed\n");
++ bphy_err(drvr, "workqueue creation failed\n");
+ rc = -EBADF;
+ goto fail;
+ }
+@@ -2381,13 +2387,13 @@ struct brcmf_fws_info *brcmf_fws_attach(
+ rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP,
+ brcmf_fws_notify_credit_map);
+ if (rc < 0) {
+- brcmf_err("register credit map handler failed\n");
++ bphy_err(drvr, "register credit map handler failed\n");
+ goto fail;
+ }
+ rc = brcmf_fweh_register(drvr, BRCMF_E_BCMC_CREDIT_SUPPORT,
+ brcmf_fws_notify_bcmc_credit_support);
+ if (rc < 0) {
+- brcmf_err("register bcmc credit handler failed\n");
++ bphy_err(drvr, "register bcmc credit handler failed\n");
+ brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP);
+ goto fail;
+ }
+@@ -2399,7 +2405,7 @@ struct brcmf_fws_info *brcmf_fws_attach(
+ fws->fw_signals = true;
+ ifp = brcmf_get_ifp(drvr, 0);
+ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
+- brcmf_err("failed to set bdcv2 tlv signaling\n");
++ bphy_err(drvr, "failed to set bdcv2 tlv signaling\n");
+ fws->fcmode = BRCMF_FWS_FCMODE_NONE;
+ fws->fw_signals = false;
+ }
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
+@@ -439,7 +439,7 @@ static int brcmf_msgbuf_tx_ioctl(struct
+ brcmf_commonring_lock(commonring);
+ ret_ptr = brcmf_commonring_reserve_for_write(commonring);
+ if (!ret_ptr) {
+- brcmf_err("Failed to reserve space in commonring\n");
++ bphy_err(drvr, "Failed to reserve space in commonring\n");
+ brcmf_commonring_unlock(commonring);
+ return -ENOMEM;
+ }
+@@ -503,7 +503,7 @@ static int brcmf_msgbuf_query_dcmd(struc
+
+ timeout = brcmf_msgbuf_ioctl_resp_wait(msgbuf);
+ if (!timeout) {
+- brcmf_err("Timeout on response for query command\n");
++ bphy_err(drvr, "Timeout on response for query command\n");
+ return -EIO;
+ }
+
+@@ -580,6 +580,7 @@ static u32
+ brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf,
+ struct brcmf_msgbuf_work_item *work)
+ {
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ struct msgbuf_tx_flowring_create_req *create;
+ struct brcmf_commonring *commonring;
+ void *ret_ptr;
+@@ -595,7 +596,7 @@ brcmf_msgbuf_flowring_create_worker(stru
+ &msgbuf->flowring_dma_handle[flowid],
+ GFP_KERNEL);
+ if (!dma_buf) {
+- brcmf_err("dma_alloc_coherent failed\n");
++ bphy_err(drvr, "dma_alloc_coherent failed\n");
+ brcmf_flowring_delete(msgbuf->flow, flowid);
+ return BRCMF_FLOWRING_INVALID_ID;
+ }
+@@ -608,7 +609,7 @@ brcmf_msgbuf_flowring_create_worker(stru
+ brcmf_commonring_lock(commonring);
+ ret_ptr = brcmf_commonring_reserve_for_write(commonring);
+ if (!ret_ptr) {
+- brcmf_err("Failed to reserve space in commonring\n");
++ bphy_err(drvr, "Failed to reserve space in commonring\n");
+ brcmf_commonring_unlock(commonring);
+ brcmf_msgbuf_remove_flowring(msgbuf, flowid);
+ return BRCMF_FLOWRING_INVALID_ID;
+@@ -635,7 +636,7 @@ brcmf_msgbuf_flowring_create_worker(stru
+ err = brcmf_commonring_write_complete(commonring);
+ brcmf_commonring_unlock(commonring);
+ if (err) {
+- brcmf_err("Failed to write commonring\n");
++ bphy_err(drvr, "Failed to write commonring\n");
+ brcmf_msgbuf_remove_flowring(msgbuf, flowid);
+ return BRCMF_FLOWRING_INVALID_ID;
+ }
+@@ -694,6 +695,7 @@ static u32 brcmf_msgbuf_flowring_create(
+ static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
+ {
+ struct brcmf_flowring *flow = msgbuf->flow;
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ struct brcmf_commonring *commonring;
+ void *ret_ptr;
+ u32 count;
+@@ -713,8 +715,8 @@ static void brcmf_msgbuf_txflow(struct b
+ while (brcmf_flowring_qlen(flow, flowid)) {
+ skb = brcmf_flowring_dequeue(flow, flowid);
+ if (skb == NULL) {
+- brcmf_err("No SKB, but qlen %d\n",
+- brcmf_flowring_qlen(flow, flowid));
++ bphy_err(drvr, "No SKB, but qlen %d\n",
++ brcmf_flowring_qlen(flow, flowid));
+ break;
+ }
+ skb_orphan(skb);
+@@ -722,7 +724,7 @@ static void brcmf_msgbuf_txflow(struct b
+ msgbuf->tx_pktids, skb, ETH_HLEN,
+ &physaddr, &pktid)) {
+ brcmf_flowring_reinsert(flow, flowid, skb);
+- brcmf_err("No PKTID available !!\n");
++ bphy_err(drvr, "No PKTID available !!\n");
+ break;
+ }
+ ret_ptr = brcmf_commonring_reserve_for_write(commonring);
+@@ -893,6 +895,7 @@ brcmf_msgbuf_process_txstatus(struct brc
+
+ static u32 brcmf_msgbuf_rxbuf_data_post(struct brcmf_msgbuf *msgbuf, u32 count)
+ {
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ struct brcmf_commonring *commonring;
+ void *ret_ptr;
+ struct sk_buff *skb;
+@@ -920,7 +923,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post(
+ skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE);
+
+ if (skb == NULL) {
+- brcmf_err("Failed to alloc SKB\n");
++ bphy_err(drvr, "Failed to alloc SKB\n");
+ brcmf_commonring_write_cancel(commonring, alloced - i);
+ break;
+ }
+@@ -930,7 +933,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post(
+ msgbuf->rx_pktids, skb, 0,
+ &physaddr, &pktid)) {
+ dev_kfree_skb_any(skb);
+- brcmf_err("No PKTID available !!\n");
++ bphy_err(drvr, "No PKTID available !!\n");
+ brcmf_commonring_write_cancel(commonring, alloced - i);
+ break;
+ }
+@@ -1000,6 +1003,7 @@ static u32
+ brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf,
+ u32 count)
+ {
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ struct brcmf_commonring *commonring;
+ void *ret_ptr;
+ struct sk_buff *skb;
+@@ -1017,7 +1021,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm
+ count,
+ &alloced);
+ if (!ret_ptr) {
+- brcmf_err("Failed to reserve space in commonring\n");
++ bphy_err(drvr, "Failed to reserve space in commonring\n");
+ brcmf_commonring_unlock(commonring);
+ return 0;
+ }
+@@ -1029,7 +1033,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm
+ skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE);
+
+ if (skb == NULL) {
+- brcmf_err("Failed to alloc SKB\n");
++ bphy_err(drvr, "Failed to alloc SKB\n");
+ brcmf_commonring_write_cancel(commonring, alloced - i);
+ break;
+ }
+@@ -1039,7 +1043,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm
+ msgbuf->rx_pktids, skb, 0,
+ &physaddr, &pktid)) {
+ dev_kfree_skb_any(skb);
+- brcmf_err("No PKTID available !!\n");
++ bphy_err(drvr, "No PKTID available !!\n");
+ brcmf_commonring_write_cancel(commonring, alloced - i);
+ break;
+ }
+@@ -1091,6 +1095,7 @@ static void brcmf_msgbuf_rxbuf_event_pos
+
+ static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
+ {
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ struct msgbuf_rx_event *event;
+ u32 idx;
+ u16 buflen;
+@@ -1117,8 +1122,8 @@ static void brcmf_msgbuf_process_event(s
+
+ ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx);
+ if (!ifp || !ifp->ndev) {
+- brcmf_err("Received pkt for invalid ifidx %d\n",
+- event->msg.ifidx);
++ bphy_err(drvr, "Received pkt for invalid ifidx %d\n",
++ event->msg.ifidx);
+ goto exit;
+ }
+
+@@ -1134,6 +1139,7 @@ exit:
+ static void
+ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
+ {
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ struct msgbuf_rx_complete *rx_complete;
+ struct sk_buff *skb;
+ u16 data_offset;
+@@ -1167,7 +1173,7 @@ brcmf_msgbuf_process_rx_complete(struct
+ ifp = msgbuf->drvr->mon_if;
+
+ if (!ifp) {
+- brcmf_err("Received unexpected monitor pkt\n");
++ bphy_err(drvr, "Received unexpected monitor pkt\n");
+ brcmu_pkt_buf_free_skb(skb);
+ return;
+ }
+@@ -1178,8 +1184,8 @@ brcmf_msgbuf_process_rx_complete(struct
+
+ ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx);
+ if (!ifp || !ifp->ndev) {
+- brcmf_err("Received pkt for invalid ifidx %d\n",
+- rx_complete->msg.ifidx);
++ bphy_err(drvr, "Received pkt for invalid ifidx %d\n",
++ rx_complete->msg.ifidx);
+ brcmu_pkt_buf_free_skb(skb);
+ return;
+ }
+@@ -1192,13 +1198,15 @@ static void brcmf_msgbuf_process_ring_st
+ void *buf)
+ {
+ struct msgbuf_ring_status *ring_status = buf;
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ int err;
+
+ err = le16_to_cpu(ring_status->compl_hdr.status);
+ if (err) {
+ int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id);
+
+- brcmf_err("Firmware reported ring %d error: %d\n", ring, err);
++ bphy_err(drvr, "Firmware reported ring %d error: %d\n", ring,
++ err);
+ }
+ }
+
+@@ -1206,6 +1214,7 @@ static void
+ brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,
+ void *buf)
+ {
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ struct msgbuf_flowring_create_resp *flowring_create_resp;
+ u16 status;
+ u16 flowid;
+@@ -1217,7 +1226,7 @@ brcmf_msgbuf_process_flow_ring_create_re
+ status = le16_to_cpu(flowring_create_resp->compl_hdr.status);
+
+ if (status) {
+- brcmf_err("Flowring creation failed, code %d\n", status);
++ bphy_err(drvr, "Flowring creation failed, code %d\n", status);
+ brcmf_msgbuf_remove_flowring(msgbuf, flowid);
+ return;
+ }
+@@ -1234,6 +1243,7 @@ static void
+ brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf,
+ void *buf)
+ {
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ struct msgbuf_flowring_delete_resp *flowring_delete_resp;
+ u16 status;
+ u16 flowid;
+@@ -1245,7 +1255,7 @@ brcmf_msgbuf_process_flow_ring_delete_re
+ status = le16_to_cpu(flowring_delete_resp->compl_hdr.status);
+
+ if (status) {
+- brcmf_err("Flowring deletion failed, code %d\n", status);
++ bphy_err(drvr, "Flowring deletion failed, code %d\n", status);
+ brcmf_flowring_delete(msgbuf->flow, flowid);
+ return;
+ }
+@@ -1258,6 +1268,7 @@ brcmf_msgbuf_process_flow_ring_delete_re
+
+ static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf)
+ {
++ struct brcmf_pub *drvr = msgbuf->drvr;
+ struct msgbuf_common_hdr *msg;
+
+ msg = (struct msgbuf_common_hdr *)buf;
+@@ -1294,7 +1305,7 @@ static void brcmf_msgbuf_process_msgtype
+ brcmf_msgbuf_process_rx_complete(msgbuf, buf);
+ break;
+ default:
+- brcmf_err("Unsupported msgtype %d\n", msg->msgtype);
++ bphy_err(drvr, "Unsupported msgtype %d\n", msg->msgtype);
+ break;
+ }
+ }
+@@ -1377,7 +1388,7 @@ void brcmf_msgbuf_delete_flowring(struct
+ brcmf_commonring_lock(commonring);
+ ret_ptr = brcmf_commonring_reserve_for_write(commonring);
+ if (!ret_ptr) {
+- brcmf_err("FW unaware, flowring will be removed !!\n");
++ bphy_err(drvr, "FW unaware, flowring will be removed !!\n");
+ brcmf_commonring_unlock(commonring);
+ brcmf_msgbuf_remove_flowring(msgbuf, flowid);
+ return;
+@@ -1401,7 +1412,7 @@ void brcmf_msgbuf_delete_flowring(struct
+ err = brcmf_commonring_write_complete(commonring);
+ brcmf_commonring_unlock(commonring);
+ if (err) {
+- brcmf_err("Failed to submit RING_DELETE, flowring will be removed\n");
++ bphy_err(drvr, "Failed to submit RING_DELETE, flowring will be removed\n");
+ brcmf_msgbuf_remove_flowring(msgbuf, flowid);
+ }
+ }
+@@ -1476,8 +1487,8 @@ int brcmf_proto_msgbuf_attach(struct brc
+ if_msgbuf = drvr->bus_if->msgbuf;
+
+ if (if_msgbuf->max_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
+- brcmf_err("driver not configured for this many flowrings %d\n",
+- if_msgbuf->max_flowrings);
++ bphy_err(drvr, "driver not configured for this many flowrings %d\n",
++ if_msgbuf->max_flowrings);
+ if_msgbuf->max_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
+ }
+
+@@ -1487,7 +1498,7 @@ int brcmf_proto_msgbuf_attach(struct brc
+
+ msgbuf->txflow_wq = create_singlethread_workqueue("msgbuf_txflow");
+ if (msgbuf->txflow_wq == NULL) {
+- brcmf_err("workqueue creation failed\n");
++ bphy_err(drvr, "workqueue creation failed\n");
+ goto fail;
+ }
+ INIT_WORK(&msgbuf->txflow_work, brcmf_msgbuf_txflow_worker);
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+@@ -434,6 +434,7 @@ static void brcmf_p2p_print_actframe(boo
+ */
+ static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ s32 ret = 0;
+
+ brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
+@@ -450,7 +451,7 @@ static int brcmf_p2p_set_firmware(struct
+ ret = brcmf_fil_iovar_data_set(ifp, "p2p_da_override", p2p_mac,
+ ETH_ALEN);
+ if (ret)
+- brcmf_err("failed to update device address ret %d\n", ret);
++ bphy_err(drvr, "failed to update device address ret %d\n", ret);
+
+ return ret;
+ }
+@@ -570,13 +571,14 @@ static s32 brcmf_p2p_deinit_discovery(st
+ */
+ static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p)
+ {
++ struct brcmf_pub *drvr = p2p->cfg->pub;
+ struct brcmf_cfg80211_vif *vif;
+ s32 ret = 0;
+
+ brcmf_dbg(TRACE, "enter\n");
+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
+ if (!vif) {
+- brcmf_err("P2P config device not available\n");
++ bphy_err(drvr, "P2P config device not available\n");
+ ret = -EPERM;
+ goto exit;
+ }
+@@ -590,13 +592,13 @@ static int brcmf_p2p_enable_discovery(st
+ vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
+ ret = brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 1);
+ if (ret < 0) {
+- brcmf_err("set p2p_disc error\n");
++ bphy_err(drvr, "set p2p_disc error\n");
+ goto exit;
+ }
+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
+ ret = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0);
+ if (ret < 0) {
+- brcmf_err("unable to set WL_P2P_DISC_ST_SCAN\n");
++ bphy_err(drvr, "unable to set WL_P2P_DISC_ST_SCAN\n");
+ goto exit;
+ }
+
+@@ -608,7 +610,7 @@ static int brcmf_p2p_enable_discovery(st
+ */
+ ret = brcmf_fil_bsscfg_int_set(vif->ifp, "wsec", AES_ENABLED);
+ if (ret < 0) {
+- brcmf_err("wsec error %d\n", ret);
++ bphy_err(drvr, "wsec error %d\n", ret);
+ goto exit;
+ }
+
+@@ -630,6 +632,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
+ u16 chanspecs[], s32 search_state,
+ enum p2p_bss_type bss_type)
+ {
++ struct brcmf_pub *drvr = p2p->cfg->pub;
+ s32 ret = 0;
+ s32 memsize = offsetof(struct brcmf_p2p_scan_le,
+ eparams.params_le.channel_list);
+@@ -648,7 +651,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
+
+ vif = p2p->bss_idx[bss_type].vif;
+ if (vif == NULL) {
+- brcmf_err("no vif for bss type %d\n", bss_type);
++ bphy_err(drvr, "no vif for bss type %d\n", bss_type);
+ ret = -EINVAL;
+ goto exit;
+ }
+@@ -676,7 +679,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
+ BRCMF_P2P_WILDCARD_SSID_LEN);
+ break;
+ default:
+- brcmf_err(" invalid search state %d\n", search_state);
++ bphy_err(drvr, " invalid search state %d\n", search_state);
+ ret = -EINVAL;
+ goto exit;
+ }
+@@ -760,6 +763,7 @@ static s32 brcmf_p2p_run_escan(struct br
+ struct cfg80211_scan_request *request)
+ {
+ struct brcmf_p2p_info *p2p = &cfg->p2p;
++ struct brcmf_pub *drvr = cfg->pub;
+ s32 err = 0;
+ s32 search_state = WL_P2P_DISC_ST_SCAN;
+ struct brcmf_cfg80211_vif *vif;
+@@ -822,7 +826,7 @@ static s32 brcmf_p2p_run_escan(struct br
+ }
+ exit:
+ if (err)
+- brcmf_err("error (%d)\n", err);
++ bphy_err(drvr, "error (%d)\n", err);
+ return err;
+ }
+
+@@ -917,19 +921,20 @@ int brcmf_p2p_scan_prep(struct wiphy *wi
+ static s32
+ brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, u16 channel, u32 duration)
+ {
++ struct brcmf_pub *drvr = p2p->cfg->pub;
+ struct brcmf_cfg80211_vif *vif;
+ struct brcmu_chan ch;
+ s32 err = 0;
+
+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
+ if (!vif) {
+- brcmf_err("Discovery is not set, so we have nothing to do\n");
++ bphy_err(drvr, "Discovery is not set, so we have nothing to do\n");
+ err = -EPERM;
+ goto exit;
+ }
+
+ if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status)) {
+- brcmf_err("Previous LISTEN is not completed yet\n");
++ bphy_err(drvr, "Previous LISTEN is not completed yet\n");
+ /* WAR: prevent cookie mismatch in wpa_supplicant return OK */
+ goto exit;
+ }
+@@ -1046,6 +1051,7 @@ void brcmf_p2p_cancel_remain_on_channel(
+ */
+ static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel)
+ {
++ struct brcmf_pub *drvr = p2p->cfg->pub;
+ s32 err;
+ u32 channel_cnt;
+ u16 *default_chan_list;
+@@ -1061,7 +1067,7 @@ static s32 brcmf_p2p_act_frm_search(stru
+ default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list),
+ GFP_KERNEL);
+ if (default_chan_list == NULL) {
+- brcmf_err("channel list allocation failed\n");
++ bphy_err(drvr, "channel list allocation failed\n");
+ err = -ENOMEM;
+ goto exit;
+ }
+@@ -1103,6 +1109,7 @@ static void brcmf_p2p_afx_handler(struct
+ struct brcmf_p2p_info *p2p = container_of(afx_hdl,
+ struct brcmf_p2p_info,
+ afx_hdl);
++ struct brcmf_pub *drvr = p2p->cfg->pub;
+ s32 err;
+
+ if (!afx_hdl->is_active)
+@@ -1116,7 +1123,7 @@ static void brcmf_p2p_afx_handler(struct
+ err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan);
+
+ if (err) {
+- brcmf_err("ERROR occurred! value is (%d)\n", err);
++ bphy_err(drvr, "ERROR occurred! value is (%d)\n", err);
+ if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
+ &p2p->status))
+ complete(&afx_hdl->act_frm_scan);
+@@ -1338,7 +1345,8 @@ int brcmf_p2p_notify_action_frame_rx(str
+ const struct brcmf_event_msg *e,
+ void *data)
+ {
+- struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
++ struct brcmf_pub *drvr = ifp->drvr;
++ struct brcmf_cfg80211_info *cfg = drvr->config;
+ struct brcmf_p2p_info *p2p = &cfg->p2p;
+ struct afx_hdl *afx_hdl = &p2p->afx_hdl;
+ struct wireless_dev *wdev;
+@@ -1409,7 +1417,7 @@ int brcmf_p2p_notify_action_frame_rx(str
+ mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) +
+ mgmt_frame_len, GFP_KERNEL);
+ if (!mgmt_frame) {
+- brcmf_err("No memory available for action frame\n");
++ bphy_err(drvr, "No memory available for action frame\n");
+ return -ENOMEM;
+ }
+ memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN);
+@@ -1492,6 +1500,7 @@ int brcmf_p2p_notify_action_tx_complete(
+ static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p,
+ struct brcmf_fil_af_params_le *af_params)
+ {
++ struct brcmf_pub *drvr = p2p->cfg->pub;
+ struct brcmf_cfg80211_vif *vif;
+ s32 err = 0;
+ s32 timeout = 0;
+@@ -1506,7 +1515,7 @@ static s32 brcmf_p2p_tx_action_frame(str
+ err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe", af_params,
+ sizeof(*af_params));
+ if (err) {
+- brcmf_err(" sending action frame has failed\n");
++ bphy_err(drvr, " sending action frame has failed\n");
+ goto exit;
+ }
+
+@@ -1556,6 +1565,7 @@ static s32 brcmf_p2p_pub_af_tx(struct br
+ struct brcmf_config_af_params *config_af_params)
+ {
+ struct brcmf_p2p_info *p2p = &cfg->p2p;
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_fil_action_frame_le *action_frame;
+ struct brcmf_p2p_pub_act_frame *act_frm;
+ s32 err = 0;
+@@ -1634,8 +1644,8 @@ static s32 brcmf_p2p_pub_af_tx(struct br
+ config_af_params->extra_listen = false;
+ break;
+ default:
+- brcmf_err("Unknown p2p pub act frame subtype: %d\n",
+- act_frm->subtype);
++ bphy_err(drvr, "Unknown p2p pub act frame subtype: %d\n",
++ act_frm->subtype);
+ err = -EINVAL;
+ }
+ return err;
+@@ -1657,6 +1667,7 @@ bool brcmf_p2p_send_action_frame(struct
+ struct brcmf_fil_action_frame_le *action_frame;
+ struct brcmf_config_af_params config_af_params;
+ struct afx_hdl *afx_hdl = &p2p->afx_hdl;
++ struct brcmf_pub *drvr = cfg->pub;
+ u16 action_frame_len;
+ bool ack = false;
+ u8 category;
+@@ -1692,7 +1703,7 @@ bool brcmf_p2p_send_action_frame(struct
+ if (brcmf_p2p_pub_af_tx(cfg, af_params, &config_af_params)) {
+ /* Just send unknown subtype frame with */
+ /* default parameters. */
+- brcmf_err("P2P Public action frame, unknown subtype.\n");
++ bphy_err(drvr, "P2P Public action frame, unknown subtype.\n");
+ }
+ } else if (brcmf_p2p_is_gas_action(action_frame->data,
+ action_frame_len)) {
+@@ -1714,7 +1725,7 @@ bool brcmf_p2p_send_action_frame(struct
+ af_params->dwell_time =
+ cpu_to_le32(P2P_AF_MIN_DWELL_TIME);
+ } else {
+- brcmf_err("Unknown action type: %d\n", action);
++ bphy_err(drvr, "Unknown action type: %d\n", action);
+ goto exit;
+ }
+ } else if (brcmf_p2p_is_p2p_action(action_frame->data,
+@@ -1722,8 +1733,8 @@ bool brcmf_p2p_send_action_frame(struct
+ /* do not configure anything. it will be */
+ /* sent with a default configuration */
+ } else {
+- brcmf_err("Unknown Frame: category 0x%x, action 0x%x\n",
+- category, action);
++ bphy_err(drvr, "Unknown Frame: category 0x%x, action 0x%x\n",
++ category, action);
+ return false;
+ }
+
+@@ -1761,7 +1772,7 @@ bool brcmf_p2p_send_action_frame(struct
+
+ if (brcmf_p2p_af_searching_channel(p2p) ==
+ P2P_INVALID_CHANNEL) {
+- brcmf_err("Couldn't find peer's channel.\n");
++ bphy_err(drvr, "Couldn't find peer's channel.\n");
+ goto exit;
+ }
+
+@@ -1783,7 +1794,8 @@ bool brcmf_p2p_send_action_frame(struct
+ tx_retry++;
+ }
+ if (ack == false) {
+- brcmf_err("Failed to send Action Frame(retry %d)\n", tx_retry);
++ bphy_err(drvr, "Failed to send Action Frame(retry %d)\n",
++ tx_retry);
+ clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
+ }
+
+@@ -1965,6 +1977,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
+ enum brcmf_fil_p2p_if_types if_type)
+ {
+ struct brcmf_p2p_info *p2p = &cfg->p2p;
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_cfg80211_vif *vif;
+ struct brcmf_fil_p2p_if_le if_request;
+ s32 err;
+@@ -1974,13 +1987,13 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
+
+ vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
+ if (!vif) {
+- brcmf_err("vif for P2PAPI_BSSCFG_PRIMARY does not exist\n");
++ bphy_err(drvr, "vif for P2PAPI_BSSCFG_PRIMARY does not exist\n");
+ return -EPERM;
+ }
+ brcmf_notify_escan_complete(cfg, vif->ifp, true, true);
+ vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif;
+ if (!vif) {
+- brcmf_err("vif for P2PAPI_BSSCFG_CONNECTION does not exist\n");
++ bphy_err(drvr, "vif for P2PAPI_BSSCFG_CONNECTION does not exist\n");
+ return -EPERM;
+ }
+ brcmf_set_mpc(vif->ifp, 0);
+@@ -1998,7 +2011,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
+ err = brcmf_fil_iovar_data_set(vif->ifp, "p2p_ifupd", &if_request,
+ sizeof(if_request));
+ if (err) {
+- brcmf_err("p2p_ifupd FAILED, err=%d\n", err);
++ bphy_err(drvr, "p2p_ifupd FAILED, err=%d\n", err);
+ brcmf_cfg80211_arm_vif_event(cfg, NULL);
+ return err;
+ }
+@@ -2006,7 +2019,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
+ BRCMF_VIF_EVENT_TIMEOUT);
+ brcmf_cfg80211_arm_vif_event(cfg, NULL);
+ if (!err) {
+- brcmf_err("No BRCMF_E_IF_CHANGE event received\n");
++ bphy_err(drvr, "No BRCMF_E_IF_CHANGE event received\n");
+ return -EIO;
+ }
+
+@@ -2069,6 +2082,7 @@ static struct wireless_dev *brcmf_p2p_cr
+ struct wiphy *wiphy,
+ u8 *addr)
+ {
++ struct brcmf_pub *drvr = p2p->cfg->pub;
+ struct brcmf_cfg80211_vif *p2p_vif;
+ struct brcmf_if *p2p_ifp;
+ struct brcmf_if *pri_ifp;
+@@ -2080,7 +2094,7 @@ static struct wireless_dev *brcmf_p2p_cr
+
+ p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE);
+ if (IS_ERR(p2p_vif)) {
+- brcmf_err("could not create discovery vif\n");
++ bphy_err(drvr, "could not create discovery vif\n");
+ return (struct wireless_dev *)p2p_vif;
+ }
+
+@@ -2088,7 +2102,7 @@ static struct wireless_dev *brcmf_p2p_cr
+
+ /* firmware requires unique mac address for p2pdev interface */
+ if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) {
+- brcmf_err("discovery vif must be different from primary interface\n");
++ bphy_err(drvr, "discovery vif must be different from primary interface\n");
+ return ERR_PTR(-EINVAL);
+ }
+
+@@ -2101,7 +2115,7 @@ static struct wireless_dev *brcmf_p2p_cr
+ /* Initialize P2P Discovery in the firmware */
+ err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
+ if (err < 0) {
+- brcmf_err("set p2p_disc error\n");
++ bphy_err(drvr, "set p2p_disc error\n");
+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
+ brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
+ goto fail;
+@@ -2113,7 +2127,7 @@ static struct wireless_dev *brcmf_p2p_cr
+ brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
+ if (!err) {
+- brcmf_err("timeout occurred\n");
++ bphy_err(drvr, "timeout occurred\n");
+ err = -EIO;
+ goto fail;
+ }
+@@ -2127,7 +2141,7 @@ static struct wireless_dev *brcmf_p2p_cr
+ /* verify bsscfg index for P2P discovery */
+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx);
+ if (err < 0) {
+- brcmf_err("retrieving discover bsscfg index failed\n");
++ bphy_err(drvr, "retrieving discover bsscfg index failed\n");
+ goto fail;
+ }
+
+@@ -2161,6 +2175,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
+ {
+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+ struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_cfg80211_vif *vif;
+ enum brcmf_fil_p2p_if_types iftype;
+ int err;
+@@ -2201,7 +2216,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
+ BRCMF_VIF_EVENT_TIMEOUT);
+ brcmf_cfg80211_arm_vif_event(cfg, NULL);
+ if (!err) {
+- brcmf_err("timeout occurred\n");
++ bphy_err(drvr, "timeout occurred\n");
+ err = -EIO;
+ goto fail;
+ }
+@@ -2209,7 +2224,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
+ /* interface created in firmware */
+ ifp = vif->ifp;
+ if (!ifp) {
+- brcmf_err("no if pointer provided\n");
++ bphy_err(drvr, "no if pointer provided\n");
+ err = -ENOENT;
+ goto fail;
+ }
+@@ -2220,7 +2235,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
+ #endif /* >= 3.17.0 */
+ err = brcmf_net_attach(ifp, true);
+ if (err) {
+- brcmf_err("Registering netdevice failed\n");
++ bphy_err(drvr, "Registering netdevice failed\n");
+ free_netdev(ifp->ndev);
+ goto fail;
+ }
+@@ -2375,6 +2390,7 @@ void brcmf_p2p_stop_device(struct wiphy
+ */
+ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
+ {
++ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_p2p_info *p2p;
+ struct brcmf_if *pri_ifp;
+ s32 err = 0;
+@@ -2389,7 +2405,7 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
+ if (p2pdev_forced) {
+ err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL);
+ if (IS_ERR(err_ptr)) {
+- brcmf_err("P2P device creation failed.\n");
++ bphy_err(drvr, "P2P device creation failed.\n");
+ err = PTR_ERR(err_ptr);
+ }
+ } else {
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
+@@ -109,6 +109,7 @@ static int brcmf_pno_channel_config(stru
+ static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq,
+ u32 mscan, u32 bestn)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_pno_param_le pfn_param;
+ u16 flags;
+ u32 pfnmem;
+@@ -132,13 +133,13 @@ static int brcmf_pno_config(struct brcmf
+ /* set bestn in firmware */
+ err = brcmf_fil_iovar_int_set(ifp, "pfnmem", pfnmem);
+ if (err < 0) {
+- brcmf_err("failed to set pfnmem\n");
++ bphy_err(drvr, "failed to set pfnmem\n");
+ goto exit;
+ }
+ /* get max mscan which the firmware supports */
+ err = brcmf_fil_iovar_int_get(ifp, "pfnmem", &pfnmem);
+ if (err < 0) {
+- brcmf_err("failed to get pfnmem\n");
++ bphy_err(drvr, "failed to get pfnmem\n");
+ goto exit;
+ }
+ mscan = min_t(u32, mscan, pfnmem);
+@@ -152,7 +153,7 @@ static int brcmf_pno_config(struct brcmf
+ err = brcmf_fil_iovar_data_set(ifp, "pfn_set", &pfn_param,
+ sizeof(pfn_param));
+ if (err)
+- brcmf_err("pfn_set failed, err=%d\n", err);
++ bphy_err(drvr, "pfn_set failed, err=%d\n", err);
+
+ exit:
+ return err;
+@@ -160,6 +161,7 @@ exit:
+
+ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_pno_macaddr_le pfn_mac;
+ u8 *mac_addr = NULL;
+ u8 *mac_mask = NULL;
+@@ -194,7 +196,7 @@ static int brcmf_pno_set_random(struct b
+ err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac,
+ sizeof(pfn_mac));
+ if (err)
+- brcmf_err("pfn_macaddr failed, err=%d\n", err);
++ bphy_err(drvr, "pfn_macaddr failed, err=%d\n", err);
+
+ return err;
+ }
+@@ -202,6 +204,7 @@ static int brcmf_pno_set_random(struct b
+ static int brcmf_pno_add_ssid(struct brcmf_if *ifp, struct cfg80211_ssid *ssid,
+ bool active)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_pno_net_param_le pfn;
+ int err;
+
+@@ -218,12 +221,13 @@ static int brcmf_pno_add_ssid(struct brc
+ brcmf_dbg(SCAN, "adding ssid=%.32s (active=%d)\n", ssid->ssid, active);
+ err = brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn, sizeof(pfn));
+ if (err < 0)
+- brcmf_err("adding failed: err=%d\n", err);
++ bphy_err(drvr, "adding failed: err=%d\n", err);
+ return err;
+ }
+
+ static int brcmf_pno_add_bssid(struct brcmf_if *ifp, const u8 *bssid)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_pno_bssid_le bssid_cfg;
+ int err;
+
+@@ -234,7 +238,7 @@ static int brcmf_pno_add_bssid(struct br
+ err = brcmf_fil_iovar_data_set(ifp, "pfn_add_bssid", &bssid_cfg,
+ sizeof(bssid_cfg));
+ if (err < 0)
+- brcmf_err("adding failed: err=%d\n", err);
++ bphy_err(drvr, "adding failed: err=%d\n", err);
+ return err;
+ }
+
+@@ -258,6 +262,7 @@ static bool brcmf_is_ssid_active(struct
+
+ static int brcmf_pno_clean(struct brcmf_if *ifp)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ int ret;
+
+ /* Disable pfn */
+@@ -267,7 +272,7 @@ static int brcmf_pno_clean(struct brcmf_
+ ret = brcmf_fil_iovar_data_set(ifp, "pfnclear", NULL, 0);
+ }
+ if (ret < 0)
+- brcmf_err("failed code %d\n", ret);
++ bphy_err(drvr, "failed code %d\n", ret);
+
+ return ret;
+ }
+@@ -392,6 +397,7 @@ static int brcmf_pno_config_networks(str
+
+ static int brcmf_pno_config_sched_scans(struct brcmf_if *ifp)
+ {
++ struct brcmf_pub *drvr = ifp->drvr;
+ struct brcmf_pno_info *pi;
+ struct brcmf_gscan_config *gscan_cfg;
+ struct brcmf_gscan_bucket_config *buckets;
+@@ -416,7 +422,7 @@ static int brcmf_pno_config_sched_scans(
+ /* clean up everything */
+ err = brcmf_pno_clean(ifp);
+ if (err < 0) {
+- brcmf_err("failed error=%d\n", err);
++ bphy_err(drvr, "failed error=%d\n", err);
+ goto free_gscan;
+ }
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
+@@ -47,8 +47,8 @@ int brcmf_proto_attach(struct brcmf_pub
+ if (brcmf_proto_msgbuf_attach(drvr))
+ goto fail;
+ } else {
+- brcmf_err("Unsupported proto type %d\n",
+- drvr->bus_if->proto_type);
++ bphy_err(drvr, "Unsupported proto type %d\n",
++ drvr->bus_if->proto_type);
+ goto fail;
+ }
+ if (!proto->tx_queue_data || (proto->hdrpull == NULL) ||
+@@ -56,7 +56,7 @@ int brcmf_proto_attach(struct brcmf_pub
+ (proto->configure_addr_mode == NULL) ||
+ (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL) ||
+ (proto->debugfs_create == NULL)) {
+- brcmf_err("Not all proto handlers have been installed\n");
++ bphy_err(drvr, "Not all proto handlers have been installed\n");
+ goto fail;
+ }
+ return 0;