summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
diff options
context:
space:
mode:
authorSean Wang <sean.wang@mediatek.com>2022-06-27 07:27:06 +0800
committerFelix Fietkau <nbd@nbd.name>2022-07-11 13:40:03 +0200
commit5163150a47af58e32940e5b223b97928ecae2b89 (patch)
treebf6d85e2f0a3bff8dfca6537297229e8ea73a951 /drivers/net/wireless/mediatek/mt76/mt7921/mac.c
parentaf1c9bb282861386dfa73e8f2d9bdb0dde5db481 (diff)
downloadlinux-stable-5163150a47af58e32940e5b223b97928ecae2b89.tar.gz
linux-stable-5163150a47af58e32940e5b223b97928ecae2b89.tar.bz2
linux-stable-5163150a47af58e32940e5b223b97928ecae2b89.zip
mt76: mt7921: reduce the mutex lock scope during reset
Reduce the mutex lock scope for reset to get rid of possible task hung e.g wpa_supplicant and to allow the user-space process to keep running during we need more retries to complete the reset. Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Suggested-by: YN Chen <YN.Chen@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7921/mac.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7921/mac.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index a07e9a4c2ea3..47f0aa81ab02 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -738,7 +738,7 @@ void mt7921_mac_reset_work(struct work_struct *work)
reset_work);
struct ieee80211_hw *hw = mt76_hw(dev);
struct mt76_connac_pm *pm = &dev->pm;
- int i;
+ int i, ret;
dev_dbg(dev->mt76.dev, "chip reset\n");
dev->hw_full_reset = true;
@@ -748,11 +748,14 @@ void mt7921_mac_reset_work(struct work_struct *work)
cancel_delayed_work_sync(&pm->ps_work);
cancel_work_sync(&pm->wake_work);
- mutex_lock(&dev->mt76.mutex);
- for (i = 0; i < 10; i++)
- if (!mt7921_dev_reset(dev))
+ for (i = 0; i < 10; i++) {
+ mutex_lock(&dev->mt76.mutex);
+ ret = mt7921_dev_reset(dev);
+ mutex_unlock(&dev->mt76.mutex);
+
+ if (!ret)
break;
- mutex_unlock(&dev->mt76.mutex);
+ }
if (i == 10)
dev_err(dev->mt76.dev, "chip reset failed\n");