Commit 1820388b authored by Qinglang Miao's avatar Qinglang Miao Committed by Felix Fietkau

mt76: Convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 062d62e3
...@@ -70,7 +70,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_edcca, mt7603_edcca_get, ...@@ -70,7 +70,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_edcca, mt7603_edcca_get,
mt7603_edcca_set, "%lld\n"); mt7603_edcca_set, "%lld\n");
static int static int
mt7603_ampdu_stat_read(struct seq_file *file, void *data) mt7603_ampdu_stat_show(struct seq_file *file, void *data)
{ {
struct mt7603_dev *dev = file->private; struct mt7603_dev *dev = file->private;
int bound[3], i, range; int bound[3], i, range;
...@@ -91,18 +91,7 @@ mt7603_ampdu_stat_read(struct seq_file *file, void *data) ...@@ -91,18 +91,7 @@ mt7603_ampdu_stat_read(struct seq_file *file, void *data)
return 0; return 0;
} }
static int DEFINE_SHOW_ATTRIBUTE(mt7603_ampdu_stat);
mt7603_ampdu_stat_open(struct inode *inode, struct file *f)
{
return single_open(f, mt7603_ampdu_stat_read, inode->i_private);
}
static const struct file_operations fops_ampdu_stat = {
.open = mt7603_ampdu_stat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
void mt7603_init_debugfs(struct mt7603_dev *dev) void mt7603_init_debugfs(struct mt7603_dev *dev)
{ {
...@@ -112,7 +101,8 @@ void mt7603_init_debugfs(struct mt7603_dev *dev) ...@@ -112,7 +101,8 @@ void mt7603_init_debugfs(struct mt7603_dev *dev)
if (!dir) if (!dir)
return; return;
debugfs_create_file("ampdu_stat", 0400, dir, dev, &fops_ampdu_stat); debugfs_create_file("ampdu_stat", 0400, dir, dev,
&mt7603_ampdu_stat_fops);
debugfs_create_devm_seqfile(dev->mt76.dev, "xmit-queues", dir, debugfs_create_devm_seqfile(dev->mt76.dev, "xmit-queues", dir,
mt76_queues_read); mt76_queues_read);
debugfs_create_file("edcca", 0600, dir, dev, &fops_edcca); debugfs_create_file("edcca", 0600, dir, dev, &fops_edcca);
......
...@@ -220,7 +220,7 @@ mt7615_ampdu_stat_read_phy(struct mt7615_phy *phy, ...@@ -220,7 +220,7 @@ mt7615_ampdu_stat_read_phy(struct mt7615_phy *phy,
} }
static int static int
mt7615_ampdu_stat_read(struct seq_file *file, void *data) mt7615_ampdu_stat_show(struct seq_file *file, void *data)
{ {
struct mt7615_dev *dev = file->private; struct mt7615_dev *dev = file->private;
...@@ -234,18 +234,7 @@ mt7615_ampdu_stat_read(struct seq_file *file, void *data) ...@@ -234,18 +234,7 @@ mt7615_ampdu_stat_read(struct seq_file *file, void *data)
return 0; return 0;
} }
static int DEFINE_SHOW_ATTRIBUTE(mt7615_ampdu_stat);
mt7615_ampdu_stat_open(struct inode *inode, struct file *f)
{
return single_open(f, mt7615_ampdu_stat_read, inode->i_private);
}
static const struct file_operations fops_ampdu_stat = {
.open = mt7615_ampdu_stat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static void static void
mt7615_radio_read_phy(struct mt7615_phy *phy, struct seq_file *s) mt7615_radio_read_phy(struct mt7615_phy *phy, struct seq_file *s)
...@@ -392,7 +381,7 @@ int mt7615_init_debugfs(struct mt7615_dev *dev) ...@@ -392,7 +381,7 @@ int mt7615_init_debugfs(struct mt7615_dev *dev)
mt76_queues_read); mt76_queues_read);
debugfs_create_devm_seqfile(dev->mt76.dev, "acq", dir, debugfs_create_devm_seqfile(dev->mt76.dev, "acq", dir,
mt7615_queues_acq); mt7615_queues_acq);
debugfs_create_file("ampdu_stat", 0400, dir, dev, &fops_ampdu_stat); debugfs_create_file("ampdu_stat", 0400, dir, dev, &mt7615_ampdu_stat_fops);
debugfs_create_file("scs", 0600, dir, dev, &fops_scs); debugfs_create_file("scs", 0600, dir, dev, &fops_scs);
debugfs_create_file("dbdc", 0600, dir, dev, &fops_dbdc); debugfs_create_file("dbdc", 0600, dir, dev, &fops_dbdc);
debugfs_create_file("fw_debug", 0600, dir, dev, &fops_fw_debug); debugfs_create_file("fw_debug", 0600, dir, dev, &fops_fw_debug);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "mt76x02.h" #include "mt76x02.h"
static int static int
mt76x02_ampdu_stat_read(struct seq_file *file, void *data) mt76x02_ampdu_stat_show(struct seq_file *file, void *data)
{ {
struct mt76x02_dev *dev = file->private; struct mt76x02_dev *dev = file->private;
int i, j; int i, j;
...@@ -31,11 +31,7 @@ mt76x02_ampdu_stat_read(struct seq_file *file, void *data) ...@@ -31,11 +31,7 @@ mt76x02_ampdu_stat_read(struct seq_file *file, void *data)
return 0; return 0;
} }
static int DEFINE_SHOW_ATTRIBUTE(mt76x02_ampdu_stat);
mt76x02_ampdu_stat_open(struct inode *inode, struct file *f)
{
return single_open(f, mt76x02_ampdu_stat_read, inode->i_private);
}
static int read_txpower(struct seq_file *file, void *data) static int read_txpower(struct seq_file *file, void *data)
{ {
...@@ -48,15 +44,8 @@ static int read_txpower(struct seq_file *file, void *data) ...@@ -48,15 +44,8 @@ static int read_txpower(struct seq_file *file, void *data)
return 0; return 0;
} }
static const struct file_operations fops_ampdu_stat = {
.open = mt76x02_ampdu_stat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int static int
mt76x02_dfs_stat_read(struct seq_file *file, void *data) mt76x02_dfs_stat_show(struct seq_file *file, void *data)
{ {
struct mt76x02_dev *dev = file->private; struct mt76x02_dev *dev = file->private;
struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd;
...@@ -81,18 +70,7 @@ mt76x02_dfs_stat_read(struct seq_file *file, void *data) ...@@ -81,18 +70,7 @@ mt76x02_dfs_stat_read(struct seq_file *file, void *data)
return 0; return 0;
} }
static int DEFINE_SHOW_ATTRIBUTE(mt76x02_dfs_stat);
mt76x02_dfs_stat_open(struct inode *inode, struct file *f)
{
return single_open(f, mt76x02_dfs_stat_read, inode->i_private);
}
static const struct file_operations fops_dfs_stat = {
.open = mt76x02_dfs_stat_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int read_agc(struct seq_file *file, void *data) static int read_agc(struct seq_file *file, void *data)
{ {
...@@ -150,8 +128,8 @@ void mt76x02_init_debugfs(struct mt76x02_dev *dev) ...@@ -150,8 +128,8 @@ void mt76x02_init_debugfs(struct mt76x02_dev *dev)
debugfs_create_bool("tpc", 0600, dir, &dev->enable_tpc); debugfs_create_bool("tpc", 0600, dir, &dev->enable_tpc);
debugfs_create_file("edcca", 0600, dir, dev, &fops_edcca); debugfs_create_file("edcca", 0600, dir, dev, &fops_edcca);
debugfs_create_file("ampdu_stat", 0400, dir, dev, &fops_ampdu_stat); debugfs_create_file("ampdu_stat", 0400, dir, dev, &mt76x02_ampdu_stat_fops);
debugfs_create_file("dfs_stats", 0400, dir, dev, &fops_dfs_stat); debugfs_create_file("dfs_stats", 0400, dir, dev, &mt76x02_dfs_stat_fops);
debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir, debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir,
read_txpower); read_txpower);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment