summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt7615/usb.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2020-07-03 10:15:43 +0200
committerFelix Fietkau <nbd@nbd.name>2020-07-21 19:01:16 +0200
commitadfd5112c81b31cc4c9ac481bd0ad372149771ea (patch)
tree39d14565ae3a85f4987c880e9e7028db41f34f2f /drivers/net/wireless/mediatek/mt76/mt7615/usb.c
parent08523a2a1db5eba808de0ba0a7aa29cb993771dd (diff)
mt76: mt7615: introduce mt7615_mutex_{acquire,release} utilities
Introduce mt7615_mutex_{acquire,release} utility routines in order to switch in full-power/low-power before/after accessing device register-map Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7615/usb.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/usb.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/usb.c b/drivers/net/wireless/mediatek/mt76/mt7615/usb.c
index f70a7d9d65e2..a780127377bf 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/usb.c
@@ -201,12 +201,13 @@ void mt7663u_wtbl_work(struct work_struct *work)
dev = (struct mt7615_dev *)container_of(work, struct mt7615_dev,
wtbl_work);
+ mt7615_mutex_acquire(dev);
+
list_for_each_entry_safe(wd, wd_next, &dev->wd_head, node) {
spin_lock_bh(&dev->mt76.lock);
list_del(&wd->node);
spin_unlock_bh(&dev->mt76.lock);
- mutex_lock(&dev->mt76.mutex);
switch (wd->type) {
case MT7615_WTBL_RATE_DESC:
__mt7663u_mac_set_rates(dev, wd);
@@ -215,10 +216,10 @@ void mt7663u_wtbl_work(struct work_struct *work)
__mt7663u_mac_set_key(dev, wd);
break;
}
- mutex_unlock(&dev->mt76.mutex);
-
kfree(wd);
}
+
+ mt7615_mutex_release(dev);
}
static void
@@ -257,9 +258,9 @@ static bool mt7663u_tx_status_data(struct mt76_dev *mdev, u8 *update)
{
struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
mt7615_mac_sta_poll(dev);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return 0;
}