mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-19 11:17:18 +07:00
mt76x0: remove mt76x0u_alloc_device routine
Remove mt76x0u_alloc_device since it just runs mt76_alloc_device. Move mt76_alloc_device call in mt76x0u_probe and in mt76x0e_probe Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
3bfaa974de
commit
fa2355265c
@ -262,25 +262,6 @@ int mt76x0_init_hardware(struct mt76x02_dev *dev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x0_init_hardware);
|
||||
|
||||
struct mt76x02_dev *
|
||||
mt76x0_alloc_device(struct device *pdev,
|
||||
const struct mt76_driver_ops *drv_ops,
|
||||
const struct ieee80211_ops *ops)
|
||||
{
|
||||
struct mt76x02_dev *dev;
|
||||
struct mt76_dev *mdev;
|
||||
|
||||
mdev = mt76_alloc_device(pdev, sizeof(*dev), ops, drv_ops);
|
||||
if (!mdev)
|
||||
return NULL;
|
||||
|
||||
dev = container_of(mdev, struct mt76x02_dev, mt76);
|
||||
mutex_init(&dev->phy_mutex);
|
||||
|
||||
return dev;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x0_alloc_device);
|
||||
|
||||
int mt76x0_register_device(struct mt76x02_dev *dev)
|
||||
{
|
||||
int ret;
|
||||
|
@ -50,10 +50,6 @@ static inline bool is_mt7630(struct mt76x02_dev *dev)
|
||||
}
|
||||
|
||||
/* Init */
|
||||
struct mt76x02_dev *
|
||||
mt76x0_alloc_device(struct device *pdev,
|
||||
const struct mt76_driver_ops *drv_ops,
|
||||
const struct ieee80211_ops *ops);
|
||||
int mt76x0_init_hardware(struct mt76x02_dev *dev);
|
||||
int mt76x0_register_device(struct mt76x02_dev *dev);
|
||||
void mt76x0_chip_onoff(struct mt76x02_dev *dev, bool enable, bool reset);
|
||||
|
@ -174,6 +174,7 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
.sta_remove = mt76x02_sta_remove,
|
||||
};
|
||||
struct mt76x02_dev *dev;
|
||||
struct mt76_dev *mdev;
|
||||
int ret;
|
||||
|
||||
ret = pcim_enable_device(pdev);
|
||||
@ -190,16 +191,20 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev = mt76x0_alloc_device(&pdev->dev, &drv_ops, &mt76x0e_ops);
|
||||
if (!dev)
|
||||
mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt76x0e_ops,
|
||||
&drv_ops);
|
||||
if (!mdev)
|
||||
return -ENOMEM;
|
||||
|
||||
mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]);
|
||||
dev = container_of(mdev, struct mt76x02_dev, mt76);
|
||||
mutex_init(&dev->phy_mutex);
|
||||
|
||||
dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION);
|
||||
dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev);
|
||||
mt76_mmio_init(mdev, pcim_iomap_table(pdev)[0]);
|
||||
|
||||
ret = devm_request_irq(dev->mt76.dev, pdev->irq, mt76x02_irq_handler,
|
||||
mdev->rev = mt76_rr(dev, MT_ASIC_VERSION);
|
||||
dev_info(mdev->dev, "ASIC revision: %08x\n", mdev->rev);
|
||||
|
||||
ret = devm_request_irq(mdev->dev, pdev->irq, mt76x02_irq_handler,
|
||||
IRQF_SHARED, KBUILD_MODNAME, dev);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
@ -233,14 +233,18 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
|
||||
};
|
||||
struct usb_device *usb_dev = interface_to_usbdev(usb_intf);
|
||||
struct mt76x02_dev *dev;
|
||||
struct mt76_dev *mdev;
|
||||
u32 asic_rev, mac_rev;
|
||||
int ret;
|
||||
|
||||
dev = mt76x0_alloc_device(&usb_intf->dev, &drv_ops,
|
||||
&mt76x0u_ops);
|
||||
if (!dev)
|
||||
mdev = mt76_alloc_device(&usb_intf->dev, sizeof(*dev), &mt76x0u_ops,
|
||||
&drv_ops);
|
||||
if (!mdev)
|
||||
return -ENOMEM;
|
||||
|
||||
dev = container_of(mdev, struct mt76x02_dev, mt76);
|
||||
mutex_init(&dev->phy_mutex);
|
||||
|
||||
/* Quirk for Archer T1U */
|
||||
if (id->driver_info)
|
||||
dev->no_2ghz = true;
|
||||
@ -250,27 +254,27 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
|
||||
|
||||
usb_set_intfdata(usb_intf, dev);
|
||||
|
||||
mt76x02u_init_mcu(&dev->mt76);
|
||||
ret = mt76u_init(&dev->mt76, usb_intf);
|
||||
mt76x02u_init_mcu(mdev);
|
||||
ret = mt76u_init(mdev, usb_intf);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
/* Disable the HW, otherwise MCU fail to initalize on hot reboot */
|
||||
mt76x0_chip_onoff(dev, false, false);
|
||||
|
||||
if (!mt76x02_wait_for_mac(&dev->mt76)) {
|
||||
if (!mt76x02_wait_for_mac(mdev)) {
|
||||
ret = -ETIMEDOUT;
|
||||
goto err;
|
||||
}
|
||||
|
||||
asic_rev = mt76_rr(dev, MT_ASIC_VERSION);
|
||||
mac_rev = mt76_rr(dev, MT_MAC_CSR0);
|
||||
dev_info(dev->mt76.dev, "ASIC revision: %08x MAC revision: %08x\n",
|
||||
dev_info(mdev->dev, "ASIC revision: %08x MAC revision: %08x\n",
|
||||
asic_rev, mac_rev);
|
||||
|
||||
/* Note: vendor driver skips this check for MT76X0U */
|
||||
if (!(mt76_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL))
|
||||
dev_warn(dev->mt76.dev, "Warning: eFUSE not present\n");
|
||||
dev_warn(mdev->dev, "Warning: eFUSE not present\n");
|
||||
|
||||
ret = mt76x0u_register_device(dev);
|
||||
if (ret < 0)
|
||||
@ -282,7 +286,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
|
||||
usb_set_intfdata(usb_intf, NULL);
|
||||
usb_put_dev(interface_to_usbdev(usb_intf));
|
||||
|
||||
ieee80211_free_hw(dev->mt76.hw);
|
||||
ieee80211_free_hw(mdev->hw);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user