mt76: move seq_put_array in mt76-core module
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Thu, 20 Sep 2018 09:11:48 +0000 (11:11 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 1 Oct 2018 10:33:38 +0000 (12:33 +0200)
Move seq_put_array utility routine in mt76-core module
in order to be reused in mt76x0 driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/debugfs.c
drivers/net/wireless/mediatek/mt76/mt76.h
drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c

index a38d05d..03ce635 100644 (file)
@@ -56,6 +56,18 @@ mt76_queues_read(struct seq_file *s, void *data)
        return 0;
 }
 
+void mt76_seq_puts_array(struct seq_file *file, const char *str,
+                        s8 *val, int len)
+{
+       int i;
+
+       seq_printf(file, "%10s:", str);
+       for (i = 0; i < len; i++)
+               seq_printf(file, " %2d", val[i]);
+       seq_puts(file, "\n");
+}
+EXPORT_SYMBOL_GPL(mt76_seq_puts_array);
+
 struct dentry *mt76_register_debugfs(struct mt76_dev *dev)
 {
        struct dentry *dir;
index dbda492..b498095 100644 (file)
@@ -539,6 +539,8 @@ int mt76_register_device(struct mt76_dev *dev, bool vht,
 void mt76_unregister_device(struct mt76_dev *dev);
 
 struct dentry *mt76_register_debugfs(struct mt76_dev *dev);
+void mt76_seq_puts_array(struct seq_file *file, const char *str,
+                        s8 *val, int len);
 
 int mt76_eeprom_init(struct mt76_dev *dev, int len);
 void mt76_eeprom_override(struct mt76_dev *dev);
index 77b5ff1..2cd0d82 100644 (file)
@@ -47,33 +47,22 @@ mt76x2_ampdu_stat_open(struct inode *inode, struct file *f)
        return single_open(f, mt76x2_ampdu_stat_read, inode->i_private);
 }
 
-static void
-seq_puts_array(struct seq_file *file, const char *str, s8 *val, int len)
-{
-       int i;
-
-       seq_printf(file, "%10s:", str);
-       for (i = 0; i < len; i++)
-               seq_printf(file, " %2d", val[i]);
-       seq_puts(file, "\n");
-}
-
 static int read_txpower(struct seq_file *file, void *data)
 {
        struct mt76x2_dev *dev = dev_get_drvdata(file->private);
 
        seq_printf(file, "Target power: %d\n", dev->target_power);
 
-       seq_puts_array(file, "Delta", dev->target_power_delta,
-                      ARRAY_SIZE(dev->target_power_delta));
-       seq_puts_array(file, "CCK", dev->rate_power.cck,
-                      ARRAY_SIZE(dev->rate_power.cck));
-       seq_puts_array(file, "OFDM", dev->rate_power.ofdm,
-                      ARRAY_SIZE(dev->rate_power.ofdm));
-       seq_puts_array(file, "HT", dev->rate_power.ht,
-                      ARRAY_SIZE(dev->rate_power.ht));
-       seq_puts_array(file, "VHT", dev->rate_power.vht,
-                      ARRAY_SIZE(dev->rate_power.vht));
+       mt76_seq_puts_array(file, "Delta", dev->target_power_delta,
+                           ARRAY_SIZE(dev->target_power_delta));
+       mt76_seq_puts_array(file, "CCK", dev->rate_power.cck,
+                           ARRAY_SIZE(dev->rate_power.cck));
+       mt76_seq_puts_array(file, "OFDM", dev->rate_power.ofdm,
+                           ARRAY_SIZE(dev->rate_power.ofdm));
+       mt76_seq_puts_array(file, "HT", dev->rate_power.ht,
+                           ARRAY_SIZE(dev->rate_power.ht));
+       mt76_seq_puts_array(file, "VHT", dev->rate_power.vht,
+                           ARRAY_SIZE(dev->rate_power.vht));
        return 0;
 }