mt76x2: remove mt76x2_alloc_device routine
Remove mt76x2_alloc_device since it just runs mt76_alloc_device. Move mt76_alloc_device call in mt76x2_probe Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
fa2355265c
commit
ecd25b547d
|
@ -49,7 +49,6 @@ static inline bool mt76x2_channel_silent(struct mt76x02_dev *dev)
|
|||
|
||||
extern const struct ieee80211_ops mt76x2_ops;
|
||||
|
||||
struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev);
|
||||
int mt76x2_register_device(struct mt76x02_dev *dev);
|
||||
|
||||
void mt76x2_phy_power_on(struct mt76x02_dev *dev);
|
||||
|
|
|
@ -30,7 +30,19 @@ static const struct pci_device_id mt76pci_device_table[] = {
|
|||
static int
|
||||
mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
{
|
||||
static const struct mt76_driver_ops drv_ops = {
|
||||
.txwi_size = sizeof(struct mt76x02_txwi),
|
||||
.update_survey = mt76x02_update_channel,
|
||||
.tx_prepare_skb = mt76x02_tx_prepare_skb,
|
||||
.tx_complete_skb = mt76x02_tx_complete_skb,
|
||||
.rx_skb = mt76x02_queue_rx_skb,
|
||||
.rx_poll_complete = mt76x02_rx_poll_complete,
|
||||
.sta_ps = mt76x02_sta_ps,
|
||||
.sta_add = mt76x02_sta_add,
|
||||
.sta_remove = mt76x02_sta_remove,
|
||||
};
|
||||
struct mt76x02_dev *dev;
|
||||
struct mt76_dev *mdev;
|
||||
int ret;
|
||||
|
||||
ret = pcim_enable_device(pdev);
|
||||
|
@ -47,17 +59,19 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev = mt76x2_alloc_device(&pdev->dev);
|
||||
if (!dev)
|
||||
mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt76x2_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);
|
||||
mt76_mmio_init(mdev, pcim_iomap_table(pdev)[0]);
|
||||
mt76x2_reset_wlan(dev, false);
|
||||
|
||||
dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION);
|
||||
dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev);
|
||||
mdev->rev = mt76_rr(dev, MT_ASIC_VERSION);
|
||||
dev_info(mdev->dev, "ASIC revision: %08x\n", mdev->rev);
|
||||
|
||||
ret = devm_request_irq(dev->mt76.dev, pdev->irq, mt76x02_irq_handler,
|
||||
ret = devm_request_irq(mdev->dev, pdev->irq, mt76x02_irq_handler,
|
||||
IRQF_SHARED, KBUILD_MODNAME, dev);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
|
|
@ -313,32 +313,6 @@ void mt76x2_cleanup(struct mt76x02_dev *dev)
|
|||
mt76x02_mcu_cleanup(dev);
|
||||
}
|
||||
|
||||
struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev)
|
||||
{
|
||||
static const struct mt76_driver_ops drv_ops = {
|
||||
.txwi_size = sizeof(struct mt76x02_txwi),
|
||||
.update_survey = mt76x02_update_channel,
|
||||
.tx_prepare_skb = mt76x02_tx_prepare_skb,
|
||||
.tx_complete_skb = mt76x02_tx_complete_skb,
|
||||
.rx_skb = mt76x02_queue_rx_skb,
|
||||
.rx_poll_complete = mt76x02_rx_poll_complete,
|
||||
.sta_ps = mt76x02_sta_ps,
|
||||
.sta_add = mt76x02_sta_add,
|
||||
.sta_remove = mt76x02_sta_remove,
|
||||
};
|
||||
struct mt76x02_dev *dev;
|
||||
struct mt76_dev *mdev;
|
||||
|
||||
mdev = mt76_alloc_device(pdev, sizeof(*dev), &mt76x2_ops,
|
||||
&drv_ops);
|
||||
if (!mdev)
|
||||
return NULL;
|
||||
|
||||
dev = container_of(mdev, struct mt76x02_dev, mt76);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
int mt76x2_register_device(struct mt76x02_dev *dev)
|
||||
{
|
||||
int ret;
|
||||
|
|
Loading…
Reference in New Issue