Skip to content

Commit

Permalink
mt76: mt7921: fix dma hang in rmmod
Browse files Browse the repository at this point in the history
The dma would be broken after rmmod flow. There are two different
cases causing this issue.
1. dma access without privilege.
2. hw access sequence borken by another context.

This patch handle both cases to avoid hw crash.

Fixes: 2b9ea5a ("mt76: mt7921: add mt7921_dma_cleanup in mt7921_unregister_device")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
deren authored and nbd168 committed Oct 20, 2021
1 parent 33920b2 commit a23f80a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt7921/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,17 @@ int mt7921_register_device(struct mt7921_dev *dev)

void mt7921_unregister_device(struct mt7921_dev *dev)
{
int i;
struct mt76_connac_pm *pm = &dev->pm;

mt76_unregister_device(&dev->mt76);
mt76_for_each_q_rx(&dev->mt76, i)
napi_disable(&dev->mt76.napi[i]);
cancel_delayed_work_sync(&pm->ps_work);
cancel_work_sync(&pm->wake_work);

mt7921_tx_token_put(dev);
mt7921_mcu_drv_pmctrl(dev);
mt7921_dma_cleanup(dev);
mt7921_mcu_exit(dev);

Expand Down

0 comments on commit a23f80a

Please sign in to comment.