r8152: redefine REALTEK_USB_DEVICE macro

Redefine REALTEK_USB_DEVICE macro with USB_DEVICE_INTERFACE_CLASS and
USB_DEVICE_AND_INTERFACE_INFO to simply the code.

Although checkpatch.pl shows the following error, it is more readable.

	ERROR: Macros with complex values should be enclosed in parentheses

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Hayes Wang 2021-04-23 17:44:55 +08:00 committed by David S. Miller
parent e7865ea51b
commit 55319eeb5b
1 changed files with 27 additions and 35 deletions

View File

@ -9579,49 +9579,41 @@ 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 \
#define REALTEK_USB_DEVICE(vend, prod) { \
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[] = {
/* Realtek */
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8050)},
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8053)},
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8152)},
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153)},
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8155)},
{REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8156)},
REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8050),
REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8053),
REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8152),
REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153),
REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8155),
REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8156),
/* Microsoft */
{REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab)},
{REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6)},
{REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927)},
{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, 0x3082)},
{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_LENOVO, 0x721e)},
{REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387)},
{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_MICROSOFT, 0x07ab),
REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6),
REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927),
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, 0x3082),
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_LENOVO, 0x721e),
REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387),
REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041),
REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff),
REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601),
{}
};