Subject: Re: [PATCH net-next 1/5] r8152: use generic USB macros to define product table

From: Marek Behún <[email-masked]>
Date: Wed, 4 Nov 2020 07:02:51 +0100

On Wed, 4 Nov 2020 01:57:10 +0000
Hayes Wang <[email-masked]> wrote:

> Marek Behún <[email-masked]>
> > Sent: Wednesday, November 4, 2020 3:22 AM
> > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> > index b1770489aca5..85dda591c838 100644
> > --- a/drivers/net/usb/r8152.c
> > +++ b/drivers/net/usb/r8152.c
> > @@ -6862,20 +6862,12 @@ static void rtl8152_disconnect(struct
> > usb_interface *intf)
> >  }
> > 
> >  #define REALTEK_USB_DEVICE(vend, prod)	\
> > -	.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
> > -		       USB_DEVICE_ID_MATCH_INT_CLASS, \
> > -	.idVendor = (vend), \
> > -	.idProduct = (prod), \
> > -	.bInterfaceClass = USB_CLASS_VENDOR_SPEC \
> > +	USB_DEVICE_INTERFACE_CLASS(vend, prod, USB_CLASS_VENDOR_SPEC)
> > \
> >  }, \
> >  { \
> > -	.match_flags = USB_DEVICE_ID_MATCH_INT_INFO | \
> > -		       USB_DEVICE_ID_MATCH_DEVICE, \
> > -	.idVendor = (vend), \
> > -	.idProduct = (prod), \
> > -	.bInterfaceClass = USB_CLASS_COMM, \
> > -	.bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
> > -	.bInterfaceProtocol = USB_CDC_PROTO_NONE
> > +	USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_COMM, \
> > +				      USB_CDC_SUBCLASS_ETHERNET, \
> > +				      USB_CDC_PROTO_NONE)
> > 
> >  /* table of devices that work with this driver */
> >  static const struct usb_device_id rtl8152_table[] = {  
> 
> I don't use these, because checkpatch.pl would show error.
> 
> 	$ scripts/checkpatch.pl --file --terse drivers/net/usb/r8152.c
> 	ERROR: Macros with complex values should be enclosed in parentheses
> 
> Best Regards,
> Hayes
> 

Hmm, checkpatch did not emit no warnings for me on these patches. Just
two CHECKs for the third patch.

BTW Hayes, is it possible for me gaining access to Realtek
documentation for these chips under NDA? For example via my employer,
CZ.NIC? I can't find any such information on Realtek website.

Also I could not download the driver from Realtek's website, I had to
find it on github. When clicking the download button on [1], it says:
  Warning
  The form #10 does not exist or it is not published.

BTW2 I am interested whether we can make the internal PHY visible to
the Linux PHY subsystem.

Marek

[1]
https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-usb-3-0-software