]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
brcmfmac: create debugfs files for bus-specific layer
authorArend van Spriel <arend.vanspriel@broadcom.com>
Thu, 14 Feb 2019 12:43:49 +0000 (13:43 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 19 Feb 2019 15:04:43 +0000 (17:04 +0200)
Since we moved the drivers debugfs directory under ieee80211 debugfs the
debugfs entries need to be added after wiphy_register() has been called.
For most part that has been done accordingly, but for the debugfs entries
added by SDIO it was not and failed silently. This patch fixes that by
adding a bus-layer callback for it.

Fixes: 856d5a011c86 ("brcmfmac: allocate struct brcmf_pub instance using wiphy_new()")
Reported-by: Russel King <linux@armlinux.org.uk>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

index c4965184cdf377af15353b1a41f05902172357ac..3d441c5c745ccf30dddf7a38e36fe8a62617d958 100644 (file)
@@ -90,6 +90,7 @@ struct brcmf_bus_ops {
        int (*get_memdump)(struct device *dev, void *data, size_t len);
        int (*get_fwname)(struct device *dev, const char *ext,
                          unsigned char *fw_name);
+       void (*debugfs_create)(struct device *dev);
 };
 
 
@@ -235,6 +236,15 @@ int brcmf_bus_get_fwname(struct brcmf_bus *bus, const char *ext,
        return bus->ops->get_fwname(bus->dev, ext, fw_name);
 }
 
+static inline
+void brcmf_bus_debugfs_create(struct brcmf_bus *bus)
+{
+       if (!bus->ops->debugfs_create)
+               return;
+
+       return bus->ops->debugfs_create(bus->dev);
+}
+
 /*
  * interface functions from common layer
  */
index a368ba6e7344f1b8dd94039c729c5273913b86cf..9d911ddefe82fc0818003aa43c5a207d7c17a53f 100644 (file)
@@ -1156,6 +1156,7 @@ static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops)
        brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read);
        brcmf_feat_debugfs_create(drvr);
        brcmf_proto_debugfs_create(drvr);
+       brcmf_bus_debugfs_create(bus_if);
 
        return 0;
 
index 0cd5b8d970d7074473621333151874c7120c5eff..5f9de618c6795c141815657ff0e1ed9ca82741a5 100644 (file)
@@ -3143,9 +3143,12 @@ static int brcmf_debugfs_sdio_count_read(struct seq_file *seq, void *data)
        return 0;
 }
 
-static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
+static void brcmf_sdio_debugfs_create(struct device *dev)
 {
-       struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr;
+       struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+       struct brcmf_pub *drvr = bus_if->drvr;
+       struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+       struct brcmf_sdio *bus = sdiodev->bus;
        struct dentry *dentry = brcmf_debugfs_get_devdir(drvr);
 
        if (IS_ERR_OR_NULL(dentry))
@@ -3165,7 +3168,7 @@ static int brcmf_sdio_checkdied(struct brcmf_sdio *bus)
        return 0;
 }
 
-static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
+static void brcmf_sdio_debugfs_create(struct device *dev)
 {
 }
 #endif /* DEBUG */
@@ -3477,8 +3480,6 @@ static int brcmf_sdio_bus_preinit(struct device *dev)
        if (bus->rxbuf)
                bus->rxblen = value;
 
-       brcmf_sdio_debugfs_create(bus);
-
        /* the commands below use the terms tx and rx from
         * a device perspective, ie. bus:txglom affects the
         * bus transfers from device to host.
@@ -4088,6 +4089,7 @@ static const struct brcmf_bus_ops brcmf_sdio_bus_ops = {
        .get_ramsize = brcmf_sdio_bus_get_ramsize,
        .get_memdump = brcmf_sdio_bus_get_memdump,
        .get_fwname = brcmf_sdio_get_fwname,
+       .debugfs_create = brcmf_sdio_debugfs_create
 };
 
 #define BRCMF_SDIO_FW_CODE     0