]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mt76x0: make device allocation bus neutral
authorStanislaw Gruszka <sgruszka@redhat.com>
Thu, 6 Sep 2018 09:18:58 +0000 (11:18 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 19 Sep 2018 10:31:14 +0000 (12:31 +0200)
Remove some USB specific code form mt76x0_alloc_device.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x0/init.c
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c

index 4a899904d51810ccf27dfcf126f9bca7143d8a52..9c720906ea13269995635145ea661d89be52fe41 100644 (file)
@@ -482,14 +482,9 @@ void mt76x0_cleanup(struct mt76x0_dev *dev)
 }
 EXPORT_SYMBOL_GPL(mt76x0_cleanup);
 
-struct mt76x0_dev *mt76x0_alloc_device(struct device *pdev)
+struct mt76x0_dev *
+mt76x0_alloc_device(struct device *pdev, const struct mt76_driver_ops *drv_ops)
 {
-       static const struct mt76_driver_ops drv_ops = {
-               .tx_prepare_skb = mt76x0_tx_prepare_skb,
-               .tx_complete_skb = mt76x02_tx_complete_skb,
-               .tx_status_data = mt76x02_tx_status_data,
-               .rx_skb = mt76x0_queue_rx_skb,
-       };
        struct mt76x0_dev *dev;
        struct mt76_dev *mdev;
 
@@ -498,7 +493,7 @@ struct mt76x0_dev *mt76x0_alloc_device(struct device *pdev)
                return NULL;
 
        mdev->dev = pdev;
-       mdev->drv = &drv_ops;
+       mdev->drv = drv_ops;
 
        dev = container_of(mdev, struct mt76x0_dev, mt76);
        mutex_init(&dev->reg_atomic_mutex);
index 31267a1805733a15455c7bb18957b415dac996a7..87eb084bd270a191002ae4ef9d208d2cc5969400 100644 (file)
@@ -134,7 +134,8 @@ int mt76x0_burst_write_regs(struct mt76x0_dev *dev, u32 offset,
                             const u32 *data, int n);
 
 /* Init */
-struct mt76x0_dev *mt76x0_alloc_device(struct device *dev);
+struct mt76x0_dev *
+mt76x0_alloc_device(struct device *pdev, const struct mt76_driver_ops *drv_ops);
 int mt76x0_init_hardware(struct mt76x0_dev *dev);
 int mt76x0_register_device(struct mt76x0_dev *dev);
 void mt76x0_cleanup(struct mt76x0_dev *dev);
index 244ab64560a634c5abdf0eab3896c41cdcfe1d5b..eb383f96ec9a3f32ca214182bc61d2dee0a2e4a2 100644 (file)
@@ -40,7 +40,7 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        if (ret)
                return ret;
 
-       dev = mt76x0_alloc_device(&pdev->dev);
+       dev = mt76x0_alloc_device(&pdev->dev, NULL);
        if (!dev)
                return -ENOMEM;
 
index 4058dae1368fe9fba35663680c5735d83142017d..3618f92662f81eab25ff46b43b23570e91be5962 100644 (file)
@@ -95,6 +95,7 @@ int mt76x0_tx_prepare_skb(struct mt76_dev *mdev, void *data,
 
        return mt76x02_set_txinfo(skb, wcid, q2ep(q->hw_idx));
 }
+EXPORT_SYMBOL_GPL(mt76x0_tx_prepare_skb);
 
 void mt76x0_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
                         struct sk_buff *skb)
@@ -110,4 +111,4 @@ void mt76x0_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
 
        mt76_rx(&dev->mt76, q, skb);
 }
-
+EXPORT_SYMBOL_GPL(mt76x0_queue_rx_skb);
index 9a803fb0cd5d310e2dde3ef412333bc468bf92c7..89e856745fecfe299f4c265c3fd0b762359e2284 100644 (file)
@@ -18,6 +18,7 @@
 #include "mt76x0.h"
 #include "usb.h"
 #include "trace.h"
+#include "../mt76x02_util.h"
 
 static struct usb_device_id mt76x0_device_table[] = {
        { USB_DEVICE(0x148F, 0x7610) }, /* MT7610U */
@@ -49,12 +50,18 @@ static struct usb_device_id mt76x0_device_table[] = {
 static int mt76x0u_probe(struct usb_interface *usb_intf,
                         const struct usb_device_id *id)
 {
+       static const struct mt76_driver_ops drv_ops = {
+               .tx_prepare_skb = mt76x0_tx_prepare_skb,
+               .tx_complete_skb = mt76x02_tx_complete_skb,
+               .tx_status_data = mt76x02_tx_status_data,
+               .rx_skb = mt76x0_queue_rx_skb,
+       };
        struct usb_device *usb_dev = interface_to_usbdev(usb_intf);
        struct mt76x0_dev *dev;
        u32 asic_rev, mac_rev;
        int ret;
 
-       dev = mt76x0_alloc_device(&usb_intf->dev);
+       dev = mt76x0_alloc_device(&usb_intf->dev, &drv_ops);
        if (!dev)
                return -ENOMEM;