346-v5.1-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025
  1. From 3ef005b82e2ad68107fc5814eaa743d171a6c362 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <[email protected]>
  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 <[email protected]>
  12. Signed-off-by: Kalle Valo <[email protected]>
  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. @@ -508,6 +509,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. @@ -524,7 +526,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. @@ -567,7 +569,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. @@ -575,7 +577,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. @@ -583,7 +585,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. free_netdev(ifp->ndev);
  73. goto fail;
  74. }
  75. @@ -620,7 +622,7 @@ static struct wireless_dev *brcmf_cfg802
  76. brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  77. err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  78. if (err) {
  79. - brcmf_err("iface validation failed: err=%d\n", err);
  80. + bphy_err(wiphy, "iface validation failed: err=%d\n", err);
  81. return ERR_PTR(err);
  82. }
  83. switch (type) {
  84. @@ -645,8 +647,8 @@ static struct wireless_dev *brcmf_cfg802
  85. }
  86. if (IS_ERR(wdev))
  87. - brcmf_err("add iface %s type %d failed: err=%d\n",
  88. - name, type, (int)PTR_ERR(wdev));
  89. + bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name,
  90. + type, (int)PTR_ERR(wdev));
  91. else
  92. brcmf_cfg80211_update_proto_addr_mode(wdev);
  93. @@ -661,12 +663,13 @@ static void brcmf_scan_config_mpc(struct
  94. void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
  95. {
  96. + struct wiphy *wiphy = ifp->drvr->wiphy;
  97. s32 err = 0;
  98. if (check_vif_up(ifp->vif)) {
  99. err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
  100. if (err) {
  101. - brcmf_err("fail to set mpc\n");
  102. + bphy_err(wiphy, "fail to set mpc\n");
  103. return;
  104. }
  105. brcmf_dbg(INFO, "MPC : %d\n", mpc);
  106. @@ -677,6 +680,7 @@ s32 brcmf_notify_escan_complete(struct b
  107. struct brcmf_if *ifp, bool aborted,
  108. bool fw_abort)
  109. {
  110. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  111. struct brcmf_scan_params_le params_le;
  112. struct cfg80211_scan_request *scan_request;
  113. u64 reqid;
  114. @@ -711,7 +715,7 @@ s32 brcmf_notify_escan_complete(struct b
  115. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
  116. &params_le, sizeof(params_le));
  117. if (err)
  118. - brcmf_err("Scan abort failed\n");
  119. + bphy_err(wiphy, "Scan abort failed\n");
  120. }
  121. brcmf_scan_config_mpc(ifp, 1);
  122. @@ -763,7 +767,7 @@ static int brcmf_cfg80211_del_ap_iface(s
  123. err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  124. if (err) {
  125. - brcmf_err("interface_remove failed %d\n", err);
  126. + bphy_err(wiphy, "interface_remove failed %d\n", err);
  127. goto err_unarm;
  128. }
  129. @@ -771,7 +775,7 @@ static int brcmf_cfg80211_del_ap_iface(s
  130. ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  131. BRCMF_VIF_EVENT_TIMEOUT);
  132. if (!ret) {
  133. - brcmf_err("timeout occurred\n");
  134. + bphy_err(wiphy, "timeout occurred\n");
  135. err = -EIO;
  136. goto err_unarm;
  137. }
  138. @@ -873,14 +877,14 @@ brcmf_cfg80211_change_iface(struct wiphy
  139. }
  140. err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  141. if (err) {
  142. - brcmf_err("iface validation failed: err=%d\n", err);
  143. + bphy_err(wiphy, "iface validation failed: err=%d\n", err);
  144. return err;
  145. }
  146. switch (type) {
  147. case NL80211_IFTYPE_MONITOR:
  148. case NL80211_IFTYPE_WDS:
  149. - brcmf_err("type (%d) : currently we do not support this type\n",
  150. - type);
  151. + bphy_err(wiphy, "type (%d) : currently we do not support this type\n",
  152. + type);
  153. return -EOPNOTSUPP;
  154. case NL80211_IFTYPE_ADHOC:
  155. infra = 0;
  156. @@ -908,7 +912,7 @@ brcmf_cfg80211_change_iface(struct wiphy
  157. } else {
  158. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
  159. if (err) {
  160. - brcmf_err("WLC_SET_INFRA error (%d)\n", err);
  161. + bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err);
  162. err = -EAGAIN;
  163. goto done;
  164. }
  165. @@ -999,6 +1003,7 @@ static s32
  166. brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  167. struct cfg80211_scan_request *request)
  168. {
  169. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  170. s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
  171. offsetof(struct brcmf_escan_params_le, params_le);
  172. struct brcmf_escan_params_le *params;
  173. @@ -1030,7 +1035,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
  174. if (err == -EBUSY)
  175. brcmf_dbg(INFO, "system busy : escan canceled\n");
  176. else
  177. - brcmf_err("error (%d)\n", err);
  178. + bphy_err(wiphy, "error (%d)\n", err);
  179. }
  180. kfree(params);
  181. @@ -1076,21 +1081,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
  182. return -EIO;
  183. if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
  184. - brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status);
  185. + bphy_err(wiphy, "Scanning already: status (%lu)\n",
  186. + cfg->scan_status);
  187. return -EAGAIN;
  188. }
  189. if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
  190. - brcmf_err("Scanning being aborted: status (%lu)\n",
  191. - cfg->scan_status);
  192. + bphy_err(wiphy, "Scanning being aborted: status (%lu)\n",
  193. + cfg->scan_status);
  194. return -EAGAIN;
  195. }
  196. if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
  197. - brcmf_err("Scanning suppressed: status (%lu)\n",
  198. - cfg->scan_status);
  199. + bphy_err(wiphy, "Scanning suppressed: status (%lu)\n",
  200. + cfg->scan_status);
  201. return -EAGAIN;
  202. }
  203. if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
  204. - brcmf_err("Connecting: status (%lu)\n", vif->sme_state);
  205. + bphy_err(wiphy, "Connecting: status (%lu)\n", vif->sme_state);
  206. return -EAGAIN;
  207. }
  208. @@ -1124,7 +1130,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
  209. return 0;
  210. scan_out:
  211. - brcmf_err("scan error (%d)\n", err);
  212. + bphy_err(wiphy, "scan error (%d)\n", err);
  213. clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
  214. cfg->scan_request = NULL;
  215. return err;
  216. @@ -1132,36 +1138,41 @@ scan_out:
  217. static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
  218. {
  219. + struct brcmf_if *ifp = netdev_priv(ndev);
  220. + struct wiphy *wiphy = ifp->drvr->wiphy;
  221. s32 err = 0;
  222. - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh",
  223. - rts_threshold);
  224. + err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
  225. if (err)
  226. - brcmf_err("Error (%d)\n", err);
  227. + bphy_err(wiphy, "Error (%d)\n", err);
  228. return err;
  229. }
  230. static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
  231. {
  232. + struct brcmf_if *ifp = netdev_priv(ndev);
  233. + struct wiphy *wiphy = ifp->drvr->wiphy;
  234. s32 err = 0;
  235. - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh",
  236. + err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
  237. frag_threshold);
  238. if (err)
  239. - brcmf_err("Error (%d)\n", err);
  240. + bphy_err(wiphy, "Error (%d)\n", err);
  241. return err;
  242. }
  243. static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
  244. {
  245. + struct brcmf_if *ifp = netdev_priv(ndev);
  246. + struct wiphy *wiphy = ifp->drvr->wiphy;
  247. s32 err = 0;
  248. u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
  249. - err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry);
  250. + err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
  251. if (err) {
  252. - brcmf_err("cmd (%d) , error (%d)\n", cmd, err);
  253. + bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err);
  254. return err;
  255. }
  256. return err;
  257. @@ -1237,6 +1248,7 @@ static u16 brcmf_map_fw_linkdown_reason(
  258. static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
  259. {
  260. + struct wiphy *wiphy = ifp->drvr->wiphy;
  261. struct brcmf_wsec_pmk_le pmk;
  262. int i, err;
  263. @@ -1250,8 +1262,8 @@ static int brcmf_set_pmk(struct brcmf_if
  264. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
  265. &pmk, sizeof(pmk));
  266. if (err < 0)
  267. - brcmf_err("failed to change PSK in firmware (len=%u)\n",
  268. - pmk_len);
  269. + bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n",
  270. + pmk_len);
  271. return err;
  272. }
  273. @@ -1259,6 +1271,7 @@ static int brcmf_set_pmk(struct brcmf_if
  274. static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
  275. {
  276. struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
  277. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  278. s32 err = 0;
  279. brcmf_dbg(TRACE, "Enter\n");
  280. @@ -1268,7 +1281,7 @@ static void brcmf_link_down(struct brcmf
  281. err = brcmf_fil_cmd_data_set(vif->ifp,
  282. BRCMF_C_DISASSOC, NULL, 0);
  283. if (err) {
  284. - brcmf_err("WLC_DISASSOC failed (%d)\n", err);
  285. + bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err);
  286. }
  287. if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
  288. (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
  289. @@ -1356,7 +1369,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  290. err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
  291. if (err) {
  292. - brcmf_err("wsec failed (%d)\n", err);
  293. + bphy_err(wiphy, "wsec failed (%d)\n", err);
  294. goto done;
  295. }
  296. @@ -1368,7 +1381,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  297. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
  298. if (err) {
  299. - brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err);
  300. + bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err);
  301. goto done;
  302. }
  303. @@ -1413,7 +1426,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  304. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
  305. target_channel);
  306. if (err) {
  307. - brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err);
  308. + bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err);
  309. goto done;
  310. }
  311. } else
  312. @@ -1425,7 +1438,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  313. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  314. &join_params, join_params_size);
  315. if (err) {
  316. - brcmf_err("WLC_SET_SSID failed (%d)\n", err);
  317. + bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err);
  318. goto done;
  319. }
  320. @@ -1461,6 +1474,8 @@ brcmf_cfg80211_leave_ibss(struct wiphy *
  321. static s32 brcmf_set_wpa_version(struct net_device *ndev,
  322. struct cfg80211_connect_params *sme)
  323. {
  324. + struct brcmf_if *ifp = netdev_priv(ndev);
  325. + struct wiphy *wiphy = ifp->drvr->wiphy;
  326. struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  327. struct brcmf_cfg80211_security *sec;
  328. s32 val = 0;
  329. @@ -1473,9 +1488,9 @@ static s32 brcmf_set_wpa_version(struct
  330. else
  331. val = WPA_AUTH_DISABLED;
  332. brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
  333. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
  334. + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
  335. if (err) {
  336. - brcmf_err("set wpa_auth failed (%d)\n", err);
  337. + bphy_err(wiphy, "set wpa_auth failed (%d)\n", err);
  338. return err;
  339. }
  340. sec = &profile->sec;
  341. @@ -1486,6 +1501,8 @@ static s32 brcmf_set_wpa_version(struct
  342. static s32 brcmf_set_auth_type(struct net_device *ndev,
  343. struct cfg80211_connect_params *sme)
  344. {
  345. + struct brcmf_if *ifp = netdev_priv(ndev);
  346. + struct wiphy *wiphy = ifp->drvr->wiphy;
  347. struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  348. struct brcmf_cfg80211_security *sec;
  349. s32 val = 0;
  350. @@ -1506,9 +1523,9 @@ static s32 brcmf_set_auth_type(struct ne
  351. break;
  352. }
  353. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
  354. + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
  355. if (err) {
  356. - brcmf_err("set auth failed (%d)\n", err);
  357. + bphy_err(wiphy, "set auth failed (%d)\n", err);
  358. return err;
  359. }
  360. sec = &profile->sec;
  361. @@ -1520,6 +1537,8 @@ static s32
  362. brcmf_set_wsec_mode(struct net_device *ndev,
  363. struct cfg80211_connect_params *sme)
  364. {
  365. + struct brcmf_if *ifp = netdev_priv(ndev);
  366. + struct wiphy *wiphy = ifp->drvr->wiphy;
  367. struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  368. struct brcmf_cfg80211_security *sec;
  369. s32 pval = 0;
  370. @@ -1543,8 +1562,8 @@ brcmf_set_wsec_mode(struct net_device *n
  371. pval = AES_ENABLED;
  372. break;
  373. default:
  374. - brcmf_err("invalid cipher pairwise (%d)\n",
  375. - sme->crypto.ciphers_pairwise[0]);
  376. + bphy_err(wiphy, "invalid cipher pairwise (%d)\n",
  377. + sme->crypto.ciphers_pairwise[0]);
  378. return -EINVAL;
  379. }
  380. }
  381. @@ -1564,8 +1583,8 @@ brcmf_set_wsec_mode(struct net_device *n
  382. gval = AES_ENABLED;
  383. break;
  384. default:
  385. - brcmf_err("invalid cipher group (%d)\n",
  386. - sme->crypto.cipher_group);
  387. + bphy_err(wiphy, "invalid cipher group (%d)\n",
  388. + sme->crypto.cipher_group);
  389. return -EINVAL;
  390. }
  391. }
  392. @@ -1578,9 +1597,9 @@ brcmf_set_wsec_mode(struct net_device *n
  393. pval = AES_ENABLED;
  394. wsec = pval | gval;
  395. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec);
  396. + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
  397. if (err) {
  398. - brcmf_err("error (%d)\n", err);
  399. + bphy_err(wiphy, "error (%d)\n", err);
  400. return err;
  401. }
  402. @@ -1595,6 +1614,7 @@ static s32
  403. brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
  404. {
  405. struct brcmf_if *ifp = netdev_priv(ndev);
  406. + struct wiphy *wiphy = ifp->drvr->wiphy;
  407. struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  408. s32 val;
  409. s32 err;
  410. @@ -1613,7 +1633,7 @@ brcmf_set_key_mgmt(struct net_device *nd
  411. err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
  412. if (err) {
  413. - brcmf_err("could not get wpa_auth (%d)\n", err);
  414. + bphy_err(wiphy, "could not get wpa_auth (%d)\n", err);
  415. return err;
  416. }
  417. if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
  418. @@ -1627,8 +1647,8 @@ brcmf_set_key_mgmt(struct net_device *nd
  419. val = WPA_AUTH_PSK;
  420. break;
  421. default:
  422. - brcmf_err("invalid cipher group (%d)\n",
  423. - sme->crypto.cipher_group);
  424. + bphy_err(wiphy, "invalid cipher group (%d)\n",
  425. + sme->crypto.cipher_group);
  426. return -EINVAL;
  427. }
  428. } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
  429. @@ -1650,8 +1670,8 @@ brcmf_set_key_mgmt(struct net_device *nd
  430. val = WPA2_AUTH_PSK;
  431. break;
  432. default:
  433. - brcmf_err("invalid cipher group (%d)\n",
  434. - sme->crypto.cipher_group);
  435. + bphy_err(wiphy, "invalid cipher group (%d)\n",
  436. + sme->crypto.cipher_group);
  437. return -EINVAL;
  438. }
  439. }
  440. @@ -1697,7 +1717,7 @@ skip_mfp_config:
  441. brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
  442. err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
  443. if (err) {
  444. - brcmf_err("could not set wpa_auth (%d)\n", err);
  445. + bphy_err(wiphy, "could not set wpa_auth (%d)\n", err);
  446. return err;
  447. }
  448. @@ -1708,6 +1728,8 @@ static s32
  449. brcmf_set_sharedkey(struct net_device *ndev,
  450. struct cfg80211_connect_params *sme)
  451. {
  452. + struct brcmf_if *ifp = netdev_priv(ndev);
  453. + struct wiphy *wiphy = ifp->drvr->wiphy;
  454. struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
  455. struct brcmf_cfg80211_security *sec;
  456. struct brcmf_wsec_key key;
  457. @@ -1734,7 +1756,7 @@ brcmf_set_sharedkey(struct net_device *n
  458. key.len = (u32) sme->key_len;
  459. key.index = (u32) sme->key_idx;
  460. if (key.len > sizeof(key.data)) {
  461. - brcmf_err("Too long key length (%u)\n", key.len);
  462. + bphy_err(wiphy, "Too long key length (%u)\n", key.len);
  463. return -EINVAL;
  464. }
  465. memcpy(key.data, sme->key, key.len);
  466. @@ -1747,24 +1769,24 @@ brcmf_set_sharedkey(struct net_device *n
  467. key.algo = CRYPTO_ALGO_WEP128;
  468. break;
  469. default:
  470. - brcmf_err("Invalid algorithm (%d)\n",
  471. - sme->crypto.ciphers_pairwise[0]);
  472. + bphy_err(wiphy, "Invalid algorithm (%d)\n",
  473. + sme->crypto.ciphers_pairwise[0]);
  474. return -EINVAL;
  475. }
  476. /* Set the new key/index */
  477. brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n",
  478. key.len, key.index, key.algo);
  479. brcmf_dbg(CONN, "key \"%s\"\n", key.data);
  480. - err = send_key_to_dongle(netdev_priv(ndev), &key);
  481. + err = send_key_to_dongle(ifp, &key);
  482. if (err)
  483. return err;
  484. if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) {
  485. brcmf_dbg(CONN, "set auth_type to shared key\n");
  486. val = WL_AUTH_SHARED_KEY; /* shared key */
  487. - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val);
  488. + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
  489. if (err)
  490. - brcmf_err("set auth failed (%d)\n", err);
  491. + bphy_err(wiphy, "set auth failed (%d)\n", err);
  492. }
  493. return err;
  494. }
  495. @@ -1784,6 +1806,7 @@ enum nl80211_auth_type brcmf_war_auth_ty
  496. static void brcmf_set_join_pref(struct brcmf_if *ifp,
  497. struct cfg80211_bss_selection *bss_select)
  498. {
  499. + struct wiphy *wiphy = ifp->drvr->wiphy;
  500. struct brcmf_join_pref_params join_pref_params[2];
  501. enum nl80211_band band;
  502. int err, i = 0;
  503. @@ -1822,7 +1845,7 @@ static void brcmf_set_join_pref(struct b
  504. err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
  505. sizeof(join_pref_params));
  506. if (err)
  507. - brcmf_err("Set join_pref error (%d)\n", err);
  508. + bphy_err(wiphy, "Set join_pref error (%d)\n", err);
  509. }
  510. static s32
  511. @@ -1849,7 +1872,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  512. return -EIO;
  513. if (!sme->ssid) {
  514. - brcmf_err("Invalid ssid\n");
  515. + bphy_err(wiphy, "Invalid ssid\n");
  516. return -EOPNOTSUPP;
  517. }
  518. @@ -1878,7 +1901,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  519. err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
  520. sme->ie, sme->ie_len);
  521. if (err)
  522. - brcmf_err("Set Assoc REQ IE Failed\n");
  523. + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
  524. else
  525. brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
  526. @@ -1899,32 +1922,32 @@ brcmf_cfg80211_connect(struct wiphy *wip
  527. err = brcmf_set_wpa_version(ndev, sme);
  528. if (err) {
  529. - brcmf_err("wl_set_wpa_version failed (%d)\n", err);
  530. + bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err);
  531. goto done;
  532. }
  533. sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
  534. err = brcmf_set_auth_type(ndev, sme);
  535. if (err) {
  536. - brcmf_err("wl_set_auth_type failed (%d)\n", err);
  537. + bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err);
  538. goto done;
  539. }
  540. err = brcmf_set_wsec_mode(ndev, sme);
  541. if (err) {
  542. - brcmf_err("wl_set_set_cipher failed (%d)\n", err);
  543. + bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err);
  544. goto done;
  545. }
  546. err = brcmf_set_key_mgmt(ndev, sme);
  547. if (err) {
  548. - brcmf_err("wl_set_key_mgmt failed (%d)\n", err);
  549. + bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err);
  550. goto done;
  551. }
  552. err = brcmf_set_sharedkey(ndev, sme);
  553. if (err) {
  554. - brcmf_err("brcmf_set_sharedkey failed (%d)\n", err);
  555. + bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err);
  556. goto done;
  557. }
  558. @@ -1941,7 +1964,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  559. /* enable firmware supplicant for this interface */
  560. err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
  561. if (err < 0) {
  562. - brcmf_err("failed to enable fw supplicant\n");
  563. + bphy_err(wiphy, "failed to enable fw supplicant\n");
  564. goto done;
  565. }
  566. }
  567. @@ -2036,7 +2059,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  568. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  569. &join_params, join_params_size);
  570. if (err)
  571. - brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err);
  572. + bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err);
  573. done:
  574. if (err)
  575. @@ -2067,7 +2090,7 @@ brcmf_cfg80211_disconnect(struct wiphy *
  576. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
  577. &scbval, sizeof(scbval));
  578. if (err)
  579. - brcmf_err("error (%d)\n", err);
  580. + bphy_err(wiphy, "error (%d)\n", err);
  581. brcmf_dbg(TRACE, "Exit\n");
  582. return err;
  583. @@ -2094,7 +2117,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  584. case NL80211_TX_POWER_LIMITED:
  585. case NL80211_TX_POWER_FIXED:
  586. if (mbm < 0) {
  587. - brcmf_err("TX_POWER_FIXED - dbm is negative\n");
  588. + bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n");
  589. err = -EINVAL;
  590. goto done;
  591. }
  592. @@ -2104,7 +2127,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  593. qdbm |= WL_TXPWR_OVERRIDE;
  594. break;
  595. default:
  596. - brcmf_err("Unsupported type %d\n", type);
  597. + bphy_err(wiphy, "Unsupported type %d\n", type);
  598. err = -EINVAL;
  599. goto done;
  600. }
  601. @@ -2112,11 +2135,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  602. disable = WL_RADIO_SW_DISABLE << 16;
  603. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
  604. if (err)
  605. - brcmf_err("WLC_SET_RADIO error (%d)\n", err);
  606. + bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err);
  607. err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
  608. if (err)
  609. - brcmf_err("qtxpower error (%d)\n", err);
  610. + bphy_err(wiphy, "qtxpower error (%d)\n", err);
  611. done:
  612. brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
  613. @@ -2137,7 +2160,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy
  614. err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
  615. if (err) {
  616. - brcmf_err("error (%d)\n", err);
  617. + bphy_err(wiphy, "error (%d)\n", err);
  618. goto done;
  619. }
  620. *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
  621. @@ -2163,7 +2186,7 @@ brcmf_cfg80211_config_default_key(struct
  622. err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  623. if (err) {
  624. - brcmf_err("WLC_GET_WSEC error (%d)\n", err);
  625. + bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
  626. goto done;
  627. }
  628. @@ -2173,7 +2196,7 @@ brcmf_cfg80211_config_default_key(struct
  629. err = brcmf_fil_cmd_int_set(ifp,
  630. BRCMF_C_SET_KEY_PRIMARY, index);
  631. if (err)
  632. - brcmf_err("error (%d)\n", err);
  633. + bphy_err(wiphy, "error (%d)\n", err);
  634. }
  635. done:
  636. brcmf_dbg(TRACE, "Exit\n");
  637. @@ -2237,7 +2260,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  638. if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
  639. /* we ignore this key index in this case */
  640. - brcmf_err("invalid key index (%d)\n", key_idx);
  641. + bphy_err(wiphy, "invalid key index (%d)\n", key_idx);
  642. return -EINVAL;
  643. }
  644. @@ -2246,7 +2269,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  645. mac_addr);
  646. if (params->key_len > sizeof(key->data)) {
  647. - brcmf_err("Too long key length (%u)\n", params->key_len);
  648. + bphy_err(wiphy, "Too long key length (%u)\n", params->key_len);
  649. return -EINVAL;
  650. }
  651. @@ -2300,7 +2323,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  652. brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
  653. break;
  654. default:
  655. - brcmf_err("Invalid cipher (0x%x)\n", params->cipher);
  656. + bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher);
  657. err = -EINVAL;
  658. goto done;
  659. }
  660. @@ -2311,13 +2334,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip
  661. err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  662. if (err) {
  663. - brcmf_err("get wsec error (%d)\n", err);
  664. + bphy_err(wiphy, "get wsec error (%d)\n", err);
  665. goto done;
  666. }
  667. wsec |= val;
  668. err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
  669. if (err) {
  670. - brcmf_err("set wsec error (%d)\n", err);
  671. + bphy_err(wiphy, "set wsec error (%d)\n", err);
  672. goto done;
  673. }
  674. @@ -2348,7 +2371,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
  675. err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  676. if (err) {
  677. - brcmf_err("WLC_GET_WSEC error (%d)\n", err);
  678. + bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err);
  679. /* Ignore this error, may happen during DISASSOC */
  680. err = -EAGAIN;
  681. goto done;
  682. @@ -2369,7 +2392,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip
  683. params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
  684. brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
  685. } else {
  686. - brcmf_err("Invalid algo (0x%x)\n", wsec);
  687. + bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec);
  688. err = -EINVAL;
  689. goto done;
  690. }
  691. @@ -2399,6 +2422,7 @@ brcmf_cfg80211_config_default_mgmt_key(s
  692. static void
  693. brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
  694. {
  695. + struct wiphy *wiphy = ifp->drvr->wiphy;
  696. s32 err;
  697. u8 key_idx;
  698. struct brcmf_wsec_key *key;
  699. @@ -2415,18 +2439,18 @@ brcmf_cfg80211_reconfigure_wep(struct br
  700. err = send_key_to_dongle(ifp, key);
  701. if (err) {
  702. - brcmf_err("Setting WEP key failed (%d)\n", err);
  703. + bphy_err(wiphy, "Setting WEP key failed (%d)\n", err);
  704. return;
  705. }
  706. err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
  707. if (err) {
  708. - brcmf_err("get wsec error (%d)\n", err);
  709. + bphy_err(wiphy, "get wsec error (%d)\n", err);
  710. return;
  711. }
  712. wsec |= WEP_ENABLED;
  713. err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
  714. if (err)
  715. - brcmf_err("set wsec error (%d)\n", err);
  716. + bphy_err(wiphy, "set wsec error (%d)\n", err);
  717. }
  718. static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
  719. @@ -2452,6 +2476,7 @@ static void brcmf_convert_sta_flags(u32
  720. static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
  721. {
  722. + struct wiphy *wiphy = ifp->drvr->wiphy;
  723. struct {
  724. __le32 len;
  725. struct brcmf_bss_info_le bss_le;
  726. @@ -2467,7 +2492,7 @@ static void brcmf_fill_bss_param(struct
  727. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
  728. WL_BSS_INFO_MAX);
  729. if (err) {
  730. - brcmf_err("Failed to get bss info (%d)\n", err);
  731. + bphy_err(wiphy, "Failed to get bss info (%d)\n", err);
  732. goto out_kfree;
  733. }
  734. si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
  735. @@ -2489,6 +2514,7 @@ static s32
  736. brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
  737. struct station_info *sinfo)
  738. {
  739. + struct wiphy *wiphy = ifp->drvr->wiphy;
  740. struct brcmf_scb_val_le scbval;
  741. struct brcmf_pktcnt_le pktcnt;
  742. s32 err;
  743. @@ -2498,7 +2524,7 @@ brcmf_cfg80211_get_station_ibss(struct b
  744. /* Get the current tx rate */
  745. err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
  746. if (err < 0) {
  747. - brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err);
  748. + bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err);
  749. return err;
  750. }
  751. sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
  752. @@ -2508,7 +2534,7 @@ brcmf_cfg80211_get_station_ibss(struct b
  753. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
  754. sizeof(scbval));
  755. if (err) {
  756. - brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err);
  757. + bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err);
  758. return err;
  759. }
  760. rssi = le32_to_cpu(scbval.val);
  761. @@ -2518,7 +2544,7 @@ brcmf_cfg80211_get_station_ibss(struct b
  762. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
  763. sizeof(pktcnt));
  764. if (err) {
  765. - brcmf_err("BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
  766. + bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
  767. return err;
  768. }
  769. sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
  770. @@ -2566,7 +2592,7 @@ brcmf_cfg80211_get_station(struct wiphy
  771. &sta_info_le,
  772. sizeof(sta_info_le));
  773. if (err < 0) {
  774. - brcmf_err("GET STA INFO failed, %d\n", err);
  775. + bphy_err(wiphy, "GET STA INFO failed, %d\n", err);
  776. goto done;
  777. }
  778. }
  779. @@ -2635,7 +2661,8 @@ brcmf_cfg80211_get_station(struct wiphy
  780. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
  781. &scb_val, sizeof(scb_val));
  782. if (err) {
  783. - brcmf_err("Could not get rssi (%d)\n", err);
  784. + bphy_err(wiphy, "Could not get rssi (%d)\n",
  785. + err);
  786. goto done;
  787. } else {
  788. rssi = le32_to_cpu(scb_val.val);
  789. @@ -2666,8 +2693,8 @@ brcmf_cfg80211_dump_station(struct wiphy
  790. &cfg->assoclist,
  791. sizeof(cfg->assoclist));
  792. if (err) {
  793. - brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
  794. - err);
  795. + bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
  796. + err);
  797. cfg->assoclist.count = 0;
  798. return -EOPNOTSUPP;
  799. }
  800. @@ -2715,9 +2742,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  801. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
  802. if (err) {
  803. if (err == -ENODEV)
  804. - brcmf_err("net_device is not ready yet\n");
  805. + bphy_err(wiphy, "net_device is not ready yet\n");
  806. else
  807. - brcmf_err("error (%d)\n", err);
  808. + bphy_err(wiphy, "error (%d)\n", err);
  809. }
  810. done:
  811. brcmf_dbg(TRACE, "Exit\n");
  812. @@ -2740,7 +2767,7 @@ static s32 brcmf_inform_single_bss(struc
  813. struct cfg80211_inform_bss bss_data = {};
  814. if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
  815. - brcmf_err("Bss info is larger than buffer. Discarding\n");
  816. + bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n");
  817. return 0;
  818. }
  819. @@ -2799,6 +2826,7 @@ next_bss_le(struct brcmf_scan_results *l
  820. static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
  821. {
  822. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  823. struct brcmf_scan_results *bss_list;
  824. struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
  825. s32 err = 0;
  826. @@ -2807,8 +2835,8 @@ static s32 brcmf_inform_bss(struct brcmf
  827. bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
  828. if (bss_list->count != 0 &&
  829. bss_list->version != BRCMF_BSS_INFO_VERSION) {
  830. - brcmf_err("Version %d != WL_BSS_INFO_VERSION\n",
  831. - bss_list->version);
  832. + bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n",
  833. + bss_list->version);
  834. return -EOPNOTSUPP;
  835. }
  836. brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count);
  837. @@ -2852,7 +2880,7 @@ static s32 brcmf_inform_ibss(struct brcm
  838. err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
  839. buf, WL_BSS_INFO_MAX);
  840. if (err) {
  841. - brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err);
  842. + bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err);
  843. goto CleanUp;
  844. }
  845. @@ -2906,6 +2934,7 @@ CleanUp:
  846. static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
  847. struct brcmf_if *ifp)
  848. {
  849. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  850. struct brcmf_bss_info_le *bi;
  851. const struct brcmf_tlv *tim;
  852. u16 beacon_interval;
  853. @@ -2922,7 +2951,7 @@ static s32 brcmf_update_bss_info(struct
  854. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
  855. cfg->extra_buf, WL_EXTRA_BUF_MAX);
  856. if (err) {
  857. - brcmf_err("Could not get bss info %d\n", err);
  858. + bphy_err(wiphy, "Could not get bss info %d\n", err);
  859. goto update_bss_info_out;
  860. }
  861. @@ -2947,7 +2976,7 @@ static s32 brcmf_update_bss_info(struct
  862. u32 var;
  863. err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
  864. if (err) {
  865. - brcmf_err("wl dtim_assoc failed (%d)\n", err);
  866. + bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err);
  867. goto update_bss_info_out;
  868. }
  869. dtim_period = (u8)var;
  870. @@ -2985,9 +3014,10 @@ static void brcmf_escan_timeout(struct t
  871. {
  872. struct brcmf_cfg80211_info *cfg =
  873. from_timer(cfg, t, escan_timeout);
  874. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  875. if (cfg->int_escan_map || cfg->scan_request) {
  876. - brcmf_err("timer expired\n");
  877. + bphy_err(wiphy, "timer expired\n");
  878. schedule_work(&cfg->escan_timeout_work);
  879. }
  880. }
  881. @@ -3036,6 +3066,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  882. const struct brcmf_event_msg *e, void *data)
  883. {
  884. struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
  885. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  886. s32 status;
  887. struct brcmf_escan_result_le *escan_result_le;
  888. u32 escan_buflen;
  889. @@ -3052,32 +3083,33 @@ brcmf_cfg80211_escan_handler(struct brcm
  890. goto exit;
  891. if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
  892. - brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
  893. + bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n",
  894. + ifp->bsscfgidx);
  895. return -EPERM;
  896. }
  897. if (status == BRCMF_E_STATUS_PARTIAL) {
  898. brcmf_dbg(SCAN, "ESCAN Partial result\n");
  899. if (e->datalen < sizeof(*escan_result_le)) {
  900. - brcmf_err("invalid event data length\n");
  901. + bphy_err(wiphy, "invalid event data length\n");
  902. goto exit;
  903. }
  904. escan_result_le = (struct brcmf_escan_result_le *) data;
  905. if (!escan_result_le) {
  906. - brcmf_err("Invalid escan result (NULL pointer)\n");
  907. + bphy_err(wiphy, "Invalid escan result (NULL pointer)\n");
  908. goto exit;
  909. }
  910. escan_buflen = le32_to_cpu(escan_result_le->buflen);
  911. if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
  912. escan_buflen > e->datalen ||
  913. escan_buflen < sizeof(*escan_result_le)) {
  914. - brcmf_err("Invalid escan buffer length: %d\n",
  915. - escan_buflen);
  916. + bphy_err(wiphy, "Invalid escan buffer length: %d\n",
  917. + escan_buflen);
  918. goto exit;
  919. }
  920. if (le16_to_cpu(escan_result_le->bss_count) != 1) {
  921. - brcmf_err("Invalid bss_count %d: ignoring\n",
  922. - escan_result_le->bss_count);
  923. + bphy_err(wiphy, "Invalid bss_count %d: ignoring\n",
  924. + escan_result_le->bss_count);
  925. goto exit;
  926. }
  927. bss_info_le = &escan_result_le->bss_info_le;
  928. @@ -3092,8 +3124,8 @@ brcmf_cfg80211_escan_handler(struct brcm
  929. bi_length = le32_to_cpu(bss_info_le->length);
  930. if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
  931. - brcmf_err("Ignoring invalid bss_info length: %d\n",
  932. - bi_length);
  933. + bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n",
  934. + bi_length);
  935. goto exit;
  936. }
  937. @@ -3101,7 +3133,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  938. BIT(NL80211_IFTYPE_ADHOC))) {
  939. if (le16_to_cpu(bss_info_le->capability) &
  940. WLAN_CAPABILITY_IBSS) {
  941. - brcmf_err("Ignoring IBSS result\n");
  942. + bphy_err(wiphy, "Ignoring IBSS result\n");
  943. goto exit;
  944. }
  945. }
  946. @@ -3109,7 +3141,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  947. list = (struct brcmf_scan_results *)
  948. cfg->escan_info.escan_buf;
  949. if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
  950. - brcmf_err("Buffer is too small: ignoring\n");
  951. + bphy_err(wiphy, "Buffer is too small: ignoring\n");
  952. goto exit;
  953. }
  954. @@ -3301,14 +3333,14 @@ brcmf_notify_sched_scan_results(struct b
  955. WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
  956. brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
  957. if (!result_count) {
  958. - brcmf_err("FALSE PNO Event. (pfn_count == 0)\n");
  959. + bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n");
  960. goto out_err;
  961. }
  962. netinfo_start = brcmf_get_netinfo_array(pfn_result);
  963. datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
  964. if (datalen < result_count * sizeof(*netinfo)) {
  965. - brcmf_err("insufficient event data\n");
  966. + bphy_err(wiphy, "insufficient event data\n");
  967. goto out_err;
  968. }
  969. @@ -3362,8 +3394,8 @@ brcmf_cfg80211_sched_scan_start(struct w
  970. req->n_match_sets, req->n_ssids);
  971. if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
  972. - brcmf_err("Scanning suppressed: status=%lu\n",
  973. - cfg->scan_status);
  974. + bphy_err(wiphy, "Scanning suppressed: status=%lu\n",
  975. + cfg->scan_status);
  976. return -EAGAIN;
  977. }
  978. @@ -3442,6 +3474,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i
  979. void *data)
  980. {
  981. struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
  982. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  983. struct brcmf_pno_scanresults_le *pfn_result;
  984. struct brcmf_pno_net_info_le *netinfo;
  985. @@ -3460,8 +3493,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i
  986. }
  987. if (le32_to_cpu(pfn_result->count) < 1) {
  988. - brcmf_err("Invalid result count, expected 1 (%d)\n",
  989. - le32_to_cpu(pfn_result->count));
  990. + bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n",
  991. + le32_to_cpu(pfn_result->count));
  992. return -EINVAL;
  993. }
  994. @@ -3498,7 +3531,7 @@ static void brcmf_report_wowl_wakeind(st
  995. err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
  996. sizeof(wake_ind_le));
  997. if (err) {
  998. - brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
  999. + bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err);
  1000. return;
  1001. }
  1002. @@ -3539,7 +3572,7 @@ static void brcmf_report_wowl_wakeind(st
  1003. cfg->wowl.nd_data_completed,
  1004. BRCMF_ND_INFO_TIMEOUT);
  1005. if (!timeout)
  1006. - brcmf_err("No result for wowl net detect\n");
  1007. + bphy_err(wiphy, "No result for wowl net detect\n");
  1008. else
  1009. wakeup_data.net_detect = cfg->wowl.nd_info;
  1010. }
  1011. @@ -3747,7 +3780,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w
  1012. cfg->pmk_list.npmk = cpu_to_le32(npmk);
  1013. }
  1014. } else {
  1015. - brcmf_err("Too many PMKSA entries cached %d\n", npmk);
  1016. + bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk);
  1017. return -EINVAL;
  1018. }
  1019. @@ -3793,7 +3826,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w
  1020. memset(&pmk[i], 0, sizeof(*pmk));
  1021. cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
  1022. } else {
  1023. - brcmf_err("Cache entry not found\n");
  1024. + bphy_err(wiphy, "Cache entry not found\n");
  1025. return -EINVAL;
  1026. }
  1027. @@ -3825,19 +3858,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy
  1028. static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
  1029. {
  1030. + struct wiphy *wiphy = ifp->drvr->wiphy;
  1031. s32 err;
  1032. s32 wpa_val;
  1033. /* set auth */
  1034. err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
  1035. if (err < 0) {
  1036. - brcmf_err("auth error %d\n", err);
  1037. + bphy_err(wiphy, "auth error %d\n", err);
  1038. return err;
  1039. }
  1040. /* set wsec */
  1041. err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
  1042. if (err < 0) {
  1043. - brcmf_err("wsec error %d\n", err);
  1044. + bphy_err(wiphy, "wsec error %d\n", err);
  1045. return err;
  1046. }
  1047. /* set upper-layer auth */
  1048. @@ -3847,7 +3881,7 @@ static s32 brcmf_configure_opensecurity(
  1049. wpa_val = WPA_AUTH_DISABLED;
  1050. err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val);
  1051. if (err < 0) {
  1052. - brcmf_err("wpa_auth error %d\n", err);
  1053. + bphy_err(wiphy, "wpa_auth error %d\n", err);
  1054. return err;
  1055. }
  1056. @@ -3867,6 +3901,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1057. const struct brcmf_vs_tlv *wpa_ie,
  1058. bool is_rsn_ie)
  1059. {
  1060. + struct wiphy *wiphy = ifp->drvr->wiphy;
  1061. u32 auth = 0; /* d11 open authentication */
  1062. u16 count;
  1063. s32 err = 0;
  1064. @@ -3897,13 +3932,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1065. /* check for multicast cipher suite */
  1066. if (offset + WPA_IE_MIN_OUI_LEN > len) {
  1067. err = -EINVAL;
  1068. - brcmf_err("no multicast cipher suite\n");
  1069. + bphy_err(wiphy, "no multicast cipher suite\n");
  1070. goto exit;
  1071. }
  1072. if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
  1073. err = -EINVAL;
  1074. - brcmf_err("ivalid OUI\n");
  1075. + bphy_err(wiphy, "ivalid OUI\n");
  1076. goto exit;
  1077. }
  1078. offset += TLV_OUI_LEN;
  1079. @@ -3925,7 +3960,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1080. break;
  1081. default:
  1082. err = -EINVAL;
  1083. - brcmf_err("Invalid multi cast cipher info\n");
  1084. + bphy_err(wiphy, "Invalid multi cast cipher info\n");
  1085. goto exit;
  1086. }
  1087. @@ -3936,13 +3971,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1088. /* Check for unicast suite(s) */
  1089. if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
  1090. err = -EINVAL;
  1091. - brcmf_err("no unicast cipher suite\n");
  1092. + bphy_err(wiphy, "no unicast cipher suite\n");
  1093. goto exit;
  1094. }
  1095. for (i = 0; i < count; i++) {
  1096. if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
  1097. err = -EINVAL;
  1098. - brcmf_err("ivalid OUI\n");
  1099. + bphy_err(wiphy, "ivalid OUI\n");
  1100. goto exit;
  1101. }
  1102. offset += TLV_OUI_LEN;
  1103. @@ -3960,7 +3995,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1104. pval |= AES_ENABLED;
  1105. break;
  1106. default:
  1107. - brcmf_err("Invalid unicast security info\n");
  1108. + bphy_err(wiphy, "Invalid unicast security info\n");
  1109. }
  1110. offset++;
  1111. }
  1112. @@ -3970,13 +4005,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1113. /* Check for auth key management suite(s) */
  1114. if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
  1115. err = -EINVAL;
  1116. - brcmf_err("no auth key mgmt suite\n");
  1117. + bphy_err(wiphy, "no auth key mgmt suite\n");
  1118. goto exit;
  1119. }
  1120. for (i = 0; i < count; i++) {
  1121. if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
  1122. err = -EINVAL;
  1123. - brcmf_err("ivalid OUI\n");
  1124. + bphy_err(wiphy, "ivalid OUI\n");
  1125. goto exit;
  1126. }
  1127. offset += TLV_OUI_LEN;
  1128. @@ -4004,7 +4039,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1129. wpa_auth |= WPA2_AUTH_1X_SHA256;
  1130. break;
  1131. default:
  1132. - brcmf_err("Invalid key mgmt info\n");
  1133. + bphy_err(wiphy, "Invalid key mgmt info\n");
  1134. }
  1135. offset++;
  1136. }
  1137. @@ -4046,7 +4081,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1138. err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
  1139. wme_bss_disable);
  1140. if (err < 0) {
  1141. - brcmf_err("wme_bss_disable error %d\n", err);
  1142. + bphy_err(wiphy, "wme_bss_disable error %d\n", err);
  1143. goto exit;
  1144. }
  1145. @@ -4060,7 +4095,7 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1146. &data[offset],
  1147. WPA_IE_MIN_OUI_LEN);
  1148. if (err < 0) {
  1149. - brcmf_err("bip error %d\n", err);
  1150. + bphy_err(wiphy, "bip error %d\n", err);
  1151. goto exit;
  1152. }
  1153. }
  1154. @@ -4071,13 +4106,13 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1155. /* set auth */
  1156. err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
  1157. if (err < 0) {
  1158. - brcmf_err("auth error %d\n", err);
  1159. + bphy_err(wiphy, "auth error %d\n", err);
  1160. goto exit;
  1161. }
  1162. /* set wsec */
  1163. err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
  1164. if (err < 0) {
  1165. - brcmf_err("wsec error %d\n", err);
  1166. + bphy_err(wiphy, "wsec error %d\n", err);
  1167. goto exit;
  1168. }
  1169. /* Configure MFP, this needs to go after wsec otherwise the wsec command
  1170. @@ -4086,14 +4121,14 @@ brcmf_configure_wpaie(struct brcmf_if *i
  1171. if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
  1172. err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
  1173. if (err < 0) {
  1174. - brcmf_err("mfp error %d\n", err);
  1175. + bphy_err(wiphy, "mfp error %d\n", err);
  1176. goto exit;
  1177. }
  1178. }
  1179. /* set upper-layer auth */
  1180. err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
  1181. if (err < 0) {
  1182. - brcmf_err("wpa_auth error %d\n", err);
  1183. + bphy_err(wiphy, "wpa_auth error %d\n", err);
  1184. goto exit;
  1185. }
  1186. @@ -4180,6 +4215,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1187. const u8 *vndr_ie_buf, u32 vndr_ie_len)
  1188. {
  1189. struct brcmf_if *ifp;
  1190. + struct wiphy *wiphy;
  1191. struct vif_saved_ie *saved_ie;
  1192. s32 err = 0;
  1193. u8 *iovar_ie_buf;
  1194. @@ -4200,6 +4236,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1195. if (!vif)
  1196. return -ENODEV;
  1197. ifp = vif->ifp;
  1198. + wiphy = ifp->drvr->wiphy;
  1199. saved_ie = &vif->saved_ie;
  1200. brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
  1201. @@ -4231,13 +4268,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1202. break;
  1203. default:
  1204. err = -EPERM;
  1205. - brcmf_err("not suitable type\n");
  1206. + bphy_err(wiphy, "not suitable type\n");
  1207. goto exit;
  1208. }
  1209. if (vndr_ie_len > mgmt_ie_buf_len) {
  1210. err = -ENOMEM;
  1211. - brcmf_err("extra IE size too big\n");
  1212. + bphy_err(wiphy, "extra IE size too big\n");
  1213. goto exit;
  1214. }
  1215. @@ -4298,8 +4335,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1216. /* verify remained buf size before copy data */
  1217. if (remained_buf_len < (vndrie_info->vndrie.len +
  1218. VNDR_IE_VSIE_OFFSET)) {
  1219. - brcmf_err("no space in mgmt_ie_buf: len left %d",
  1220. - remained_buf_len);
  1221. + bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d",
  1222. + remained_buf_len);
  1223. break;
  1224. }
  1225. remained_buf_len -= (vndrie_info->ie_len +
  1226. @@ -4330,7 +4367,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  1227. err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
  1228. total_ie_buf_len);
  1229. if (err)
  1230. - brcmf_err("vndr ie set error : %d\n", err);
  1231. + bphy_err(wiphy, "vndr ie set error : %d\n", err);
  1232. }
  1233. exit:
  1234. @@ -4358,13 +4395,14 @@ static s32
  1235. brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
  1236. struct cfg80211_beacon_data *beacon)
  1237. {
  1238. + struct wiphy *wiphy = vif->ifp->drvr->wiphy;
  1239. s32 err;
  1240. /* Set Beacon IEs to FW */
  1241. err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
  1242. beacon->tail, beacon->tail_len);
  1243. if (err) {
  1244. - brcmf_err("Set Beacon IE Failed\n");
  1245. + bphy_err(wiphy, "Set Beacon IE Failed\n");
  1246. return err;
  1247. }
  1248. brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
  1249. @@ -4374,7 +4412,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg
  1250. beacon->proberesp_ies,
  1251. beacon->proberesp_ies_len);
  1252. if (err)
  1253. - brcmf_err("Set Probe Resp IE Failed\n");
  1254. + bphy_err(wiphy, "Set Probe Resp IE Failed\n");
  1255. else
  1256. brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
  1257. @@ -4483,7 +4521,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1258. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  1259. is_11d);
  1260. if (err < 0) {
  1261. - brcmf_err("Regulatory Set Error, %d\n", err);
  1262. + bphy_err(wiphy, "Regulatory Set Error, %d\n",
  1263. + err);
  1264. goto exit;
  1265. }
  1266. }
  1267. @@ -4491,8 +4530,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1268. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
  1269. settings->beacon_interval);
  1270. if (err < 0) {
  1271. - brcmf_err("Beacon Interval Set Error, %d\n",
  1272. - err);
  1273. + bphy_err(wiphy, "Beacon Interval Set Error, %d\n",
  1274. + err);
  1275. goto exit;
  1276. }
  1277. }
  1278. @@ -4500,7 +4539,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1279. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
  1280. settings->dtim_period);
  1281. if (err < 0) {
  1282. - brcmf_err("DTIM Interval Set Error, %d\n", err);
  1283. + bphy_err(wiphy, "DTIM Interval Set Error, %d\n",
  1284. + err);
  1285. goto exit;
  1286. }
  1287. }
  1288. @@ -4510,7 +4550,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1289. !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
  1290. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
  1291. if (err < 0) {
  1292. - brcmf_err("BRCMF_C_DOWN error %d\n", err);
  1293. + bphy_err(wiphy, "BRCMF_C_DOWN error %d\n",
  1294. + err);
  1295. goto exit;
  1296. }
  1297. brcmf_fil_iovar_int_set(ifp, "apsta", 0);
  1298. @@ -4518,7 +4559,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1299. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
  1300. if (err < 0) {
  1301. - brcmf_err("SET INFRA error %d\n", err);
  1302. + bphy_err(wiphy, "SET INFRA error %d\n", err);
  1303. goto exit;
  1304. }
  1305. } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
  1306. @@ -4534,7 +4575,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1307. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
  1308. if (err < 0) {
  1309. - brcmf_err("setting AP mode failed %d\n", err);
  1310. + bphy_err(wiphy, "setting AP mode failed %d\n",
  1311. + err);
  1312. goto exit;
  1313. }
  1314. if (!mbss) {
  1315. @@ -4543,14 +4585,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1316. */
  1317. err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  1318. if (err < 0) {
  1319. - brcmf_err("Set Channel failed: chspec=%d, %d\n",
  1320. - chanspec, err);
  1321. + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
  1322. + chanspec, err);
  1323. goto exit;
  1324. }
  1325. }
  1326. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  1327. if (err < 0) {
  1328. - brcmf_err("BRCMF_C_UP error (%d)\n", err);
  1329. + bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err);
  1330. goto exit;
  1331. }
  1332. /* On DOWN the firmware removes the WEP keys, reconfigure
  1333. @@ -4565,14 +4607,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1334. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  1335. &join_params, sizeof(join_params));
  1336. if (err < 0) {
  1337. - brcmf_err("SET SSID error (%d)\n", err);
  1338. + bphy_err(wiphy, "SET SSID error (%d)\n", err);
  1339. goto exit;
  1340. }
  1341. if (settings->hidden_ssid) {
  1342. err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
  1343. if (err) {
  1344. - brcmf_err("closednet error (%d)\n", err);
  1345. + bphy_err(wiphy, "closednet error (%d)\n", err);
  1346. goto exit;
  1347. }
  1348. }
  1349. @@ -4581,14 +4623,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1350. } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
  1351. err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
  1352. if (err < 0) {
  1353. - brcmf_err("Set Channel failed: chspec=%d, %d\n",
  1354. - chanspec, err);
  1355. + bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n",
  1356. + chanspec, err);
  1357. goto exit;
  1358. }
  1359. err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
  1360. sizeof(ssid_le));
  1361. if (err < 0) {
  1362. - brcmf_err("setting ssid failed %d\n", err);
  1363. + bphy_err(wiphy, "setting ssid failed %d\n", err);
  1364. goto exit;
  1365. }
  1366. bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
  1367. @@ -4596,7 +4638,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  1368. err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  1369. sizeof(bss_enable));
  1370. if (err < 0) {
  1371. - brcmf_err("bss_enable config failed %d\n", err);
  1372. + bphy_err(wiphy, "bss_enable config failed %d\n", err);
  1373. goto exit;
  1374. }
  1375. @@ -4644,13 +4686,13 @@ static int brcmf_cfg80211_stop_ap(struct
  1376. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
  1377. &join_params, sizeof(join_params));
  1378. if (err < 0)
  1379. - brcmf_err("SET SSID error (%d)\n", err);
  1380. + bphy_err(wiphy, "SET SSID error (%d)\n", err);
  1381. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
  1382. if (err < 0)
  1383. - brcmf_err("BRCMF_C_DOWN error %d\n", err);
  1384. + bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err);
  1385. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
  1386. if (err < 0)
  1387. - brcmf_err("setting AP mode failed %d\n", err);
  1388. + bphy_err(wiphy, "setting AP mode failed %d\n", err);
  1389. if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
  1390. brcmf_fil_iovar_int_set(ifp, "mbss", 0);
  1391. brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
  1392. @@ -4658,7 +4700,7 @@ static int brcmf_cfg80211_stop_ap(struct
  1393. /* Bring device back up so it can be used again */
  1394. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
  1395. if (err < 0)
  1396. - brcmf_err("BRCMF_C_UP error %d\n", err);
  1397. + bphy_err(wiphy, "BRCMF_C_UP error %d\n", err);
  1398. brcmf_vif_clear_mgmt_ies(ifp->vif);
  1399. } else {
  1400. @@ -4667,7 +4709,7 @@ static int brcmf_cfg80211_stop_ap(struct
  1401. err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  1402. sizeof(bss_enable));
  1403. if (err < 0)
  1404. - brcmf_err("bss_enable config failed %d\n", err);
  1405. + bphy_err(wiphy, "bss_enable config failed %d\n", err);
  1406. }
  1407. brcmf_set_mpc(ifp, 1);
  1408. brcmf_configure_arp_nd_offload(ifp, true);
  1409. @@ -4715,7 +4757,8 @@ brcmf_cfg80211_del_station(struct wiphy
  1410. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
  1411. &scbval, sizeof(scbval));
  1412. if (err)
  1413. - brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err);
  1414. + bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
  1415. + err);
  1416. brcmf_dbg(TRACE, "Exit\n");
  1417. return err;
  1418. @@ -4745,7 +4788,7 @@ brcmf_cfg80211_change_station(struct wip
  1419. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
  1420. (void *)mac, ETH_ALEN);
  1421. if (err < 0)
  1422. - brcmf_err("Setting SCB (de-)authorize failed, %d\n", err);
  1423. + bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err);
  1424. return err;
  1425. }
  1426. @@ -4795,7 +4838,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
  1427. mgmt = (const struct ieee80211_mgmt *)buf;
  1428. if (!ieee80211_is_mgmt(mgmt->frame_control)) {
  1429. - brcmf_err("Driver only allows MGMT packet type\n");
  1430. + bphy_err(wiphy, "Driver only allows MGMT packet type\n");
  1431. return -EPERM;
  1432. }
  1433. @@ -4826,13 +4869,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip
  1434. GFP_KERNEL);
  1435. } else if (ieee80211_is_action(mgmt->frame_control)) {
  1436. if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
  1437. - brcmf_err("invalid action frame length\n");
  1438. + bphy_err(wiphy, "invalid action frame length\n");
  1439. err = -EINVAL;
  1440. goto exit;
  1441. }
  1442. af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
  1443. if (af_params == NULL) {
  1444. - brcmf_err("unable to allocate frame\n");
  1445. + bphy_err(wiphy, "unable to allocate frame\n");
  1446. err = -ENOMEM;
  1447. goto exit;
  1448. }
  1449. @@ -4890,7 +4933,7 @@ brcmf_cfg80211_cancel_remain_on_channel(
  1450. vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  1451. if (vif == NULL) {
  1452. - brcmf_err("No p2p device available for probe response\n");
  1453. + bphy_err(wiphy, "No p2p device available for probe response\n");
  1454. err = -ENODEV;
  1455. goto exit;
  1456. }
  1457. @@ -4918,7 +4961,7 @@ static int brcmf_cfg80211_get_channel(st
  1458. err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
  1459. if (err) {
  1460. - brcmf_err("chanspec failed (%d)\n", err);
  1461. + bphy_err(wiphy, "chanspec failed (%d)\n", err);
  1462. return err;
  1463. }
  1464. @@ -5057,7 +5100,7 @@ static int brcmf_cfg80211_tdls_oper(stru
  1465. ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
  1466. &info, sizeof(info));
  1467. if (ret < 0)
  1468. - brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret);
  1469. + bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret);
  1470. return ret;
  1471. }
  1472. @@ -5078,7 +5121,7 @@ brcmf_cfg80211_update_conn_params(struct
  1473. err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
  1474. sme->ie, sme->ie_len);
  1475. if (err)
  1476. - brcmf_err("Set Assoc REQ IE Failed\n");
  1477. + bphy_err(wiphy, "Set Assoc REQ IE Failed\n");
  1478. else
  1479. brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
  1480. @@ -5104,7 +5147,7 @@ brcmf_cfg80211_set_rekey_data(struct wip
  1481. ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
  1482. sizeof(gtk_le));
  1483. if (ret < 0)
  1484. - brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret);
  1485. + bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret);
  1486. return ret;
  1487. }
  1488. @@ -5336,6 +5379,7 @@ static void brcmf_clear_assoc_ies(struct
  1489. static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
  1490. struct brcmf_if *ifp)
  1491. {
  1492. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1493. struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
  1494. struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
  1495. u32 req_len;
  1496. @@ -5347,7 +5391,7 @@ static s32 brcmf_get_assoc_ies(struct br
  1497. err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
  1498. cfg->extra_buf, WL_ASSOC_INFO_MAX);
  1499. if (err) {
  1500. - brcmf_err("could not get assoc info (%d)\n", err);
  1501. + bphy_err(wiphy, "could not get assoc info (%d)\n", err);
  1502. return err;
  1503. }
  1504. assoc_info =
  1505. @@ -5359,7 +5403,7 @@ static s32 brcmf_get_assoc_ies(struct br
  1506. cfg->extra_buf,
  1507. WL_ASSOC_INFO_MAX);
  1508. if (err) {
  1509. - brcmf_err("could not get assoc req (%d)\n", err);
  1510. + bphy_err(wiphy, "could not get assoc req (%d)\n", err);
  1511. return err;
  1512. }
  1513. conn_info->req_ie_len = req_len;
  1514. @@ -5375,7 +5419,7 @@ static s32 brcmf_get_assoc_ies(struct br
  1515. cfg->extra_buf,
  1516. WL_ASSOC_INFO_MAX);
  1517. if (err) {
  1518. - brcmf_err("could not get assoc resp (%d)\n", err);
  1519. + bphy_err(wiphy, "could not get assoc resp (%d)\n", err);
  1520. return err;
  1521. }
  1522. conn_info->resp_ie_len = resp_len;
  1523. @@ -5502,6 +5546,7 @@ brcmf_notify_connect_status_ap(struct br
  1524. struct net_device *ndev,
  1525. const struct brcmf_event_msg *e, void *data)
  1526. {
  1527. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1528. static int generation;
  1529. u32 event = e->event_code;
  1530. u32 reason = e->reason;
  1531. @@ -5519,7 +5564,7 @@ brcmf_notify_connect_status_ap(struct br
  1532. if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) &&
  1533. (reason == BRCMF_E_STATUS_SUCCESS)) {
  1534. if (!data) {
  1535. - brcmf_err("No IEs present in ASSOC/REASSOC_IND");
  1536. + bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n");
  1537. return -EINVAL;
  1538. }
  1539. @@ -5811,6 +5856,7 @@ static void init_vif_event(struct brcmf_
  1540. static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
  1541. {
  1542. + struct wiphy *wiphy = ifp->drvr->wiphy;
  1543. s32 err;
  1544. u32 bcn_timeout;
  1545. __le32 roamtrigger[2];
  1546. @@ -5823,7 +5869,7 @@ static s32 brcmf_dongle_roam(struct brcm
  1547. bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
  1548. err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
  1549. if (err) {
  1550. - brcmf_err("bcn_timeout error (%d)\n", err);
  1551. + bphy_err(wiphy, "bcn_timeout error (%d)\n", err);
  1552. goto roam_setup_done;
  1553. }
  1554. @@ -5835,7 +5881,7 @@ static s32 brcmf_dongle_roam(struct brcm
  1555. err = brcmf_fil_iovar_int_set(ifp, "roam_off",
  1556. ifp->drvr->settings->roamoff);
  1557. if (err) {
  1558. - brcmf_err("roam_off error (%d)\n", err);
  1559. + bphy_err(wiphy, "roam_off error (%d)\n", err);
  1560. goto roam_setup_done;
  1561. }
  1562. @@ -5844,7 +5890,7 @@ static s32 brcmf_dongle_roam(struct brcm
  1563. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
  1564. (void *)roamtrigger, sizeof(roamtrigger));
  1565. if (err) {
  1566. - brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
  1567. + bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
  1568. goto roam_setup_done;
  1569. }
  1570. @@ -5853,7 +5899,7 @@ static s32 brcmf_dongle_roam(struct brcm
  1571. err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
  1572. (void *)roam_delta, sizeof(roam_delta));
  1573. if (err) {
  1574. - brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
  1575. + bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err);
  1576. goto roam_setup_done;
  1577. }
  1578. @@ -5864,25 +5910,26 @@ roam_setup_done:
  1579. static s32
  1580. brcmf_dongle_scantime(struct brcmf_if *ifp)
  1581. {
  1582. + struct wiphy *wiphy = ifp->drvr->wiphy;
  1583. s32 err = 0;
  1584. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
  1585. BRCMF_SCAN_CHANNEL_TIME);
  1586. if (err) {
  1587. - brcmf_err("Scan assoc time error (%d)\n", err);
  1588. + bphy_err(wiphy, "Scan assoc time error (%d)\n", err);
  1589. goto dongle_scantime_out;
  1590. }
  1591. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
  1592. BRCMF_SCAN_UNASSOC_TIME);
  1593. if (err) {
  1594. - brcmf_err("Scan unassoc time error (%d)\n", err);
  1595. + bphy_err(wiphy, "Scan unassoc time error (%d)\n", err);
  1596. goto dongle_scantime_out;
  1597. }
  1598. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
  1599. BRCMF_SCAN_PASSIVE_TIME);
  1600. if (err) {
  1601. - brcmf_err("Scan passive time error (%d)\n", err);
  1602. + bphy_err(wiphy, "Scan passive time error (%d)\n", err);
  1603. goto dongle_scantime_out;
  1604. }
  1605. @@ -5914,10 +5961,10 @@ static void brcmf_update_bw40_channel_fl
  1606. static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
  1607. u32 bw_cap[])
  1608. {
  1609. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1610. struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  1611. struct ieee80211_supported_band *band;
  1612. struct ieee80211_channel *channel;
  1613. - struct wiphy *wiphy;
  1614. struct brcmf_chanspec_list *list;
  1615. struct brcmu_chan ch;
  1616. int err;
  1617. @@ -5936,11 +5983,10 @@ static int brcmf_construct_chaninfo(stru
  1618. err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
  1619. BRCMF_DCMD_MEDLEN);
  1620. if (err) {
  1621. - brcmf_err("get chanspecs error (%d)\n", err);
  1622. + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
  1623. goto fail_pbuf;
  1624. }
  1625. - wiphy = cfg_to_wiphy(cfg);
  1626. band = wiphy->bands[NL80211_BAND_2GHZ];
  1627. if (band)
  1628. for (i = 0; i < band->n_channels; i++)
  1629. @@ -5960,7 +6006,8 @@ static int brcmf_construct_chaninfo(stru
  1630. } else if (ch.band == BRCMU_CHAN_BAND_5G) {
  1631. band = wiphy->bands[NL80211_BAND_5GHZ];
  1632. } else {
  1633. - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
  1634. + bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n",
  1635. + ch.chspec);
  1636. continue;
  1637. }
  1638. if (!band)
  1639. @@ -5983,8 +6030,8 @@ static int brcmf_construct_chaninfo(stru
  1640. /* It seems firmware supports some channel we never
  1641. * considered. Something new in IEEE standard?
  1642. */
  1643. - brcmf_err("Ignoring unexpected firmware channel %d\n",
  1644. - ch.control_ch_num);
  1645. + bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n",
  1646. + ch.control_ch_num);
  1647. continue;
  1648. }
  1649. @@ -6030,6 +6077,7 @@ fail_pbuf:
  1650. static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
  1651. {
  1652. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1653. struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  1654. struct ieee80211_supported_band *band;
  1655. struct brcmf_fil_bwcap_le band_bwcap;
  1656. @@ -6076,7 +6124,7 @@ static int brcmf_enable_bw40_2g(struct b
  1657. err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
  1658. BRCMF_DCMD_MEDLEN);
  1659. if (err) {
  1660. - brcmf_err("get chanspecs error (%d)\n", err);
  1661. + bphy_err(wiphy, "get chanspecs error (%d)\n", err);
  1662. kfree(pbuf);
  1663. return err;
  1664. }
  1665. @@ -6107,6 +6155,7 @@ static int brcmf_enable_bw40_2g(struct b
  1666. static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
  1667. {
  1668. + struct wiphy *wiphy = ifp->drvr->wiphy;
  1669. u32 band, mimo_bwcap;
  1670. int err;
  1671. @@ -6142,7 +6191,7 @@ static void brcmf_get_bwcap(struct brcmf
  1672. bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
  1673. break;
  1674. default:
  1675. - brcmf_err("invalid mimo_bw_cap value\n");
  1676. + bphy_err(wiphy, "invalid mimo_bw_cap value\n");
  1677. }
  1678. }
  1679. @@ -6218,7 +6267,7 @@ static void brcmf_update_vht_cap(struct
  1680. static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
  1681. {
  1682. struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  1683. - struct wiphy *wiphy;
  1684. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1685. u32 nmode = 0;
  1686. u32 vhtmode = 0;
  1687. u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
  1688. @@ -6234,7 +6283,7 @@ static int brcmf_setup_wiphybands(struct
  1689. (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
  1690. err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
  1691. if (err) {
  1692. - brcmf_err("nmode error (%d)\n", err);
  1693. + bphy_err(wiphy, "nmode error (%d)\n", err);
  1694. } else {
  1695. brcmf_get_bwcap(ifp, bw_cap);
  1696. }
  1697. @@ -6244,7 +6293,7 @@ static int brcmf_setup_wiphybands(struct
  1698. err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
  1699. if (err) {
  1700. - brcmf_err("rxchain error (%d)\n", err);
  1701. + bphy_err(wiphy, "rxchain error (%d)\n", err);
  1702. nchain = 1;
  1703. } else {
  1704. for (nchain = 0; rxchain; nchain++)
  1705. @@ -6254,7 +6303,7 @@ static int brcmf_setup_wiphybands(struct
  1706. err = brcmf_construct_chaninfo(cfg, bw_cap);
  1707. if (err) {
  1708. - brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err);
  1709. + bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err);
  1710. return err;
  1711. }
  1712. @@ -6266,7 +6315,6 @@ static int brcmf_setup_wiphybands(struct
  1713. &txbf_bfr_cap);
  1714. }
  1715. - wiphy = cfg_to_wiphy(cfg);
  1716. for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
  1717. band = wiphy->bands[i];
  1718. if (band == NULL)
  1719. @@ -6467,7 +6515,7 @@ static void brcmf_wiphy_wowl_params(stru
  1720. wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
  1721. GFP_KERNEL);
  1722. if (!wowl) {
  1723. - brcmf_err("only support basic wowlan features\n");
  1724. + bphy_err(wiphy, "only support basic wowlan features\n");
  1725. wiphy->wowlan = &brcmf_wowlan_support;
  1726. return;
  1727. }
  1728. @@ -6564,7 +6612,7 @@ static int brcmf_setup_wiphy(struct wiph
  1729. err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
  1730. sizeof(bandlist));
  1731. if (err) {
  1732. - brcmf_err("could not obtain band info: err=%d\n", err);
  1733. + bphy_err(wiphy, "could not obtain band info: err=%d\n", err);
  1734. return err;
  1735. }
  1736. /* first entry in bandlist is number of bands */
  1737. @@ -6613,6 +6661,7 @@ static int brcmf_setup_wiphy(struct wiph
  1738. static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
  1739. {
  1740. + struct wiphy *wiphy = cfg_to_wiphy(cfg);
  1741. struct net_device *ndev;
  1742. struct wireless_dev *wdev;
  1743. struct brcmf_if *ifp;
  1744. @@ -6650,7 +6699,7 @@ static s32 brcmf_config_dongle(struct br
  1745. err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
  1746. if (err) {
  1747. - brcmf_err("failed to set frameburst mode\n");
  1748. + bphy_err(wiphy, "failed to set frameburst mode\n");
  1749. goto default_conf_out;
  1750. }
  1751. @@ -6842,8 +6891,8 @@ static void brcmf_cfg80211_reg_notifier(
  1752. /* ignore non-ISO3166 country codes */
  1753. for (i = 0; i < 2; i++)
  1754. if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
  1755. - brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n",
  1756. - req->alpha2[0], req->alpha2[1]);
  1757. + bphy_err(wiphy, "not an ISO3166 code (0x%02x 0x%02x)\n",
  1758. + req->alpha2[0], req->alpha2[1]);
  1759. return;
  1760. }
  1761. @@ -6852,7 +6901,7 @@ static void brcmf_cfg80211_reg_notifier(
  1762. err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
  1763. if (err) {
  1764. - brcmf_err("Country code iovar returned err = %d\n", err);
  1765. + bphy_err(wiphy, "Country code iovar returned err = %d\n", err);
  1766. return;
  1767. }
  1768. @@ -6862,7 +6911,7 @@ static void brcmf_cfg80211_reg_notifier(
  1769. err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  1770. if (err) {
  1771. - brcmf_err("Firmware rejected country setting\n");
  1772. + bphy_err(wiphy, "Firmware rejected country setting\n");
  1773. return;
  1774. }
  1775. brcmf_setup_wiphybands(cfg);
  1776. @@ -6908,13 +6957,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1777. u16 *cap = NULL;
  1778. if (!ndev) {
  1779. - brcmf_err("ndev is invalid\n");
  1780. + bphy_err(wiphy, "ndev is invalid\n");
  1781. return NULL;
  1782. }
  1783. cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
  1784. if (!cfg) {
  1785. - brcmf_err("Could not allocate wiphy device\n");
  1786. + bphy_err(wiphy, "Could not allocate wiphy device\n");
  1787. return NULL;
  1788. }
  1789. @@ -6935,7 +6984,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1790. err = wl_init_priv(cfg);
  1791. if (err) {
  1792. - brcmf_err("Failed to init iwm_priv (%d)\n", err);
  1793. + bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err);
  1794. brcmf_free_vif(vif);
  1795. goto wiphy_out;
  1796. }
  1797. @@ -6944,7 +6993,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1798. /* determine d11 io type before wiphy setup */
  1799. err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
  1800. if (err) {
  1801. - brcmf_err("Failed to get D11 version (%d)\n", err);
  1802. + bphy_err(wiphy, "Failed to get D11 version (%d)\n", err);
  1803. goto priv_out;
  1804. }
  1805. cfg->d11inf.io_type = (u8)io_type;
  1806. @@ -6978,13 +7027,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1807. #endif
  1808. err = wiphy_register(wiphy);
  1809. if (err < 0) {
  1810. - brcmf_err("Could not register wiphy device (%d)\n", err);
  1811. + bphy_err(wiphy, "Could not register wiphy device (%d)\n", err);
  1812. goto priv_out;
  1813. }
  1814. err = brcmf_setup_wiphybands(cfg);
  1815. if (err) {
  1816. - brcmf_err("Setting wiphy bands failed (%d)\n", err);
  1817. + bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err);
  1818. goto wiphy_unreg_out;
  1819. }
  1820. @@ -7002,24 +7051,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1821. err = brcmf_fweh_activate_events(ifp);
  1822. if (err) {
  1823. - brcmf_err("FWEH activation failed (%d)\n", err);
  1824. + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
  1825. goto wiphy_unreg_out;
  1826. }
  1827. err = brcmf_p2p_attach(cfg, p2pdev_forced);
  1828. if (err) {
  1829. - brcmf_err("P2P initialisation failed (%d)\n", err);
  1830. + bphy_err(wiphy, "P2P initialisation failed (%d)\n", err);
  1831. goto wiphy_unreg_out;
  1832. }
  1833. err = brcmf_btcoex_attach(cfg);
  1834. if (err) {
  1835. - brcmf_err("BT-coex initialisation failed (%d)\n", err);
  1836. + bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err);
  1837. brcmf_p2p_detach(&cfg->p2p);
  1838. goto wiphy_unreg_out;
  1839. }
  1840. err = brcmf_pno_attach(cfg);
  1841. if (err) {
  1842. - brcmf_err("PNO initialisation failed (%d)\n", err);
  1843. + bphy_err(wiphy, "PNO initialisation failed (%d)\n", err);
  1844. brcmf_btcoex_detach(cfg);
  1845. brcmf_p2p_detach(&cfg->p2p);
  1846. goto wiphy_unreg_out;
  1847. @@ -7039,7 +7088,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  1848. /* (re-) activate FWEH event handling */
  1849. err = brcmf_fweh_activate_events(ifp);
  1850. if (err) {
  1851. - brcmf_err("FWEH activation failed (%d)\n", err);
  1852. + bphy_err(wiphy, "FWEH activation failed (%d)\n", err);
  1853. goto detach;
  1854. }
  1855. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
  1856. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
  1857. @@ -62,6 +62,15 @@ void __brcmf_err(struct brcmf_bus *bus,
  1858. } while (0)
  1859. #endif
  1860. +#define bphy_err(wiphy, fmt, ...) \
  1861. + do { \
  1862. + if (IS_ENABLED(CPTCFG_BRCMDBG) || \
  1863. + IS_ENABLED(CPTCFG_BRCM_TRACING) || \
  1864. + net_ratelimit()) \
  1865. + wiphy_err(wiphy, "%s: " fmt, __func__, \
  1866. + ##__VA_ARGS__); \
  1867. + } while (0)
  1868. +
  1869. #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING)
  1870. /* For debug/tracing purposes treat info messages as errors */