Commit def34a2f authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

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: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent e5fc742f
...@@ -369,10 +369,16 @@ void mt76_unregister_device(struct mt76_dev *dev) ...@@ -369,10 +369,16 @@ void mt76_unregister_device(struct mt76_dev *dev)
mt76_tx_status_check(dev, NULL, true); mt76_tx_status_check(dev, NULL, true);
ieee80211_unregister_hw(hw); ieee80211_unregister_hw(hw);
mt76_tx_free(dev);
} }
EXPORT_SYMBOL_GPL(mt76_unregister_device); 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) void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb)
{ {
if (!test_bit(MT76_STATE_RUNNING, &dev->state)) { if (!test_bit(MT76_STATE_RUNNING, &dev->state)) {
......
...@@ -605,6 +605,7 @@ struct mt76_dev *mt76_alloc_device(struct device *pdev, unsigned int size, ...@@ -605,6 +605,7 @@ struct mt76_dev *mt76_alloc_device(struct device *pdev, unsigned int size,
int mt76_register_device(struct mt76_dev *dev, bool vht, int mt76_register_device(struct mt76_dev *dev, bool vht,
struct ieee80211_rate *rates, int n_rates); struct ieee80211_rate *rates, int n_rates);
void mt76_unregister_device(struct mt76_dev *dev); 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); struct dentry *mt76_register_debugfs(struct mt76_dev *dev);
void mt76_seq_puts_array(struct seq_file *file, const char *str, void mt76_seq_puts_array(struct seq_file *file, const char *str,
......
...@@ -576,5 +576,5 @@ void mt7603_unregister_device(struct mt7603_dev *dev) ...@@ -576,5 +576,5 @@ void mt7603_unregister_device(struct mt7603_dev *dev)
mt76_unregister_device(&dev->mt76); mt76_unregister_device(&dev->mt76);
mt7603_mcu_exit(dev); mt7603_mcu_exit(dev);
mt7603_dma_cleanup(dev); mt7603_dma_cleanup(dev);
ieee80211_free_hw(mt76_hw(dev)); mt76_free_device(&dev->mt76);
} }
...@@ -234,7 +234,7 @@ mt76x0e_remove(struct pci_dev *pdev) ...@@ -234,7 +234,7 @@ mt76x0e_remove(struct pci_dev *pdev)
mt76_unregister_device(mdev); mt76_unregister_device(mdev);
mt76x0e_cleanup(dev); mt76x0e_cleanup(dev);
ieee80211_free_hw(mdev->hw); mt76_free_device(mdev);
} }
static const struct pci_device_id mt76x0e_device_table[] = { static const struct pci_device_id mt76x0e_device_table[] = {
......
...@@ -107,7 +107,7 @@ mt76pci_remove(struct pci_dev *pdev) ...@@ -107,7 +107,7 @@ mt76pci_remove(struct pci_dev *pdev)
mt76_unregister_device(mdev); mt76_unregister_device(mdev);
mt76x2_cleanup(dev); mt76x2_cleanup(dev);
ieee80211_free_hw(mdev->hw); mt76_free_device(mdev);
} }
MODULE_DEVICE_TABLE(pci, mt76pci_device_table); MODULE_DEVICE_TABLE(pci, mt76pci_device_table);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment