]> Pileus Git - ~andy/linux/commitdiff
USB: add USB_DEVICE_INTERFACE_CLASS macro
authorBjørn Mork <bjorn@mork.no>
Wed, 31 Oct 2012 05:08:39 +0000 (06:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Oct 2012 19:58:11 +0000 (12:58 -0700)
Matching on device and interface class with with unspecified
subclass and protocol is sometimes useful.  This is slightly
different from USB_DEVICE_AND_INTERFACE_INFO which requires
the full interface class/subclass/protocol triplet.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/usb.h

index f51f9981de1ed9157257f63fff244e4397c71fe1..689b14b26c8d84343d8271b87d9aefca00b20904 100644 (file)
@@ -807,6 +807,22 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
        .bcdDevice_lo = (lo), \
        .bcdDevice_hi = (hi)
 
+/**
+ * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class
+ * @vend: the 16 bit USB Vendor ID
+ * @prod: the 16 bit USB Product ID
+ * @cl: bInterfaceClass value
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific interface class of devices.
+ */
+#define USB_DEVICE_INTERFACE_CLASS(vend, prod, cl) \
+       .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
+                      USB_DEVICE_ID_MATCH_INT_CLASS, \
+       .idVendor = (vend), \
+       .idProduct = (prod), \
+       .bInterfaceClass = (cl)
+
 /**
  * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol
  * @vend: the 16 bit USB Vendor ID