From: greearb@candelatech.com
To: ath11k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org, Ben Greear <greearb@candelatech.com>
Subject: [PATCH] ath11k: Allow debugfs to work with 2+ radios installed.
Date: Thu, 3 Sep 2020 10:23:59 -0700 [thread overview]
Message-ID: <20200903172359.29199-1-greearb@candelatech.com> (raw)
From: Ben Greear <greearb@candelatech.com>
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@candelatech.com>
---
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
next reply other threads:[~2020-09-03 17:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 17:23 greearb [this message]
2020-09-04 15:00 ` [PATCH] ath11k: Allow debugfs to work with 2+ radios installed akolli
2020-09-04 15:34 ` Ben Greear
2020-09-04 16:49 ` akolli
2020-09-04 16:57 ` Ben Greear
2020-09-04 17:45 ` akolli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200903172359.29199-1-greearb@candelatech.com \
--to=greearb@candelatech.com \
--cc=ath11k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox