b58ec4b7e904db5c3faf2fc0a306729a02eaa343
[openwrt/staging/adrian.git] /
1 From aaf6a5e86e36766abbeedf220462bde8031f9a72 Mon Sep 17 00:00:00 2001
2 From: Arend van Spriel <arend.vanspriel@broadcom.com>
3 Date: Thu, 14 Feb 2019 13:43:49 +0100
4 Subject: [PATCH] brcmfmac: create debugfs files for bus-specific layer
5
6 Since we moved the drivers debugfs directory under ieee80211 debugfs the
7 debugfs entries need to be added after wiphy_register() has been called.
8 For most part that has been done accordingly, but for the debugfs entries
9 added by SDIO it was not and failed silently. This patch fixes that by
10 adding a bus-layer callback for it.
11
12 Fixes: 856d5a011c86 ("brcmfmac: allocate struct brcmf_pub instance using wiphy_new()")
13 Reported-by: Russel King <linux@armlinux.org.uk>
14 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
15 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
16 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
17 ---
18 .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 10 ++++++++++
19 .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 1 +
20 .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 +++++++-----
21 3 files changed, 18 insertions(+), 5 deletions(-)
22
23 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
24 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
25 @@ -90,6 +90,7 @@ struct brcmf_bus_ops {
26 int (*get_memdump)(struct device *dev, void *data, size_t len);
27 int (*get_fwname)(struct device *dev, const char *ext,
28 unsigned char *fw_name);
29 + void (*debugfs_create)(struct device *dev);
30 };
31
32
33 @@ -235,6 +236,15 @@ int brcmf_bus_get_fwname(struct brcmf_bu
34 return bus->ops->get_fwname(bus->dev, ext, fw_name);
35 }
36
37 +static inline
38 +void brcmf_bus_debugfs_create(struct brcmf_bus *bus)
39 +{
40 + if (!bus->ops->debugfs_create)
41 + return;
42 +
43 + return bus->ops->debugfs_create(bus->dev);
44 +}
45 +
46 /*
47 * interface functions from common layer
48 */
49 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
50 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
51 @@ -1177,6 +1177,7 @@ static int brcmf_bus_started(struct brcm
52 brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read);
53 brcmf_feat_debugfs_create(drvr);
54 brcmf_proto_debugfs_create(drvr);
55 + brcmf_bus_debugfs_create(bus_if);
56
57 return 0;
58
59 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
60 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
61 @@ -3143,9 +3143,12 @@ static int brcmf_debugfs_sdio_count_read
62 return 0;
63 }
64
65 -static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
66 +static void brcmf_sdio_debugfs_create(struct device *dev)
67 {
68 - struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr;
69 + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
70 + struct brcmf_pub *drvr = bus_if->drvr;
71 + struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
72 + struct brcmf_sdio *bus = sdiodev->bus;
73 struct dentry *dentry = brcmf_debugfs_get_devdir(drvr);
74
75 if (IS_ERR_OR_NULL(dentry))
76 @@ -3165,7 +3168,7 @@ static int brcmf_sdio_checkdied(struct b
77 return 0;
78 }
79
80 -static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
81 +static void brcmf_sdio_debugfs_create(struct device *dev)
82 {
83 }
84 #endif /* DEBUG */
85 @@ -3477,8 +3480,6 @@ static int brcmf_sdio_bus_preinit(struct
86 if (bus->rxbuf)
87 bus->rxblen = value;
88
89 - brcmf_sdio_debugfs_create(bus);
90 -
91 /* the commands below use the terms tx and rx from
92 * a device perspective, ie. bus:txglom affects the
93 * bus transfers from device to host.
94 @@ -4088,6 +4089,7 @@ static const struct brcmf_bus_ops brcmf_
95 .get_ramsize = brcmf_sdio_bus_get_ramsize,
96 .get_memdump = brcmf_sdio_bus_get_memdump,
97 .get_fwname = brcmf_sdio_get_fwname,
98 + .debugfs_create = brcmf_sdio_debugfs_create
99 };
100
101 #define BRCMF_SDIO_FW_CODE 0