usbnet: ipheth: Simplify device detection
authorGuenter Roeck <linux@roeck-us.net>
Wed, 24 Apr 2019 17:58:24 +0000 (10:58 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Apr 2019 15:34:01 +0000 (11:34 -0400)
All Apple products use the same protocol for tethering over USB.
To simplify the code and make it future proof, use
USB_VENDOR_AND_INTERFACE_INFO() instead of
USB_DEVICE_AND_INTERFACE_INFO() to automatically detect and support
all existing and future Apple products using the same interface.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/ipheth.c

index 3d8a70d3ea9bd67c91f85c6cab38d1afbf5f25f3..a01a71a7e48d6047c46970799cd8837277e1e586 100644 (file)
 #include <linux/workqueue.h>
 
 #define USB_VENDOR_APPLE        0x05ac
-#define USB_PRODUCT_IPHONE      0x1290
-#define USB_PRODUCT_IPHONE_3G   0x1292
-#define USB_PRODUCT_IPHONE_3GS  0x1294
-#define USB_PRODUCT_IPHONE_4   0x1297
-#define USB_PRODUCT_IPAD 0x129a
-#define USB_PRODUCT_IPAD_2     0x12a2
-#define USB_PRODUCT_IPAD_3     0x12a6
-#define USB_PRODUCT_IPAD_MINI    0x12ab
-#define USB_PRODUCT_IPHONE_4_VZW 0x129c
-#define USB_PRODUCT_IPHONE_4S  0x12a0
-#define USB_PRODUCT_IPHONE_5   0x12a8
 
 #define IPHETH_USBINTF_CLASS    255
 #define IPHETH_USBINTF_SUBCLASS 253
 #define IPHETH_CARRIER_ON       0x04
 
 static const struct usb_device_id ipheth_table[] = {
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPHONE,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_3G,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_3GS,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPAD,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPAD_2,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPAD_3,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPAD_MINI,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4S,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
-       { USB_DEVICE_AND_INTERFACE_INFO(
-               USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_5,
-               IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
-               IPHETH_USBINTF_PROTO) },
+       { USB_VENDOR_AND_INTERFACE_INFO(USB_VENDOR_APPLE, IPHETH_USBINTF_CLASS,
+                                       IPHETH_USBINTF_SUBCLASS,
+                                       IPHETH_USBINTF_PROTO) },
        { }
 };
 MODULE_DEVICE_TABLE(usb, ipheth_table);