forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/wireless/mediatek/mt7601u/debugfs.c
....@@ -1,15 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
34 * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2
7
- * as published by the Free Software Foundation
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
135 */
146
157 #include <linux/debugfs.h>
....@@ -35,10 +27,10 @@
3527 return 0;
3628 }
3729
38
-DEFINE_SIMPLE_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, "0x%08llx\n");
30
+DEFINE_DEBUGFS_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, "0x%08llx\n");
3931
4032 static int
41
-mt7601u_ampdu_stat_read(struct seq_file *file, void *data)
33
+mt7601u_ampdu_stat_show(struct seq_file *file, void *data)
4234 {
4335 struct mt7601u_dev *dev = file->private;
4436 int i, j;
....@@ -81,21 +73,10 @@
8173 return 0;
8274 }
8375
84
-static int
85
-mt7601u_ampdu_stat_open(struct inode *inode, struct file *f)
86
-{
87
- return single_open(f, mt7601u_ampdu_stat_read, inode->i_private);
88
-}
89
-
90
-static const struct file_operations fops_ampdu_stat = {
91
- .open = mt7601u_ampdu_stat_open,
92
- .read = seq_read,
93
- .llseek = seq_lseek,
94
- .release = single_release,
95
-};
76
+DEFINE_SHOW_ATTRIBUTE(mt7601u_ampdu_stat);
9677
9778 static int
98
-mt7601u_eeprom_param_read(struct seq_file *file, void *data)
79
+mt7601u_eeprom_param_show(struct seq_file *file, void *data)
9980 {
10081 struct mt7601u_dev *dev = file->private;
10182 struct mt7601u_rate_power *rp = &dev->ee->power_rate_table;
....@@ -139,18 +120,7 @@
139120 return 0;
140121 }
141122
142
-static int
143
-mt7601u_eeprom_param_open(struct inode *inode, struct file *f)
144
-{
145
- return single_open(f, mt7601u_eeprom_param_read, inode->i_private);
146
-}
147
-
148
-static const struct file_operations fops_eeprom_param = {
149
- .open = mt7601u_eeprom_param_open,
150
- .read = seq_read,
151
- .llseek = seq_lseek,
152
- .release = single_release,
153
-};
123
+DEFINE_SHOW_ATTRIBUTE(mt7601u_eeprom_param);
154124
155125 void mt7601u_init_debugfs(struct mt7601u_dev *dev)
156126 {
....@@ -165,6 +135,6 @@
165135
166136 debugfs_create_u32("regidx", 0600, dir, &dev->debugfs_reg);
167137 debugfs_create_file("regval", 0600, dir, dev, &fops_regval);
168
- debugfs_create_file("ampdu_stat", 0400, dir, dev, &fops_ampdu_stat);
169
- debugfs_create_file("eeprom_param", 0400, dir, dev, &fops_eeprom_param);
138
+ debugfs_create_file("ampdu_stat", 0400, dir, dev, &mt7601u_ampdu_stat_fops);
139
+ debugfs_create_file("eeprom_param", 0400, dir, dev, &mt7601u_eeprom_param_fops);
170140 }