wifi: ath12k: unregister per pdev debugfs
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Tue, 11 Jun 2024 06:42:32 +0000 (09:42 +0300)
committerKalle Valo <quic_kvalo@quicinc.com>
Tue, 11 Jun 2024 18:44:18 +0000 (21:44 +0300)
During normal de-initialization path or if any error happens while
registering the hardware, there is no support to unregister the per pdev
debugfs. Add support for the same.

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-3-quic_adisi@quicinc.com
drivers/net/wireless/ath/ath12k/debugfs.c
drivers/net/wireless/ath/ath12k/debugfs.h
drivers/net/wireless/ath/ath12k/mac.c

index 8d8ba951093b3b186479469ceb1226f68e205e2b..3b464cd40da67a32df8ead074da1bb4d45efe7a0 100644 (file)
@@ -88,3 +88,13 @@ void ath12k_debugfs_register(struct ath12k *ar)
                                    &fops_simulate_radar);
        }
 }
+
+void ath12k_debugfs_unregister(struct ath12k *ar)
+{
+       if (!ar->debug.debugfs_pdev)
+               return;
+
+       /* TODO: Remove symlink under ieee80211/phy* */
+       debugfs_remove_recursive(ar->debug.debugfs_pdev);
+       ar->debug.debugfs_pdev = NULL;
+}
index a62f2a550b2341513a44e1463cf02f0c83640cb6..8d64ba03aa9ad1a471a6f01097dc7cc8d5aca278 100644 (file)
@@ -11,7 +11,7 @@
 void ath12k_debugfs_soc_create(struct ath12k_base *ab);
 void ath12k_debugfs_soc_destroy(struct ath12k_base *ab);
 void ath12k_debugfs_register(struct ath12k *ar);
-
+void ath12k_debugfs_unregister(struct ath12k *ar);
 #else
 static inline void ath12k_debugfs_soc_create(struct ath12k_base *ab)
 {
@@ -25,6 +25,10 @@ static inline void ath12k_debugfs_register(struct ath12k *ar)
 {
 }
 
+static inline void ath12k_debugfs_unregister(struct ath12k *ar)
+{
+}
+
 #endif /* CONFIG_ATH12K_DEBUGFS */
 
 #endif /* _ATH12K_DEBUGFS_H_ */
index 4b71dfbfe728200f7ca7463c4d540e076eec8470..2259ce22cc8b2613eb13d4750a85423ef8c8f93e 100644 (file)
@@ -8892,8 +8892,10 @@ static void ath12k_mac_hw_unregister(struct ath12k_hw *ah)
        struct ath12k *ar;
        int i;
 
-       for_each_ar(ah, ar, i)
+       for_each_ar(ah, ar, i) {
                cancel_work_sync(&ar->regd_update_work);
+               ath12k_debugfs_unregister(ar);
+       }
 
        ieee80211_unregister_hw(hw);
 
@@ -9140,6 +9142,9 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
        return 0;
 
 err_unregister_hw:
+       for_each_ar(ah, ar, i)
+               ath12k_debugfs_unregister(ar);
+
        ieee80211_unregister_hw(hw);
 
 err_free_if_combs: