[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220422012830.342993-1-zhaojunkui2008@126.com>
Date: Thu, 21 Apr 2022 18:28:30 -0700
From: Bernard Zhao <zhaojunkui2008@....com>
To: Jakub Kicinski <kubakici@...pl>, Kalle Valo <kvalo@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>,
Matthias Brugger <matthias.bgg@...il.com>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: bernard@...o.com, Bernard Zhao <zhaojunkui2008@....com>
Subject: [PATCH] net/wireless: add debugfs exit function
This patch add exit debugfs function to mt7601u.
Debugfs need to be cleanup when module is unloaded or load fail.
Signed-off-by: Bernard Zhao <zhaojunkui2008@....com>
---
drivers/net/wireless/mediatek/mt7601u/debugfs.c | 9 +++++++--
drivers/net/wireless/mediatek/mt7601u/init.c | 1 +
drivers/net/wireless/mediatek/mt7601u/mt7601u.h | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt7601u/debugfs.c b/drivers/net/wireless/mediatek/mt7601u/debugfs.c
index 20669eacb66e..5ae27aae685b 100644
--- a/drivers/net/wireless/mediatek/mt7601u/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt7601u/debugfs.c
@@ -9,6 +9,8 @@
#include "mt7601u.h"
#include "eeprom.h"
+static struct dentry *dir;
+
static int
mt76_reg_set(void *data, u64 val)
{
@@ -124,8 +126,6 @@ DEFINE_SHOW_ATTRIBUTE(mt7601u_eeprom_param);
void mt7601u_init_debugfs(struct mt7601u_dev *dev)
{
- struct dentry *dir;
-
dir = debugfs_create_dir("mt7601u", dev->hw->wiphy->debugfsdir);
if (!dir)
return;
@@ -138,3 +138,8 @@ void mt7601u_init_debugfs(struct mt7601u_dev *dev)
debugfs_create_file("ampdu_stat", 0400, dir, dev, &mt7601u_ampdu_stat_fops);
debugfs_create_file("eeprom_param", 0400, dir, dev, &mt7601u_eeprom_param_fops);
}
+
+void mt7601u_exit_debugfs(struct mt7601u_dev *dev)
+{
+ debugfs_remove(dir);
+}
diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c b/drivers/net/wireless/mediatek/mt7601u/init.c
index 5d9e952b2966..eacdd5785fa6 100644
--- a/drivers/net/wireless/mediatek/mt7601u/init.c
+++ b/drivers/net/wireless/mediatek/mt7601u/init.c
@@ -427,6 +427,7 @@ void mt7601u_cleanup(struct mt7601u_dev *dev)
mt7601u_stop_hardware(dev);
mt7601u_dma_cleanup(dev);
mt7601u_mcu_cmd_deinit(dev);
+ mt7601u_exit_debugfs(dev);
}
struct mt7601u_dev *mt7601u_alloc_device(struct device *pdev)
diff --git a/drivers/net/wireless/mediatek/mt7601u/mt7601u.h b/drivers/net/wireless/mediatek/mt7601u/mt7601u.h
index a122f1dd38f6..a77bfef0d39f 100644
--- a/drivers/net/wireless/mediatek/mt7601u/mt7601u.h
+++ b/drivers/net/wireless/mediatek/mt7601u/mt7601u.h
@@ -279,6 +279,7 @@ struct mt7601u_rxwi;
extern const struct ieee80211_ops mt7601u_ops;
void mt7601u_init_debugfs(struct mt7601u_dev *dev);
+void mt7601u_exit_debugfs(struct mt7601u_dev *dev);
u32 mt7601u_rr(struct mt7601u_dev *dev, u32 offset);
void mt7601u_wr(struct mt7601u_dev *dev, u32 offset, u32 val);
--
2.33.1
Powered by blists - more mailing lists