1 From ba76ff25ee64d5cfc86209d1fbb3c294b2c04412 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Tue, 3 Sep 2019 06:29:26 +0200
4 Subject: [PATCH 1/3] brcmfmac: move "cfg80211_ops" pointer to another struct
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 This moves "ops" pointer from "struct brcmf_cfg80211_info" to the
10 "struct brcmf_pub". This movement makes it possible to allocate wiphy
11 without attaching cfg80211 (brcmf_cfg80211_attach()). It's required for
12 later separation of wiphy allocation and driver initialization.
14 While at it fix also an unlikely memory leak in the brcmf_attach().
16 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
17 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
19 .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 1 -
20 .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 1 -
21 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 9 ++++++---
22 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 1 +
23 4 files changed, 7 insertions(+), 5 deletions(-)
25 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
26 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
27 @@ -7194,7 +7194,6 @@ void brcmf_cfg80211_detach(struct brcmf_
28 brcmf_pno_detach(cfg);
29 brcmf_btcoex_detach(cfg);
30 wiphy_unregister(cfg->wiphy);
33 brcmf_free_wiphy(cfg->wiphy);
35 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
36 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
37 @@ -292,7 +292,6 @@ struct brcmf_cfg80211_wowl {
39 struct brcmf_cfg80211_info {
41 - struct cfg80211_ops *ops;
42 struct brcmf_cfg80211_conf *conf;
43 struct brcmf_p2p_info p2p;
44 struct brcmf_btcoex_info *btcoex;
45 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
46 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
47 @@ -1245,12 +1245,15 @@ int brcmf_attach(struct device *dev, str
50 wiphy = wiphy_new(ops, sizeof(*drvr));
57 set_wiphy_dev(wiphy, dev);
58 drvr = wiphy_priv(wiphy);
62 for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++)
63 drvr->if2bss[i] = BRCMF_BSSIDX_INVALID;
64 @@ -1283,12 +1286,10 @@ int brcmf_attach(struct device *dev, str
68 - drvr->config->ops = ops;
77 @@ -1374,6 +1375,8 @@ void brcmf_detach(struct device *dev)
83 wiphy_free(drvr->wiphy);
86 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
87 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
88 @@ -97,6 +97,7 @@ struct brcmf_pub {
89 struct brcmf_bus *bus_if;
90 struct brcmf_proto *proto;
92 + struct cfg80211_ops *ops;
93 struct brcmf_cfg80211_info *config;
95 /* Internal brcmf items */