wifi: mt76: mt7921s: fix race issue between reset and suspend/resume
authorSean Wang <sean.wang@mediatek.com>
Wed, 20 Jul 2022 22:25:38 +0000 (06:25 +0800)
committerFelix Fietkau <nbd@nbd.name>
Thu, 15 Sep 2022 10:53:57 +0000 (12:53 +0200)
commite86f10e6809add9132ecc2c6b3184ed59db7ca71
treedc23fbb103b58da8b99e3660cdec16c411c26b03
parentff6c4a6449793e9718ef2e9ad46864b63022648e
wifi: mt76: mt7921s: fix race issue between reset and suspend/resume

It is unexpected that the reset work is running simultaneously with
the suspend or resume context and it is possible that reset work is still
running even after mt7921 is suspended if we don't fix the race issue.

Thus, the suspend procedure should be waiting until the reset is completed
at the beginning and ignore the subsequent the reset requests.

In case there is an error that happens during either suspend or resume
handler, we will schedule a reset task to recover the error before
returning the error code to ensure we can immediately fix the error there.

Fixes: ca74b9b907f9 ("mt76: mt7921s: add reset support")
Co-developed-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7921/sdio.c