diff mbox series

[3/3] wifi: ath12k: handle symlink cleanup for per pdev debugfs dentry

Message ID 20240529043043.2488031-4-quic_adisi@quicinc.com
State New
Headers show
Series wifi: ath12k: fixes for per pdev debugfs | expand

Commit Message

Aditya Kumar Singh May 29, 2024, 4:30 a.m. UTC
Whenever per pdev debugfs directory is created, a symlink to it is also
placed in ieee80211/phy* directory. During clean up of per pdev debugfs,
this symlink also needs to be cleaned up.

Add changes to clean up the symlink whenever the per pdev debugfs is
removed.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/core.h    | 1 +
 drivers/net/wireless/ath/ath12k/debugfs.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 7d20b09c52e6..87cb3fde68c2 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -473,6 +473,7 @@  struct ath12k_fw_stats {
 
 struct ath12k_debug {
 	struct dentry *debugfs_pdev;
+	struct dentry *debugfs_pdev_symlink;
 };
 
 struct ath12k_per_peer_tx_stats {
diff --git a/drivers/net/wireless/ath/ath12k/debugfs.c b/drivers/net/wireless/ath/ath12k/debugfs.c
index 3b464cd40da6..751a9b04386a 100644
--- a/drivers/net/wireless/ath/ath12k/debugfs.c
+++ b/drivers/net/wireless/ath/ath12k/debugfs.c
@@ -80,7 +80,9 @@  void ath12k_debugfs_register(struct ath12k *ar)
 
 	/* Create a symlink under ieee80211/phy* */
 	scnprintf(buf, sizeof(buf), "../../ath12k/%pd2", ar->debug.debugfs_pdev);
-	debugfs_create_symlink("ath12k", hw->wiphy->debugfsdir, buf);
+	ar->debug.debugfs_pdev_symlink = debugfs_create_symlink("ath12k",
+								hw->wiphy->debugfsdir,
+								buf);
 
 	if (ar->mac.sbands[NL80211_BAND_5GHZ].channels) {
 		debugfs_create_file("dfs_simulate_radar", 0200,
@@ -94,7 +96,9 @@  void ath12k_debugfs_unregister(struct ath12k *ar)
 	if (!ar->debug.debugfs_pdev)
 		return;
 
-	/* TODO: Remove symlink under ieee80211/phy* */
+	/* Remove symlink under ieee80211/phy* */
+	debugfs_remove(ar->debug.debugfs_pdev_symlink);
 	debugfs_remove_recursive(ar->debug.debugfs_pdev);
+	ar->debug.debugfs_pdev_symlink = NULL;
 	ar->debug.debugfs_pdev = NULL;
 }