linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro
@ 2019-10-25 10:59 Kai-Heng Feng
  2019-10-25 10:59 ` [PATCH 2/2] r8152: Add macpassthru support for ThinkPad Thunderbolt 3 Dock Gen 2 Kai-Heng Feng
  2019-10-28  9:41 ` [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro Hayes Wang
  0 siblings, 2 replies; 7+ messages in thread
From: Kai-Heng Feng @ 2019-10-25 10:59 UTC (permalink / raw)
  To: davem, oliver; +Cc: hayeswang, linux-usb, netdev, linux-kernel, Kai-Heng Feng

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(-)

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)},
 	{}
 };
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] r8152: Add macpassthru support for ThinkPad Thunderbolt 3 Dock Gen 2
  2019-10-25 10:59 [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro Kai-Heng Feng
@ 2019-10-25 10:59 ` Kai-Heng Feng
  2019-10-28  3:58   ` Hayes Wang
  2019-10-28  9:41 ` [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro Hayes Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Kai-Heng Feng @ 2019-10-25 10:59 UTC (permalink / raw)
  To: davem, oliver; +Cc: hayeswang, linux-usb, netdev, linux-kernel, Kai-Heng Feng

ThinkPad Thunderbolt 3 Dock Gen 2 is another docking station that uses
RTL8153 based USB ethernet.

The device supports macpassthru, but it failed to pass the test of -AD,
-BND and -BD. Simply bypass these tests since the device supports this
feature just fine.

Also the ACPI objects have some differences between Dell's and Lenovo's,
so make those ACPI infos no longer hardcoded.

BugLink: https://bugs.launchpad.net/bugs/1827961

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/net/usb/cdc_ether.c |  7 ++++
 drivers/net/usb/r8152.c     | 65 ++++++++++++++++++++++++++-----------
 2 files changed, 53 insertions(+), 19 deletions(-)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 32f53de5b1fe..92751f6e792d 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -766,6 +766,13 @@ static const struct usb_device_id	products[] = {
 	.driver_info = 0,
 },
 
+/* ThinkPad Thunderbolt 3 Dock Gen 2 (based on Realtek RTL8153) */
+{
+	USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0x3082, USB_CLASS_COMM,
+			USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
+	.driver_info = 0,
+},
+
 /* Lenovo Thinkpad USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
 {
 	USB_DEVICE_AND_INTERFACE_INFO(LENOVO_VENDOR_ID, 0x7205, USB_CLASS_COMM,
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 1a987d4e45ab..65bdb745860c 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -658,6 +658,8 @@ enum rtl_register_content {
 #define RTL8152_NAPI_WEIGHT	64
 #define rx_reserved_size(x)	((x) + VLAN_ETH_HLEN + ETH_FCS_LEN + \
 				 sizeof(struct rx_desc) + RX_ALIGN)
+/* Device quirks */
+#define R8152_QUIRK_LENOVO_MACPASSTHRU		BIT(1)
 
 /* rtl8152 flags */
 enum rtl8152_flags {
@@ -670,6 +672,7 @@ enum rtl8152_flags {
 	SCHEDULE_TASKLET,
 	GREEN_ETHERNET,
 	DELL_TB_RX_AGG_BUG,
+	LENOVO_MACPASSTHRU,
 };
 
 /* Define these values to match your device */
@@ -1408,38 +1411,57 @@ static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa)
 	int ret = -EINVAL;
 	u32 ocp_data;
 	unsigned char buf[6];
-
-	/* test for -AD variant of RTL8153 */
-	ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0);
-	if ((ocp_data & AD_MASK) == 0x1000) {
-		/* test for MAC address pass-through bit */
-		ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, EFUSE);
-		if ((ocp_data & PASS_THRU_MASK) != 1) {
-			netif_dbg(tp, probe, tp->netdev,
-				  "No efuse for RTL8153-AD MAC pass through\n");
-			return -ENODEV;
-		}
+	bool bypass_test;
+	char *mac_obj_name;
+	acpi_object_type mac_obj_type;
+	int mac_strlen;
+
+	if (test_bit(LENOVO_MACPASSTHRU, &tp->flags)) {
+		bypass_test = true;
+		mac_obj_name = "\\MACA";
+		mac_obj_type = ACPI_TYPE_STRING;
+		mac_strlen = 0x16;
 	} else {
-		/* test for RTL8153-BND and RTL8153-BD */
-		ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_MISC_1);
-		if ((ocp_data & BND_MASK) == 0 && (ocp_data & BD_MASK) == 0) {
-			netif_dbg(tp, probe, tp->netdev,
-				  "Invalid variant for MAC pass through\n");
-			return -ENODEV;
+		bypass_test = false;
+		mac_obj_name = "\\_SB.AMAC";
+		mac_obj_type = ACPI_TYPE_BUFFER;
+		mac_strlen = 0x17;
+	}
+
+	if (!bypass_test) {
+		/* test for -AD variant of RTL8153 */
+		ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0);
+		if ((ocp_data & AD_MASK) == 0x1000) {
+			/* test for MAC address pass-through bit */
+			ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, EFUSE);
+			if ((ocp_data & PASS_THRU_MASK) != 1) {
+				netif_dbg(tp, probe, tp->netdev,
+						"No efuse for RTL8153-AD MAC pass through\n");
+				return -ENODEV;
+			}
+		} else {
+			/* test for RTL8153-BND and RTL8153-BD */
+			ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_MISC_1);
+			if ((ocp_data & BND_MASK) == 0 && (ocp_data & BD_MASK) == 0) {
+				netif_dbg(tp, probe, tp->netdev,
+						"Invalid variant for MAC pass through\n");
+				return -ENODEV;
+			}
 		}
 	}
 
 	/* returns _AUXMAC_#AABBCCDDEEFF# */
-	status = acpi_evaluate_object(NULL, "\\_SB.AMAC", NULL, &buffer);
+	status = acpi_evaluate_object(NULL, mac_obj_name, NULL, &buffer);
 	obj = (union acpi_object *)buffer.pointer;
 	if (!ACPI_SUCCESS(status))
 		return -ENODEV;
-	if (obj->type != ACPI_TYPE_BUFFER || obj->string.length != 0x17) {
+	if (obj->type != mac_obj_type || obj->string.length != mac_strlen) {
 		netif_warn(tp, probe, tp->netdev,
 			   "Invalid buffer for pass-thru MAC addr: (%d, %d)\n",
 			   obj->type, obj->string.length);
 		goto amacout;
 	}
+
 	if (strncmp(obj->string.pointer, "_AUXMAC_#", 9) != 0 ||
 	    strncmp(obj->string.pointer + 0x15, "#", 1) != 0) {
 		netif_warn(tp, probe, tp->netdev,
@@ -6626,6 +6648,9 @@ static int rtl8152_probe(struct usb_interface *intf,
 		netdev->hw_features &= ~NETIF_F_RXCSUM;
 	}
 
+	if (id->driver_info & R8152_QUIRK_LENOVO_MACPASSTHRU)
+		set_bit(LENOVO_MACPASSTHRU, &tp->flags);
+
 	if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial &&
 	    (!strcmp(udev->serial, "000001000000") ||
 	     !strcmp(udev->serial, "000002000000"))) {
@@ -6754,6 +6779,8 @@ static const struct usb_device_id rtl8152_table[] = {
 	{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,  0x3082,
+			R8152_QUIRK_LENOVO_MACPASSTHRU)},
 	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x7205, 0)},
 	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x720c, 0)},
 	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x7214, 0)},
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/2] r8152: Add macpassthru support for ThinkPad Thunderbolt 3 Dock Gen 2
  2019-10-25 10:59 ` [PATCH 2/2] r8152: Add macpassthru support for ThinkPad Thunderbolt 3 Dock Gen 2 Kai-Heng Feng
@ 2019-10-28  3:58   ` Hayes Wang
  2019-10-28  4:58     ` Kai-Heng Feng
  0 siblings, 1 reply; 7+ messages in thread
From: Hayes Wang @ 2019-10-28  3:58 UTC (permalink / raw)
  To: Kai-Heng Feng, davem, oliver; +Cc: linux-usb, netdev, linux-kernel, nic_swsd

Kai-Heng Feng [mailto:kai.heng.feng@canonical.com]
> Sent: Friday, October 25, 2019 6:59 PM
[...]
> @@ -6626,6 +6648,9 @@ static int rtl8152_probe(struct usb_interface *intf,
>  		netdev->hw_features &= ~NETIF_F_RXCSUM;
>  	}
> 
> +	if (id->driver_info & R8152_QUIRK_LENOVO_MACPASSTHRU)

Do you really need this?
It seems the information of idVendor and idProduct is enough. 

> +		set_bit(LENOVO_MACPASSTHRU, &tp->flags);
> +
>  	if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial
> &&
>  	    (!strcmp(udev->serial, "000001000000") ||
>  	     !strcmp(udev->serial, "000002000000"))) {
> @@ -6754,6 +6779,8 @@ static const struct usb_device_id rtl8152_table[] = {
>  	{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,  0x3082,
> +			R8152_QUIRK_LENOVO_MACPASSTHRU)},

This limits the usage of driver_info. For example, I couldn't
use it to store a pointer address anymore.

>  	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x7205, 0)},
>  	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x720c, 0)},
>  	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x7214, 0)},
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] r8152: Add macpassthru support for ThinkPad Thunderbolt 3 Dock Gen 2
  2019-10-28  3:58   ` Hayes Wang
@ 2019-10-28  4:58     ` Kai-Heng Feng
  2019-10-28  9:21       ` Hayes Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Kai-Heng Feng @ 2019-10-28  4:58 UTC (permalink / raw)
  To: Hayes Wang; +Cc: davem, oliver, linux-usb, netdev, linux-kernel, nic_swsd


> On Oct 28, 2019, at 11:58, Hayes Wang <hayeswang@realtek.com> wrote:
> 
> Kai-Heng Feng [mailto:kai.heng.feng@canonical.com]
>> Sent: Friday, October 25, 2019 6:59 PM
> [...]
>> @@ -6626,6 +6648,9 @@ static int rtl8152_probe(struct usb_interface *intf,
>> 		netdev->hw_features &= ~NETIF_F_RXCSUM;
>> 	}
>> 
>> +	if (id->driver_info & R8152_QUIRK_LENOVO_MACPASSTHRU)
> 
> Do you really need this?
> It seems the information of idVendor and idProduct is enough. 

Both idVendor and idProduct are just part of "struct usb_device_id".
IMO it's clearer to add quirks there.

> 
>> +		set_bit(LENOVO_MACPASSTHRU, &tp->flags);
>> +
>> 	if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial
>> &&
>> 	    (!strcmp(udev->serial, "000001000000") ||
>> 	     !strcmp(udev->serial, "000002000000"))) {
>> @@ -6754,6 +6779,8 @@ static const struct usb_device_id rtl8152_table[] = {
>> 	{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,  0x3082,
>> +			R8152_QUIRK_LENOVO_MACPASSTHRU)},
> 
> This limits the usage of driver_info. For example, I couldn't
> use it to store a pointer address anymore.

But will the driver ever use .driver_info for pointers?
There are many driver use it for quirks and quirks only.

Kai-Heng

> 
>> 	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x7205, 0)},
>> 	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x720c, 0)},
>> 	{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO,  0x7214, 0)},
>> --
>> 2.17.1
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/2] r8152: Add macpassthru support for ThinkPad Thunderbolt 3 Dock Gen 2
  2019-10-28  4:58     ` Kai-Heng Feng
@ 2019-10-28  9:21       ` Hayes Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Hayes Wang @ 2019-10-28  9:21 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: davem, oliver, linux-usb, netdev, linux-kernel, nic_swsd

Kai-Heng Feng [mailto:kai.heng.feng@canonical.com]
> Sent: Monday, October 28, 2019 12:58 PM
[...]
> >> @@ -6754,6 +6779,8 @@ static const struct usb_device_id rtl8152_table[]
> = {
> >> 	{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,  0x3082,
> >> +			R8152_QUIRK_LENOVO_MACPASSTHRU)},
> >
> > This limits the usage of driver_info. For example, I couldn't
> > use it to store a pointer address anymore.
> 
> But will the driver ever use .driver_info for pointers?
> There are many driver use it for quirks and quirks only.

I prefer to keep .driver_info empty, even though it is not
used currently.

The R8152_QUIRK_LENOVO_MACPASSTHRU is only used to set the
flag of LENOVO_MACPASSTHRU in probe(), and it is used only once.
Besides, it could be replaced by checking the vendor ID and
product ID. Therefore, I don't think it is necessary to use
driver_info , unless there are more devices needing it.

Best Regards,
Hayes



^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro
  2019-10-25 10:59 [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro Kai-Heng Feng
  2019-10-25 10:59 ` [PATCH 2/2] r8152: Add macpassthru support for ThinkPad Thunderbolt 3 Dock Gen 2 Kai-Heng Feng
@ 2019-10-28  9:41 ` Hayes Wang
  2019-10-28  9:52   ` Kai-Heng Feng
  1 sibling, 1 reply; 7+ messages in thread
From: Hayes Wang @ 2019-10-28  9:41 UTC (permalink / raw)
  To: Kai-Heng Feng, davem, oliver; +Cc: linux-usb, netdev, linux-kernel

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro
  2019-10-28  9:41 ` [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro Hayes Wang
@ 2019-10-28  9:52   ` Kai-Heng Feng
  0 siblings, 0 replies; 7+ messages in thread
From: Kai-Heng Feng @ 2019-10-28  9:52 UTC (permalink / raw)
  To: Hayes Wang; +Cc: davem, oliver, linux-usb, netdev, linux-kernel



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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-28  9:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 10:59 [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro Kai-Heng Feng
2019-10-25 10:59 ` [PATCH 2/2] r8152: Add macpassthru support for ThinkPad Thunderbolt 3 Dock Gen 2 Kai-Heng Feng
2019-10-28  3:58   ` Hayes Wang
2019-10-28  4:58     ` Kai-Heng Feng
2019-10-28  9:21       ` Hayes Wang
2019-10-28  9:41 ` [PATCH 1/2] r8152: Pass driver_info to REALTEK_USB_DEVICE() macro Hayes Wang
2019-10-28  9:52   ` Kai-Heng Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).