Search Linux Wireless

[PATCH] ath11k: Allow debugfs to work with 2+ radios installed.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ben Greear <greearb@xxxxxxxxxxxxxxx>

The code is trying to create an ath11k directory on debugfs
root, but that fails when there is a second radio (and thus
second instance of the driver).

Work around this by finding a free name.  This may fall into
the HACK category, I'm not really sure what the original design
is supposed to accomplish.

Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
---

NOTE:  A second radio still does not get far enough to fully boot
the NIC and create a phy* device, but at least system doesn't crash
hard now.

 drivers/net/wireless/ath/ath11k/core.h  |  5 +++--
 drivers/net/wireless/ath/ath11k/debug.c | 23 ++++++++++++++++-------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index bb22b41fefaa..858dfc700d54 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -707,8 +707,9 @@ struct ath11k_base {
 	/* Current DFS Regulatory */
 	enum ath11k_dfs_region dfs_region;
 #ifdef CONFIG_ATH11K_DEBUGFS
-	struct dentry *debugfs_soc;
-	struct dentry *debugfs_ath11k;
+	struct dentry *debugfs_soc; /* child of debugfs_ath11k */
+	char debugfs_ath11k_fname[36];
+	struct dentry *debugfs_ath11k; /* per driver instance */
 #endif
 	struct ath11k_soc_dp_stats soc_stats;
 
diff --git a/drivers/net/wireless/ath/ath11k/debug.c b/drivers/net/wireless/ath/ath11k/debug.c
index 31978ef9144e..70b4c4837879 100644
--- a/drivers/net/wireless/ath/ath11k/debug.c
+++ b/drivers/net/wireless/ath/ath11k/debug.c
@@ -1011,15 +1011,24 @@ void ath11k_debug_pdev_destroy(struct ath11k_base *ab)
 
 int ath11k_debug_soc_create(struct ath11k_base *ab)
 {
-	ab->debugfs_ath11k = debugfs_create_dir("ath11k", NULL);
+	/* We need one of these per driver instance, try until we find an un-used name */
+	int i;
 
-	if (IS_ERR_OR_NULL(ab->debugfs_ath11k)) {
-		if (IS_ERR(ab->debugfs_ath11k))
-			return PTR_ERR(ab->debugfs_ath11k);
-		return -ENOMEM;
+	for (i = 0; i<99; i++) {
+		snprintf(ab->debugfs_ath11k_fname, sizeof(ab->debugfs_ath11k_fname), "ath11k-%d", i);
+		ab->debugfs_ath11k = debugfs_create_dir(ab->debugfs_ath11k_fname, NULL);
+
+		if (!IS_ERR_OR_NULL(ab->debugfs_ath11k)) {
+			return 0;
+		}
 	}
 
-	return 0;
+	/* Couldn't create one */
+	ab->debugfs_ath11k_fname[0] = 0;
+
+	if (IS_ERR(ab->debugfs_ath11k))
+		return PTR_ERR(ab->debugfs_ath11k);
+	return -ENOMEM;
 }
 
 void ath11k_debug_soc_destroy(struct ath11k_base *ab)
@@ -1228,7 +1237,7 @@ int ath11k_debug_register(struct ath11k *ar)
 	}
 
 	/* Create a symlink under ieee80211/phy* */
-	snprintf(buf, 100, "../../ath11k/%pd2", ar->debug.debugfs_pdev);
+	snprintf(buf, 100, "../../%s/%pd2", ab->debugfs_ath11k_fname, ar->debug.debugfs_pdev);
 	debugfs_create_symlink("ath11k", ar->hw->wiphy->debugfsdir, buf);
 
 	ath11k_debug_htt_stats_init(ar);
-- 
2.26.2




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux