diff mbox series

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

Message ID 20201103192226.2455-2-kabel@kernel.org
State Changes Requested
Delegated to: David Miller
Headers show
Series r8152 changes | expand

Checks

Context Check Description
jkicinski/cover_letter success Link
jkicinski/fixes_present success Link
jkicinski/patch_count success Link
jkicinski/tree_selection success Clearly marked for net-next
jkicinski/subject_prefix success Link
jkicinski/source_inline success Was 0 now: 0
jkicinski/verify_signedoff success Link
jkicinski/module_param success Was 0 now: 0
jkicinski/build_32bit success Errors and warnings before: 8 this patch: 8
jkicinski/kdoc success Errors and warnings before: 8 this patch: 8
jkicinski/verify_fixes success Link
jkicinski/checkpatch warning WARNING: From:/Signed-off-by: email name mismatch: 'From: "Marek Behún" <kabel@kernel.org>' != 'Signed-off-by: Marek Behún <kabel@kernel.org>'
jkicinski/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
jkicinski/header_inline success Link
jkicinski/stable success Stable not CCed

Commit Message

Marek Behún Nov. 3, 2020, 7:22 p.m. UTC
We can now use macros USB_DEVICE_INTERFACE_CLASS and
USB_DEVICE_AND_INTERFACE_INFO to define r8152 product table.

Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/net/usb/r8152.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Comments

Hayes Wang Nov. 4, 2020, 1:57 a.m. UTC | #1
Marek Behún <kabel@kernel.org>
> 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
Marek Behún Nov. 4, 2020, 6:02 a.m. UTC | #2
On Wed, 4 Nov 2020 01:57:10 +0000
Hayes Wang <hayeswang@realtek.com> wrote:

> Marek Behún <kabel@kernel.org>
> > 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
Hayes Wang Nov. 4, 2020, 7:14 a.m. UTC | #3
Marek Behún <kabel@kernel.org>
> Sent: Wednesday, November 4, 2020 2:03 PM
[...] 
> 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.

I have to ask my boss.
Maybe I reply you in private when I get the answer.

> 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.

I try to download the driver from our website.
And it seem to work fine.
I will send it to you later.

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

I think it is possible.
I am not familiar with the Linux PHY subsystem, so I have no idea about
how to start.

Best Regards,
Hayes
Greg KH Nov. 4, 2020, 8:53 a.m. UTC | #4
On Wed, Nov 04, 2020 at 01:57:10AM +0000, Hayes Wang wrote:
> Marek Behún <kabel@kernel.org>
> > 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

checkpatch is wrong.
diff mbox series

Patch

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[] = {