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

mt76: move rate_txpower handler in mt76 debugfs

Move rate_txpower handler in mt76 debugfs in order to be reused
in 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 b9f192b8
......@@ -68,6 +68,23 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str,
}
EXPORT_SYMBOL_GPL(mt76_seq_puts_array);
static int mt76_read_rate_txpower(struct seq_file *s, void *data)
{
struct mt76_dev *dev = dev_get_drvdata(s->private);
mt76_seq_puts_array(s, "CCK", dev->rate_power.cck,
ARRAY_SIZE(dev->rate_power.cck));
mt76_seq_puts_array(s, "OFDM", dev->rate_power.ofdm,
ARRAY_SIZE(dev->rate_power.ofdm));
mt76_seq_puts_array(s, "STBC", dev->rate_power.stbc,
ARRAY_SIZE(dev->rate_power.stbc));
mt76_seq_puts_array(s, "HT", dev->rate_power.ht,
ARRAY_SIZE(dev->rate_power.ht));
mt76_seq_puts_array(s, "VHT", dev->rate_power.vht,
ARRAY_SIZE(dev->rate_power.vht));
return 0;
}
struct dentry *mt76_register_debugfs(struct mt76_dev *dev)
{
struct dentry *dir;
......@@ -84,6 +101,8 @@ struct dentry *mt76_register_debugfs(struct mt76_dev *dev)
if (dev->otp.data)
debugfs_create_blob("otp", 0400, dir, &dev->otp);
debugfs_create_devm_seqfile(dev->dev, "queues", dir, mt76_queues_read);
debugfs_create_devm_seqfile(dev->dev, "rate_txpower", dir,
mt76_read_rate_txpower);
return dir;
}
......
......@@ -55,16 +55,6 @@ static int read_txpower(struct seq_file *file, void *data)
mt76_seq_puts_array(file, "Delta", dev->target_power_delta,
ARRAY_SIZE(dev->target_power_delta));
mt76_seq_puts_array(file, "CCK", dev->mt76.rate_power.cck,
ARRAY_SIZE(dev->mt76.rate_power.cck));
mt76_seq_puts_array(file, "OFDM", dev->mt76.rate_power.ofdm,
ARRAY_SIZE(dev->mt76.rate_power.ofdm));
mt76_seq_puts_array(file, "STBC", dev->mt76.rate_power.stbc,
ARRAY_SIZE(dev->mt76.rate_power.stbc));
mt76_seq_puts_array(file, "HT", dev->mt76.rate_power.ht,
ARRAY_SIZE(dev->mt76.rate_power.ht));
mt76_seq_puts_array(file, "VHT", dev->mt76.rate_power.vht,
ARRAY_SIZE(dev->mt76.rate_power.vht));
return 0;
}
......
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