Message ID | 20191025105919.689-1-kai.heng.feng@canonical.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro | expand |
Kai-Heng Feng [mailto:kai.heng.feng@canonical.com] > Sent: Friday, October 25, 2019 6:59 PM [...] > -#define REALTEK_USB_DEVICE(vend, prod) \ > +#define REALTEK_USB_DEVICE(vend, prod, info) \ > .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ > USB_DEVICE_ID_MATCH_INT_CLASS, \ > .idVendor = (vend), \ > .idProduct = (prod), \ > - .bInterfaceClass = USB_CLASS_VENDOR_SPEC \ > + .bInterfaceClass = USB_CLASS_VENDOR_SPEC, \ > + .driver_info = (info) \ > }, \ > { \ > .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | \ > @@ -6739,25 +6740,26 @@ static void rtl8152_disconnect(struct > usb_interface *intf) > .idProduct = (prod), \ > .bInterfaceClass = USB_CLASS_COMM, \ > .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \ > - .bInterfaceProtocol = USB_CDC_PROTO_NONE > + .bInterfaceProtocol = USB_CDC_PROTO_NONE, \ > + .driver_info = (info) \ This part is for ECM mode. Add driver_info here is useless, because it is never be used. The driver always changes the ECM mode to vendor mode. Best Regards, Hayes
> On Oct 28, 2019, at 17:41, Hayes Wang <hayeswang@realtek.com> wrote: > > Kai-Heng Feng [mailto:kai.heng.feng@canonical.com] >> Sent: Friday, October 25, 2019 6:59 PM > [...] >> -#define REALTEK_USB_DEVICE(vend, prod) \ >> +#define REALTEK_USB_DEVICE(vend, prod, info) \ >> .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ >> USB_DEVICE_ID_MATCH_INT_CLASS, \ >> .idVendor = (vend), \ >> .idProduct = (prod), \ >> - .bInterfaceClass = USB_CLASS_VENDOR_SPEC \ >> + .bInterfaceClass = USB_CLASS_VENDOR_SPEC, \ >> + .driver_info = (info) \ >> }, \ >> { \ >> .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | \ >> @@ -6739,25 +6740,26 @@ static void rtl8152_disconnect(struct >> usb_interface *intf) >> .idProduct = (prod), \ >> .bInterfaceClass = USB_CLASS_COMM, \ >> .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \ >> - .bInterfaceProtocol = USB_CDC_PROTO_NONE >> + .bInterfaceProtocol = USB_CDC_PROTO_NONE, \ >> + .driver_info = (info) \ > > This part is for ECM mode. Add driver_info here is useless, > because it is never be used. The driver always changes > the ECM mode to vendor mode. Thanks for the explanation. Since we are going to compare IDs directly in probe(), I'll just drop this patch. Kai-Heng > > Best Regards, > Hayes > >
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index d3c30ccc8577..1a987d4e45ab 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -6725,12 +6725,13 @@ static void rtl8152_disconnect(struct usb_interface *intf) } } -#define REALTEK_USB_DEVICE(vend, prod) \ +#define REALTEK_USB_DEVICE(vend, prod, info) \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ USB_DEVICE_ID_MATCH_INT_CLASS, \ .idVendor = (vend), \ .idProduct = (prod), \ - .bInterfaceClass = USB_CLASS_VENDOR_SPEC \ + .bInterfaceClass = USB_CLASS_VENDOR_SPEC, \ + .driver_info = (info) \ }, \ { \ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | \ @@ -6739,25 +6740,26 @@ static void rtl8152_disconnect(struct usb_interface *intf) .idProduct = (prod), \ .bInterfaceClass = USB_CLASS_COMM, \ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \ - .bInterfaceProtocol = USB_CDC_PROTO_NONE + .bInterfaceProtocol = USB_CDC_PROTO_NONE, \ + .driver_info = (info) \ /* table of devices that work with this driver */ static const struct usb_device_id rtl8152_table[] = { - {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8050)}, - {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8152)}, - {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153)}, - {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab)}, - {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6)}, - {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)}, - {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)}, - {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062)}, - {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3069)}, - {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)}, - {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c)}, - {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)}, - {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)}, - {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)}, - {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601)}, + {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8050, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8152, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3069, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff, 0)}, + {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601, 0)}, {} };
REALTEK_USB_DEVICE() in current form doesn't take driver_info as its parameter. However, driver_info can be useful to add device specific information so let's adjust REALTEK_USB_DEVICE() macro to be able to do that. It'll be used by later patch. Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> --- drivers/net/usb/r8152.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)