352-v5.4-0005-brcmfmac-avoid-firmware-commands-when-bus-is-down.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From 1ac11ae949dd883854f4523ef8e3a32aabfd6256 Mon Sep 17 00:00:00 2001
  2. From: Arend van Spriel <arend.vanspriel@broadcom.com>
  3. Date: Thu, 11 Jul 2019 11:05:10 +0200
  4. Subject: [PATCH] brcmfmac: avoid firmware commands when bus is down
  5. Upon rmmod a few attempts are made to inform firmware, but there is
  6. no point as the bus is down and these will fail. Avoid them to keep
  7. the logs clean.
  8. Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
  9. Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  10. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  11. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  12. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  13. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14. ---
  15. .../broadcom/brcm80211/brcmfmac/cfg80211.c | 23 +++++++++++--------
  16. 1 file changed, 13 insertions(+), 10 deletions(-)
  17. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  19. @@ -1388,17 +1388,21 @@ static void brcmf_link_down(struct brcmf
  20. {
  21. struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
  22. struct brcmf_pub *drvr = cfg->pub;
  23. + bool bus_up = drvr->bus_if->state == BRCMF_BUS_UP;
  24. s32 err = 0;
  25. brcmf_dbg(TRACE, "Enter\n");
  26. if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) {
  27. - brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n ");
  28. - err = brcmf_fil_cmd_data_set(vif->ifp,
  29. - BRCMF_C_DISASSOC, NULL, 0);
  30. - if (err) {
  31. - bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err);
  32. + if (bus_up) {
  33. + brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n");
  34. + err = brcmf_fil_cmd_data_set(vif->ifp,
  35. + BRCMF_C_DISASSOC, NULL, 0);
  36. + if (err)
  37. + bphy_err(drvr, "WLC_DISASSOC failed (%d)\n",
  38. + err);
  39. }
  40. +
  41. if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
  42. (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
  43. cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0,
  44. @@ -5041,18 +5045,16 @@ static int brcmf_cfg80211_get_channel(st
  45. struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  46. struct net_device *ndev = wdev->netdev;
  47. struct brcmf_pub *drvr = cfg->pub;
  48. - struct brcmf_if *ifp;
  49. struct brcmu_chan ch;
  50. enum nl80211_band band = 0;
  51. enum nl80211_chan_width width = 0;
  52. u32 chanspec;
  53. int freq, err;
  54. - if (!ndev)
  55. + if (!ndev || drvr->bus_if->state != BRCMF_BUS_UP)
  56. return -ENODEV;
  57. - ifp = netdev_priv(ndev);
  58. - err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
  59. + err = brcmf_fil_iovar_int_get(netdev_priv(ndev), "chanspec", &chanspec);
  60. if (err) {
  61. bphy_err(drvr, "chanspec failed (%d)\n", err);
  62. return err;