1 From 66ab63fbb33bf367807e3e471231379dce6f8b8c 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 5/7] brcmfmac: avoid firmware commands when bus is down
6 Upon rmmod a few attempts are made to inform firmware, but there is
7 no point as the bus is down and these will fail. Avoid them to keep
10 Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
11 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
12 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
13 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
14 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
16 .../broadcom/brcm80211/brcmfmac/cfg80211.c | 23 +++++++++++--------
17 1 file changed, 13 insertions(+), 10 deletions(-)
19 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
20 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
21 @@ -1388,17 +1388,21 @@ static void brcmf_link_down(struct brcmf
23 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
24 struct brcmf_pub *drvr = cfg->pub;
25 + bool bus_up = drvr->bus_if->state == BRCMF_BUS_UP;
28 brcmf_dbg(TRACE, "Enter\n");
30 if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) {
31 - brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n ");
32 - err = brcmf_fil_cmd_data_set(vif->ifp,
33 - BRCMF_C_DISASSOC, NULL, 0);
35 - bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err);
37 + brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n");
38 + err = brcmf_fil_cmd_data_set(vif->ifp,
39 + BRCMF_C_DISASSOC, NULL, 0);
41 + bphy_err(drvr, "WLC_DISASSOC failed (%d)\n",
45 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
46 (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
47 cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0,
48 @@ -5041,18 +5045,16 @@ static int brcmf_cfg80211_get_channel(st
49 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
50 struct net_device *ndev = wdev->netdev;
51 struct brcmf_pub *drvr = cfg->pub;
52 - struct brcmf_if *ifp;
54 enum nl80211_band band = 0;
55 enum nl80211_chan_width width = 0;
60 + if (!ndev || drvr->bus_if->state != BRCMF_BUS_UP)
62 - ifp = netdev_priv(ndev);
64 - err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
65 + err = brcmf_fil_iovar_int_get(netdev_priv(ndev), "chanspec", &chanspec);
67 bphy_err(drvr, "chanspec failed (%d)\n", err);