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

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: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarDeren Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 2e7f7a2c
...@@ -254,23 +254,6 @@ static int mt7921u_probe(struct usb_interface *usb_intf, ...@@ -254,23 +254,6 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
return ret; return ret;
} }
static void mt7921u_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);
}
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int mt7921u_suspend(struct usb_interface *intf, pm_message_t state) static int mt7921u_suspend(struct usb_interface *intf, pm_message_t state)
{ {
...@@ -350,7 +333,7 @@ static struct usb_driver mt7921u_driver = { ...@@ -350,7 +333,7 @@ static struct usb_driver mt7921u_driver = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
.id_table = mt7921u_device_table, .id_table = mt7921u_device_table,
.probe = mt7921u_probe, .probe = mt7921u_probe,
.disconnect = mt7921u_disconnect, .disconnect = mt792xu_disconnect,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = mt7921u_suspend, .suspend = mt7921u_suspend,
.resume = mt7921u_resume, .resume = mt7921u_resume,
......
...@@ -336,7 +336,7 @@ u32 mt792xu_rr(struct mt76_dev *dev, u32 addr); ...@@ -336,7 +336,7 @@ u32 mt792xu_rr(struct mt76_dev *dev, u32 addr);
void mt792xu_wr(struct mt76_dev *dev, u32 addr, u32 val); void mt792xu_wr(struct mt76_dev *dev, u32 addr, u32 val);
u32 mt792xu_rmw(struct mt76_dev *dev, u32 addr, u32 mask, u32 val); u32 mt792xu_rmw(struct mt76_dev *dev, u32 addr, u32 mask, u32 val);
void mt792xu_copy(struct mt76_dev *dev, u32 offset, const void *data, int len); void mt792xu_copy(struct mt76_dev *dev, u32 offset, const void *data, int len);
void mt792xu_cleanup(struct mt792x_dev *dev); void mt792xu_disconnect(struct usb_interface *usb_intf);
int __mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev); int __mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev);
int mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev); int mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev);
......
...@@ -91,14 +91,13 @@ int mt792xu_mcu_power_on(struct mt792x_dev *dev) ...@@ -91,14 +91,13 @@ int mt792xu_mcu_power_on(struct mt792x_dev *dev)
} }
EXPORT_SYMBOL_GPL(mt792xu_mcu_power_on); 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); clear_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
mt792xu_wfsys_reset(dev); mt792xu_wfsys_reset(dev);
skb_queue_purge(&dev->mt76.mcu.res_q); skb_queue_purge(&dev->mt76.mcu.res_q);
mt76u_queues_deinit(&dev->mt76); mt76u_queues_deinit(&dev->mt76);
} }
EXPORT_SYMBOL_GPL(mt792xu_cleanup);
static u32 mt792xu_uhw_rr(struct mt76_dev *dev, u32 addr) static u32 mt792xu_uhw_rr(struct mt76_dev *dev, u32 addr)
{ {
...@@ -288,5 +287,23 @@ int mt792xu_init_reset(struct mt792x_dev *dev) ...@@ -288,5 +287,23 @@ int mt792xu_init_reset(struct mt792x_dev *dev)
} }
EXPORT_SYMBOL_GPL(mt792xu_init_reset); 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_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>"); MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
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