c72fa249917f3e6f81c091e8d9a2ca3d7e02b508
[openwrt/staging/aparcar.git] /
1 From 701fb69f2c36cba83583990e67a3925f920fd96a Mon Sep 17 00:00:00 2001
2 From: Arend van Spriel <arend.vanspriel@broadcom.com>
3 Date: Thu, 11 Jul 2019 11:05:07 +0200
4 Subject: [PATCH 2/7] brcmfmac: change the order of things in brcmf_detach()
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 When brcmf_detach() from the bus layer upon rmmod we can no longer
10 communicate. Hence we will set the bus state to DOWN and cleanup
11 the event and protocol layer. The network interfaces need to be
12 deleted before brcmf_cfg80211_detach() because the latter does the
13 wiphy_unregister() which issues a warning if there are still network
14 devices linked to the wiphy instance.
15
16 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
17 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
18 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
19 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
20 Tested-by: Rafał Miłecki <rafal@milecki.pl>
21 ---
22 .../broadcom/brcm80211/brcmfmac/core.c | 27 ++++++++++---------
23 1 file changed, 14 insertions(+), 13 deletions(-)
24
25 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
26 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
27 @@ -1328,25 +1328,26 @@ void brcmf_detach(struct device *dev)
28 unregister_inet6addr_notifier(&drvr->inet6addr_notifier);
29 #endif
30
31 - /* stop firmware event handling */
32 - brcmf_fweh_detach(drvr);
33 - if (drvr->config)
34 - brcmf_p2p_detach(&drvr->config->p2p);
35 -
36 brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
37 -
38 - /* make sure primary interface removed last */
39 - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
40 - brcmf_remove_interface(drvr->iflist[i], false);
41 -
42 - brcmf_cfg80211_detach(drvr->config);
43 - drvr->config = NULL;
44 -
45 brcmf_bus_stop(drvr->bus_if);
46
47 + brcmf_fweh_detach(drvr);
48 brcmf_proto_detach(drvr);
49
50 + /* make sure primary interface removed last */
51 + for (i = BRCMF_MAX_IFS - 1; i > -1; i--) {
52 + if (drvr->iflist[i])
53 + brcmf_del_if(drvr, drvr->iflist[i]->bsscfgidx, false);
54 + }
55 +
56 + if (drvr->config) {
57 + brcmf_p2p_detach(&drvr->config->p2p);
58 + brcmf_cfg80211_detach(drvr->config);
59 + drvr->config = NULL;
60 + }
61 +
62 bus_if->drvr = NULL;
63 +
64 wiphy_free(drvr->wiphy);
65 }
66