mt76: Convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Junlin Yang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Junlin Yang
2021-04-17 11:27:04 +02:00
committed by Felix Fietkau
parent 1622bf4f87
commit ef96fafad8
2 changed files with 9 additions and 45 deletions
+3 -15
View File
@@ -64,7 +64,7 @@ mt7921_ampdu_stat_read_phy(struct mt7921_phy *phy,
}
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;
@@ -90,19 +90,7 @@ mt7921_tx_stats_read(struct seq_file *file, void *data)
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)
@@ -328,7 +316,7 @@ int mt7921_init_debugfs(struct mt7921_dev *dev)
mt7921_queues_acq);
debugfs_create_devm_seqfile(dev->mt76.dev, "txpower_sku", dir,
mt7921_txpwr);
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,