wifi: ath12k: handle symlink cleanup for per pdev debugfs dentry
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Tue, 11 Jun 2024 06:42:33 +0000 (09:42 +0300)
committerKalle Valo <quic_kvalo@quicinc.com>
Tue, 11 Jun 2024 18:44:18 +0000 (21:44 +0300)
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>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240529043043.2488031-4-quic_adisi@quicinc.com
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/debugfs.c

index d03326a68a9f53e391b2f459d097bfa1598426cc..b483899ca13684ce594605de20b5fbc8f5702263 100644 (file)
@@ -474,6 +474,7 @@ struct ath12k_fw_stats {
 
 struct ath12k_debug {
        struct dentry *debugfs_pdev;
+       struct dentry *debugfs_pdev_symlink;
 };
 
 struct ath12k_per_peer_tx_stats {
index 3b464cd40da67a32df8ead074da1bb4d45efe7a0..751a9b04386a7497bbd0b191bb28ac95300e56f5 100644 (file)
@@ -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;
 }