Commit 76055413 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: move mt76x02_debugfs in mt76x02-lib module

Move mt76x02_debugfs in mt76x02-lib module in order to
be reused by mt76x0 driver and remove duplicated code
Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 7dd73588
...@@ -14,7 +14,7 @@ CFLAGS_mt76x02_trace.o := -I$(src) ...@@ -14,7 +14,7 @@ CFLAGS_mt76x02_trace.o := -I$(src)
mt76x02-lib-y := mt76x02_util.o mt76x02_mac.o mt76x02_mcu.o \ mt76x02-lib-y := mt76x02_util.o mt76x02_mac.o mt76x02_mcu.o \
mt76x02_eeprom.o mt76x02_phy.o mt76x02_mmio.o \ mt76x02_eeprom.o mt76x02_phy.o mt76x02_mmio.o \
mt76x02_txrx.o mt76x02_trace.o mt76x02_txrx.o mt76x02_trace.o mt76x02_debugfs.o
mt76x02-usb-y := mt76x02_usb_mcu.o mt76x02_usb_core.o mt76x02-usb-y := mt76x02_usb_mcu.o mt76x02_usb_core.o
......
...@@ -162,6 +162,8 @@ void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev); ...@@ -162,6 +162,8 @@ void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev);
void mt76x02_set_irq_mask(struct mt76x02_dev *dev, u32 clear, u32 set); void mt76x02_set_irq_mask(struct mt76x02_dev *dev, u32 clear, u32 set);
void mt76x02_mac_start(struct mt76x02_dev *dev); void mt76x02_mac_start(struct mt76x02_dev *dev);
void mt76x02_init_debugfs(struct mt76x02_dev *dev);
static inline bool is_mt76x2(struct mt76x02_dev *dev) static inline bool is_mt76x2(struct mt76x02_dev *dev)
{ {
return mt76_chip(&dev->mt76) == 0x7612 || return mt76_chip(&dev->mt76) == 0x7612 ||
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
*/ */
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include "mt76x2.h" #include "mt76x02.h"
static int static int
mt76x2_ampdu_stat_read(struct seq_file *file, void *data) mt76x02_ampdu_stat_read(struct seq_file *file, void *data)
{ {
struct mt76x02_dev *dev = file->private; struct mt76x02_dev *dev = file->private;
int i, j; int i, j;
...@@ -42,9 +42,9 @@ mt76x2_ampdu_stat_read(struct seq_file *file, void *data) ...@@ -42,9 +42,9 @@ mt76x2_ampdu_stat_read(struct seq_file *file, void *data)
} }
static int static int
mt76x2_ampdu_stat_open(struct inode *inode, struct file *f) mt76x02_ampdu_stat_open(struct inode *inode, struct file *f)
{ {
return single_open(f, mt76x2_ampdu_stat_read, inode->i_private); 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)
...@@ -59,14 +59,14 @@ static int read_txpower(struct seq_file *file, void *data) ...@@ -59,14 +59,14 @@ static int read_txpower(struct seq_file *file, void *data)
} }
static const struct file_operations fops_ampdu_stat = { static const struct file_operations fops_ampdu_stat = {
.open = mt76x2_ampdu_stat_open, .open = mt76x02_ampdu_stat_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
static int static int
mt76x2_dfs_stat_read(struct seq_file *file, void *data) mt76x02_dfs_stat_read(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;
...@@ -92,13 +92,13 @@ mt76x2_dfs_stat_read(struct seq_file *file, void *data) ...@@ -92,13 +92,13 @@ mt76x2_dfs_stat_read(struct seq_file *file, void *data)
} }
static int static int
mt76x2_dfs_stat_open(struct inode *inode, struct file *f) mt76x02_dfs_stat_open(struct inode *inode, struct file *f)
{ {
return single_open(f, mt76x2_dfs_stat_read, inode->i_private); return single_open(f, mt76x02_dfs_stat_read, inode->i_private);
} }
static const struct file_operations fops_dfs_stat = { static const struct file_operations fops_dfs_stat = {
.open = mt76x2_dfs_stat_open, .open = mt76x02_dfs_stat_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
...@@ -116,7 +116,7 @@ static int read_agc(struct seq_file *file, void *data) ...@@ -116,7 +116,7 @@ static int read_agc(struct seq_file *file, void *data)
return 0; return 0;
} }
void mt76x2_init_debugfs(struct mt76x02_dev *dev) void mt76x02_init_debugfs(struct mt76x02_dev *dev)
{ {
struct dentry *dir; struct dentry *dir;
...@@ -134,4 +134,4 @@ void mt76x2_init_debugfs(struct mt76x02_dev *dev) ...@@ -134,4 +134,4 @@ void mt76x2_init_debugfs(struct mt76x02_dev *dev)
debugfs_create_devm_seqfile(dev->mt76.dev, "agc", dir, read_agc); debugfs_create_devm_seqfile(dev->mt76.dev, "agc", dir, read_agc);
} }
EXPORT_SYMBOL_GPL(mt76x2_init_debugfs); EXPORT_SYMBOL_GPL(mt76x02_init_debugfs);
...@@ -3,7 +3,7 @@ obj-$(CONFIG_MT76x2E) += mt76x2e.o ...@@ -3,7 +3,7 @@ obj-$(CONFIG_MT76x2E) += mt76x2e.o
obj-$(CONFIG_MT76x2U) += mt76x2u.o obj-$(CONFIG_MT76x2U) += mt76x2u.o
mt76x2-common-y := \ mt76x2-common-y := \
eeprom.o mac.o init.o phy.o debugfs.o mcu.o eeprom.o mac.o init.o phy.o mcu.o
mt76x2e-y := \ mt76x2e-y := \
pci.o pci_main.o pci_init.o pci_tx.o \ pci.o pci_main.o pci_init.o pci_tx.o \
......
...@@ -52,7 +52,6 @@ extern const struct ieee80211_ops mt76x2_ops; ...@@ -52,7 +52,6 @@ extern const struct ieee80211_ops mt76x2_ops;
struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev); struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev);
int mt76x2_register_device(struct mt76x02_dev *dev); int mt76x2_register_device(struct mt76x02_dev *dev);
void mt76x2_init_debugfs(struct mt76x02_dev *dev);
void mt76x2_init_device(struct mt76x02_dev *dev); void mt76x2_init_device(struct mt76x02_dev *dev);
void mt76x2_phy_power_on(struct mt76x02_dev *dev); void mt76x2_phy_power_on(struct mt76x02_dev *dev);
......
...@@ -515,7 +515,7 @@ int mt76x2_register_device(struct mt76x02_dev *dev) ...@@ -515,7 +515,7 @@ int mt76x2_register_device(struct mt76x02_dev *dev)
if (ret) if (ret)
goto fail; goto fail;
mt76x2_init_debugfs(dev); mt76x02_init_debugfs(dev);
mt76x2_init_txpower(dev, &dev->mt76.sband_2g.sband); mt76x2_init_txpower(dev, &dev->mt76.sband_2g.sband);
mt76x2_init_txpower(dev, &dev->mt76.sband_5g.sband); mt76x2_init_txpower(dev, &dev->mt76.sband_5g.sband);
......
...@@ -282,7 +282,7 @@ int mt76x2u_register_device(struct mt76x02_dev *dev) ...@@ -282,7 +282,7 @@ int mt76x2u_register_device(struct mt76x02_dev *dev)
set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state); set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
mt76x2_init_debugfs(dev); mt76x02_init_debugfs(dev);
mt76x2_init_txpower(dev, &dev->mt76.sband_2g.sband); mt76x2_init_txpower(dev, &dev->mt76.sband_2g.sband);
mt76x2_init_txpower(dev, &dev->mt76.sband_5g.sband); mt76x2_init_txpower(dev, &dev->mt76.sband_5g.sband);
......
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