mt76: Convert to DEFINE_SHOW_ATTRIBUTE
PATCH 1/1 mt76: Convert to DEFINE_SHOW_ATTRIBUTE
From: Junlin Yang <[email protected]>
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by Junlin Yang <[email protected]>
--- .../net/wireless/mediatek/mt76/mt7915/debugfs.c | 36 ++++------------------ .../net/wireless/mediatek/mt76/mt7921/debugfs.c | 18 ++--------- 2 files changed, 9 insertions(+), 45 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +6 -30
@@ -192,7 +192,7 @@ static int mt7915_ser_trigger_set(void *data, u64 val) }static int -mt7915_tx_stats_read (struct seq_file *file,void *data) +mt7915_tx_stats_show (struct seq_file *file,void *data) {struct mt7915_dev *dev = file->private;int stat[8 ], i, n;
@@ -222,19 +222,7 @@ static int mt7915_ser_trigger_set(void *data, u64 val)return 0 ; } -static int -mt7915_tx_stats_open (struct inode *inode,struct file *f) -{ -return single_open (f, mt7915_tx_stats_read, inode->i_private); -} - -static const struct file_operations fops_tx_stats = { - .open = mt7915_tx_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, - .owner =THIS_MODULE , -}; +DEFINE_SHOW_ATTRIBUTE (mt7915_tx_stats);static int mt7915_read_temperature (struct seq_file *s,void *data) {
@@ -379,7 +367,7 @@ int mt7915_init_debugfs(struct mt7915_dev *dev) mt7915_queues_read);debugfs_create_devm_seqfile (dev->mt76.dev,"acq" , dir, mt7915_queues_acq); -debugfs_create_file ("tx_stats" ,0400 , dir, dev, &fops_tx_stats); +debugfs_create_file ("tx_stats" ,0400 , dir, dev, &mt7915_tx_stats_fops);debugfs_create_file ("fw_debug" ,0600 , dir, dev, &fops_fw_debug);debugfs_create_file ("implicit_txbf" ,0600 , dir, dev, &fops_implicit_txbf);
@@ -412,7 +400,7 @@ static int mt7915_sta_fixed_rate_set(void *data, u64 rate) mt7915_sta_fixed_rate_set, "%llx\n");static int -mt7915_sta_stats_read (struct seq_file *s,void *data) +mt7915_sta_stats_show (struct seq_file *s,void *data) {struct ieee80211_sta *sta = s->private;struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
@@ -455,24 +443,12 @@ static int mt7915_sta_fixed_rate_set(void *data, u64 rate) return 0; } -static int -mt7915_sta_stats_open (struct inode *inode,struct file *f) -{ -return single_open (f, mt7915_sta_stats_read, inode->i_private); -} - -static const struct file_operations fops_sta_stats = { - .open = mt7915_sta_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, - .owner =THIS_MODULE , -}; +DEFINE_SHOW_ATTRIBUTE (mt7915_sta_stats);void mt7915_sta_add_debugfs (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta,struct dentry *dir) {debugfs_create_file ("fixed_rate" ,0600 , dir, sta, &fops_fixed_rate); -debugfs_create_file ("stats" ,0400 , dir, sta, &fops_sta_stats); +debugfs_create_file ("stats" ,0400 , dir, sta, &mt7915_sta_stats_fops); }#endif
drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +3 -15
@@ -62,7 +62,7 @@ }static int -mt7921_tx_stats_read (struct seq_file *file,void *data) +mt7921_tx_stats_show (struct seq_file *file,void *data) {struct mt7921_dev *dev = file->private;int stat[8 ], i, n;
@@ -88,19 +88,7 @@return 0 ; } -static int -mt7921_tx_stats_open (struct inode *inode,struct file *f) -{ -return single_open (f, mt7921_tx_stats_read, inode->i_private); -} - -static const struct file_operations fops_tx_stats = { - .open = mt7921_tx_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, - .owner =THIS_MODULE , -}; +DEFINE_SHOW_ATTRIBUTE (mt7921_tx_stats);static int mt7921_queues_acq (struct seq_file *s,void *data)
@@ -239,7 +227,7 @@ int mt7921_init_debugfs(struct mt7921_dev *dev) mt7921_queues_read);debugfs_create_devm_seqfile (dev->mt76.dev,"acq" , dir, mt7921_queues_acq); -debugfs_create_file ("tx_stats" ,0400 , dir, dev, &fops_tx_stats); +debugfs_create_file ("tx_stats" ,0400 , dir, dev, &mt7921_tx_stats_fops);debugfs_create_file ("fw_debug" ,0600 , dir, dev, &fops_fw_debug);debugfs_create_file ("runtime-pm" ,0600 , dir, dev, &fops_pm); debugfs_create_file("idle-timeout", 0600, dir, dev,
Signature · 8 lines
1.9.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
This patch was applied to netdev/net-next.git (refs/heads/master):
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
Quoted 9 lines · On Sat, 27 Mar 2021 17:56:17 +0800 you wrote:
From: Junlin Yang <[email protected]>
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Junlin Yang <[email protected]>--- .../net/wireless/mediatek/mt76/mt7915/debugfs.c | 36 ++++------------------ .../net/wireless/mediatek/mt76/mt7921/debugfs.c | 18 ++--------- 2 files changed, 9 insertions(+), 45 deletions(-)
Here is the summary with links:
- mt76: Convert to DEFINE_SHOW_ATTRIBUTE
https://git.kernel.org/netdev/net-next/c/8d93a4f9ccfd
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html