mac80211: brcmfmac: backport minor code cleanups
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 361-0001-brcmfmac-make-brcmf_of_probe-more-generic.patch
1 From e457a8a01a19277e96830d3d95887e0e3c1e2f26 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Sat, 7 Jan 2017 23:43:45 +0100
4 Subject: [PATCH] brcmfmac: make brcmf_of_probe more generic
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 We may want to use Open Firmware for other devices than just SDIO ones.
10 In future we may want to support more Broadcom properties so there is
11 really no reason for such limitation.
12
13 Call brcmf_of_probe for all kind of devices & move extra conditions to
14 the body of that funcion.
15
16 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
17 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
18 ---
19 drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 8 +++-----
20 drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 7 +++++--
21 drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h | 6 ++++--
22 3 files changed, 12 insertions(+), 9 deletions(-)
23
24 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
25 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
26 @@ -299,11 +299,9 @@ struct brcmf_mp_device *brcmf_get_module
27 }
28 }
29 }
30 - if ((bus_type == BRCMF_BUSTYPE_SDIO) && (!found)) {
31 - /* No platform data for this device. In case of SDIO try OF
32 - * (Open Firwmare) Device Tree.
33 - */
34 - brcmf_of_probe(dev, &settings->bus.sdio);
35 + if (!found) {
36 + /* No platform data for this device, try OF (Open Firwmare) */
37 + brcmf_of_probe(dev, bus_type, settings);
38 }
39 return settings;
40 }
41 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
42 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
43 @@ -23,14 +23,17 @@
44 #include "common.h"
45 #include "of.h"
46
47 -void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
48 +void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
49 + struct brcmf_mp_device *settings)
50 {
51 + struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio;
52 struct device_node *np = dev->of_node;
53 int irq;
54 u32 irqf;
55 u32 val;
56
57 - if (!np || !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
58 + if (!np || bus_type != BRCMF_BUSTYPE_SDIO ||
59 + !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
60 return;
61
62 if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
63 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
64 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h
65 @@ -14,9 +14,11 @@
66 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
67 */
68 #ifdef CONFIG_OF
69 -void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio);
70 +void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
71 + struct brcmf_mp_device *settings);
72 #else
73 -static void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd *sdio)
74 +static void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
75 + struct brcmf_mp_device *settings)
76 {
77 }
78 #endif /* CONFIG_OF */