Commit 80df01f4 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt76u: rely on usb_interface instead of usb_dev

usb drivers are supposed to communicate using usb_interface instead
mt76x{0,2}u is now registering through usb_device. Fix it by passing
usb_intf device to mt76_alloc_device routine.

Fixes: 112f980a ("mt76usb: use usb_dev private data")
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Tested-By: default avatarZero_Chaos <sidhayn@gmail.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 5d1ad7d7
...@@ -804,7 +804,8 @@ static inline int ...@@ -804,7 +804,8 @@ static inline int
mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len, mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len,
int timeout) int timeout)
{ {
struct usb_device *udev = to_usb_device(dev->dev); struct usb_interface *uintf = to_usb_interface(dev->dev);
struct usb_device *udev = interface_to_usbdev(uintf);
struct mt76_usb *usb = &dev->usb; struct mt76_usb *usb = &dev->usb;
unsigned int pipe; unsigned int pipe;
......
...@@ -221,7 +221,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf, ...@@ -221,7 +221,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
u32 mac_rev; u32 mac_rev;
int ret; int ret;
mdev = mt76_alloc_device(&usb_dev->dev, sizeof(*dev), &mt76x0u_ops, mdev = mt76_alloc_device(&usb_intf->dev, sizeof(*dev), &mt76x0u_ops,
&drv_ops); &drv_ops);
if (!mdev) if (!mdev)
return -ENOMEM; return -ENOMEM;
......
...@@ -41,7 +41,7 @@ static int mt76x2u_probe(struct usb_interface *intf, ...@@ -41,7 +41,7 @@ static int mt76x2u_probe(struct usb_interface *intf,
struct mt76_dev *mdev; struct mt76_dev *mdev;
int err; int err;
mdev = mt76_alloc_device(&udev->dev, sizeof(*dev), &mt76x2u_ops, mdev = mt76_alloc_device(&intf->dev, sizeof(*dev), &mt76x2u_ops,
&drv_ops); &drv_ops);
if (!mdev) if (!mdev)
return -ENOMEM; return -ENOMEM;
......
...@@ -19,7 +19,8 @@ static int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, ...@@ -19,7 +19,8 @@ static int __mt76u_vendor_request(struct mt76_dev *dev, u8 req,
u8 req_type, u16 val, u16 offset, u8 req_type, u16 val, u16 offset,
void *buf, size_t len) void *buf, size_t len)
{ {
struct usb_device *udev = to_usb_device(dev->dev); struct usb_interface *uintf = to_usb_interface(dev->dev);
struct usb_device *udev = interface_to_usbdev(uintf);
unsigned int pipe; unsigned int pipe;
int i, ret; int i, ret;
...@@ -234,7 +235,8 @@ mt76u_rd_rp(struct mt76_dev *dev, u32 base, ...@@ -234,7 +235,8 @@ mt76u_rd_rp(struct mt76_dev *dev, u32 base,
static bool mt76u_check_sg(struct mt76_dev *dev) static bool mt76u_check_sg(struct mt76_dev *dev)
{ {
struct usb_device *udev = to_usb_device(dev->dev); struct usb_interface *uintf = to_usb_interface(dev->dev);
struct usb_device *udev = interface_to_usbdev(uintf);
return (!disable_usb_sg && udev->bus->sg_tablesize > 0 && return (!disable_usb_sg && udev->bus->sg_tablesize > 0 &&
(udev->bus->no_sg_constraint || (udev->bus->no_sg_constraint ||
...@@ -369,7 +371,8 @@ mt76u_fill_bulk_urb(struct mt76_dev *dev, int dir, int index, ...@@ -369,7 +371,8 @@ mt76u_fill_bulk_urb(struct mt76_dev *dev, int dir, int index,
struct urb *urb, usb_complete_t complete_fn, struct urb *urb, usb_complete_t complete_fn,
void *context) void *context)
{ {
struct usb_device *udev = to_usb_device(dev->dev); struct usb_interface *uintf = to_usb_interface(dev->dev);
struct usb_device *udev = interface_to_usbdev(uintf);
unsigned int pipe; unsigned int pipe;
if (dir == USB_DIR_IN) if (dir == USB_DIR_IN)
...@@ -951,6 +954,7 @@ int mt76u_init(struct mt76_dev *dev, ...@@ -951,6 +954,7 @@ int mt76u_init(struct mt76_dev *dev,
.rd_rp = mt76u_rd_rp, .rd_rp = mt76u_rd_rp,
.type = MT76_BUS_USB, .type = MT76_BUS_USB,
}; };
struct usb_device *udev = interface_to_usbdev(intf);
struct mt76_usb *usb = &dev->usb; struct mt76_usb *usb = &dev->usb;
tasklet_init(&usb->rx_tasklet, mt76u_rx_tasklet, (unsigned long)dev); tasklet_init(&usb->rx_tasklet, mt76u_rx_tasklet, (unsigned long)dev);
...@@ -964,6 +968,8 @@ int mt76u_init(struct mt76_dev *dev, ...@@ -964,6 +968,8 @@ int mt76u_init(struct mt76_dev *dev,
dev->bus = &mt76u_ops; dev->bus = &mt76u_ops;
dev->queue_ops = &usb_queue_ops; dev->queue_ops = &usb_queue_ops;
dev_set_drvdata(&udev->dev, dev);
usb->sg_en = mt76u_check_sg(dev); usb->sg_en = mt76u_check_sg(dev);
return mt76u_set_endpoints(intf, usb); return mt76u_set_endpoints(intf, usb);
......
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