summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2023-06-28 15:07:24 +0800
committerFelix Fietkau <nbd@nbd.name>2023-07-26 11:36:17 +0200
commitfc80731ba06316da80be2993c91c315c9923dac0 (patch)
tree8e56816e04cde93e0b26ec2ba8d1568c0da86f55 /drivers/net/wireless/mediatek/mt76/mt792x_usb.c
parent2e7f7a2c871cd3b4a01c0a325f86f5b112f3b50f (diff)
wifi: mt76: mt7921: move mt7921u_disconnect mt792x-lib
mt7921u_disconnect routine is shared between mt7921 and mt7925 so move it in mt792x-usb module. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt792x_usb.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt792x_usb.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_usb.c b/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
index 97480c9c9974..20e7f9c7c88c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_usb.c
@@ -91,14 +91,13 @@ int mt792xu_mcu_power_on(struct mt792x_dev *dev)
}
EXPORT_SYMBOL_GPL(mt792xu_mcu_power_on);
-void mt792xu_cleanup(struct mt792x_dev *dev)
+static void mt792xu_cleanup(struct mt792x_dev *dev)
{
clear_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
mt792xu_wfsys_reset(dev);
skb_queue_purge(&dev->mt76.mcu.res_q);
mt76u_queues_deinit(&dev->mt76);
}
-EXPORT_SYMBOL_GPL(mt792xu_cleanup);
static u32 mt792xu_uhw_rr(struct mt76_dev *dev, u32 addr)
{
@@ -288,5 +287,23 @@ int mt792xu_init_reset(struct mt792x_dev *dev)
}
EXPORT_SYMBOL_GPL(mt792xu_init_reset);
+void mt792xu_disconnect(struct usb_interface *usb_intf)
+{
+ struct mt792x_dev *dev = usb_get_intfdata(usb_intf);
+
+ cancel_work_sync(&dev->init_work);
+ if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
+ return;
+
+ mt76_unregister_device(&dev->mt76);
+ mt792xu_cleanup(dev);
+
+ usb_set_intfdata(usb_intf, NULL);
+ usb_put_dev(interface_to_usbdev(usb_intf));
+
+ mt76_free_device(&dev->mt76);
+}
+EXPORT_SYMBOL_GPL(mt792xu_disconnect);
+
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");