339-v5.1-0003-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954
  1. From 3ef005b82e2ad68107fc5814eaa743d171a6c362 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Wed, 16 Jan 2019 07:28:54 +0100
  4. Subject: [PATCH] brcmfmac: add bphy_err() and use it in the cfg80211.c
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. This new macro uses wiphy_err() which:
  9. 1) Should be the best choice with wiphy already created
  10. 2) Uses dev_err() which allows identifying error-affected device
  11. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  12. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13. ---
  14. .../broadcom/brcm80211/brcmfmac/cfg80211.c | 497 ++++++++++--------
  15. .../broadcom/brcm80211/brcmfmac/debug.h | 9 +
  16. 2 files changed, 282 insertions(+), 224 deletions(-)
  17. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19. @@ -457,6 +457,7 @@ static void convert_key_from_CPU(struct
  20. static int
  21. send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
  22. {
  23. + struct wiphy *wiphy = ifp->drvr->wiphy;
  24. int err;
  25. struct brcmf_wsec_key_le key_le;
  26. @@ -468,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp,
  27. sizeof(key_le));
  28. if (err)
  29. - brcmf_err("wsec_key error (%d)\n", err);
  30. + bphy_err(wiphy, "wsec_key error (%d)\n", err);
  31. return err;
  32. }
  33. @@ -549,6 +550,7 @@ static int brcmf_get_first_free_bsscfgid
  34. static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
  35. {
  36. + struct wiphy *wiphy = ifp->drvr->wiphy;
  37. struct brcmf_mbss_ssid_le mbss_ssid_le;
  38. int bsscfgidx;
  39. int err;
  40. @@ -565,7 +567,7 @@ static int brcmf_cfg80211_request_ap_if(
  41. err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
  42. sizeof(mbss_ssid_le));
  43. if (err < 0)
  44. - brcmf_err("setting ssid failed %d\n", err);
  45. + bphy_err(wiphy, "setting ssid failed %d\n", err);
  46. return err;
  47. }
  48. @@ -609,7 +611,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
  49. BRCMF_VIF_EVENT_TIMEOUT);
  50. brcmf_cfg80211_arm_vif_event(cfg, NULL);
  51. if (!err) {
  52. - brcmf_err("timeout occurred\n");
  53. + bphy_err(wiphy, "timeout occurred\n");
  54. err = -EIO;
  55. goto fail;
  56. }
  57. @@ -617,7 +619,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
  58. /* interface created in firmware */
  59. ifp = vif->ifp;
  60. if (!ifp) {
  61. - brcmf_err("no if pointer provided\n");
  62. + bphy_err(wiphy, "no if pointer provided\n");
  63. err = -ENOENT;
  64. goto fail;
  65. }
  66. @@ -625,7 +627,7 @@ struct wireless_dev *brcmf_ap_add_vif(st
  67. strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1);
  68. err = brcmf_net_attach(ifp, true);
  69. if (err) {
  70. - brcmf_err("Registering netdevice failed\n");
  71. + bphy_err(wiphy, "Registering netdevice failed\n");
  72. goto fail;
  73. }
  74. @@ -662,7 +664,7 @@ static struct wireless_dev *brcmf_cfg802
  75. brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  76. err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  77. if (err) {
  78. - brcmf_err("iface validation failed: err=%d\n", err);
  79. + bphy_err(wiphy, "iface validation failed: err=%d\n", err);
  80. return ERR_PTR(err);
  81. }
  82. switch (type) {
  83. @@ -687,8 +689,8 @@ static struct wireless_dev *brcmf_cfg802
  84. }
  85. if (IS_ERR(wdev))
  86. - brcmf_err("add iface %s type %d failed: err=%d\n",
  87. - name, type, (int)PTR_ERR(wdev));
  88. + bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name,
  89. + type, (int)PTR_ERR(wdev));
  90. else
  91. brcmf_cfg80211_update_proto_addr_mode(wdev);
  92. @@ -703,12 +705,13 @@ static void brcmf_scan_config_mpc(struct
  93. void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
  94. {
  95. + struct wiphy *wiphy = ifp->drvr->wiphy;
  96. s32 err = 0;
  97. if (check_vif_up(ifp->vif)) {
  98. err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
  99. if (err) {
  100. - brcmf_err("fail to set mpc\n");
  101. + bphy_err(wiphy, "fail to set mpc\n");
  102. return;
  103. }
  104. brcmf_dbg(INFO, "MPC : %d\n", mpc);
  105. @@ -793,7 +796,7 @@ static int brcmf_cfg80211_del_ap_iface(s
  106. err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  107. if (err) {
  108. - brcmf_err("interface_remove failed %d\n", err);
  109. + bphy_err(wiphy, "interface_remove failed %d\n", err);
  110. goto err_unarm;
  111. }
  112. @@ -801,7 +804,7 @@ static int brcmf_cfg80211_del_ap_iface(s
  113. ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  114. BRCMF_VIF_EVENT_TIMEOUT);
  115. if (!ret) {
  116. - brcmf_err("timeout occurred\n");
  117. + bphy_err(wiphy, "timeout occurred\n");
  118. err = -EIO;
  119. goto err_unarm;
  120. }
  121. @@ -903,14 +906,14 @@ brcmf_cfg80211_change_iface(struct wiphy
  122. }
  123. err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  124. if (err) {
  125. - brcmf_err("iface validation failed: err=%d\n", err);
  126. + bphy_err(wiphy, "iface validation failed: err=%d\n", err);
  127. return err;
  128. }
  129. switch (type) {
  130. case NL80211_IFTYPE_MONITOR:
  131. case NL80211_IFTYPE_WDS:
  132. - brcmf_err("type (%d) : currently we do not support this type\n",
  133. - type);
  134. + bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
  135. + type);
  136. return -EOPNOTSUPP;
  137. case NL80211_IFTYPE_ADHOC:
  138. infra = 0;
  139. @@ -938,7 +941,7 @@ brcmf_cfg80211_change_iface(struct wiphy
  140. } else {
  141. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
  142. if (err) {
  143. - brcmf_err("WLC_SET_INFRA error (%d)\n", err);
  144. + bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
  145. err = -EAGAIN;
  146. goto done;
  147. }
  148. @@ -1040,6 +1043,7 @@ static s32
  149. brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  150. struct cfg80211_scan_request *request)
  151. {
  152. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  153. s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
  154. offsetof(struct brcmf_escan_params_le, params_le);
  155. struct brcmf_escan_params_le *params;
  156. @@ -1071,7 +1075,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
  157. if (err == -EBUSY)
  158. brcmf_dbg(INFO, "system busy : escan canceled\n");
  159. else
  160. - brcmf_err("error (%d)\n", err);
  161. + bphy_err(wiphy, "error (%d)\n", err);
  162. }
  163. kfree(params);
  164. @@ -1129,21 +1133,23 @@ brcmf_cfg80211_escan(struct wiphy *wiphy
  165. brcmf_dbg(SCAN, "START ESCAN\n");
  166. if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
  167. - brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status);
  168. + bphy_err(wiphy, "Scanning already: status (%lu)\n",
  169. + cfg->scan_status);
  170. return -EAGAIN;
  171. }
  172. if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
  173. - brcmf_err("Scanning being aborted: status (%lu)\n",
  174. - cfg->scan_status);
  175. + bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
  176. + cfg->scan_status);
  177. return -EAGAIN;
  178. }
  179. if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
  180. - brcmf_err("Scanning suppressed: status (%lu)\n",
  181. - cfg->scan_status);
  182. + bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
  183. + cfg->scan_status);
  184. return -EAGAIN;
  185. }
  186. if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) {
  187. - brcmf_err("Connecting: status (%lu)\n", ifp->vif->sme_state);
  188. + bphy_err(wiphy, "Connecting: status (%lu)\n",
  189. + ifp->vif->sme_state);
  190. return -EAGAIN;
  191. }
  192. @@ -1235,7 +1241,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
  193. err = brcmf_cfg80211_escan(wiphy, vif, request, NULL);
  194. if (err)
  195. - brcmf_err("scan error (%d)\n", err);
  196. + bphy_err(wiphy, "scan error (%d)\n", err);
  197. brcmf_dbg(TRACE, "Exit\n");
  198. return err;
  199. @@ -1243,36 +1249,41 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
  200. static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
  201. {
  202. + struct brcmf_if *ifp = netdev_priv(ndev);
  203. + struct wiphy *wiphy = ifp->drvr->wiphy;
  204. s32 err = 0;
  205. - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh",
  206. - rts_threshold);
  207. + err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
  208. if (err)
  209. - brcmf_err("Error (%d)\n", err);
  210. + bphy_err(wiphy, "Error (%d)\n", err);
  211. return err;
  212. }
  213. static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
  214. {
  215. + struct brcmf_if *ifp = netdev_priv(ndev);
  216. + struct wiphy *wiphy = ifp->drvr->wiphy;
  217. s32 err = 0;
  218. - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh",
  219. + err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
  220. frag_threshold);
  221. if (err)
  222. - brcmf_err("Error (%d)\n", err);
  223. + bphy_err(wiphy, "Error (%d)\n", err);
  224. return err;
  225. }
  226. static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
  227. {
  228. + struct brcmf_if *ifp = netdev_priv(ndev);
  229. + struct wiphy *wiphy = ifp->drvr->wiphy;
  230. s32 err = 0;
  231. u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
  232. - err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry);
  233. + err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
  234. if (err) {
  235. - brcmf_err("cmd (%d) , error (%d)\n", cmd, err);
  236. + bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
  237. return err;
  238. }
  239. return err;
  240. @@ -1349,6 +1360,7 @@ static u16 brcmf_map_fw_linkdown_reason(
  241. static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
  242. {
  243. struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
  244. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  245. s32 err = 0;
  246. brcmf_dbg(TRACE, "Enter\n");
  247. @@ -1358,7 +1370,7 @@ static void brcmf_link_down(struct brcmf
  248. err = brcmf_fil_cmd_data_set(vif->ifp,
  249. BRCMF_C_DISASSOC, NULL, 0);
  250. if (err) {
  251. - brcmf_err("WLC_DISASSOC failed (%d)\n", err);
  252. + bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
  253. }
  254. if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
  255. (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
  256. @@ -1442,7 +1454,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  257. err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
  258. if (err) {
  259. - brcmf_err("wsec failed (%d)\n", err);
  260. + bphy_err(wiphy, "wsec failed (%d)\n", err);
  261. goto done;
  262. }
  263. @@ -1454,7 +1466,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  264. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
  265. if (err) {
  266. - brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err);
  267. + bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
  268. goto done;
  269. }
  270. @@ -1499,7 +1511,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  271. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
  272. target_channel);
  273. if (err) {
  274. - brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err);
  275. + bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
  276. goto done;
  277. }
  278. } else
  279. @@ -1511,7 +1523,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  280. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  281. &join_params, join_params_size);
  282. if (err) {
  283. - brcmf_err("WLC_SET_SSID failed (%d)\n", err);
  284. + bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
  285. goto done;
  286. }
  287. @@ -1547,6 +1559,8 @@ brcmf_cfg80211_leave_ibss(struct wiphy *
  288. static s32 brcmf_set_wpa_version(struct net_device *ndev,
  289. struct cfg80211_connect_params *sme)
  290. {
  291. + struct brcmf_if *ifp = netdev_priv(ndev);
  292. + struct wiphy *wiphy = ifp->drvr->wiphy;
  293. struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  294. struct brcmf_cfg80211_security *sec;
  295. s32 val = 0;
  296. @@ -1559,9 +1573,9 @@ static s32 brcmf_set_wpa_version(struct
  297. else
  298. val = WPA_AUTH_DISABLED;
  299. brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
  300. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
  301. + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
  302. if (err) {
  303. - brcmf_err("set wpa_auth failed (%d)\n", err);
  304. + bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
  305. return err;
  306. }
  307. sec = &profile->sec;
  308. @@ -1572,6 +1586,8 @@ static s32 brcmf_set_wpa_version(struct
  309. static s32 brcmf_set_auth_type(struct net_device *ndev,
  310. struct cfg80211_connect_params *sme)
  311. {
  312. + struct brcmf_if *ifp = netdev_priv(ndev);
  313. + struct wiphy *wiphy = ifp->drvr->wiphy;
  314. struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  315. struct brcmf_cfg80211_security *sec;
  316. s32 val = 0;
  317. @@ -1592,9 +1608,9 @@ static s32 brcmf_set_auth_type(struct ne
  318. break;
  319. }
  320. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
  321. + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
  322. if (err) {
  323. - brcmf_err("set auth failed (%d)\n", err);
  324. + bphy_err(wiphy, "set auth failed (%d)\n", err);
  325. return err;
  326. }
  327. sec = &profile->sec;
  328. @@ -1606,6 +1622,8 @@ static s32
  329. brcmf_set_wsec_mode(struct net_device *ndev,
  330. struct cfg80211_connect_params *sme)
  331. {
  332. + struct brcmf_if *ifp = netdev_priv(ndev);
  333. + struct wiphy *wiphy = ifp->drvr->wiphy;
  334. struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  335. struct brcmf_cfg80211_security *sec;
  336. s32 pval = 0;
  337. @@ -1629,8 +1647,8 @@ brcmf_set_wsec_mode(struct net_device *n
  338. pval = AES_ENABLED;
  339. break;
  340. default:
  341. - brcmf_err("invalid cipher pairwise (%d)\n",
  342. - sme->crypto.ciphers_pairwise[0]);
  343. + bphy_err(wiphy, "invalid cipher pairwise (%d)\n",
  344. + sme->crypto.ciphers_pairwise[0]);
  345. return -EINVAL;
  346. }
  347. }
  348. @@ -1650,8 +1668,8 @@ brcmf_set_wsec_mode(struct net_device *n
  349. gval = AES_ENABLED;
  350. break;
  351. default:
  352. - brcmf_err("invalid cipher group (%d)\n",
  353. - sme->crypto.cipher_group);
  354. + bphy_err(wiphy, "invalid cipher group (%d)\n",
  355. + sme->crypto.cipher_group);
  356. return -EINVAL;
  357. }
  358. }
  359. @@ -1664,9 +1682,9 @@ brcmf_set_wsec_mode(struct net_device *n
  360. pval = AES_ENABLED;
  361. wsec = pval | gval;
  362. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
  363. + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
  364. if (err) {
  365. - brcmf_err("error (%d)\n", err);
  366. + bphy_err(wiphy, "error (%d)\n", err);
  367. return err;
  368. }
  369. @@ -1681,6 +1699,7 @@ static s32
  370. brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
  371. {
  372. struct brcmf_if *ifp = netdev_priv(ndev);
  373. + struct wiphy *wiphy = ifp->drvr->wiphy;
  374. s32 val;
  375. s32 err;
  376. const struct brcmf_tlv *rsn_ie;
  377. @@ -1696,7 +1715,7 @@ brcmf_set_key_mgmt(struct net_device *nd
  378. err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
  379. if (err) {
  380. - brcmf_err("could not get wpa_auth (%d)\n", err);
  381. + bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
  382. return err;
  383. }
  384. if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
  385. @@ -1708,8 +1727,8 @@ brcmf_set_key_mgmt(struct net_device *nd
  386. val = WPA_AUTH_PSK;
  387. break;
  388. default:
  389. - brcmf_err("invalid cipher group (%d)\n",
  390. - sme->crypto.cipher_group);
  391. + bphy_err(wiphy, "invalid cipher group (%d)\n",
  392. + sme->crypto.cipher_group);
  393. return -EINVAL;
  394. }
  395. } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
  396. @@ -1727,8 +1746,8 @@ brcmf_set_key_mgmt(struct net_device *nd
  397. val = WPA2_AUTH_PSK;
  398. break;
  399. default:
  400. - brcmf_err("invalid cipher group (%d)\n",
  401. - sme->crypto.cipher_group);
  402. + bphy_err(wiphy, "invalid cipher group (%d)\n",
  403. + sme->crypto.cipher_group);
  404. return -EINVAL;
  405. }
  406. }
  407. @@ -1771,7 +1790,7 @@ skip_mfp_config:
  408. brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
  409. err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
  410. if (err) {
  411. - brcmf_err("could not set wpa_auth (%d)\n", err);
  412. + bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
  413. return err;
  414. }
  415. @@ -1782,6 +1801,8 @@ static s32
  416. brcmf_set_sharedkey(struct net_device *ndev,
  417. struct cfg80211_connect_params *sme)
  418. {
  419. + struct brcmf_if *ifp = netdev_priv(ndev);
  420. + struct wiphy *wiphy = ifp->drvr->wiphy;
  421. struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  422. struct brcmf_cfg80211_security *sec;
  423. struct brcmf_wsec_key key;
  424. @@ -1808,7 +1829,7 @@ brcmf_set_sharedkey(struct net_device *n
  425. key.len = (u32) sme->key_len;
  426. key.index = (u32) sme->key_idx;
  427. if (key.len > sizeof(key.data)) {
  428. - brcmf_err("Too long key length (%u)\n", key.len);
  429. + bphy_err(wiphy, "Too long key length (%u)\n", key.len);
  430. return -EINVAL;
  431. }
  432. memcpy(key.data, sme->key, key.len);
  433. @@ -1821,24 +1842,24 @@ brcmf_set_sharedkey(struct net_device *n
  434. key.algo = CRYPTO_ALGO_WEP128;
  435. break;
  436. default:
  437. - brcmf_err("Invalid algorithm (%d)\n",
  438. - sme->crypto.ciphers_pairwise[0]);
  439. + bphy_err(wiphy, "Invalid algorithm (%d)\n",
  440. + sme->crypto.ciphers_pairwise[0]);
  441. return -EINVAL;
  442. }
  443. /* Set the new key/index */
  444. brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n",
  445. key.len, key.index, key.algo);
  446. brcmf_dbg(CONN, "key \"%s\"\n", key.data);
  447. - err = send_key_to_dongle(netdev_priv(ndev), &key);
  448. + err = send_key_to_dongle(ifp, &key);
  449. if (err)
  450. return err;
  451. if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) {
  452. brcmf_dbg(CONN, "set auth_type to shared key\n");
  453. val = WL_AUTH_SHARED_KEY; /* shared key */
  454. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
  455. + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
  456. if (err)
  457. - brcmf_err("set auth failed (%d)\n", err);
  458. + bphy_err(wiphy, "set auth failed (%d)\n", err);
  459. }
  460. return err;
  461. }
  462. @@ -1858,6 +1879,7 @@ enum nl80211_auth_type brcmf_war_auth_ty
  463. static void brcmf_set_join_pref(struct brcmf_if *ifp,
  464. struct cfg80211_bss_selection *bss_select)
  465. {
  466. + struct wiphy *wiphy = ifp->drvr->wiphy;
  467. struct brcmf_join_pref_params join_pref_params[2];
  468. enum nl80211_band band;
  469. int err, i = 0;
  470. @@ -1896,7 +1918,7 @@ static void brcmf_set_join_pref(struct b
  471. err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
  472. sizeof(join_pref_params));
  473. if (err)
  474. - brcmf_err("Set join_pref error (%d)\n", err);
  475. + bphy_err(wiphy, "Set join_pref error (%d)\n", err);
  476. }
  477. static s32
  478. @@ -1922,7 +1944,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  479. return -EIO;
  480. if (!sme->ssid) {
  481. - brcmf_err("Invalid ssid\n");
  482. + bphy_err(wiphy, "Invalid ssid\n");
  483. return -EOPNOTSUPP;
  484. }
  485. @@ -1951,7 +1973,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  486. err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
  487. sme->ie, sme->ie_len);
  488. if (err)
  489. - brcmf_err("Set Assoc REQ IE Failed\n");
  490. + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
  491. else
  492. brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
  493. @@ -1972,32 +1994,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
  494. err = brcmf_set_wpa_version(ndev, sme);
  495. if (err) {
  496. - brcmf_err("wl_set_wpa_version failed (%d)\n", err);
  497. + bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
  498. goto done;
  499. }
  500. sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
  501. err = brcmf_set_auth_type(ndev, sme);
  502. if (err) {
  503. - brcmf_err("wl_set_auth_type failed (%d)\n", err);
  504. + bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
  505. goto done;
  506. }
  507. err = brcmf_set_wsec_mode(ndev, sme);
  508. if (err) {
  509. - brcmf_err("wl_set_set_cipher failed (%d)\n", err);
  510. + bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
  511. goto done;
  512. }
  513. err = brcmf_set_key_mgmt(ndev, sme);
  514. if (err) {
  515. - brcmf_err("wl_set_key_mgmt failed (%d)\n", err);
  516. + bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
  517. goto done;
  518. }
  519. err = brcmf_set_sharedkey(ndev, sme);
  520. if (err) {
  521. - brcmf_err("brcmf_set_sharedkey failed (%d)\n", err);
  522. + bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
  523. goto done;
  524. }
  525. @@ -2084,7 +2106,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  526. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  527. &join_params, join_params_size);
  528. if (err)
  529. - brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err);
  530. + bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
  531. done:
  532. if (err)
  533. @@ -2115,7 +2137,7 @@ brcmf_cfg80211_disconnect(struct wiphy *
  534. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
  535. &scbval, sizeof(scbval));
  536. if (err)
  537. - brcmf_err("error (%d)\n", err);
  538. + bphy_err(wiphy, "error (%d)\n", err);
  539. brcmf_dbg(TRACE, "Exit\n");
  540. return err;
  541. @@ -2142,7 +2164,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  542. case NL80211_TX_POWER_LIMITED:
  543. case NL80211_TX_POWER_FIXED:
  544. if (mbm < 0) {
  545. - brcmf_err("TX_POWER_FIXED - dbm is negative\n");
  546. + bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
  547. err = -EINVAL;
  548. goto done;
  549. }
  550. @@ -2152,7 +2174,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  551. qdbm |= WL_TXPWR_OVERRIDE;
  552. break;
  553. default:
  554. - brcmf_err("Unsupported type %d\n", type);
  555. + bphy_err(wiphy, "Unsupported type %d\n", type);
  556. err = -EINVAL;
  557. goto done;
  558. }
  559. @@ -2160,11 +2182,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  560. disable = WL_RADIO_SW_DISABLE << 16;
  561. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
  562. if (err)
  563. - brcmf_err("WLC_SET_RADIO error (%d)\n", err);
  564. + bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
  565. err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
  566. if (err)
  567. - brcmf_err("qtxpower error (%d)\n", err);
  568. + bphy_err(wiphy, "qtxpower error (%d)\n", err);
  569. done:
  570. brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
  571. @@ -2185,7 +2207,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
  572. err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
  573. if (err) {
  574. - brcmf_err("error (%d)\n", err);
  575. + bphy_err(wiphy, "error (%d)\n", err);
  576. goto done;
  577. }
  578. *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
  579. @@ -2211,7 +2233,7 @@ brcmf_cfg80211_config_default_key(struct
  580. err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  581. if (err) {
  582. - brcmf_err("WLC_GET_WSEC error (%d)\n", err);
  583. + bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
  584. goto done;
  585. }
  586. @@ -2221,7 +2243,7 @@ brcmf_cfg80211_config_default_key(struct
  587. err = brcmf_fil_cmd_int_set(ifp,
  588. BRCMF_C_SET_KEY_PRIMARY, index);
  589. if (err)
  590. - brcmf_err("error (%d)\n", err);
  591. + bphy_err(wiphy, "error (%d)\n", err);
  592. }
  593. done:
  594. brcmf_dbg(TRACE, "Exit\n");
  595. @@ -2285,7 +2307,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  596. if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
  597. /* we ignore this key index in this case */
  598. - brcmf_err("invalid key index (%d)\n", key_idx);
  599. + bphy_err(wiphy, "invalid key index (%d)\n", key_idx);
  600. return -EINVAL;
  601. }
  602. @@ -2294,7 +2316,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  603. mac_addr);
  604. if (params->key_len > sizeof(key->data)) {
  605. - brcmf_err("Too long key length (%u)\n", params->key_len);
  606. + bphy_err(wiphy, "Too long key length (%u)\n", params->key_len);
  607. return -EINVAL;
  608. }
  609. @@ -2348,7 +2370,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  610. brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
  611. break;
  612. default:
  613. - brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
  614. + bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
  615. err = -EINVAL;
  616. goto done;
  617. }
  618. @@ -2359,13 +2381,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  619. err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  620. if (err) {
  621. - brcmf_err("get wsec error (%d)\n", err);
  622. + bphy_err(wiphy, "get wsec error (%d)\n", err);
  623. goto done;
  624. }
  625. wsec |= val;
  626. err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
  627. if (err) {
  628. - brcmf_err("set wsec error (%d)\n", err);
  629. + bphy_err(wiphy, "set wsec error (%d)\n", err);
  630. goto done;
  631. }
  632. @@ -2396,7 +2418,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
  633. err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  634. if (err) {
  635. - brcmf_err("WLC_GET_WSEC error (%d)\n", err);
  636. + bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
  637. /* Ignore this error, may happen during DISASSOC */
  638. err = -EAGAIN;
  639. goto done;
  640. @@ -2417,7 +2439,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
  641. params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
  642. brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
  643. } else {
  644. - brcmf_err("Invalid algo (0x%x)\n", wsec);
  645. + bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
  646. err = -EINVAL;
  647. goto done;
  648. }
  649. @@ -2447,6 +2469,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
  650. static void
  651. brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
  652. {
  653. + struct wiphy *wiphy = ifp->drvr->wiphy;
  654. s32 err;
  655. u8 key_idx;
  656. struct brcmf_wsec_key *key;
  657. @@ -2463,18 +2486,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
  658. err = send_key_to_dongle(ifp, key);
  659. if (err) {
  660. - brcmf_err("Setting WEP key failed (%d)\n", err);
  661. + bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
  662. return;
  663. }
  664. err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  665. if (err) {
  666. - brcmf_err("get wsec error (%d)\n", err);
  667. + bphy_err(wiphy, "get wsec error (%d)\n", err);
  668. return;
  669. }
  670. wsec |= WEP_ENABLED;
  671. err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
  672. if (err)
  673. - brcmf_err("set wsec error (%d)\n", err);
  674. + bphy_err(wiphy, "set wsec error (%d)\n", err);
  675. }
  676. static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
  677. @@ -2500,6 +2523,7 @@ static void brcmf_convert_sta_flags(u32
  678. static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
  679. {
  680. + struct wiphy *wiphy = ifp->drvr->wiphy;
  681. struct {
  682. __le32 len;
  683. struct brcmf_bss_info_le bss_le;
  684. @@ -2515,7 +2539,7 @@ static void brcmf_fill_bss_param(struct
  685. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
  686. WL_BSS_INFO_MAX);
  687. if (err) {
  688. - brcmf_err("Failed to get bss info (%d)\n", err);
  689. + bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
  690. goto out_kfree;
  691. }
  692. si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  693. @@ -2537,6 +2561,7 @@ static s32
  694. brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
  695. struct station_info *sinfo)
  696. {
  697. + struct wiphy *wiphy = ifp->drvr->wiphy;
  698. struct brcmf_scb_val_le scbval;
  699. struct brcmf_pktcnt_le pktcnt;
  700. s32 err;
  701. @@ -2546,7 +2571,7 @@ brcmf_cfg80211_get_station_ibss(struct b
  702. /* Get the current tx rate */
  703. err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
  704. if (err < 0) {
  705. - brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err);
  706. + bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
  707. return err;
  708. }
  709. sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  710. @@ -2556,7 +2581,7 @@ brcmf_cfg80211_get_station_ibss(struct b
  711. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
  712. sizeof(scbval));
  713. if (err) {
  714. - brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err);
  715. + bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
  716. return err;
  717. }
  718. rssi = le32_to_cpu(scbval.val);
  719. @@ -2566,7 +2591,7 @@ brcmf_cfg80211_get_station_ibss(struct b
  720. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
  721. sizeof(pktcnt));
  722. if (err) {
  723. - brcmf_err("BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
  724. + bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
  725. return err;
  726. }
  727. sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS) |
  728. @@ -2614,7 +2639,7 @@ brcmf_cfg80211_get_station(struct wiphy
  729. &sta_info_le,
  730. sizeof(sta_info_le));
  731. if (err < 0) {
  732. - brcmf_err("GET STA INFO failed, %d\n", err);
  733. + bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
  734. goto done;
  735. }
  736. }
  737. @@ -2683,7 +2708,8 @@ brcmf_cfg80211_get_station(struct wiphy
  738. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
  739. &scb_val, sizeof(scb_val));
  740. if (err) {
  741. - brcmf_err("Could not get rssi (%d)\n", err);
  742. + bphy_err(wiphy, "Could not get rssi (%d)\n",
  743. + err);
  744. goto done;
  745. } else {
  746. rssi = le32_to_cpu(scb_val.val);
  747. @@ -2714,8 +2740,8 @@ brcmf_cfg80211_dump_station(struct wiphy
  748. &cfg->assoclist,
  749. sizeof(cfg->assoclist));
  750. if (err) {
  751. - brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
  752. - err);
  753. + bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
  754. + err);
  755. cfg->assoclist.count = 0;
  756. return -EOPNOTSUPP;
  757. }
  758. @@ -2763,9 +2789,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  759. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
  760. if (err) {
  761. if (err == -ENODEV)
  762. - brcmf_err("net_device is not ready yet\n");
  763. + bphy_err(wiphy, "net_device is not ready yet\n");
  764. else
  765. - brcmf_err("error (%d)\n", err);
  766. + bphy_err(wiphy, "error (%d)\n", err);
  767. }
  768. done:
  769. brcmf_dbg(TRACE, "Exit\n");
  770. @@ -2789,7 +2815,7 @@ static s32 brcmf_inform_single_bss(struc
  771. s32 notify_signal;
  772. if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
  773. - brcmf_err("Bss info is larger than buffer. Discarding\n");
  774. + bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n");
  775. return 0;
  776. }
  777. @@ -2847,6 +2873,7 @@ next_bss_le(struct brcmf_scan_results *l
  778. static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
  779. {
  780. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  781. struct brcmf_scan_results *bss_list;
  782. struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
  783. s32 err = 0;
  784. @@ -2855,8 +2882,8 @@ static s32 brcmf_inform_bss(struct brcmf
  785. bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
  786. if (bss_list->count != 0 &&
  787. bss_list->version != BRCMF_BSS_INFO_VERSION) {
  788. - brcmf_err("Version %d != WL_BSS_INFO_VERSION\n",
  789. - bss_list->version);
  790. + bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n",
  791. + bss_list->version);
  792. return -EOPNOTSUPP;
  793. }
  794. brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count);
  795. @@ -2900,7 +2927,7 @@ static s32 brcmf_inform_ibss(struct brcm
  796. err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
  797. buf, WL_BSS_INFO_MAX);
  798. if (err) {
  799. - brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err);
  800. + bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
  801. goto CleanUp;
  802. }
  803. @@ -2954,6 +2981,7 @@ CleanUp:
  804. static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
  805. struct brcmf_if *ifp)
  806. {
  807. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  808. struct brcmf_bss_info_le *bi;
  809. const struct brcmf_tlv *tim;
  810. u16 beacon_interval;
  811. @@ -2970,7 +2998,7 @@ static s32 brcmf_update_bss_info(struct
  812. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
  813. cfg->extra_buf, WL_EXTRA_BUF_MAX);
  814. if (err) {
  815. - brcmf_err("Could not get bss info %d\n", err);
  816. + bphy_err(wiphy, "Could not get bss info %d\n", err);
  817. goto update_bss_info_out;
  818. }
  819. @@ -2995,7 +3023,7 @@ static s32 brcmf_update_bss_info(struct
  820. u32 var;
  821. err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
  822. if (err) {
  823. - brcmf_err("wl dtim_assoc failed (%d)\n", err);
  824. + bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err);
  825. goto update_bss_info_out;
  826. }
  827. dtim_period = (u8)var;
  828. @@ -3033,9 +3061,10 @@ static void brcmf_escan_timeout(unsigned
  829. {
  830. struct brcmf_cfg80211_info *cfg =
  831. (struct brcmf_cfg80211_info *)data;
  832. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  833. if (cfg->internal_escan || cfg->scan_request) {
  834. - brcmf_err("timer expired\n");
  835. + bphy_err(wiphy, "timer expired\n");
  836. schedule_work(&cfg->escan_timeout_work);
  837. }
  838. }
  839. @@ -3084,6 +3113,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  840. const struct brcmf_event_msg *e, void *data)
  841. {
  842. struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
  843. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  844. s32 status;
  845. struct brcmf_escan_result_le *escan_result_le;
  846. u32 escan_buflen;
  847. @@ -3100,32 +3130,33 @@ brcmf_cfg80211_escan_handler(struct brcm
  848. goto exit;
  849. if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
  850. - brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
  851. + bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n",
  852. + ifp->bsscfgidx);
  853. return -EPERM;
  854. }
  855. if (status == BRCMF_E_STATUS_PARTIAL) {
  856. brcmf_dbg(SCAN, "ESCAN Partial result\n");
  857. if (e->datalen < sizeof(*escan_result_le)) {
  858. - brcmf_err("invalid event data length\n");
  859. + bphy_err(wiphy, "invalid event data length\n");
  860. goto exit;
  861. }
  862. escan_result_le = (struct brcmf_escan_result_le *) data;
  863. if (!escan_result_le) {
  864. - brcmf_err("Invalid escan result (NULL pointer)\n");
  865. + bphy_err(wiphy, "Invalid escan result (NULL pointer)\n");
  866. goto exit;
  867. }
  868. escan_buflen = le32_to_cpu(escan_result_le->buflen);
  869. if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
  870. escan_buflen > e->datalen ||
  871. escan_buflen < sizeof(*escan_result_le)) {
  872. - brcmf_err("Invalid escan buffer length: %d\n",
  873. - escan_buflen);
  874. + bphy_err(wiphy, "Invalid escan buffer length: %d\n",
  875. + escan_buflen);
  876. goto exit;
  877. }
  878. if (le16_to_cpu(escan_result_le->bss_count) != 1) {
  879. - brcmf_err("Invalid bss_count %d: ignoring\n",
  880. - escan_result_le->bss_count);
  881. + bphy_err(wiphy, "Invalid bss_count %d: ignoring\n",
  882. + escan_result_le->bss_count);
  883. goto exit;
  884. }
  885. bss_info_le = &escan_result_le->bss_info_le;
  886. @@ -3140,8 +3171,8 @@ brcmf_cfg80211_escan_handler(struct brcm
  887. bi_length = le32_to_cpu(bss_info_le->length);
  888. if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
  889. - brcmf_err("Ignoring invalid bss_info length: %d\n",
  890. - bi_length);
  891. + bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
  892. + bi_length);
  893. goto exit;
  894. }
  895. @@ -3149,7 +3180,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  896. BIT(NL80211_IFTYPE_ADHOC))) {
  897. if (le16_to_cpu(bss_info_le->capability) &
  898. WLAN_CAPABILITY_IBSS) {
  899. - brcmf_err("Ignoring IBSS result\n");
  900. + bphy_err(wiphy, "Ignoring IBSS result\n");
  901. goto exit;
  902. }
  903. }
  904. @@ -3157,7 +3188,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  905. list = (struct brcmf_scan_results *)
  906. cfg->escan_info.escan_buf;
  907. if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
  908. - brcmf_err("Buffer is too small: ignoring\n");
  909. + bphy_err(wiphy, "Buffer is too small: ignoring\n");
  910. goto exit;
  911. }
  912. @@ -3346,14 +3377,14 @@ brcmf_notify_sched_scan_results(struct b
  913. WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
  914. brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
  915. if (!result_count) {
  916. - brcmf_err("FALSE PNO Event. (pfn_count == 0)\n");
  917. + bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n");
  918. goto out_err;
  919. }
  920. netinfo_start = brcmf_get_netinfo_array(pfn_result);
  921. datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
  922. if (datalen < result_count * sizeof(*netinfo)) {
  923. - brcmf_err("insufficient event data\n");
  924. + bphy_err(wiphy, "insufficient event data\n");
  925. goto out_err;
  926. }
  927. @@ -3402,8 +3433,8 @@ brcmf_cfg80211_sched_scan_start(struct w
  928. req->n_match_sets, req->n_ssids);
  929. if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
  930. - brcmf_err("Scanning suppressed: status (%lu)\n",
  931. - cfg->scan_status);
  932. + bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
  933. + cfg->scan_status);
  934. return -EAGAIN;
  935. }
  936. @@ -3482,6 +3513,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
  937. void *data)
  938. {
  939. struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
  940. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  941. struct brcmf_pno_scanresults_le *pfn_result;
  942. struct brcmf_pno_net_info_le *netinfo;
  943. @@ -3500,8 +3532,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i
  944. }
  945. if (le32_to_cpu(pfn_result->count) < 1) {
  946. - brcmf_err("Invalid result count, expected 1 (%d)\n",
  947. - le32_to_cpu(pfn_result->count));
  948. + bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n",
  949. + le32_to_cpu(pfn_result->count));
  950. return -EINVAL;
  951. }
  952. @@ -3538,7 +3570,7 @@ static void brcmf_report_wowl_wakeind(st
  953. err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
  954. sizeof(wake_ind_le));
  955. if (err) {
  956. - brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
  957. + bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
  958. return;
  959. }
  960. @@ -3579,7 +3611,7 @@ static void brcmf_report_wowl_wakeind(st
  961. cfg->wowl.nd_data_completed,
  962. BRCMF_ND_INFO_TIMEOUT);
  963. if (!timeout)
  964. - brcmf_err("No result for wowl net detect\n");
  965. + bphy_err(wiphy, "No result for wowl net detect\n");
  966. else
  967. wakeup_data.net_detect = cfg->wowl.nd_info;
  968. }
  969. @@ -3787,7 +3819,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
  970. cfg->pmk_list.npmk = cpu_to_le32(npmk);
  971. }
  972. } else {
  973. - brcmf_err("Too many PMKSA entries cached %d\n", npmk);
  974. + bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
  975. return -EINVAL;
  976. }
  977. @@ -3833,7 +3865,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
  978. memset(&pmk[i], 0, sizeof(*pmk));
  979. cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
  980. } else {
  981. - brcmf_err("Cache entry not found\n");
  982. + bphy_err(wiphy, "Cache entry not found\n");
  983. return -EINVAL;
  984. }
  985. @@ -3865,24 +3897,25 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
  986. static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
  987. {
  988. + struct wiphy *wiphy = ifp->drvr->wiphy;
  989. s32 err;
  990. /* set auth */
  991. err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
  992. if (err < 0) {
  993. - brcmf_err("auth error %d\n", err);
  994. + bphy_err(wiphy, "auth error %d\n", err);
  995. return err;
  996. }
  997. /* set wsec */
  998. err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
  999. if (err < 0) {
  1000. - brcmf_err("wsec error %d\n", err);
  1001. + bphy_err(wiphy, "wsec error %d\n", err);
  1002. return err;
  1003. }
  1004. /* set upper-layer auth */
  1005. err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", WPA_AUTH_NONE);
  1006. if (err < 0) {
  1007. - brcmf_err("wpa_auth error %d\n", err);
  1008. + bphy_err(wiphy, "wpa_auth error %d\n", err);
  1009. return err;
  1010. }
  1011. @@ -3902,6 +3935,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1012. const struct brcmf_vs_tlv *wpa_ie,
  1013. bool is_rsn_ie)
  1014. {
  1015. + struct wiphy *wiphy = ifp->drvr->wiphy;
  1016. u32 auth = 0; /* d11 open authentication */
  1017. u16 count;
  1018. s32 err = 0;
  1019. @@ -3932,13 +3966,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1020. /* check for multicast cipher suite */
  1021. if (offset + WPA_IE_MIN_OUI_LEN > len) {
  1022. err = -EINVAL;
  1023. - brcmf_err("no multicast cipher suite\n");
  1024. + bphy_err(wiphy, "no multicast cipher suite\n");
  1025. goto exit;
  1026. }
  1027. if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
  1028. err = -EINVAL;
  1029. - brcmf_err("ivalid OUI\n");
  1030. + bphy_err(wiphy, "ivalid OUI\n");
  1031. goto exit;
  1032. }
  1033. offset += TLV_OUI_LEN;
  1034. @@ -3960,7 +3994,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1035. break;
  1036. default:
  1037. err = -EINVAL;
  1038. - brcmf_err("Invalid multi cast cipher info\n");
  1039. + bphy_err(wiphy, "Invalid multi cast cipher info\n");
  1040. goto exit;
  1041. }
  1042. @@ -3971,13 +4005,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1043. /* Check for unicast suite(s) */
  1044. if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
  1045. err = -EINVAL;
  1046. - brcmf_err("no unicast cipher suite\n");
  1047. + bphy_err(wiphy, "no unicast cipher suite\n");
  1048. goto exit;
  1049. }
  1050. for (i = 0; i < count; i++) {
  1051. if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
  1052. err = -EINVAL;
  1053. - brcmf_err("ivalid OUI\n");
  1054. + bphy_err(wiphy, "ivalid OUI\n");
  1055. goto exit;
  1056. }
  1057. offset += TLV_OUI_LEN;
  1058. @@ -3995,7 +4029,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1059. pval |= AES_ENABLED;
  1060. break;
  1061. default:
  1062. - brcmf_err("Invalid unicast security info\n");
  1063. + bphy_err(wiphy, "Invalid unicast security info\n");
  1064. }
  1065. offset++;
  1066. }
  1067. @@ -4005,13 +4039,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1068. /* Check for auth key management suite(s) */
  1069. if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
  1070. err = -EINVAL;
  1071. - brcmf_err("no auth key mgmt suite\n");
  1072. + bphy_err(wiphy, "no auth key mgmt suite\n");
  1073. goto exit;
  1074. }
  1075. for (i = 0; i < count; i++) {
  1076. if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
  1077. err = -EINVAL;
  1078. - brcmf_err("ivalid OUI\n");
  1079. + bphy_err(wiphy, "ivalid OUI\n");
  1080. goto exit;
  1081. }
  1082. offset += TLV_OUI_LEN;
  1083. @@ -4039,7 +4073,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1084. wpa_auth |= WPA2_AUTH_1X_SHA256;
  1085. break;
  1086. default:
  1087. - brcmf_err("Invalid key mgmt info\n");
  1088. + bphy_err(wiphy, "Invalid key mgmt info\n");
  1089. }
  1090. offset++;
  1091. }
  1092. @@ -4081,7 +4115,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1093. err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
  1094. wme_bss_disable);
  1095. if (err < 0) {
  1096. - brcmf_err("wme_bss_disable error %d\n", err);
  1097. + bphy_err(wiphy, "wme_bss_disable error %d\n", err);
  1098. goto exit;
  1099. }
  1100. @@ -4095,7 +4129,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1101. &data[offset],
  1102. WPA_IE_MIN_OUI_LEN);
  1103. if (err < 0) {
  1104. - brcmf_err("bip error %d\n", err);
  1105. + bphy_err(wiphy, "bip error %d\n", err);
  1106. goto exit;
  1107. }
  1108. }
  1109. @@ -4106,13 +4140,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1110. /* set auth */
  1111. err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
  1112. if (err < 0) {
  1113. - brcmf_err("auth error %d\n", err);
  1114. + bphy_err(wiphy, "auth error %d\n", err);
  1115. goto exit;
  1116. }
  1117. /* set wsec */
  1118. err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
  1119. if (err < 0) {
  1120. - brcmf_err("wsec error %d\n", err);
  1121. + bphy_err(wiphy, "wsec error %d\n", err);
  1122. goto exit;
  1123. }
  1124. /* Configure MFP, this needs to go after wsec otherwise the wsec command
  1125. @@ -4121,14 +4155,14 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1126. if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
  1127. err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
  1128. if (err < 0) {
  1129. - brcmf_err("mfp error %d\n", err);
  1130. + bphy_err(wiphy, "mfp error %d\n", err);
  1131. goto exit;
  1132. }
  1133. }
  1134. /* set upper-layer auth */
  1135. err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
  1136. if (err < 0) {
  1137. - brcmf_err("wpa_auth error %d\n", err);
  1138. + bphy_err(wiphy, "wpa_auth error %d\n", err);
  1139. goto exit;
  1140. }
  1141. @@ -4215,6 +4249,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1142. const u8 *vndr_ie_buf, u32 vndr_ie_len)
  1143. {
  1144. struct brcmf_if *ifp;
  1145. + struct wiphy *wiphy;
  1146. struct vif_saved_ie *saved_ie;
  1147. s32 err = 0;
  1148. u8 *iovar_ie_buf;
  1149. @@ -4235,6 +4270,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1150. if (!vif)
  1151. return -ENODEV;
  1152. ifp = vif->ifp;
  1153. + wiphy = ifp->drvr->wiphy;
  1154. saved_ie = &vif->saved_ie;
  1155. brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
  1156. @@ -4266,13 +4302,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1157. break;
  1158. default:
  1159. err = -EPERM;
  1160. - brcmf_err("not suitable type\n");
  1161. + bphy_err(wiphy, "not suitable type\n");
  1162. goto exit;
  1163. }
  1164. if (vndr_ie_len > mgmt_ie_buf_len) {
  1165. err = -ENOMEM;
  1166. - brcmf_err("extra IE size too big\n");
  1167. + bphy_err(wiphy, "extra IE size too big\n");
  1168. goto exit;
  1169. }
  1170. @@ -4333,8 +4369,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1171. /* verify remained buf size before copy data */
  1172. if (remained_buf_len < (vndrie_info->vndrie.len +
  1173. VNDR_IE_VSIE_OFFSET)) {
  1174. - brcmf_err("no space in mgmt_ie_buf: len left %d",
  1175. - remained_buf_len);
  1176. + bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d",
  1177. + remained_buf_len);
  1178. break;
  1179. }
  1180. remained_buf_len -= (vndrie_info->ie_len +
  1181. @@ -4365,7 +4401,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1182. err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
  1183. total_ie_buf_len);
  1184. if (err)
  1185. - brcmf_err("vndr ie set error : %d\n", err);
  1186. + bphy_err(wiphy, "vndr ie set error : %d\n", err);
  1187. }
  1188. exit:
  1189. @@ -4393,13 +4429,14 @@ static s32
  1190. brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
  1191. struct cfg80211_beacon_data *beacon)
  1192. {
  1193. + struct wiphy *wiphy = vif->ifp->drvr->wiphy;
  1194. s32 err;
  1195. /* Set Beacon IEs to FW */
  1196. err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
  1197. beacon->tail, beacon->tail_len);
  1198. if (err) {
  1199. - brcmf_err("Set Beacon IE Failed\n");
  1200. + bphy_err(wiphy, "Set Beacon IE Failed\n");
  1201. return err;
  1202. }
  1203. brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
  1204. @@ -4409,7 +4446,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
  1205. beacon->proberesp_ies,
  1206. beacon->proberesp_ies_len);
  1207. if (err)
  1208. - brcmf_err("Set Probe Resp IE Failed\n");
  1209. + bphy_err(wiphy, "Set Probe Resp IE Failed\n");
  1210. else
  1211. brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
  1212. @@ -4518,7 +4555,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1213. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  1214. is_11d);
  1215. if (err < 0) {
  1216. - brcmf_err("Regulatory Set Error, %d\n", err);
  1217. + bphy_err(wiphy, "Regulatory Set Error, %d\n",
  1218. + err);
  1219. goto exit;
  1220. }
  1221. }
  1222. @@ -4526,8 +4564,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1223. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
  1224. settings->beacon_interval);
  1225. if (err < 0) {
  1226. - brcmf_err("Beacon Interval Set Error, %d\n",
  1227. - err);
  1228. + bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
  1229. + err);
  1230. goto exit;
  1231. }
  1232. }
  1233. @@ -4535,7 +4573,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1234. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
  1235. settings->dtim_period);
  1236. if (err < 0) {
  1237. - brcmf_err("DTIM Interval Set Error, %d\n", err);
  1238. + bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
  1239. + err);
  1240. goto exit;
  1241. }
  1242. }
  1243. @@ -4545,7 +4584,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1244. !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
  1245. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
  1246. if (err < 0) {
  1247. - brcmf_err("BRCMF_C_DOWN error %d\n", err);
  1248. + bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
  1249. + err);
  1250. goto exit;
  1251. }
  1252. brcmf_fil_iovar_int_set(ifp, "apsta", 0);
  1253. @@ -4553,7 +4593,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1254. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
  1255. if (err < 0) {
  1256. - brcmf_err("SET INFRA error %d\n", err);
  1257. + bphy_err(wiphy, "SET INFRA error %d\n", err);
  1258. goto exit;
  1259. }
  1260. } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
  1261. @@ -4569,7 +4609,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1262. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
  1263. if (err < 0) {
  1264. - brcmf_err("setting AP mode failed %d\n", err);
  1265. + bphy_err(wiphy, "setting AP mode failed %d\n",
  1266. + err);
  1267. goto exit;
  1268. }
  1269. if (!mbss) {
  1270. @@ -4578,14 +4619,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1271. */
  1272. err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  1273. if (err < 0) {
  1274. - brcmf_err("Set Channel failed: chspec=%d, %d\n",
  1275. - chanspec, err);
  1276. + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
  1277. + chanspec, err);
  1278. goto exit;
  1279. }
  1280. }
  1281. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  1282. if (err < 0) {
  1283. - brcmf_err("BRCMF_C_UP error (%d)\n", err);
  1284. + bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
  1285. goto exit;
  1286. }
  1287. /* On DOWN the firmware removes the WEP keys, reconfigure
  1288. @@ -4600,14 +4641,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1289. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  1290. &join_params, sizeof(join_params));
  1291. if (err < 0) {
  1292. - brcmf_err("SET SSID error (%d)\n", err);
  1293. + bphy_err(wiphy, "SET SSID error (%d)\n", err);
  1294. goto exit;
  1295. }
  1296. if (settings->hidden_ssid) {
  1297. err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
  1298. if (err) {
  1299. - brcmf_err("closednet error (%d)\n", err);
  1300. + bphy_err(wiphy, "closednet error (%d)\n", err);
  1301. goto exit;
  1302. }
  1303. }
  1304. @@ -4616,14 +4657,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1305. } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
  1306. err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  1307. if (err < 0) {
  1308. - brcmf_err("Set Channel failed: chspec=%d, %d\n",
  1309. - chanspec, err);
  1310. + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
  1311. + chanspec, err);
  1312. goto exit;
  1313. }
  1314. err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
  1315. sizeof(ssid_le));
  1316. if (err < 0) {
  1317. - brcmf_err("setting ssid failed %d\n", err);
  1318. + bphy_err(wiphy, "setting ssid failed %d\n", err);
  1319. goto exit;
  1320. }
  1321. bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
  1322. @@ -4631,7 +4672,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1323. err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  1324. sizeof(bss_enable));
  1325. if (err < 0) {
  1326. - brcmf_err("bss_enable config failed %d\n", err);
  1327. + bphy_err(wiphy, "bss_enable config failed %d\n", err);
  1328. goto exit;
  1329. }
  1330. @@ -4679,13 +4720,13 @@ static int brcmf_cfg80211_stop_ap(struct
  1331. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  1332. &join_params, sizeof(join_params));
  1333. if (err < 0)
  1334. - brcmf_err("SET SSID error (%d)\n", err);
  1335. + bphy_err(wiphy, "SET SSID error (%d)\n", err);
  1336. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
  1337. if (err < 0)
  1338. - brcmf_err("BRCMF_C_DOWN error %d\n", err);
  1339. + bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err);
  1340. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
  1341. if (err < 0)
  1342. - brcmf_err("setting AP mode failed %d\n", err);
  1343. + bphy_err(wiphy, "setting AP mode failed %d\n", err);
  1344. if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
  1345. brcmf_fil_iovar_int_set(ifp, "mbss", 0);
  1346. brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  1347. @@ -4693,7 +4734,7 @@ static int brcmf_cfg80211_stop_ap(struct
  1348. /* Bring device back up so it can be used again */
  1349. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  1350. if (err < 0)
  1351. - brcmf_err("BRCMF_C_UP error %d\n", err);
  1352. + bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
  1353. brcmf_vif_clear_mgmt_ies(ifp->vif);
  1354. } else {
  1355. @@ -4702,7 +4743,7 @@ static int brcmf_cfg80211_stop_ap(struct
  1356. err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  1357. sizeof(bss_enable));
  1358. if (err < 0)
  1359. - brcmf_err("bss_enable config failed %d\n", err);
  1360. + bphy_err(wiphy, "bss_enable config failed %d\n", err);
  1361. }
  1362. brcmf_set_mpc(ifp, 1);
  1363. brcmf_configure_arp_nd_offload(ifp, true);
  1364. @@ -4750,7 +4791,8 @@ brcmf_cfg80211_del_station(struct wiphy
  1365. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
  1366. &scbval, sizeof(scbval));
  1367. if (err)
  1368. - brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err);
  1369. + bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
  1370. + err);
  1371. brcmf_dbg(TRACE, "Exit\n");
  1372. return err;
  1373. @@ -4780,7 +4822,7 @@ brcmf_cfg80211_change_station(struct wip
  1374. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
  1375. (void *)mac, ETH_ALEN);
  1376. if (err < 0)
  1377. - brcmf_err("Setting SCB (de-)authorize failed, %d\n", err);
  1378. + bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
  1379. return err;
  1380. }
  1381. @@ -4830,7 +4872,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
  1382. mgmt = (const struct ieee80211_mgmt *)buf;
  1383. if (!ieee80211_is_mgmt(mgmt->frame_control)) {
  1384. - brcmf_err("Driver only allows MGMT packet type\n");
  1385. + bphy_err(wiphy, "Driver only allows MGMT packet type\n");
  1386. return -EPERM;
  1387. }
  1388. @@ -4861,13 +4903,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
  1389. GFP_KERNEL);
  1390. } else if (ieee80211_is_action(mgmt->frame_control)) {
  1391. if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
  1392. - brcmf_err("invalid action frame length\n");
  1393. + bphy_err(wiphy, "invalid action frame length\n");
  1394. err = -EINVAL;
  1395. goto exit;
  1396. }
  1397. af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
  1398. if (af_params == NULL) {
  1399. - brcmf_err("unable to allocate frame\n");
  1400. + bphy_err(wiphy, "unable to allocate frame\n");
  1401. err = -ENOMEM;
  1402. goto exit;
  1403. }
  1404. @@ -4925,7 +4967,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
  1405. vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  1406. if (vif == NULL) {
  1407. - brcmf_err("No p2p device available for probe response\n");
  1408. + bphy_err(wiphy, "No p2p device available for probe response\n");
  1409. err = -ENODEV;
  1410. goto exit;
  1411. }
  1412. @@ -4953,7 +4995,7 @@ static int brcmf_cfg80211_get_channel(st
  1413. err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
  1414. if (err) {
  1415. - brcmf_err("chanspec failed (%d)\n", err);
  1416. + bphy_err(wiphy, "chanspec failed (%d)\n", err);
  1417. return err;
  1418. }
  1419. @@ -5092,7 +5134,7 @@ static int brcmf_cfg80211_tdls_oper(stru
  1420. ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
  1421. &info, sizeof(info));
  1422. if (ret < 0)
  1423. - brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret);
  1424. + bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
  1425. return ret;
  1426. }
  1427. @@ -5113,7 +5155,7 @@ brcmf_cfg80211_update_conn_params(struct
  1428. err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
  1429. sme->ie, sme->ie_len);
  1430. if (err)
  1431. - brcmf_err("Set Assoc REQ IE Failed\n");
  1432. + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
  1433. else
  1434. brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
  1435. @@ -5139,7 +5181,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
  1436. ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
  1437. sizeof(gtk_le));
  1438. if (ret < 0)
  1439. - brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret);
  1440. + bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret);
  1441. return ret;
  1442. }
  1443. @@ -5317,6 +5359,7 @@ static void brcmf_clear_assoc_ies(struct
  1444. static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
  1445. struct brcmf_if *ifp)
  1446. {
  1447. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1448. struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
  1449. struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
  1450. u32 req_len;
  1451. @@ -5328,7 +5371,7 @@ static s32 brcmf_get_assoc_ies(struct br
  1452. err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
  1453. cfg->extra_buf, WL_ASSOC_INFO_MAX);
  1454. if (err) {
  1455. - brcmf_err("could not get assoc info (%d)\n", err);
  1456. + bphy_err(wiphy, "could not get assoc info (%d)\n", err);
  1457. return err;
  1458. }
  1459. assoc_info =
  1460. @@ -5340,7 +5383,7 @@ static s32 brcmf_get_assoc_ies(struct br
  1461. cfg->extra_buf,
  1462. WL_ASSOC_INFO_MAX);
  1463. if (err) {
  1464. - brcmf_err("could not get assoc req (%d)\n", err);
  1465. + bphy_err(wiphy, "could not get assoc req (%d)\n", err);
  1466. return err;
  1467. }
  1468. conn_info->req_ie_len = req_len;
  1469. @@ -5356,7 +5399,7 @@ static s32 brcmf_get_assoc_ies(struct br
  1470. cfg->extra_buf,
  1471. WL_ASSOC_INFO_MAX);
  1472. if (err) {
  1473. - brcmf_err("could not get assoc resp (%d)\n", err);
  1474. + bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
  1475. return err;
  1476. }
  1477. conn_info->resp_ie_len = resp_len;
  1478. @@ -5475,6 +5518,7 @@ brcmf_notify_connect_status_ap(struct br
  1479. struct net_device *ndev,
  1480. const struct brcmf_event_msg *e, void *data)
  1481. {
  1482. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1483. static int generation;
  1484. u32 event = e->event_code;
  1485. u32 reason = e->reason;
  1486. @@ -5493,7 +5537,7 @@ brcmf_notify_connect_status_ap(struct br
  1487. (reason == BRCMF_E_STATUS_SUCCESS)) {
  1488. memset(&sinfo, 0, sizeof(sinfo));
  1489. if (!data) {
  1490. - brcmf_err("No IEs present in ASSOC/REASSOC_IND");
  1491. + bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
  1492. return -EINVAL;
  1493. }
  1494. sinfo.assoc_req_ies = data;
  1495. @@ -5774,6 +5818,7 @@ static void init_vif_event(struct brcmf_
  1496. static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
  1497. {
  1498. + struct wiphy *wiphy = ifp->drvr->wiphy;
  1499. s32 err;
  1500. u32 bcn_timeout;
  1501. __le32 roamtrigger[2];
  1502. @@ -5786,7 +5831,7 @@ static s32 brcmf_dongle_roam(struct brcm
  1503. bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
  1504. err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
  1505. if (err) {
  1506. - brcmf_err("bcn_timeout error (%d)\n", err);
  1507. + bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
  1508. goto roam_setup_done;
  1509. }
  1510. @@ -5798,7 +5843,7 @@ static s32 brcmf_dongle_roam(struct brcm
  1511. err = brcmf_fil_iovar_int_set(ifp, "roam_off",
  1512. ifp->drvr->settings->roamoff);
  1513. if (err) {
  1514. - brcmf_err("roam_off error (%d)\n", err);
  1515. + bphy_err(wiphy, "roam_off error (%d)\n", err);
  1516. goto roam_setup_done;
  1517. }
  1518. @@ -5807,7 +5852,7 @@ static s32 brcmf_dongle_roam(struct brcm
  1519. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
  1520. (void *)roamtrigger, sizeof(roamtrigger));
  1521. if (err) {
  1522. - brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
  1523. + bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
  1524. goto roam_setup_done;
  1525. }
  1526. @@ -5816,7 +5861,7 @@ static s32 brcmf_dongle_roam(struct brcm
  1527. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
  1528. (void *)roam_delta, sizeof(roam_delta));
  1529. if (err) {
  1530. - brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
  1531. + bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err);
  1532. goto roam_setup_done;
  1533. }
  1534. @@ -5827,25 +5872,26 @@ roam_setup_done:
  1535. static s32
  1536. brcmf_dongle_scantime(struct brcmf_if *ifp)
  1537. {
  1538. + struct wiphy *wiphy = ifp->drvr->wiphy;
  1539. s32 err = 0;
  1540. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
  1541. BRCMF_SCAN_CHANNEL_TIME);
  1542. if (err) {
  1543. - brcmf_err("Scan assoc time error (%d)\n", err);
  1544. + bphy_err(wiphy, "Scan assoc time error (%d)\n", err);
  1545. goto dongle_scantime_out;
  1546. }
  1547. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
  1548. BRCMF_SCAN_UNASSOC_TIME);
  1549. if (err) {
  1550. - brcmf_err("Scan unassoc time error (%d)\n", err);
  1551. + bphy_err(wiphy, "Scan unassoc time error (%d)\n", err);
  1552. goto dongle_scantime_out;
  1553. }
  1554. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
  1555. BRCMF_SCAN_PASSIVE_TIME);
  1556. if (err) {
  1557. - brcmf_err("Scan passive time error (%d)\n", err);
  1558. + bphy_err(wiphy, "Scan passive time error (%d)\n", err);
  1559. goto dongle_scantime_out;
  1560. }
  1561. @@ -5877,10 +5923,10 @@ static void brcmf_update_bw40_channel_fl
  1562. static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
  1563. u32 bw_cap[])
  1564. {
  1565. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1566. struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  1567. struct ieee80211_supported_band *band;
  1568. struct ieee80211_channel *channel;
  1569. - struct wiphy *wiphy;
  1570. struct brcmf_chanspec_list *list;
  1571. struct brcmu_chan ch;
  1572. int err;
  1573. @@ -5899,11 +5945,10 @@ static int brcmf_construct_chaninfo(stru
  1574. err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
  1575. BRCMF_DCMD_MEDLEN);
  1576. if (err) {
  1577. - brcmf_err("get chanspecs error (%d)\n", err);
  1578. + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
  1579. goto fail_pbuf;
  1580. }
  1581. - wiphy = cfg_to_wiphy(cfg);
  1582. band = wiphy->bands[NL80211_BAND_2GHZ];
  1583. if (band)
  1584. for (i = 0; i < band->n_channels; i++)
  1585. @@ -5923,7 +5968,8 @@ static int brcmf_construct_chaninfo(stru
  1586. } else if (ch.band == BRCMU_CHAN_BAND_5G) {
  1587. band = wiphy->bands[NL80211_BAND_5GHZ];
  1588. } else {
  1589. - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
  1590. + bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
  1591. + ch.chspec);
  1592. continue;
  1593. }
  1594. if (!band)
  1595. @@ -5946,8 +5992,8 @@ static int brcmf_construct_chaninfo(stru
  1596. /* It seems firmware supports some channel we never
  1597. * considered. Something new in IEEE standard?
  1598. */
  1599. - brcmf_err("Ignoring unexpected firmware channel %d\n",
  1600. - ch.control_ch_num);
  1601. + bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n",
  1602. + ch.control_ch_num);
  1603. continue;
  1604. }
  1605. @@ -5993,6 +6039,7 @@ fail_pbuf:
  1606. static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
  1607. {
  1608. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1609. struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  1610. struct ieee80211_supported_band *band;
  1611. struct brcmf_fil_bwcap_le band_bwcap;
  1612. @@ -6039,7 +6086,7 @@ static int brcmf_enable_bw40_2g(struct b
  1613. err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
  1614. BRCMF_DCMD_MEDLEN);
  1615. if (err) {
  1616. - brcmf_err("get chanspecs error (%d)\n", err);
  1617. + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
  1618. kfree(pbuf);
  1619. return err;
  1620. }
  1621. @@ -6070,6 +6117,7 @@ static int brcmf_enable_bw40_2g(struct b
  1622. static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
  1623. {
  1624. + struct wiphy *wiphy = ifp->drvr->wiphy;
  1625. u32 band, mimo_bwcap;
  1626. int err;
  1627. @@ -6105,7 +6153,7 @@ static void brcmf_get_bwcap(struct brcmf
  1628. bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
  1629. break;
  1630. default:
  1631. - brcmf_err("invalid mimo_bw_cap value\n");
  1632. + bphy_err(wiphy, "invalid mimo_bw_cap value\n");
  1633. }
  1634. }
  1635. @@ -6181,7 +6229,7 @@ static void brcmf_update_vht_cap(struct
  1636. static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
  1637. {
  1638. struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  1639. - struct wiphy *wiphy;
  1640. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1641. u32 nmode = 0;
  1642. u32 vhtmode = 0;
  1643. u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
  1644. @@ -6197,7 +6245,7 @@ static int brcmf_setup_wiphybands(struct
  1645. (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
  1646. err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
  1647. if (err) {
  1648. - brcmf_err("nmode error (%d)\n", err);
  1649. + bphy_err(wiphy, "nmode error (%d)\n", err);
  1650. } else {
  1651. brcmf_get_bwcap(ifp, bw_cap);
  1652. }
  1653. @@ -6207,7 +6255,7 @@ static int brcmf_setup_wiphybands(struct
  1654. err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
  1655. if (err) {
  1656. - brcmf_err("rxchain error (%d)\n", err);
  1657. + bphy_err(wiphy, "rxchain error (%d)\n", err);
  1658. nchain = 1;
  1659. } else {
  1660. for (nchain = 0; rxchain; nchain++)
  1661. @@ -6217,7 +6265,7 @@ static int brcmf_setup_wiphybands(struct
  1662. err = brcmf_construct_chaninfo(cfg, bw_cap);
  1663. if (err) {
  1664. - brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err);
  1665. + bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
  1666. return err;
  1667. }
  1668. @@ -6229,7 +6277,6 @@ static int brcmf_setup_wiphybands(struct
  1669. &txbf_bfr_cap);
  1670. }
  1671. - wiphy = cfg_to_wiphy(cfg);
  1672. for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
  1673. band = wiphy->bands[i];
  1674. if (band == NULL)
  1675. @@ -6440,7 +6487,7 @@ static void brcmf_wiphy_wowl_params(stru
  1676. wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
  1677. GFP_KERNEL);
  1678. if (!wowl) {
  1679. - brcmf_err("only support basic wowlan features\n");
  1680. + bphy_err(wiphy, "only support basic wowlan features\n");
  1681. wiphy->wowlan = &brcmf_wowlan_support;
  1682. return;
  1683. }
  1684. @@ -6529,7 +6576,7 @@ static int brcmf_setup_wiphy(struct wiph
  1685. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
  1686. sizeof(bandlist));
  1687. if (err) {
  1688. - brcmf_err("could not obtain band info: err=%d\n", err);
  1689. + bphy_err(wiphy, "could not obtain band info: err=%d\n", err);
  1690. return err;
  1691. }
  1692. /* first entry in bandlist is number of bands */
  1693. @@ -6801,8 +6848,8 @@ static void brcmf_cfg80211_reg_notifier(
  1694. /* ignore non-ISO3166 country codes */
  1695. for (i = 0; i < 2; i++)
  1696. if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
  1697. - brcmf_err("not a ISO3166 code (0x%02x 0x%02x)\n",
  1698. - req->alpha2[0], req->alpha2[1]);
  1699. + bphy_err(wiphy, "not a ISO3166 code (0x%02x 0x%02x)\n",
  1700. + req->alpha2[0], req->alpha2[1]);
  1701. return;
  1702. }
  1703. @@ -6811,7 +6858,7 @@ static void brcmf_cfg80211_reg_notifier(
  1704. err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
  1705. if (err) {
  1706. - brcmf_err("Country code iovar returned err = %d\n", err);
  1707. + bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
  1708. return;
  1709. }
  1710. @@ -6821,7 +6868,7 @@ static void brcmf_cfg80211_reg_notifier(
  1711. err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  1712. if (err) {
  1713. - brcmf_err("Firmware rejected country setting\n");
  1714. + bphy_err(wiphy, "Firmware rejected country setting\n");
  1715. return;
  1716. }
  1717. brcmf_setup_wiphybands(cfg);
  1718. @@ -6867,13 +6914,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1719. u16 *cap = NULL;
  1720. if (!ndev) {
  1721. - brcmf_err("ndev is invalid\n");
  1722. + bphy_err(wiphy, "ndev is invalid\n");
  1723. return NULL;
  1724. }
  1725. cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
  1726. if (!cfg) {
  1727. - brcmf_err("Could not allocate wiphy device\n");
  1728. + bphy_err(wiphy, "Could not allocate wiphy device\n");
  1729. return NULL;
  1730. }
  1731. @@ -6894,7 +6941,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1732. err = wl_init_priv(cfg);
  1733. if (err) {
  1734. - brcmf_err("Failed to init iwm_priv (%d)\n", err);
  1735. + bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err);
  1736. brcmf_free_vif(vif);
  1737. goto wiphy_out;
  1738. }
  1739. @@ -6903,7 +6950,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1740. /* determine d11 io type before wiphy setup */
  1741. err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
  1742. if (err) {
  1743. - brcmf_err("Failed to get D11 version (%d)\n", err);
  1744. + bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
  1745. goto priv_out;
  1746. }
  1747. cfg->d11inf.io_type = (u8)io_type;
  1748. @@ -6937,13 +6984,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1749. #endif
  1750. err = wiphy_register(wiphy);
  1751. if (err < 0) {
  1752. - brcmf_err("Could not register wiphy device (%d)\n", err);
  1753. + bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
  1754. goto priv_out;
  1755. }
  1756. err = brcmf_setup_wiphybands(cfg);
  1757. if (err) {
  1758. - brcmf_err("Setting wiphy bands failed (%d)\n", err);
  1759. + bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err);
  1760. goto wiphy_unreg_out;
  1761. }
  1762. @@ -6961,18 +7008,18 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1763. err = brcmf_fweh_activate_events(ifp);
  1764. if (err) {
  1765. - brcmf_err("FWEH activation failed (%d)\n", err);
  1766. + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
  1767. goto wiphy_unreg_out;
  1768. }
  1769. err = brcmf_p2p_attach(cfg, p2pdev_forced);
  1770. if (err) {
  1771. - brcmf_err("P2P initialisation failed (%d)\n", err);
  1772. + bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
  1773. goto wiphy_unreg_out;
  1774. }
  1775. err = brcmf_btcoex_attach(cfg);
  1776. if (err) {
  1777. - brcmf_err("BT-coex initialisation failed (%d)\n", err);
  1778. + bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err);
  1779. brcmf_p2p_detach(&cfg->p2p);
  1780. goto wiphy_unreg_out;
  1781. }
  1782. @@ -6991,7 +7038,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1783. /* (re-) activate FWEH event handling */
  1784. err = brcmf_fweh_activate_events(ifp);
  1785. if (err) {
  1786. - brcmf_err("FWEH activation failed (%d)\n", err);
  1787. + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
  1788. goto detach;
  1789. }
  1790. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
  1791. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
  1792. @@ -62,6 +62,15 @@ void __brcmf_err(struct brcmf_bus *bus,
  1793. } while (0)
  1794. #endif
  1795. +#define bphy_err(wiphy, fmt, ...) \
  1796. + do { \
  1797. + if (IS_ENABLED(CPTCFG_BRCMDBG) || \
  1798. + IS_ENABLED(CPTCFG_BRCM_TRACING) || \
  1799. + net_ratelimit()) \
  1800. + wiphy_err(wiphy, "%s: " fmt, __func__, \
  1801. + ##__VA_ARGS__); \
  1802. + } while (0)
  1803. +
  1804. #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
  1805. /* For debug/tracing purposes treat info messages as errors */