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 @@ -1297,17 +1297,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 @@ -1317,7 +1321,8 @@ static void brcmf_link_down(struct brcmf
49 clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status);
50 brcmf_btcoex_set_mode(vif, BRCMF_BTCOEX_ENABLED, 0);
51 if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_NONE) {
52 - brcmf_set_pmk(vif->ifp, NULL, 0);
54 + brcmf_set_pmk(vif->ifp, NULL, 0);
55 vif->profile.use_fwsup = BRCMF_PROFILE_FWSUP_NONE;
57 brcmf_dbg(TRACE, "Exit\n");
58 @@ -5006,18 +5011,16 @@ static int brcmf_cfg80211_get_channel(st
59 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
60 struct net_device *ndev = wdev->netdev;
61 struct brcmf_pub *drvr = cfg->pub;
62 - struct brcmf_if *ifp;
64 enum nl80211_band band = 0;
65 enum nl80211_chan_width width = 0;
70 + if (!ndev || drvr->bus_if->state != BRCMF_BUS_UP)
72 - ifp = netdev_priv(ndev);
74 - err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
75 + err = brcmf_fil_iovar_int_get(netdev_priv(ndev), "chanspec", &chanspec);
77 bphy_err(drvr, "chanspec failed (%d)\n", err);