From 61311d9b307a1e1549a325ede691906392dc99ad Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Wed, 27 Mar 2019 12:41:03 +0100 Subject: [PATCH] mt76: introduce mt76_free_device routine Move mt76_tx_free in mt76_free_device routine in order to unmap all txwi descriptors at module unload Signed-off-by: Lorenzo Bianconi --- mac80211.c | 8 +++++++- mt76.h | 1 + mt7603/init.c | 2 +- mt76x0/pci.c | 2 +- mt76x2/pci.c | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mac80211.c b/mac80211.c index b7861e41..60b86ca0 100644 --- a/mac80211.c +++ b/mac80211.c @@ -369,10 +369,16 @@ void mt76_unregister_device(struct mt76_dev *dev) mt76_tx_status_check(dev, NULL, true); ieee80211_unregister_hw(hw); - mt76_tx_free(dev); } EXPORT_SYMBOL_GPL(mt76_unregister_device); +void mt76_free_device(struct mt76_dev *dev) +{ + mt76_tx_free(dev); + ieee80211_free_hw(dev->hw); +} +EXPORT_SYMBOL_GPL(mt76_free_device); + void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb) { if (!test_bit(MT76_STATE_RUNNING, &dev->state)) { diff --git a/mt76.h b/mt76.h index 450fd65b..8de856fe 100644 --- a/mt76.h +++ b/mt76.h @@ -606,6 +606,7 @@ struct mt76_dev *mt76_alloc_device(struct device *pdev, unsigned int size, int mt76_register_device(struct mt76_dev *dev, bool vht, struct ieee80211_rate *rates, int n_rates); void mt76_unregister_device(struct mt76_dev *dev); +void mt76_free_device(struct mt76_dev *dev); struct dentry *mt76_register_debugfs(struct mt76_dev *dev); void mt76_seq_puts_array(struct seq_file *file, const char *str, diff --git a/mt7603/init.c b/mt7603/init.c index e4f9db6b..0bec409d 100644 --- a/mt7603/init.c +++ b/mt7603/init.c @@ -578,5 +578,5 @@ void mt7603_unregister_device(struct mt7603_dev *dev) mt76_unregister_device(&dev->mt76); mt7603_mcu_exit(dev); mt7603_dma_cleanup(dev); - ieee80211_free_hw(mt76_hw(dev)); + mt76_free_device(&dev->mt76); } diff --git a/mt76x0/pci.c b/mt76x0/pci.c index 26c22fd5..3c1f3852 100644 --- a/mt76x0/pci.c +++ b/mt76x0/pci.c @@ -233,7 +233,7 @@ mt76x0e_remove(struct pci_dev *pdev) mt76_unregister_device(mdev); mt76x0e_cleanup(dev); - ieee80211_free_hw(mdev->hw); + mt76_free_device(mdev); } static const struct pci_device_id mt76x0e_device_table[] = { diff --git a/mt76x2/pci.c b/mt76x2/pci.c index 6274655e..cab00d0b 100644 --- a/mt76x2/pci.c +++ b/mt76x2/pci.c @@ -106,7 +106,7 @@ mt76pci_remove(struct pci_dev *pdev) mt76_unregister_device(mdev); mt76x2_cleanup(dev); - ieee80211_free_hw(mdev->hw); + mt76_free_device(mdev); } MODULE_DEVICE_TABLE(pci, mt76pci_device_table);