]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mt76x2u: remove mt76x2u_alloc_device routine
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Thu, 31 Jan 2019 16:55:55 +0000 (17:55 +0100)
committerFelix Fietkau <nbd@nbd.name>
Mon, 18 Feb 2019 18:54:34 +0000 (19:54 +0100)
Remove mt76x2u_alloc_device since it just runs mt76_alloc_device.
Move mt76_alloc_device call in mt76x2u_probe

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2u.h
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c

index 0b0075411b34db77c7fb35b33628075d58d6301f..787cdfdf5db57bc07948b6ae410f6cedc5226c4f 100644 (file)
@@ -29,7 +29,6 @@
 
 extern const struct ieee80211_ops mt76x2u_ops;
 
-struct mt76x02_dev *mt76x2u_alloc_device(struct device *pdev);
 int mt76x2u_register_device(struct mt76x02_dev *dev);
 int mt76x2u_init_hardware(struct mt76x02_dev *dev);
 void mt76x2u_cleanup(struct mt76x02_dev *dev);
index 4d1788eb3812a2f2dd72a350ab4429fb8cb1e4c8..f81a85e9692270fa3f6e542a7e1b139d7736cdd8 100644 (file)
@@ -36,24 +36,36 @@ static const struct usb_device_id mt76x2u_device_table[] = {
 static int mt76x2u_probe(struct usb_interface *intf,
                         const struct usb_device_id *id)
 {
+       static const struct mt76_driver_ops drv_ops = {
+               .tx_prepare_skb = mt76x02u_tx_prepare_skb,
+               .tx_complete_skb = mt76x02u_tx_complete_skb,
+               .tx_status_data = mt76x02_tx_status_data,
+               .rx_skb = mt76x02_queue_rx_skb,
+               .sta_add = mt76x02_sta_add,
+               .sta_remove = mt76x02_sta_remove,
+       };
        struct usb_device *udev = interface_to_usbdev(intf);
        struct mt76x02_dev *dev;
+       struct mt76_dev *mdev;
        int err;
 
-       dev = mt76x2u_alloc_device(&intf->dev);
-       if (!dev)
+       mdev = mt76_alloc_device(&intf->dev, sizeof(*dev), &mt76x2u_ops,
+                                &drv_ops);
+       if (!mdev)
                return -ENOMEM;
 
+       dev = container_of(mdev, struct mt76x02_dev, mt76);
+
        udev = usb_get_dev(udev);
        usb_reset_device(udev);
 
-       mt76x02u_init_mcu(&dev->mt76);
-       err = mt76u_init(&dev->mt76, intf);
+       mt76x02u_init_mcu(mdev);
+       err = mt76u_init(mdev, intf);
        if (err < 0)
                goto err;
 
-       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);
 
        err = mt76x2u_register_device(dev);
        if (err < 0)
index 11ce106391e19419dc69a083480b310e1323e52b..006e430e374edb04dd927068dcd2fc9ae3f47acd 100644 (file)
@@ -134,29 +134,6 @@ static int mt76x2u_init_eeprom(struct mt76x02_dev *dev)
        return 0;
 }
 
-struct mt76x02_dev *mt76x2u_alloc_device(struct device *pdev)
-{
-       static const struct mt76_driver_ops drv_ops = {
-               .tx_prepare_skb = mt76x02u_tx_prepare_skb,
-               .tx_complete_skb = mt76x02u_tx_complete_skb,
-               .tx_status_data = mt76x02_tx_status_data,
-               .rx_skb = mt76x02_queue_rx_skb,
-               .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), &mt76x2u_ops,
-                                &drv_ops);
-       if (!mdev)
-               return NULL;
-
-       dev = container_of(mdev, struct mt76x02_dev, mt76);
-
-       return dev;
-}
-
 int mt76x2u_init_hardware(struct mt76x02_dev *dev)
 {
        int i, k, err;