linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76: convert to DEFINE_SHOW_ATTRIBUTE
@ 2018-12-03 13:40 Yangtao Li
  2018-12-03 18:55 ` Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Yangtao Li @ 2018-12-03 13:40 UTC (permalink / raw)
  To: davem, kubakici, matthias.bgg, nbd, lorenzo.bianconi, joe,
	sgruszka, kvalo
  Cc: Yangtao Li, netdev, linux-wireless, linux-kernel, linux-mediatek,
	linux-arm-kernel

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 .../wireless/mediatek/mt76/mt76x0/debugfs.c   | 20 ++--------
 .../wireless/mediatek/mt76/mt76x2/debugfs.c   | 38 +++---------------
 .../net/wireless/mediatek/mt7601u/debugfs.c   | 40 ++++---------------
 3 files changed, 18 insertions(+), 80 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c
index 3224e5b1a1e5..21fde45b1b20 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c
@@ -18,8 +18,7 @@
 #include "mt76x0.h"
 #include "eeprom.h"
 
-static int
-mt76x0_ampdu_stat_read(struct seq_file *file, void *data)
+static int ampdu_stat_show(struct seq_file *file, void *data)
 {
 	struct mt76x02_dev *dev = file->private;
 	int i, j;
@@ -61,19 +60,7 @@ mt76x0_ampdu_stat_read(struct seq_file *file, void *data)
 
 	return 0;
 }
-
-static int
-mt76x0_ampdu_stat_open(struct inode *inode, struct file *f)
-{
-	return single_open(f, mt76x0_ampdu_stat_read, inode->i_private);
-}
-
-static const struct file_operations fops_ampdu_stat = {
-	.open = mt76x0_ampdu_stat_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(ampdu_stat);
 
 void mt76x0_init_debugfs(struct mt76x02_dev *dev)
 {
@@ -83,5 +70,6 @@ void mt76x0_init_debugfs(struct mt76x02_dev *dev)
 	if (!dir)
 		return;
 
-	debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev, &fops_ampdu_stat);
+	debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev,
+				&ampdu_stat_fops);
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x2/debugfs.c
index e8f8ccc0a5ed..04711cd09d21 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/debugfs.c
@@ -17,8 +17,7 @@
 #include <linux/debugfs.h>
 #include "mt76x2.h"
 
-static int
-mt76x2_ampdu_stat_read(struct seq_file *file, void *data)
+static int ampdu_stat_show(struct seq_file *file, void *data)
 {
 	struct mt76x02_dev *dev = file->private;
 	int i, j;
@@ -40,12 +39,7 @@ mt76x2_ampdu_stat_read(struct seq_file *file, void *data)
 
 	return 0;
 }
-
-static int
-mt76x2_ampdu_stat_open(struct inode *inode, struct file *f)
-{
-	return single_open(f, mt76x2_ampdu_stat_read, inode->i_private);
-}
+DEFINE_SHOW_ATTRIBUTE(ampdu_stat);
 
 static int read_txpower(struct seq_file *file, void *data)
 {
@@ -58,15 +52,7 @@ static int read_txpower(struct seq_file *file, void *data)
 	return 0;
 }
 
-static const struct file_operations fops_ampdu_stat = {
-	.open = mt76x2_ampdu_stat_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
-
-static int
-mt76x2_dfs_stat_read(struct seq_file *file, void *data)
+static int dfs_stat_show(struct seq_file *file, void *data)
 {
 	struct mt76x02_dev *dev = file->private;
 	struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd;
@@ -90,19 +76,7 @@ mt76x2_dfs_stat_read(struct seq_file *file, void *data)
 
 	return 0;
 }
-
-static int
-mt76x2_dfs_stat_open(struct inode *inode, struct file *f)
-{
-	return single_open(f, mt76x2_dfs_stat_read, inode->i_private);
-}
-
-static const struct file_operations fops_dfs_stat = {
-	.open = mt76x2_dfs_stat_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(dfs_stat);
 
 static int read_agc(struct seq_file *file, void *data)
 {
@@ -127,8 +101,8 @@ void mt76x2_init_debugfs(struct mt76x02_dev *dev)
 	debugfs_create_u8("temperature", 0400, dir, &dev->cal.temp);
 	debugfs_create_bool("tpc", 0600, dir, &dev->enable_tpc);
 
-	debugfs_create_file("ampdu_stat", 0400, dir, dev, &fops_ampdu_stat);
-	debugfs_create_file("dfs_stats", 0400, dir, dev, &fops_dfs_stat);
+	debugfs_create_file("ampdu_stat", 0400, dir, dev, &ampdu_stat_fops);
+	debugfs_create_file("dfs_stats", 0400, dir, dev, &dfs_stat_fops);
 	debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir,
 				    read_txpower);
 
diff --git a/drivers/net/wireless/mediatek/mt7601u/debugfs.c b/drivers/net/wireless/mediatek/mt7601u/debugfs.c
index 991a6a729b1e..0be3084fee01 100644
--- a/drivers/net/wireless/mediatek/mt7601u/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt7601u/debugfs.c
@@ -37,8 +37,7 @@ mt76_reg_get(void *data, u64 *val)
 
 DEFINE_SIMPLE_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, "0x%08llx\n");
 
-static int
-mt7601u_ampdu_stat_read(struct seq_file *file, void *data)
+static int ampdu_stat_show(struct seq_file *file, void *data)
 {
 	struct mt7601u_dev *dev = file->private;
 	int i, j;
@@ -80,22 +79,9 @@ mt7601u_ampdu_stat_read(struct seq_file *file, void *data)
 
 	return 0;
 }
+DEFINE_SHOW_ATTRIBUTE(ampdu_stat);
 
-static int
-mt7601u_ampdu_stat_open(struct inode *inode, struct file *f)
-{
-	return single_open(f, mt7601u_ampdu_stat_read, inode->i_private);
-}
-
-static const struct file_operations fops_ampdu_stat = {
-	.open = mt7601u_ampdu_stat_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
-
-static int
-mt7601u_eeprom_param_read(struct seq_file *file, void *data)
+static int eeprom_param_show(struct seq_file *file, void *data)
 {
 	struct mt7601u_dev *dev = file->private;
 	struct mt7601u_rate_power *rp = &dev->ee->power_rate_table;
@@ -138,19 +124,7 @@ mt7601u_eeprom_param_read(struct seq_file *file, void *data)
 
 	return 0;
 }
-
-static int
-mt7601u_eeprom_param_open(struct inode *inode, struct file *f)
-{
-	return single_open(f, mt7601u_eeprom_param_read, inode->i_private);
-}
-
-static const struct file_operations fops_eeprom_param = {
-	.open = mt7601u_eeprom_param_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(eeprom_param);
 
 void mt7601u_init_debugfs(struct mt7601u_dev *dev)
 {
@@ -165,6 +139,8 @@ void mt7601u_init_debugfs(struct mt7601u_dev *dev)
 
 	debugfs_create_u32("regidx", 0600, dir, &dev->debugfs_reg);
 	debugfs_create_file("regval", 0600, dir, dev, &fops_regval);
-	debugfs_create_file("ampdu_stat", 0400, dir, dev, &fops_ampdu_stat);
-	debugfs_create_file("eeprom_param", 0400, dir, dev, &fops_eeprom_param);
+	debugfs_create_file("ampdu_stat", 0400, dir, dev, 
+				&ampdu_stat_fops);
+	debugfs_create_file("eeprom_param", 0400, dir, dev,
+				&eeprom_param_fops);
 }
-- 
2.17.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76: convert to DEFINE_SHOW_ATTRIBUTE
  2018-12-03 13:40 [PATCH] mt76: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
@ 2018-12-03 18:55 ` Jakub Kicinski
  2018-12-05 18:09 ` Joe Perches
  2019-01-11 14:16 ` Felix Fietkau
  2 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2018-12-03 18:55 UTC (permalink / raw)
  To: Yangtao Li
  Cc: sgruszka, netdev, linux-wireless, linux-kernel, joe,
	linux-mediatek, linux-arm-kernel, matthias.bgg, lorenzo.bianconi,
	davem, kvalo, nbd

On Mon,  3 Dec 2018 08:40:28 -0500, Yangtao Li wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Acked-by: Jakub Kicinski <kubakici@wp.pl>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76: convert to DEFINE_SHOW_ATTRIBUTE
  2018-12-03 13:40 [PATCH] mt76: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
  2018-12-03 18:55 ` Jakub Kicinski
@ 2018-12-05 18:09 ` Joe Perches
  2018-12-15  9:11   ` Frank Lee
  2019-01-11 14:16 ` Felix Fietkau
  2 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2018-12-05 18:09 UTC (permalink / raw)
  To: Yangtao Li, davem, kubakici, matthias.bgg, nbd, lorenzo.bianconi,
	sgruszka, kvalo
  Cc: netdev, linux-mediatek, linux-wireless, linux-kernel, linux-arm-kernel

On Mon, 2018-12-03 at 08:40 -0500, Yangtao Li wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Thanks.

Are you doing these manually or using some script?



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76: convert to DEFINE_SHOW_ATTRIBUTE
  2018-12-05 18:09 ` Joe Perches
@ 2018-12-15  9:11   ` Frank Lee
  0 siblings, 0 replies; 7+ messages in thread
From: Frank Lee @ 2018-12-15  9:11 UTC (permalink / raw)
  To: Joe Perches
  Cc: sgruszka, kubakici, netdev, linux-wireless,
	Linux Kernel Mailing List, linux-mediatek, linux-arm-kernel,
	Matthias Brugger, lorenzo.bianconi, davem, kvalo, Felix Fietkau

On Thu, Dec 6, 2018 at 2:09 AM Joe Perches <joe@perches.com> wrote:
>
> On Mon, 2018-12-03 at 08:40 -0500, Yangtao Li wrote:
> > Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>
> Thanks.
>
> Are you doing these manually or using some script?
In fact, just use grep.

Yours,
Yangtao
>
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76: convert to DEFINE_SHOW_ATTRIBUTE
  2018-12-03 13:40 [PATCH] mt76: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
  2018-12-03 18:55 ` Jakub Kicinski
  2018-12-05 18:09 ` Joe Perches
@ 2019-01-11 14:16 ` Felix Fietkau
  2 siblings, 0 replies; 7+ messages in thread
From: Felix Fietkau @ 2019-01-11 14:16 UTC (permalink / raw)
  To: Yangtao Li, davem, kubakici, matthias.bgg, lorenzo.bianconi, joe,
	sgruszka, kvalo
  Cc: netdev, linux-mediatek, linux-wireless, linux-kernel, linux-arm-kernel

On 2018-12-03 14:40, Yangtao Li wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>Please rebase this patch onto the mt76 branch of
https://github.com/nbd168/wireless

Thanks,

- Felix

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76: Convert to DEFINE_SHOW_ATTRIBUTE
  2021-03-27  9:56 [PATCH] mt76: Convert " angkery
@ 2021-03-29  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-29  1:10 UTC (permalink / raw)
  To: angkery
  Cc: nbd, lorenzo.bianconi83, ryder.lee, kvalo, davem, kuba,
	matthias.bgg, shayne.chen, yiwei.chung, ap420073, sean.wang,
	Soul.Huang, linux-wireless, netdev, linux-arm-kernel,
	linux-mediatek, linux-kernel, yangjunlin

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Sat, 27 Mar 2021 17:56:17 +0800 you wrote:
> From: Junlin Yang <yangjunlin@yulong.com>
> 
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
> ---
>  .../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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] mt76: Convert to DEFINE_SHOW_ATTRIBUTE
@ 2021-03-27  9:56 angkery
  2021-03-29  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 7+ messages in thread
From: angkery @ 2021-03-27  9:56 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi83, ryder.lee, kvalo, davem, kuba,
	matthias.bgg, shayne.chen, yiwei.chung, ap420073, sean.wang,
	Soul.Huang
  Cc: linux-wireless, netdev, linux-arm-kernel, linux-mediatek,
	linux-kernel, Junlin Yang

From: Junlin Yang <yangjunlin@yulong.com>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
---
 .../net/wireless/mediatek/mt76/mt7915/debugfs.c    | 36 ++++------------------
 .../net/wireless/mediatek/mt76/mt7921/debugfs.c    | 18 ++---------
 2 files changed, 9 insertions(+), 45 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
index 77dcd71..7bef36f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
@@ -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
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
index 0dc8e25..c1a64ff 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c
@@ -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,
-- 
1.9.1



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-29 17:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 13:40 [PATCH] mt76: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
2018-12-03 18:55 ` Jakub Kicinski
2018-12-05 18:09 ` Joe Perches
2018-12-15  9:11   ` Frank Lee
2019-01-11 14:16 ` Felix Fietkau
2021-03-27  9:56 [PATCH] mt76: Convert " angkery
2021-03-29  1:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).