349-v5.1-0003-brcmfmac-create-debugfs-files-for-bus-specific-layer.patch 3.6 KB

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