339-v5.1-0009-brcmfmac-use-bphy_err-in-all-wiphy-related-code.patch 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594
  1. From dcb1471bc6d0541d636c7ecd9239573304842884 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Tue, 19 Feb 2019 23:42:19 +0100
  4. Subject: [PATCH] brcmfmac: use bphy_err() in all wiphy-related code
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. This recently added macro provides more meaningful error messages thanks
  9. to identifying a specific wiphy. It's especially important on systems
  10. with few cards supported by the same (brcmfmac) driver.
  11. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  12. Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  13. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14. ---
  15. .../broadcom/brcm80211/brcmfmac/bcdc.c | 22 ++---
  16. .../broadcom/brcm80211/brcmfmac/common.c | 39 ++++----
  17. .../broadcom/brcm80211/brcmfmac/core.c | 74 ++++++++--------
  18. .../broadcom/brcm80211/brcmfmac/feature.c | 8 +-
  19. .../broadcom/brcm80211/brcmfmac/fweh.c | 25 +++---
  20. .../broadcom/brcm80211/brcmfmac/fwil.c | 10 +--
  21. .../broadcom/brcm80211/brcmfmac/fwsignal.c | 38 ++++----
  22. .../broadcom/brcm80211/brcmfmac/msgbuf.c | 65 ++++++++------
  23. .../broadcom/brcm80211/brcmfmac/p2p.c | 88 +++++++++++--------
  24. .../broadcom/brcm80211/brcmfmac/pno.c | 22 +++--
  25. .../broadcom/brcm80211/brcmfmac/proto.c | 6 +-
  26. 11 files changed, 224 insertions(+), 173 deletions(-)
  27. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  28. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
  29. @@ -177,8 +177,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf
  30. ret = brcmf_proto_bcdc_msg(drvr, ifidx, cmd, buf, len, false);
  31. if (ret < 0) {
  32. - brcmf_err("brcmf_proto_bcdc_msg failed w/status %d\n",
  33. - ret);
  34. + bphy_err(drvr, "brcmf_proto_bcdc_msg failed w/status %d\n",
  35. + ret);
  36. goto done;
  37. }
  38. @@ -194,9 +194,9 @@ retry:
  39. if ((id < bcdc->reqid) && (++retries < RETRIES))
  40. goto retry;
  41. if (id != bcdc->reqid) {
  42. - brcmf_err("%s: unexpected request id %d (expected %d)\n",
  43. - brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  44. - bcdc->reqid);
  45. + bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n",
  46. + brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  47. + bcdc->reqid);
  48. ret = -EINVAL;
  49. goto done;
  50. }
  51. @@ -242,9 +242,9 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
  52. id = (flags & BCDC_DCMD_ID_MASK) >> BCDC_DCMD_ID_SHIFT;
  53. if (id != bcdc->reqid) {
  54. - brcmf_err("%s: unexpected request id %d (expected %d)\n",
  55. - brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  56. - bcdc->reqid);
  57. + bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n",
  58. + brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  59. + bcdc->reqid);
  60. ret = -EINVAL;
  61. goto done;
  62. }
  63. @@ -307,8 +307,8 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  64. }
  65. if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  66. BCDC_PROTO_VER) {
  67. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  68. - brcmf_ifname(tmp_if), h->flags);
  69. + bphy_err(drvr, "%s: non-BCDC packet received, flags 0x%x\n",
  70. + brcmf_ifname(tmp_if), h->flags);
  71. return -EBADE;
  72. }
  73. @@ -450,7 +450,7 @@ int brcmf_proto_bcdc_attach(struct brcmf
  74. /* ensure that the msg buf directly follows the cdc msg struct */
  75. if ((unsigned long)(&bcdc->msg + 1) != (unsigned long)bcdc->buf) {
  76. - brcmf_err("struct brcmf_proto_bcdc is not correctly defined\n");
  77. + bphy_err(drvr, "struct brcmf_proto_bcdc is not correctly defined\n");
  78. goto fail;
  79. }
  80. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  81. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  82. @@ -89,6 +89,7 @@ struct brcmf_mp_global_t brcmf_mp_global
  83. void brcmf_c_set_joinpref_default(struct brcmf_if *ifp)
  84. {
  85. + struct brcmf_pub *drvr = ifp->drvr;
  86. struct brcmf_join_pref_params join_pref_params[2];
  87. int err;
  88. @@ -105,11 +106,12 @@ void brcmf_c_set_joinpref_default(struct
  89. err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
  90. sizeof(join_pref_params));
  91. if (err)
  92. - brcmf_err("Set join_pref error (%d)\n", err);
  93. + bphy_err(drvr, "Set join_pref error (%d)\n", err);
  94. }
  95. int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
  96. {
  97. + struct brcmf_pub *drvr = ifp->drvr;
  98. s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  99. u8 buf[BRCMF_DCMD_SMLEN];
  100. struct brcmf_rev_info_le revinfo;
  101. @@ -121,7 +123,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  102. err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr,
  103. sizeof(ifp->mac_addr));
  104. if (err < 0) {
  105. - brcmf_err("Retrieving cur_etheraddr failed, %d\n", err);
  106. + bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err);
  107. goto done;
  108. }
  109. memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN);
  110. @@ -131,7 +133,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  111. &revinfo, sizeof(revinfo));
  112. ri = &ifp->drvr->revinfo;
  113. if (err < 0) {
  114. - brcmf_err("retrieving revision info failed, %d\n", err);
  115. + bphy_err(drvr, "retrieving revision info failed, %d\n", err);
  116. } else {
  117. ri->vendorid = le32_to_cpu(revinfo.vendorid);
  118. ri->deviceid = le32_to_cpu(revinfo.deviceid);
  119. @@ -158,8 +160,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  120. strcpy(buf, "ver");
  121. err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf));
  122. if (err < 0) {
  123. - brcmf_err("Retrieving version information failed, %d\n",
  124. - err);
  125. + bphy_err(drvr, "Retrieving version information failed, %d\n",
  126. + err);
  127. goto done;
  128. }
  129. ptr = (char *)buf;
  130. @@ -175,7 +177,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  131. /* set mpc */
  132. err = brcmf_fil_iovar_int_set(ifp, "mpc", 1);
  133. if (err) {
  134. - brcmf_err("failed setting mpc\n");
  135. + bphy_err(drvr, "failed setting mpc\n");
  136. goto done;
  137. }
  138. @@ -185,14 +187,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  139. err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask,
  140. BRCMF_EVENTING_MASK_LEN);
  141. if (err) {
  142. - brcmf_err("Get event_msgs error (%d)\n", err);
  143. + bphy_err(drvr, "Get event_msgs error (%d)\n", err);
  144. goto done;
  145. }
  146. setbit(eventmask, BRCMF_E_IF);
  147. err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask,
  148. BRCMF_EVENTING_MASK_LEN);
  149. if (err) {
  150. - brcmf_err("Set event_msgs error (%d)\n", err);
  151. + bphy_err(drvr, "Set event_msgs error (%d)\n", err);
  152. goto done;
  153. }
  154. @@ -200,8 +202,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  155. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
  156. BRCMF_DEFAULT_SCAN_CHANNEL_TIME);
  157. if (err) {
  158. - brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n",
  159. - err);
  160. + bphy_err(drvr, "BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n",
  161. + err);
  162. goto done;
  163. }
  164. @@ -209,8 +211,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  165. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
  166. BRCMF_DEFAULT_SCAN_UNASSOC_TIME);
  167. if (err) {
  168. - brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n",
  169. - err);
  170. + bphy_err(drvr, "BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n",
  171. + err);
  172. goto done;
  173. }
  174. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  175. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  176. @@ -89,7 +89,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  177. s32 bsscfgidx;
  178. if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  179. - brcmf_err("ifidx %d out of range\n", ifidx);
  180. + bphy_err(drvr, "ifidx %d out of range\n", ifidx);
  181. return NULL;
  182. }
  183. @@ -103,7 +103,9 @@ struct brcmf_if *brcmf_get_ifp(struct br
  184. static void _brcmf_set_multicast_list(struct work_struct *work)
  185. {
  186. - struct brcmf_if *ifp;
  187. + struct brcmf_if *ifp = container_of(work, struct brcmf_if,
  188. + multicast_work);
  189. + struct brcmf_pub *drvr = ifp->drvr;
  190. struct net_device *ndev;
  191. struct netdev_hw_addr *ha;
  192. u32 cmd_value, cnt;
  193. @@ -112,8 +114,6 @@ static void _brcmf_set_multicast_list(st
  194. u32 buflen;
  195. s32 err;
  196. - ifp = container_of(work, struct brcmf_if, multicast_work);
  197. -
  198. brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  199. ndev = ifp->ndev;
  200. @@ -143,7 +143,7 @@ static void _brcmf_set_multicast_list(st
  201. err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen);
  202. if (err < 0) {
  203. - brcmf_err("Setting mcast_list failed, %d\n", err);
  204. + bphy_err(drvr, "Setting mcast_list failed, %d\n", err);
  205. cmd_value = cnt ? true : cmd_value;
  206. }
  207. @@ -156,24 +156,24 @@ static void _brcmf_set_multicast_list(st
  208. */
  209. err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value);
  210. if (err < 0)
  211. - brcmf_err("Setting allmulti failed, %d\n", err);
  212. + bphy_err(drvr, "Setting allmulti failed, %d\n", err);
  213. /*Finally, pick up the PROMISC flag */
  214. cmd_value = (ndev->flags & IFF_PROMISC) ? true : false;
  215. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value);
  216. if (err < 0)
  217. - brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n",
  218. - err);
  219. + bphy_err(drvr, "Setting BRCMF_C_SET_PROMISC failed, %d\n",
  220. + err);
  221. }
  222. #if IS_ENABLED(CONFIG_IPV6)
  223. static void _brcmf_update_ndtable(struct work_struct *work)
  224. {
  225. - struct brcmf_if *ifp;
  226. + struct brcmf_if *ifp = container_of(work, struct brcmf_if,
  227. + ndoffload_work);
  228. + struct brcmf_pub *drvr = ifp->drvr;
  229. int i, ret;
  230. - ifp = container_of(work, struct brcmf_if, ndoffload_work);
  231. -
  232. /* clear the table in firmware */
  233. ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0);
  234. if (ret) {
  235. @@ -186,7 +186,7 @@ static void _brcmf_update_ndtable(struct
  236. &ifp->ipv6_addr_tbl[i],
  237. sizeof(struct in6_addr));
  238. if (ret)
  239. - brcmf_err("add nd ip err %d\n", ret);
  240. + bphy_err(drvr, "add nd ip err %d\n", ret);
  241. }
  242. }
  243. #else
  244. @@ -199,6 +199,7 @@ static int brcmf_netdev_set_mac_address(
  245. {
  246. struct brcmf_if *ifp = netdev_priv(ndev);
  247. struct sockaddr *sa = (struct sockaddr *)addr;
  248. + struct brcmf_pub *drvr = ifp->drvr;
  249. int err;
  250. brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  251. @@ -206,7 +207,7 @@ static int brcmf_netdev_set_mac_address(
  252. err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data,
  253. ETH_ALEN);
  254. if (err < 0) {
  255. - brcmf_err("Setting cur_etheraddr failed, %d\n", err);
  256. + bphy_err(drvr, "Setting cur_etheraddr failed, %d\n", err);
  257. } else {
  258. brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
  259. memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN);
  260. @@ -265,7 +266,7 @@ static netdev_tx_t brcmf_netdev_start_xm
  261. /* Can the device send data? */
  262. if (drvr->bus_if->state != BRCMF_BUS_UP) {
  263. - brcmf_err("xmit rejected state=%d\n", drvr->bus_if->state);
  264. + bphy_err(drvr, "xmit rejected state=%d\n", drvr->bus_if->state);
  265. netif_stop_queue(ndev);
  266. dev_kfree_skb(skb);
  267. ret = -ENODEV;
  268. @@ -575,7 +576,7 @@ static int brcmf_netdev_open(struct net_
  269. /* If bus is not ready, can't continue */
  270. if (bus_if->state != BRCMF_BUS_UP) {
  271. - brcmf_err("failed bus is not ready\n");
  272. + bphy_err(drvr, "failed bus is not ready\n");
  273. return -EAGAIN;
  274. }
  275. @@ -589,7 +590,7 @@ static int brcmf_netdev_open(struct net_
  276. ndev->features &= ~NETIF_F_IP_CSUM;
  277. if (brcmf_cfg80211_up(ndev)) {
  278. - brcmf_err("failed to bring up cfg80211\n");
  279. + bphy_err(drvr, "failed to bring up cfg80211\n");
  280. return -EIO;
  281. }
  282. @@ -635,7 +636,7 @@ int brcmf_net_attach(struct brcmf_if *if
  283. else
  284. err = register_netdev(ndev);
  285. if (err != 0) {
  286. - brcmf_err("couldn't register the net device\n");
  287. + bphy_err(drvr, "couldn't register the net device\n");
  288. goto fail;
  289. }
  290. @@ -711,6 +712,7 @@ static const struct net_device_ops brcmf
  291. static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
  292. {
  293. + struct brcmf_pub *drvr = ifp->drvr;
  294. struct net_device *ndev;
  295. brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
  296. @@ -723,7 +725,7 @@ static int brcmf_net_p2p_attach(struct b
  297. memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
  298. if (register_netdev(ndev) != 0) {
  299. - brcmf_err("couldn't register the p2p net device\n");
  300. + bphy_err(drvr, "couldn't register the p2p net device\n");
  301. goto fail;
  302. }
  303. @@ -753,8 +755,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  304. */
  305. if (ifp) {
  306. if (ifidx) {
  307. - brcmf_err("ERROR: netdev:%s already exists\n",
  308. - ifp->ndev->name);
  309. + bphy_err(drvr, "ERROR: netdev:%s already exists\n",
  310. + ifp->ndev->name);
  311. netif_stop_queue(ifp->ndev);
  312. brcmf_net_detach(ifp->ndev, false);
  313. drvr->iflist[bsscfgidx] = NULL;
  314. @@ -812,7 +814,7 @@ static void brcmf_del_if(struct brcmf_pu
  315. ifp = drvr->iflist[bsscfgidx];
  316. drvr->iflist[bsscfgidx] = NULL;
  317. if (!ifp) {
  318. - brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx);
  319. + bphy_err(drvr, "Null interface, bsscfgidx=%d\n", bsscfgidx);
  320. return;
  321. }
  322. brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx,
  323. @@ -862,16 +864,17 @@ static int brcmf_psm_watchdog_notify(str
  324. const struct brcmf_event_msg *evtmsg,
  325. void *data)
  326. {
  327. + struct brcmf_pub *drvr = ifp->drvr;
  328. int err;
  329. brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
  330. - brcmf_err("PSM's watchdog has fired!\n");
  331. + bphy_err(drvr, "PSM's watchdog has fired!\n");
  332. err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
  333. evtmsg->datalen);
  334. if (err)
  335. - brcmf_err("Failed to get memory dump, %d\n", err);
  336. + bphy_err(drvr, "Failed to get memory dump, %d\n", err);
  337. return err;
  338. }
  339. @@ -915,7 +918,7 @@ static int brcmf_inetaddr_changed(struct
  340. ret = brcmf_fil_iovar_data_get(ifp, "arp_hostip", addr_table,
  341. sizeof(addr_table));
  342. if (ret) {
  343. - brcmf_err("fail to get arp ip table err:%d\n", ret);
  344. + bphy_err(drvr, "fail to get arp ip table err:%d\n", ret);
  345. return NOTIFY_OK;
  346. }
  347. @@ -932,7 +935,7 @@ static int brcmf_inetaddr_changed(struct
  348. ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
  349. &ifa->ifa_address, sizeof(ifa->ifa_address));
  350. if (ret)
  351. - brcmf_err("add arp ip err %d\n", ret);
  352. + bphy_err(drvr, "add arp ip err %d\n", ret);
  353. }
  354. break;
  355. case NETDEV_DOWN:
  356. @@ -944,8 +947,8 @@ static int brcmf_inetaddr_changed(struct
  357. ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear",
  358. NULL, 0);
  359. if (ret) {
  360. - brcmf_err("fail to clear arp ip table err:%d\n",
  361. - ret);
  362. + bphy_err(drvr, "fail to clear arp ip table err:%d\n",
  363. + ret);
  364. return NOTIFY_OK;
  365. }
  366. for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
  367. @@ -955,8 +958,8 @@ static int brcmf_inetaddr_changed(struct
  368. &addr_table[i],
  369. sizeof(addr_table[i]));
  370. if (ret)
  371. - brcmf_err("add arp ip err %d\n",
  372. - ret);
  373. + bphy_err(drvr, "add arp ip err %d\n",
  374. + ret);
  375. }
  376. }
  377. break;
  378. @@ -1133,7 +1136,7 @@ int brcmf_bus_started(struct device *dev
  379. return 0;
  380. fail:
  381. - brcmf_err("failed: %d\n", ret);
  382. + bphy_err(drvr, "failed: %d\n", ret);
  383. if (drvr->config) {
  384. brcmf_cfg80211_detach(drvr->config);
  385. drvr->config = NULL;
  386. @@ -1188,7 +1191,7 @@ int brcmf_attach(struct device *dev, str
  387. /* Attach and link in the protocol */
  388. ret = brcmf_proto_attach(drvr);
  389. if (ret != 0) {
  390. - brcmf_err("brcmf_prot_attach failed\n");
  391. + bphy_err(drvr, "brcmf_prot_attach failed\n");
  392. goto fail;
  393. }
  394. @@ -1296,6 +1299,7 @@ static int brcmf_get_pend_8021x_cnt(stru
  395. int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp)
  396. {
  397. + struct brcmf_pub *drvr = ifp->drvr;
  398. int err;
  399. err = wait_event_timeout(ifp->pend_8021x_wait,
  400. @@ -1303,7 +1307,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  401. MAX_WAIT_FOR_8021X_TX);
  402. if (!err)
  403. - brcmf_err("Timed out waiting for no pending 802.1x packets\n");
  404. + bphy_err(drvr, "Timed out waiting for no pending 802.1x packets\n");
  405. return !err;
  406. }
  407. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  408. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
  409. @@ -158,13 +158,14 @@ static void brcmf_feat_iovar_int_get(str
  410. #define MAX_CAPS_BUFFER_SIZE 768
  411. static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp)
  412. {
  413. + struct brcmf_pub *drvr = ifp->drvr;
  414. char caps[MAX_CAPS_BUFFER_SIZE];
  415. enum brcmf_feat_id id;
  416. int i, err;
  417. err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
  418. if (err) {
  419. - brcmf_err("could not get firmware cap (%d)\n", err);
  420. + bphy_err(drvr, "could not get firmware cap (%d)\n", err);
  421. return;
  422. }
  423. @@ -189,14 +190,15 @@ static void brcmf_feat_firmware_capabili
  424. static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
  425. {
  426. struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  427. - struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0);
  428. + struct brcmf_pub *drvr = bus_if->drvr;
  429. + struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  430. char caps[MAX_CAPS_BUFFER_SIZE + 1] = { };
  431. char *tmp;
  432. int err;
  433. err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
  434. if (err) {
  435. - brcmf_err("could not get firmware cap (%d)\n", err);
  436. + bphy_err(drvr, "could not get firmware cap (%d)\n", err);
  437. return err;
  438. }
  439. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  440. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  441. @@ -102,7 +102,8 @@ static void brcmf_fweh_queue_event(struc
  442. schedule_work(&fweh->event_work);
  443. }
  444. -static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp,
  445. +static int brcmf_fweh_call_event_handler(struct brcmf_pub *drvr,
  446. + struct brcmf_if *ifp,
  447. enum brcmf_fweh_event_code code,
  448. struct brcmf_event_msg *emsg,
  449. void *data)
  450. @@ -117,9 +118,9 @@ static int brcmf_fweh_call_event_handler
  451. if (fweh->evt_handler[code])
  452. err = fweh->evt_handler[code](ifp, emsg, data);
  453. else
  454. - brcmf_err("unhandled event %d ignored\n", code);
  455. + bphy_err(drvr, "unhandled event %d ignored\n", code);
  456. } else {
  457. - brcmf_err("no interface object\n");
  458. + bphy_err(drvr, "no interface object\n");
  459. }
  460. return err;
  461. }
  462. @@ -158,7 +159,7 @@ static void brcmf_fweh_handle_if_event(s
  463. return;
  464. }
  465. if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  466. - brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  467. + bphy_err(drvr, "invalid interface index: %u\n", ifevent->ifidx);
  468. return;
  469. }
  470. @@ -181,7 +182,8 @@ static void brcmf_fweh_handle_if_event(s
  471. if (ifp && ifevent->action == BRCMF_E_IF_CHANGE)
  472. brcmf_proto_reset_if(drvr, ifp);
  473. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  474. + err = brcmf_fweh_call_event_handler(drvr, ifp, emsg->event_code, emsg,
  475. + data);
  476. if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  477. bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  478. @@ -273,11 +275,11 @@ static void brcmf_fweh_event_worker(stru
  479. ifp = drvr->iflist[0];
  480. else
  481. ifp = drvr->iflist[emsg.bsscfgidx];
  482. - err = brcmf_fweh_call_event_handler(ifp, event->code, &emsg,
  483. - event->data);
  484. + err = brcmf_fweh_call_event_handler(drvr, ifp, event->code,
  485. + &emsg, event->data);
  486. if (err) {
  487. - brcmf_err("event handler failed (%d)\n",
  488. - event->code);
  489. + bphy_err(drvr, "event handler failed (%d)\n",
  490. + event->code);
  491. err = 0;
  492. }
  493. event_free:
  494. @@ -344,7 +346,7 @@ int brcmf_fweh_register(struct brcmf_pub
  495. brcmf_fweh_handler_t handler)
  496. {
  497. if (drvr->fweh.evt_handler[code]) {
  498. - brcmf_err("event code %d already registered\n", code);
  499. + bphy_err(drvr, "event code %d already registered\n", code);
  500. return -ENOSPC;
  501. }
  502. drvr->fweh.evt_handler[code] = handler;
  503. @@ -374,6 +376,7 @@ void brcmf_fweh_unregister(struct brcmf_
  504. */
  505. int brcmf_fweh_activate_events(struct brcmf_if *ifp)
  506. {
  507. + struct brcmf_pub *drvr = ifp->drvr;
  508. int i, err;
  509. s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  510. @@ -393,7 +396,7 @@ int brcmf_fweh_activate_events(struct br
  511. err = brcmf_fil_iovar_data_set(ifp, "event_msgs",
  512. eventmask, BRCMF_EVENTING_MASK_LEN);
  513. if (err)
  514. - brcmf_err("Set event_msgs error (%d)\n", err);
  515. + bphy_err(drvr, "Set event_msgs error (%d)\n", err);
  516. return err;
  517. }
  518. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
  519. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
  520. @@ -110,7 +110,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp,
  521. s32 err;
  522. if (drvr->bus_if->state != BRCMF_BUS_UP) {
  523. - brcmf_err("bus is down. we have nothing to do.\n");
  524. + bphy_err(drvr, "bus is down. we have nothing to do.\n");
  525. return -EIO;
  526. }
  527. @@ -236,7 +236,7 @@ brcmf_fil_iovar_data_set(struct brcmf_if
  528. buflen, true);
  529. } else {
  530. err = -EPERM;
  531. - brcmf_err("Creating iovar failed\n");
  532. + bphy_err(drvr, "Creating iovar failed\n");
  533. }
  534. mutex_unlock(&drvr->proto_block);
  535. @@ -262,7 +262,7 @@ brcmf_fil_iovar_data_get(struct brcmf_if
  536. memcpy(data, drvr->proto_buf, len);
  537. } else {
  538. err = -EPERM;
  539. - brcmf_err("Creating iovar failed\n");
  540. + bphy_err(drvr, "Creating iovar failed\n");
  541. }
  542. brcmf_dbg(FIL, "ifidx=%d, name=%s, len=%d\n", ifp->ifidx, name, len);
  543. @@ -360,7 +360,7 @@ brcmf_fil_bsscfg_data_set(struct brcmf_i
  544. buflen, true);
  545. } else {
  546. err = -EPERM;
  547. - brcmf_err("Creating bsscfg failed\n");
  548. + bphy_err(drvr, "Creating bsscfg failed\n");
  549. }
  550. mutex_unlock(&drvr->proto_block);
  551. @@ -386,7 +386,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i
  552. memcpy(data, drvr->proto_buf, len);
  553. } else {
  554. err = -EPERM;
  555. - brcmf_err("Creating bsscfg failed\n");
  556. + bphy_err(drvr, "Creating bsscfg failed\n");
  557. }
  558. brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
  559. ifp->bsscfgidx, name, len);
  560. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  561. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
  562. @@ -1251,6 +1251,7 @@ static int brcmf_fws_enq(struct brcmf_fw
  563. enum brcmf_fws_skb_state state, int fifo,
  564. struct sk_buff *p)
  565. {
  566. + struct brcmf_pub *drvr = fws->drvr;
  567. int prec = 2 * fifo;
  568. u32 *qfull_stat = &fws->stats.delayq_full_error;
  569. struct brcmf_fws_mac_descriptor *entry;
  570. @@ -1263,7 +1264,7 @@ static int brcmf_fws_enq(struct brcmf_fw
  571. entry = brcmf_skbcb(p)->mac;
  572. if (entry == NULL) {
  573. - brcmf_err("no mac descriptor found for skb %p\n", p);
  574. + bphy_err(drvr, "no mac descriptor found for skb %p\n", p);
  575. return -ENOENT;
  576. }
  577. @@ -1453,6 +1454,7 @@ static int
  578. brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot,
  579. u32 genbit, u16 seq)
  580. {
  581. + struct brcmf_pub *drvr = fws->drvr;
  582. u32 fifo;
  583. int ret;
  584. bool remove_from_hanger = true;
  585. @@ -1476,12 +1478,12 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  586. else if (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED)
  587. fws->stats.txs_host_tossed++;
  588. else
  589. - brcmf_err("unexpected txstatus\n");
  590. + bphy_err(drvr, "unexpected txstatus\n");
  591. ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb,
  592. remove_from_hanger);
  593. if (ret != 0) {
  594. - brcmf_err("no packet in hanger slot: hslot=%d\n", hslot);
  595. + bphy_err(drvr, "no packet in hanger slot: hslot=%d\n", hslot);
  596. return ret;
  597. }
  598. @@ -1587,12 +1589,13 @@ static int brcmf_fws_notify_credit_map(s
  599. const struct brcmf_event_msg *e,
  600. void *data)
  601. {
  602. - struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
  603. + struct brcmf_pub *drvr = ifp->drvr;
  604. + struct brcmf_fws_info *fws = drvr_to_fws(drvr);
  605. int i;
  606. u8 *credits = data;
  607. if (e->datalen < BRCMF_FWS_FIFO_COUNT) {
  608. - brcmf_err("event payload too small (%d)\n", e->datalen);
  609. + bphy_err(drvr, "event payload too small (%d)\n", e->datalen);
  610. return -EINVAL;
  611. }
  612. if (fws->creditmap_received)
  613. @@ -1654,6 +1657,7 @@ static void brcmf_rxreorder_get_skb_list
  614. void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
  615. {
  616. + struct brcmf_pub *drvr = ifp->drvr;
  617. u8 *reorder_data;
  618. u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
  619. struct brcmf_ampdu_rx_reorder *rfi;
  620. @@ -1668,7 +1672,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  621. /* validate flags and flow id */
  622. if (flags == 0xFF) {
  623. - brcmf_err("invalid flags...so ignore this packet\n");
  624. + bphy_err(drvr, "invalid flags...so ignore this packet\n");
  625. brcmf_netif_rx(ifp, pkt);
  626. return;
  627. }
  628. @@ -1705,7 +1709,7 @@ void brcmf_fws_rxreorder(struct brcmf_if
  629. flow_id, max_idx);
  630. rfi = kzalloc(buf_size, GFP_ATOMIC);
  631. if (rfi == NULL) {
  632. - brcmf_err("failed to alloc buffer\n");
  633. + bphy_err(drvr, "failed to alloc buffer\n");
  634. brcmf_netif_rx(ifp, pkt);
  635. return;
  636. }
  637. @@ -1970,6 +1974,7 @@ static u8 brcmf_fws_precommit_skb(struct
  638. static void brcmf_fws_rollback_toq(struct brcmf_fws_info *fws,
  639. struct sk_buff *skb, int fifo)
  640. {
  641. + struct brcmf_pub *drvr = fws->drvr;
  642. struct brcmf_fws_mac_descriptor *entry;
  643. struct sk_buff *pktout;
  644. int qidx, hslot;
  645. @@ -1983,11 +1988,11 @@ static void brcmf_fws_rollback_toq(struc
  646. pktout = brcmu_pktq_penq_head(&entry->psq, qidx, skb);
  647. if (pktout == NULL) {
  648. - brcmf_err("%s queue %d full\n", entry->name, qidx);
  649. + bphy_err(drvr, "%s queue %d full\n", entry->name, qidx);
  650. rc = -ENOSPC;
  651. }
  652. } else {
  653. - brcmf_err("%s entry removed\n", entry->name);
  654. + bphy_err(drvr, "%s entry removed\n", entry->name);
  655. rc = -ENOENT;
  656. }
  657. @@ -2092,7 +2097,8 @@ static int brcmf_fws_assign_htod(struct
  658. int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
  659. {
  660. - struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr);
  661. + struct brcmf_pub *drvr = ifp->drvr;
  662. + struct brcmf_fws_info *fws = drvr_to_fws(drvr);
  663. struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb);
  664. struct ethhdr *eh = (struct ethhdr *)(skb->data);
  665. int fifo = BRCMF_FWS_FIFO_BCMC;
  666. @@ -2120,7 +2126,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  667. brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb);
  668. brcmf_fws_schedule_deq(fws);
  669. } else {
  670. - brcmf_err("drop skb: no hanger slot\n");
  671. + bphy_err(drvr, "drop skb: no hanger slot\n");
  672. brcmf_txfinalize(ifp, skb, false);
  673. rc = -ENOMEM;
  674. }
  675. @@ -2338,7 +2344,7 @@ struct brcmf_fws_info *brcmf_fws_attach(
  676. fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq");
  677. if (fws->fws_wq == NULL) {
  678. - brcmf_err("workqueue creation failed\n");
  679. + bphy_err(drvr, "workqueue creation failed\n");
  680. rc = -EBADF;
  681. goto fail;
  682. }
  683. @@ -2354,13 +2360,13 @@ struct brcmf_fws_info *brcmf_fws_attach(
  684. rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP,
  685. brcmf_fws_notify_credit_map);
  686. if (rc < 0) {
  687. - brcmf_err("register credit map handler failed\n");
  688. + bphy_err(drvr, "register credit map handler failed\n");
  689. goto fail;
  690. }
  691. rc = brcmf_fweh_register(drvr, BRCMF_E_BCMC_CREDIT_SUPPORT,
  692. brcmf_fws_notify_bcmc_credit_support);
  693. if (rc < 0) {
  694. - brcmf_err("register bcmc credit handler failed\n");
  695. + bphy_err(drvr, "register bcmc credit handler failed\n");
  696. brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP);
  697. goto fail;
  698. }
  699. @@ -2372,7 +2378,7 @@ struct brcmf_fws_info *brcmf_fws_attach(
  700. fws->fw_signals = true;
  701. ifp = brcmf_get_ifp(drvr, 0);
  702. if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  703. - brcmf_err("failed to set bdcv2 tlv signaling\n");
  704. + bphy_err(drvr, "failed to set bdcv2 tlv signaling\n");
  705. fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  706. fws->fw_signals = false;
  707. }
  708. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  709. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  710. @@ -439,7 +439,7 @@ static int brcmf_msgbuf_tx_ioctl(struct
  711. brcmf_commonring_lock(commonring);
  712. ret_ptr = brcmf_commonring_reserve_for_write(commonring);
  713. if (!ret_ptr) {
  714. - brcmf_err("Failed to reserve space in commonring\n");
  715. + bphy_err(drvr, "Failed to reserve space in commonring\n");
  716. brcmf_commonring_unlock(commonring);
  717. return -ENOMEM;
  718. }
  719. @@ -502,7 +502,7 @@ static int brcmf_msgbuf_query_dcmd(struc
  720. timeout = brcmf_msgbuf_ioctl_resp_wait(msgbuf);
  721. if (!timeout) {
  722. - brcmf_err("Timeout on response for query command\n");
  723. + bphy_err(drvr, "Timeout on response for query command\n");
  724. return -EIO;
  725. }
  726. @@ -578,6 +578,7 @@ static u32
  727. brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf,
  728. struct brcmf_msgbuf_work_item *work)
  729. {
  730. + struct brcmf_pub *drvr = msgbuf->drvr;
  731. struct msgbuf_tx_flowring_create_req *create;
  732. struct brcmf_commonring *commonring;
  733. void *ret_ptr;
  734. @@ -593,7 +594,7 @@ brcmf_msgbuf_flowring_create_worker(stru
  735. &msgbuf->flowring_dma_handle[flowid],
  736. GFP_KERNEL);
  737. if (!dma_buf) {
  738. - brcmf_err("dma_alloc_coherent failed\n");
  739. + bphy_err(drvr, "dma_alloc_coherent failed\n");
  740. brcmf_flowring_delete(msgbuf->flow, flowid);
  741. return BRCMF_FLOWRING_INVALID_ID;
  742. }
  743. @@ -606,7 +607,7 @@ brcmf_msgbuf_flowring_create_worker(stru
  744. brcmf_commonring_lock(commonring);
  745. ret_ptr = brcmf_commonring_reserve_for_write(commonring);
  746. if (!ret_ptr) {
  747. - brcmf_err("Failed to reserve space in commonring\n");
  748. + bphy_err(drvr, "Failed to reserve space in commonring\n");
  749. brcmf_commonring_unlock(commonring);
  750. brcmf_msgbuf_remove_flowring(msgbuf, flowid);
  751. return BRCMF_FLOWRING_INVALID_ID;
  752. @@ -633,7 +634,7 @@ brcmf_msgbuf_flowring_create_worker(stru
  753. err = brcmf_commonring_write_complete(commonring);
  754. brcmf_commonring_unlock(commonring);
  755. if (err) {
  756. - brcmf_err("Failed to write commonring\n");
  757. + bphy_err(drvr, "Failed to write commonring\n");
  758. brcmf_msgbuf_remove_flowring(msgbuf, flowid);
  759. return BRCMF_FLOWRING_INVALID_ID;
  760. }
  761. @@ -692,6 +693,7 @@ static u32 brcmf_msgbuf_flowring_create(
  762. static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  763. {
  764. struct brcmf_flowring *flow = msgbuf->flow;
  765. + struct brcmf_pub *drvr = msgbuf->drvr;
  766. struct brcmf_commonring *commonring;
  767. void *ret_ptr;
  768. u32 count;
  769. @@ -711,8 +713,8 @@ static void brcmf_msgbuf_txflow(struct b
  770. while (brcmf_flowring_qlen(flow, flowid)) {
  771. skb = brcmf_flowring_dequeue(flow, flowid);
  772. if (skb == NULL) {
  773. - brcmf_err("No SKB, but qlen %d\n",
  774. - brcmf_flowring_qlen(flow, flowid));
  775. + bphy_err(drvr, "No SKB, but qlen %d\n",
  776. + brcmf_flowring_qlen(flow, flowid));
  777. break;
  778. }
  779. skb_orphan(skb);
  780. @@ -720,7 +722,7 @@ static void brcmf_msgbuf_txflow(struct b
  781. msgbuf->tx_pktids, skb, ETH_HLEN,
  782. &physaddr, &pktid)) {
  783. brcmf_flowring_reinsert(flow, flowid, skb);
  784. - brcmf_err("No PKTID available !!\n");
  785. + bphy_err(drvr, "No PKTID available !!\n");
  786. break;
  787. }
  788. ret_ptr = brcmf_commonring_reserve_for_write(commonring);
  789. @@ -891,6 +893,7 @@ brcmf_msgbuf_process_txstatus(struct brc
  790. static u32 brcmf_msgbuf_rxbuf_data_post(struct brcmf_msgbuf *msgbuf, u32 count)
  791. {
  792. + struct brcmf_pub *drvr = msgbuf->drvr;
  793. struct brcmf_commonring *commonring;
  794. void *ret_ptr;
  795. struct sk_buff *skb;
  796. @@ -918,7 +921,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post(
  797. skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE);
  798. if (skb == NULL) {
  799. - brcmf_err("Failed to alloc SKB\n");
  800. + bphy_err(drvr, "Failed to alloc SKB\n");
  801. brcmf_commonring_write_cancel(commonring, alloced - i);
  802. break;
  803. }
  804. @@ -928,7 +931,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post(
  805. msgbuf->rx_pktids, skb, 0,
  806. &physaddr, &pktid)) {
  807. dev_kfree_skb_any(skb);
  808. - brcmf_err("No PKTID available !!\n");
  809. + bphy_err(drvr, "No PKTID available !!\n");
  810. brcmf_commonring_write_cancel(commonring, alloced - i);
  811. break;
  812. }
  813. @@ -998,6 +1001,7 @@ static u32
  814. brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf,
  815. u32 count)
  816. {
  817. + struct brcmf_pub *drvr = msgbuf->drvr;
  818. struct brcmf_commonring *commonring;
  819. void *ret_ptr;
  820. struct sk_buff *skb;
  821. @@ -1015,7 +1019,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm
  822. count,
  823. &alloced);
  824. if (!ret_ptr) {
  825. - brcmf_err("Failed to reserve space in commonring\n");
  826. + bphy_err(drvr, "Failed to reserve space in commonring\n");
  827. brcmf_commonring_unlock(commonring);
  828. return 0;
  829. }
  830. @@ -1027,7 +1031,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm
  831. skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE);
  832. if (skb == NULL) {
  833. - brcmf_err("Failed to alloc SKB\n");
  834. + bphy_err(drvr, "Failed to alloc SKB\n");
  835. brcmf_commonring_write_cancel(commonring, alloced - i);
  836. break;
  837. }
  838. @@ -1037,7 +1041,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm
  839. msgbuf->rx_pktids, skb, 0,
  840. &physaddr, &pktid)) {
  841. dev_kfree_skb_any(skb);
  842. - brcmf_err("No PKTID available !!\n");
  843. + bphy_err(drvr, "No PKTID available !!\n");
  844. brcmf_commonring_write_cancel(commonring, alloced - i);
  845. break;
  846. }
  847. @@ -1089,6 +1093,7 @@ static void brcmf_msgbuf_rxbuf_event_pos
  848. static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
  849. {
  850. + struct brcmf_pub *drvr = msgbuf->drvr;
  851. struct msgbuf_rx_event *event;
  852. u32 idx;
  853. u16 buflen;
  854. @@ -1115,8 +1120,8 @@ static void brcmf_msgbuf_process_event(s
  855. ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx);
  856. if (!ifp || !ifp->ndev) {
  857. - brcmf_err("Received pkt for invalid ifidx %d\n",
  858. - event->msg.ifidx);
  859. + bphy_err(drvr, "Received pkt for invalid ifidx %d\n",
  860. + event->msg.ifidx);
  861. goto exit;
  862. }
  863. @@ -1132,6 +1137,7 @@ exit:
  864. static void
  865. brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
  866. {
  867. + struct brcmf_pub *drvr = msgbuf->drvr;
  868. struct msgbuf_rx_complete *rx_complete;
  869. struct sk_buff *skb;
  870. u16 data_offset;
  871. @@ -1165,7 +1171,7 @@ brcmf_msgbuf_process_rx_complete(struct
  872. ifp = msgbuf->drvr->mon_if;
  873. if (!ifp) {
  874. - brcmf_err("Received unexpected monitor pkt\n");
  875. + bphy_err(drvr, "Received unexpected monitor pkt\n");
  876. brcmu_pkt_buf_free_skb(skb);
  877. return;
  878. }
  879. @@ -1176,8 +1182,8 @@ brcmf_msgbuf_process_rx_complete(struct
  880. ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx);
  881. if (!ifp || !ifp->ndev) {
  882. - brcmf_err("Received pkt for invalid ifidx %d\n",
  883. - rx_complete->msg.ifidx);
  884. + bphy_err(drvr, "Received pkt for invalid ifidx %d\n",
  885. + rx_complete->msg.ifidx);
  886. brcmu_pkt_buf_free_skb(skb);
  887. return;
  888. }
  889. @@ -1190,13 +1196,15 @@ static void brcmf_msgbuf_process_ring_st
  890. void *buf)
  891. {
  892. struct msgbuf_ring_status *ring_status = buf;
  893. + struct brcmf_pub *drvr = msgbuf->drvr;
  894. int err;
  895. err = le16_to_cpu(ring_status->compl_hdr.status);
  896. if (err) {
  897. int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id);
  898. - brcmf_err("Firmware reported ring %d error: %d\n", ring, err);
  899. + bphy_err(drvr, "Firmware reported ring %d error: %d\n", ring,
  900. + err);
  901. }
  902. }
  903. @@ -1204,6 +1212,7 @@ static void
  904. brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,
  905. void *buf)
  906. {
  907. + struct brcmf_pub *drvr = msgbuf->drvr;
  908. struct msgbuf_flowring_create_resp *flowring_create_resp;
  909. u16 status;
  910. u16 flowid;
  911. @@ -1215,7 +1224,7 @@ brcmf_msgbuf_process_flow_ring_create_re
  912. status = le16_to_cpu(flowring_create_resp->compl_hdr.status);
  913. if (status) {
  914. - brcmf_err("Flowring creation failed, code %d\n", status);
  915. + bphy_err(drvr, "Flowring creation failed, code %d\n", status);
  916. brcmf_msgbuf_remove_flowring(msgbuf, flowid);
  917. return;
  918. }
  919. @@ -1232,6 +1241,7 @@ static void
  920. brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf,
  921. void *buf)
  922. {
  923. + struct brcmf_pub *drvr = msgbuf->drvr;
  924. struct msgbuf_flowring_delete_resp *flowring_delete_resp;
  925. u16 status;
  926. u16 flowid;
  927. @@ -1243,7 +1253,7 @@ brcmf_msgbuf_process_flow_ring_delete_re
  928. status = le16_to_cpu(flowring_delete_resp->compl_hdr.status);
  929. if (status) {
  930. - brcmf_err("Flowring deletion failed, code %d\n", status);
  931. + bphy_err(drvr, "Flowring deletion failed, code %d\n", status);
  932. brcmf_flowring_delete(msgbuf->flow, flowid);
  933. return;
  934. }
  935. @@ -1256,6 +1266,7 @@ brcmf_msgbuf_process_flow_ring_delete_re
  936. static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf)
  937. {
  938. + struct brcmf_pub *drvr = msgbuf->drvr;
  939. struct msgbuf_common_hdr *msg;
  940. msg = (struct msgbuf_common_hdr *)buf;
  941. @@ -1292,7 +1303,7 @@ static void brcmf_msgbuf_process_msgtype
  942. brcmf_msgbuf_process_rx_complete(msgbuf, buf);
  943. break;
  944. default:
  945. - brcmf_err("Unsupported msgtype %d\n", msg->msgtype);
  946. + bphy_err(drvr, "Unsupported msgtype %d\n", msg->msgtype);
  947. break;
  948. }
  949. }
  950. @@ -1375,7 +1386,7 @@ void brcmf_msgbuf_delete_flowring(struct
  951. brcmf_commonring_lock(commonring);
  952. ret_ptr = brcmf_commonring_reserve_for_write(commonring);
  953. if (!ret_ptr) {
  954. - brcmf_err("FW unaware, flowring will be removed !!\n");
  955. + bphy_err(drvr, "FW unaware, flowring will be removed !!\n");
  956. brcmf_commonring_unlock(commonring);
  957. brcmf_msgbuf_remove_flowring(msgbuf, flowid);
  958. return;
  959. @@ -1399,7 +1410,7 @@ void brcmf_msgbuf_delete_flowring(struct
  960. err = brcmf_commonring_write_complete(commonring);
  961. brcmf_commonring_unlock(commonring);
  962. if (err) {
  963. - brcmf_err("Failed to submit RING_DELETE, flowring will be removed\n");
  964. + bphy_err(drvr, "Failed to submit RING_DELETE, flowring will be removed\n");
  965. brcmf_msgbuf_remove_flowring(msgbuf, flowid);
  966. }
  967. }
  968. @@ -1469,8 +1480,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  969. if_msgbuf = drvr->bus_if->msgbuf;
  970. if (if_msgbuf->max_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  971. - brcmf_err("driver not configured for this many flowrings %d\n",
  972. - if_msgbuf->max_flowrings);
  973. + bphy_err(drvr, "driver not configured for this many flowrings %d\n",
  974. + if_msgbuf->max_flowrings);
  975. if_msgbuf->max_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  976. }
  977. @@ -1480,7 +1491,7 @@ int brcmf_proto_msgbuf_attach(struct brc
  978. msgbuf->txflow_wq = create_singlethread_workqueue("msgbuf_txflow");
  979. if (msgbuf->txflow_wq == NULL) {
  980. - brcmf_err("workqueue creation failed\n");
  981. + bphy_err(drvr, "workqueue creation failed\n");
  982. goto fail;
  983. }
  984. INIT_WORK(&msgbuf->txflow_work, brcmf_msgbuf_txflow_worker);
  985. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  986. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  987. @@ -434,6 +434,7 @@ static void brcmf_p2p_print_actframe(boo
  988. */
  989. static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac)
  990. {
  991. + struct brcmf_pub *drvr = ifp->drvr;
  992. s32 ret = 0;
  993. brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
  994. @@ -450,7 +451,7 @@ static int brcmf_p2p_set_firmware(struct
  995. ret = brcmf_fil_iovar_data_set(ifp, "p2p_da_override", p2p_mac,
  996. ETH_ALEN);
  997. if (ret)
  998. - brcmf_err("failed to update device address ret %d\n", ret);
  999. + bphy_err(drvr, "failed to update device address ret %d\n", ret);
  1000. return ret;
  1001. }
  1002. @@ -572,13 +573,14 @@ static s32 brcmf_p2p_deinit_discovery(st
  1003. */
  1004. static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p)
  1005. {
  1006. + struct brcmf_pub *drvr = p2p->cfg->pub;
  1007. struct brcmf_cfg80211_vif *vif;
  1008. s32 ret = 0;
  1009. brcmf_dbg(TRACE, "enter\n");
  1010. vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  1011. if (!vif) {
  1012. - brcmf_err("P2P config device not available\n");
  1013. + bphy_err(drvr, "P2P config device not available\n");
  1014. ret = -EPERM;
  1015. goto exit;
  1016. }
  1017. @@ -592,13 +594,13 @@ static int brcmf_p2p_enable_discovery(st
  1018. vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
  1019. ret = brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 1);
  1020. if (ret < 0) {
  1021. - brcmf_err("set p2p_disc error\n");
  1022. + bphy_err(drvr, "set p2p_disc error\n");
  1023. goto exit;
  1024. }
  1025. vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  1026. ret = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0);
  1027. if (ret < 0) {
  1028. - brcmf_err("unable to set WL_P2P_DISC_ST_SCAN\n");
  1029. + bphy_err(drvr, "unable to set WL_P2P_DISC_ST_SCAN\n");
  1030. goto exit;
  1031. }
  1032. @@ -610,7 +612,7 @@ static int brcmf_p2p_enable_discovery(st
  1033. */
  1034. ret = brcmf_fil_bsscfg_int_set(vif->ifp, "wsec", AES_ENABLED);
  1035. if (ret < 0) {
  1036. - brcmf_err("wsec error %d\n", ret);
  1037. + bphy_err(drvr, "wsec error %d\n", ret);
  1038. goto exit;
  1039. }
  1040. @@ -632,6 +634,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
  1041. u16 chanspecs[], s32 search_state,
  1042. enum p2p_bss_type bss_type)
  1043. {
  1044. + struct brcmf_pub *drvr = p2p->cfg->pub;
  1045. s32 ret = 0;
  1046. s32 memsize = offsetof(struct brcmf_p2p_scan_le,
  1047. eparams.params_le.channel_list);
  1048. @@ -650,7 +653,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
  1049. vif = p2p->bss_idx[bss_type].vif;
  1050. if (vif == NULL) {
  1051. - brcmf_err("no vif for bss type %d\n", bss_type);
  1052. + bphy_err(drvr, "no vif for bss type %d\n", bss_type);
  1053. ret = -EINVAL;
  1054. goto exit;
  1055. }
  1056. @@ -678,7 +681,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
  1057. BRCMF_P2P_WILDCARD_SSID_LEN);
  1058. break;
  1059. default:
  1060. - brcmf_err(" invalid search state %d\n", search_state);
  1061. + bphy_err(drvr, " invalid search state %d\n", search_state);
  1062. ret = -EINVAL;
  1063. goto exit;
  1064. }
  1065. @@ -765,6 +768,7 @@ static s32 brcmf_p2p_run_escan(struct br
  1066. struct cfg80211_scan_request *request)
  1067. {
  1068. struct brcmf_p2p_info *p2p = &cfg->p2p;
  1069. + struct brcmf_pub *drvr = cfg->pub;
  1070. s32 err = 0;
  1071. s32 search_state = WL_P2P_DISC_ST_SCAN;
  1072. struct brcmf_cfg80211_vif *vif;
  1073. @@ -827,7 +831,7 @@ static s32 brcmf_p2p_run_escan(struct br
  1074. }
  1075. exit:
  1076. if (err)
  1077. - brcmf_err("error (%d)\n", err);
  1078. + bphy_err(drvr, "error (%d)\n", err);
  1079. return err;
  1080. }
  1081. @@ -924,19 +928,20 @@ int brcmf_p2p_scan_prep(struct wiphy *wi
  1082. static s32
  1083. brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, u16 channel, u32 duration)
  1084. {
  1085. + struct brcmf_pub *drvr = p2p->cfg->pub;
  1086. struct brcmf_cfg80211_vif *vif;
  1087. struct brcmu_chan ch;
  1088. s32 err = 0;
  1089. vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  1090. if (!vif) {
  1091. - brcmf_err("Discovery is not set, so we have nothing to do\n");
  1092. + bphy_err(drvr, "Discovery is not set, so we have nothing to do\n");
  1093. err = -EPERM;
  1094. goto exit;
  1095. }
  1096. if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status)) {
  1097. - brcmf_err("Previous LISTEN is not completed yet\n");
  1098. + bphy_err(drvr, "Previous LISTEN is not completed yet\n");
  1099. /* WAR: prevent cookie mismatch in wpa_supplicant return OK */
  1100. goto exit;
  1101. }
  1102. @@ -1053,6 +1058,7 @@ void brcmf_p2p_cancel_remain_on_channel(
  1103. */
  1104. static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel)
  1105. {
  1106. + struct brcmf_pub *drvr = p2p->cfg->pub;
  1107. s32 err;
  1108. u32 channel_cnt;
  1109. u16 *default_chan_list;
  1110. @@ -1068,7 +1074,7 @@ static s32 brcmf_p2p_act_frm_search(stru
  1111. default_chan_list = kzalloc(channel_cnt * sizeof(*default_chan_list),
  1112. GFP_KERNEL);
  1113. if (default_chan_list == NULL) {
  1114. - brcmf_err("channel list allocation failed\n");
  1115. + bphy_err(drvr, "channel list allocation failed\n");
  1116. err = -ENOMEM;
  1117. goto exit;
  1118. }
  1119. @@ -1110,6 +1116,7 @@ static void brcmf_p2p_afx_handler(struct
  1120. struct brcmf_p2p_info *p2p = container_of(afx_hdl,
  1121. struct brcmf_p2p_info,
  1122. afx_hdl);
  1123. + struct brcmf_pub *drvr = p2p->cfg->pub;
  1124. s32 err;
  1125. if (!afx_hdl->is_active)
  1126. @@ -1123,7 +1130,7 @@ static void brcmf_p2p_afx_handler(struct
  1127. err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan);
  1128. if (err) {
  1129. - brcmf_err("ERROR occurred! value is (%d)\n", err);
  1130. + bphy_err(drvr, "ERROR occurred! value is (%d)\n", err);
  1131. if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
  1132. &p2p->status))
  1133. complete(&afx_hdl->act_frm_scan);
  1134. @@ -1345,7 +1352,8 @@ int brcmf_p2p_notify_action_frame_rx(str
  1135. const struct brcmf_event_msg *e,
  1136. void *data)
  1137. {
  1138. - struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
  1139. + struct brcmf_pub *drvr = ifp->drvr;
  1140. + struct brcmf_cfg80211_info *cfg = drvr->config;
  1141. struct brcmf_p2p_info *p2p = &cfg->p2p;
  1142. struct afx_hdl *afx_hdl = &p2p->afx_hdl;
  1143. struct wireless_dev *wdev;
  1144. @@ -1416,7 +1424,7 @@ int brcmf_p2p_notify_action_frame_rx(str
  1145. mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) +
  1146. mgmt_frame_len, GFP_KERNEL);
  1147. if (!mgmt_frame) {
  1148. - brcmf_err("No memory available for action frame\n");
  1149. + bphy_err(drvr, "No memory available for action frame\n");
  1150. return -ENOMEM;
  1151. }
  1152. memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN);
  1153. @@ -1499,6 +1507,7 @@ int brcmf_p2p_notify_action_tx_complete(
  1154. static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p,
  1155. struct brcmf_fil_af_params_le *af_params)
  1156. {
  1157. + struct brcmf_pub *drvr = p2p->cfg->pub;
  1158. struct brcmf_cfg80211_vif *vif;
  1159. s32 err = 0;
  1160. s32 timeout = 0;
  1161. @@ -1513,7 +1522,7 @@ static s32 brcmf_p2p_tx_action_frame(str
  1162. err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe", af_params,
  1163. sizeof(*af_params));
  1164. if (err) {
  1165. - brcmf_err(" sending action frame has failed\n");
  1166. + bphy_err(drvr, " sending action frame has failed\n");
  1167. goto exit;
  1168. }
  1169. @@ -1563,6 +1572,7 @@ static s32 brcmf_p2p_pub_af_tx(struct br
  1170. struct brcmf_config_af_params *config_af_params)
  1171. {
  1172. struct brcmf_p2p_info *p2p = &cfg->p2p;
  1173. + struct brcmf_pub *drvr = cfg->pub;
  1174. struct brcmf_fil_action_frame_le *action_frame;
  1175. struct brcmf_p2p_pub_act_frame *act_frm;
  1176. s32 err = 0;
  1177. @@ -1641,8 +1651,8 @@ static s32 brcmf_p2p_pub_af_tx(struct br
  1178. config_af_params->extra_listen = false;
  1179. break;
  1180. default:
  1181. - brcmf_err("Unknown p2p pub act frame subtype: %d\n",
  1182. - act_frm->subtype);
  1183. + bphy_err(drvr, "Unknown p2p pub act frame subtype: %d\n",
  1184. + act_frm->subtype);
  1185. err = -EINVAL;
  1186. }
  1187. return err;
  1188. @@ -1664,6 +1674,7 @@ bool brcmf_p2p_send_action_frame(struct
  1189. struct brcmf_fil_action_frame_le *action_frame;
  1190. struct brcmf_config_af_params config_af_params;
  1191. struct afx_hdl *afx_hdl = &p2p->afx_hdl;
  1192. + struct brcmf_pub *drvr = cfg->pub;
  1193. u16 action_frame_len;
  1194. bool ack = false;
  1195. u8 category;
  1196. @@ -1699,7 +1710,7 @@ bool brcmf_p2p_send_action_frame(struct
  1197. if (brcmf_p2p_pub_af_tx(cfg, af_params, &config_af_params)) {
  1198. /* Just send unknown subtype frame with */
  1199. /* default parameters. */
  1200. - brcmf_err("P2P Public action frame, unknown subtype.\n");
  1201. + bphy_err(drvr, "P2P Public action frame, unknown subtype.\n");
  1202. }
  1203. } else if (brcmf_p2p_is_gas_action(action_frame->data,
  1204. action_frame_len)) {
  1205. @@ -1721,7 +1732,7 @@ bool brcmf_p2p_send_action_frame(struct
  1206. af_params->dwell_time =
  1207. cpu_to_le32(P2P_AF_MIN_DWELL_TIME);
  1208. } else {
  1209. - brcmf_err("Unknown action type: %d\n", action);
  1210. + bphy_err(drvr, "Unknown action type: %d\n", action);
  1211. goto exit;
  1212. }
  1213. } else if (brcmf_p2p_is_p2p_action(action_frame->data,
  1214. @@ -1729,8 +1740,8 @@ bool brcmf_p2p_send_action_frame(struct
  1215. /* do not configure anything. it will be */
  1216. /* sent with a default configuration */
  1217. } else {
  1218. - brcmf_err("Unknown Frame: category 0x%x, action 0x%x\n",
  1219. - category, action);
  1220. + bphy_err(drvr, "Unknown Frame: category 0x%x, action 0x%x\n",
  1221. + category, action);
  1222. return false;
  1223. }
  1224. @@ -1768,7 +1779,7 @@ bool brcmf_p2p_send_action_frame(struct
  1225. if (brcmf_p2p_af_searching_channel(p2p) ==
  1226. P2P_INVALID_CHANNEL) {
  1227. - brcmf_err("Couldn't find peer's channel.\n");
  1228. + bphy_err(drvr, "Couldn't find peer's channel.\n");
  1229. goto exit;
  1230. }
  1231. @@ -1790,7 +1801,8 @@ bool brcmf_p2p_send_action_frame(struct
  1232. tx_retry++;
  1233. }
  1234. if (ack == false) {
  1235. - brcmf_err("Failed to send Action Frame(retry %d)\n", tx_retry);
  1236. + bphy_err(drvr, "Failed to send Action Frame(retry %d)\n",
  1237. + tx_retry);
  1238. clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
  1239. }
  1240. @@ -1972,6 +1984,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
  1241. enum brcmf_fil_p2p_if_types if_type)
  1242. {
  1243. struct brcmf_p2p_info *p2p = &cfg->p2p;
  1244. + struct brcmf_pub *drvr = cfg->pub;
  1245. struct brcmf_cfg80211_vif *vif;
  1246. struct brcmf_fil_p2p_if_le if_request;
  1247. s32 err;
  1248. @@ -1981,13 +1994,13 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
  1249. vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
  1250. if (!vif) {
  1251. - brcmf_err("vif for P2PAPI_BSSCFG_PRIMARY does not exist\n");
  1252. + bphy_err(drvr, "vif for P2PAPI_BSSCFG_PRIMARY does not exist\n");
  1253. return -EPERM;
  1254. }
  1255. brcmf_notify_escan_complete(cfg, vif->ifp, true, true);
  1256. vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif;
  1257. if (!vif) {
  1258. - brcmf_err("vif for P2PAPI_BSSCFG_CONNECTION does not exist\n");
  1259. + bphy_err(drvr, "vif for P2PAPI_BSSCFG_CONNECTION does not exist\n");
  1260. return -EPERM;
  1261. }
  1262. brcmf_set_mpc(vif->ifp, 0);
  1263. @@ -2005,7 +2018,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
  1264. err = brcmf_fil_iovar_data_set(vif->ifp, "p2p_ifupd", &if_request,
  1265. sizeof(if_request));
  1266. if (err) {
  1267. - brcmf_err("p2p_ifupd FAILED, err=%d\n", err);
  1268. + bphy_err(drvr, "p2p_ifupd FAILED, err=%d\n", err);
  1269. brcmf_cfg80211_arm_vif_event(cfg, NULL);
  1270. return err;
  1271. }
  1272. @@ -2013,7 +2026,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8
  1273. BRCMF_VIF_EVENT_TIMEOUT);
  1274. brcmf_cfg80211_arm_vif_event(cfg, NULL);
  1275. if (!err) {
  1276. - brcmf_err("No BRCMF_E_IF_CHANGE event received\n");
  1277. + bphy_err(drvr, "No BRCMF_E_IF_CHANGE event received\n");
  1278. return -EIO;
  1279. }
  1280. @@ -2076,6 +2089,7 @@ static struct wireless_dev *brcmf_p2p_cr
  1281. struct wiphy *wiphy,
  1282. u8 *addr)
  1283. {
  1284. + struct brcmf_pub *drvr = p2p->cfg->pub;
  1285. struct brcmf_cfg80211_vif *p2p_vif;
  1286. struct brcmf_if *p2p_ifp;
  1287. struct brcmf_if *pri_ifp;
  1288. @@ -2087,7 +2101,7 @@ static struct wireless_dev *brcmf_p2p_cr
  1289. p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE);
  1290. if (IS_ERR(p2p_vif)) {
  1291. - brcmf_err("could not create discovery vif\n");
  1292. + bphy_err(drvr, "could not create discovery vif\n");
  1293. return (struct wireless_dev *)p2p_vif;
  1294. }
  1295. @@ -2101,7 +2115,7 @@ static struct wireless_dev *brcmf_p2p_cr
  1296. /* Initialize P2P Discovery in the firmware */
  1297. err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  1298. if (err < 0) {
  1299. - brcmf_err("set p2p_disc error\n");
  1300. + bphy_err(drvr, "set p2p_disc error\n");
  1301. brcmf_fweh_p2pdev_setup(pri_ifp, false);
  1302. brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  1303. goto fail;
  1304. @@ -2113,7 +2127,7 @@ static struct wireless_dev *brcmf_p2p_cr
  1305. brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  1306. brcmf_fweh_p2pdev_setup(pri_ifp, false);
  1307. if (!err) {
  1308. - brcmf_err("timeout occurred\n");
  1309. + bphy_err(drvr, "timeout occurred\n");
  1310. err = -EIO;
  1311. goto fail;
  1312. }
  1313. @@ -2127,7 +2141,7 @@ static struct wireless_dev *brcmf_p2p_cr
  1314. /* verify bsscfg index for P2P discovery */
  1315. err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx);
  1316. if (err < 0) {
  1317. - brcmf_err("retrieving discover bsscfg index failed\n");
  1318. + bphy_err(drvr, "retrieving discover bsscfg index failed\n");
  1319. goto fail;
  1320. }
  1321. @@ -2162,6 +2176,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  1322. {
  1323. struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  1324. struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  1325. + struct brcmf_pub *drvr = cfg->pub;
  1326. struct brcmf_cfg80211_vif *vif;
  1327. enum brcmf_fil_p2p_if_types iftype;
  1328. int err;
  1329. @@ -2202,7 +2217,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  1330. BRCMF_VIF_EVENT_TIMEOUT);
  1331. brcmf_cfg80211_arm_vif_event(cfg, NULL);
  1332. if (!err) {
  1333. - brcmf_err("timeout occurred\n");
  1334. + bphy_err(drvr, "timeout occurred\n");
  1335. err = -EIO;
  1336. goto fail;
  1337. }
  1338. @@ -2210,7 +2225,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  1339. /* interface created in firmware */
  1340. ifp = vif->ifp;
  1341. if (!ifp) {
  1342. - brcmf_err("no if pointer provided\n");
  1343. + bphy_err(drvr, "no if pointer provided\n");
  1344. err = -ENOENT;
  1345. goto fail;
  1346. }
  1347. @@ -2221,7 +2236,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  1348. #endif /* >= 3.17.0 */
  1349. err = brcmf_net_attach(ifp, true);
  1350. if (err) {
  1351. - brcmf_err("Registering netdevice failed\n");
  1352. + bphy_err(drvr, "Registering netdevice failed\n");
  1353. goto fail;
  1354. }
  1355. @@ -2375,6 +2390,7 @@ void brcmf_p2p_stop_device(struct wiphy
  1356. */
  1357. s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
  1358. {
  1359. + struct brcmf_pub *drvr = cfg->pub;
  1360. struct brcmf_p2p_info *p2p;
  1361. struct brcmf_if *pri_ifp;
  1362. s32 err = 0;
  1363. @@ -2389,7 +2405,7 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  1364. if (p2pdev_forced) {
  1365. err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL);
  1366. if (IS_ERR(err_ptr)) {
  1367. - brcmf_err("P2P device creation failed.\n");
  1368. + bphy_err(drvr, "P2P device creation failed.\n");
  1369. err = PTR_ERR(err_ptr);
  1370. }
  1371. } else {
  1372. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
  1373. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
  1374. @@ -47,6 +47,7 @@ static int brcmf_pno_channel_config(stru
  1375. static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq,
  1376. u32 mscan, u32 bestn)
  1377. {
  1378. + struct brcmf_pub *drvr = ifp->drvr;
  1379. struct brcmf_pno_param_le pfn_param;
  1380. u16 flags;
  1381. u32 pfnmem;
  1382. @@ -75,13 +76,13 @@ static int brcmf_pno_config(struct brcmf
  1383. /* set bestn in firmware */
  1384. err = brcmf_fil_iovar_int_set(ifp, "pfnmem", pfnmem);
  1385. if (err < 0) {
  1386. - brcmf_err("failed to set pfnmem\n");
  1387. + bphy_err(drvr, "failed to set pfnmem\n");
  1388. goto exit;
  1389. }
  1390. /* get max mscan which the firmware supports */
  1391. err = brcmf_fil_iovar_int_get(ifp, "pfnmem", &pfnmem);
  1392. if (err < 0) {
  1393. - brcmf_err("failed to get pfnmem\n");
  1394. + bphy_err(drvr, "failed to get pfnmem\n");
  1395. goto exit;
  1396. }
  1397. mscan = min_t(u32, mscan, pfnmem);
  1398. @@ -95,7 +96,7 @@ static int brcmf_pno_config(struct brcmf
  1399. err = brcmf_fil_iovar_data_set(ifp, "pfn_set", &pfn_param,
  1400. sizeof(pfn_param));
  1401. if (err)
  1402. - brcmf_err("pfn_set failed, err=%d\n", err);
  1403. + bphy_err(drvr, "pfn_set failed, err=%d\n", err);
  1404. exit:
  1405. return err;
  1406. @@ -104,6 +105,7 @@ exit:
  1407. static int brcmf_pno_set_random(struct brcmf_if *ifp, u8 *mac_addr,
  1408. u8 *mac_mask)
  1409. {
  1410. + struct brcmf_pub *drvr = ifp->drvr;
  1411. struct brcmf_pno_macaddr_le pfn_mac;
  1412. int err, i;
  1413. @@ -123,7 +125,7 @@ static int brcmf_pno_set_random(struct b
  1414. err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac,
  1415. sizeof(pfn_mac));
  1416. if (err)
  1417. - brcmf_err("pfn_macaddr failed, err=%d\n", err);
  1418. + bphy_err(drvr, "pfn_macaddr failed, err=%d\n", err);
  1419. return err;
  1420. }
  1421. @@ -165,6 +167,7 @@ static bool brcmf_is_ssid_active(struct
  1422. int brcmf_pno_clean(struct brcmf_if *ifp)
  1423. {
  1424. + struct brcmf_pub *drvr = ifp->drvr;
  1425. int ret;
  1426. /* Disable pfn */
  1427. @@ -174,7 +177,7 @@ int brcmf_pno_clean(struct brcmf_if *ifp
  1428. ret = brcmf_fil_iovar_data_set(ifp, "pfnclear", NULL, 0);
  1429. }
  1430. if (ret < 0)
  1431. - brcmf_err("failed code %d\n", ret);
  1432. + bphy_err(drvr, "failed code %d\n", ret);
  1433. return ret;
  1434. }
  1435. @@ -182,6 +185,7 @@ int brcmf_pno_clean(struct brcmf_if *ifp
  1436. int brcmf_pno_start_sched_scan(struct brcmf_if *ifp,
  1437. struct cfg80211_sched_scan_request *req)
  1438. {
  1439. + struct brcmf_pub *drvr = ifp->drvr;
  1440. struct brcmf_pno_config_le pno_cfg;
  1441. struct cfg80211_ssid *ssid;
  1442. u16 chan;
  1443. @@ -190,7 +194,7 @@ int brcmf_pno_start_sched_scan(struct br
  1444. /* clean up everything */
  1445. ret = brcmf_pno_clean(ifp);
  1446. if (ret < 0) {
  1447. - brcmf_err("failed error=%d\n", ret);
  1448. + bphy_err(drvr, "failed error=%d\n", ret);
  1449. return ret;
  1450. }
  1451. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
  1452. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
  1453. @@ -47,15 +47,15 @@ int brcmf_proto_attach(struct brcmf_pub
  1454. if (brcmf_proto_msgbuf_attach(drvr))
  1455. goto fail;
  1456. } else {
  1457. - brcmf_err("Unsupported proto type %d\n",
  1458. - drvr->bus_if->proto_type);
  1459. + bphy_err(drvr, "Unsupported proto type %d\n",
  1460. + drvr->bus_if->proto_type);
  1461. goto fail;
  1462. }
  1463. if (!proto->tx_queue_data || (proto->hdrpull == NULL) ||
  1464. (proto->query_dcmd == NULL) || (proto->set_dcmd == NULL) ||
  1465. (proto->configure_addr_mode == NULL) ||
  1466. (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL)) {
  1467. - brcmf_err("Not all proto handlers have been installed\n");
  1468. + bphy_err(drvr, "Not all proto handlers have been installed\n");
  1469. goto fail;
  1470. }
  1471. return 0;