summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2020-07-03 10:15:44 +0200
committerFelix Fietkau <nbd@nbd.name>2020-07-21 19:01:16 +0200
commitea4906c4be4944f8341d500f83267d1ba3e8e838 (patch)
tree9360616681a7c99b0b4d85df16325959e436f69b /drivers/net/wireless/mediatek
parentadfd5112c81b31cc4c9ac481bd0ad372149771ea (diff)
mt76: mt7615: wake device before accessing regmap in debugfs
Make sure the device is in full-power before reading regs in debugfs Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c
index 8bb7c64db738..8894a0ab407b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c
@@ -6,11 +6,16 @@ static int
mt7615_radar_pattern_set(void *data, u64 val)
{
struct mt7615_dev *dev = data;
+ int err;
if (!mt7615_wait_for_mcu_init(dev))
return 0;
- return mt7615_mcu_rdd_send_pattern(dev);
+ mt7615_mutex_acquire(dev);
+ err = mt7615_mcu_rdd_send_pattern(dev);
+ mt7615_mutex_release(dev);
+
+ return err;
}
DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_pattern, NULL,
@@ -84,7 +89,10 @@ mt7615_fw_debug_set(void *data, u64 val)
return 0;
dev->fw_debug = val;
+
+ mt7615_mutex_acquire(dev);
mt7615_mcu_fw_log_2_host(dev, dev->fw_debug ? 2 : 0);
+ mt7615_mutex_release(dev);
return 0;
}
@@ -111,6 +119,8 @@ mt7615_reset_test_set(void *data, u64 val)
if (!mt7615_wait_for_mcu_init(dev))
return 0;
+ mt7615_mutex_acquire(dev);
+
skb = alloc_skb(1, GFP_KERNEL);
if (!skb)
return -ENOMEM;
@@ -118,6 +128,8 @@ mt7615_reset_test_set(void *data, u64 val)
skb_put(skb, 1);
mt76_tx_queue_skb_raw(dev, 0, skb, 0);
+ mt7615_mutex_release(dev);
+
return 0;
}
@@ -167,9 +179,13 @@ mt7615_ampdu_stat_read(struct seq_file *file, void *data)
{
struct mt7615_dev *dev = file->private;
+ mt7615_mutex_acquire(dev);
+
mt7615_ampdu_stat_read_phy(&dev->phy, file);
mt7615_ampdu_stat_read_phy(mt7615_ext_phy(dev), file);
+ mt7615_mutex_release(dev);
+
return 0;
}
@@ -221,7 +237,10 @@ static int mt7615_read_temperature(struct seq_file *s, void *data)
return 0;
/* cpu */
+ mt7615_mutex_acquire(dev);
temp = mt7615_mcu_get_temperature(dev, 0);
+ mt7615_mutex_release(dev);
+
seq_printf(s, "Temperature: %d\n", temp);
return 0;
@@ -233,6 +252,8 @@ mt7615_queues_acq(struct seq_file *s, void *data)
struct mt7615_dev *dev = dev_get_drvdata(s->private);
int i;
+ mt7615_mutex_acquire(dev);
+
for (i = 0; i < 16; i++) {
int j, wmm_idx = i % MT7615_MAX_WMM_SETS;
int acs = i / MT7615_MAX_WMM_SETS;
@@ -253,6 +274,8 @@ mt7615_queues_acq(struct seq_file *s, void *data)
seq_printf(s, "AC%d%d: queued=%d\n", wmm_idx, acs, qlen);
}
+ mt7615_mutex_release(dev);
+
return 0;
}