OSDN Git Service

qtnfmac: modify debugfs to support multiple cards
authorSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Tue, 9 Apr 2019 07:35:12 +0000 (07:35 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 26 Apr 2019 11:53:13 +0000 (14:53 +0300)
This patch modifies location of debugfs entries and their naming
conventions to support multiple wireless cards on pcie host.
Selected approach is to use separate directories for different
wireless cards in top-level qtnfmac debugfs directory.

Here is an example that clarifies the chosen naming conventions:

 $ sudo ls /sys/kernel/debug/qtnfmac/
   qtnfmac_pcie:0000:01:00.0

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/core.c
drivers/net/wireless/quantenna/qtnfmac/core.h
drivers/net/wireless/quantenna/qtnfmac/debug.c

index ad0c9e0..8d699cc 100644 (file)
@@ -20,6 +20,8 @@ static bool slave_radar = true;
 module_param(slave_radar, bool, 0644);
 MODULE_PARM_DESC(slave_radar, "set 0 to disable radar detection in slave mode");
 
+static struct dentry *qtnf_debugfs_dir;
+
 struct qtnf_frame_meta_info {
        u8 magic_s;
        u8 ifidx;
@@ -848,6 +850,30 @@ void qtnf_packet_send_hi_pri(struct sk_buff *skb)
 }
 EXPORT_SYMBOL_GPL(qtnf_packet_send_hi_pri);
 
+struct dentry *qtnf_get_debugfs_dir(void)
+{
+       return qtnf_debugfs_dir;
+}
+EXPORT_SYMBOL_GPL(qtnf_get_debugfs_dir);
+
+static int __init qtnf_core_register(void)
+{
+       qtnf_debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
+
+       if (IS_ERR(qtnf_debugfs_dir))
+               qtnf_debugfs_dir = NULL;
+
+       return 0;
+}
+
+static void __exit qtnf_core_exit(void)
+{
+       debugfs_remove(qtnf_debugfs_dir);
+}
+
+module_init(qtnf_core_register);
+module_exit(qtnf_core_exit);
+
 MODULE_AUTHOR("Quantenna Communications");
 MODULE_DESCRIPTION("Quantenna 802.11 wireless LAN FullMAC driver.");
 MODULE_LICENSE("GPL");
index d5caff4..322858d 100644 (file)
@@ -153,6 +153,7 @@ void qtnf_virtual_intf_cleanup(struct net_device *ndev);
 void qtnf_netdev_updown(struct net_device *ndev, bool up);
 void qtnf_scan_done(struct qtnf_wmac *mac, bool aborted);
 void qtnf_packet_send_hi_pri(struct sk_buff *skb);
+struct dentry *qtnf_get_debugfs_dir(void);
 
 static inline struct qtnf_vif *qtnf_netdev_get_priv(struct net_device *dev)
 {
index 598ece7..2d3574c 100644 (file)
@@ -5,7 +5,9 @@
 
 void qtnf_debugfs_init(struct qtnf_bus *bus, const char *name)
 {
-       bus->dbg_dir = debugfs_create_dir(name, NULL);
+       struct dentry *parent = qtnf_get_debugfs_dir();
+
+       bus->dbg_dir = debugfs_create_dir(name, parent);
 }
 
 void qtnf_debugfs_remove(struct qtnf_bus *bus)