diff options
author | fangxiaozhi <huananhu@huawei.com> | 2013-02-04 02:14:46 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-04 13:40:16 -0500 |
commit | 07c7be3d87e5cdaf5f94c271c516456364ef286c (patch) | |
tree | e95f31a0fc73a7d2d4ffa4e42dfa3941918b1073 /drivers/usb/storage | |
parent | 0ba3b2ccc72b3df5c305d61f59d93ab0f0e87991 (diff) |
USB: storage: Define a new macro for USB storage match rules
1. Define a new macro for USB storage match rules:
matching with Vendor ID and interface descriptors.
Signed-off-by: fangxiaozhi <huananhu@huawei.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/usb.c | 12 | ||||
-rw-r--r-- | drivers/usb/storage/usual-tables.c | 15 |
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 31b3e1a61bbd..cf09b6ba71ff 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -120,6 +120,17 @@ MODULE_PARM_DESC(quirks, "supplemental list of device IDs and their quirks"); | |||
120 | .useTransport = use_transport, \ | 120 | .useTransport = use_transport, \ |
121 | } | 121 | } |
122 | 122 | ||
123 | #define UNUSUAL_VENDOR_INTF(idVendor, cl, sc, pr, \ | ||
124 | vendor_name, product_name, use_protocol, use_transport, \ | ||
125 | init_function, Flags) \ | ||
126 | { \ | ||
127 | .vendorName = vendor_name, \ | ||
128 | .productName = product_name, \ | ||
129 | .useProtocol = use_protocol, \ | ||
130 | .useTransport = use_transport, \ | ||
131 | .initFunction = init_function, \ | ||
132 | } | ||
133 | |||
123 | static struct us_unusual_dev us_unusual_dev_list[] = { | 134 | static struct us_unusual_dev us_unusual_dev_list[] = { |
124 | # include "unusual_devs.h" | 135 | # include "unusual_devs.h" |
125 | { } /* Terminating entry */ | 136 | { } /* Terminating entry */ |
@@ -131,6 +142,7 @@ static struct us_unusual_dev for_dynamic_ids = | |||
131 | #undef UNUSUAL_DEV | 142 | #undef UNUSUAL_DEV |
132 | #undef COMPLIANT_DEV | 143 | #undef COMPLIANT_DEV |
133 | #undef USUAL_DEV | 144 | #undef USUAL_DEV |
145 | #undef UNUSUAL_VENDOR_INTF | ||
134 | 146 | ||
135 | #ifdef CONFIG_LOCKDEP | 147 | #ifdef CONFIG_LOCKDEP |
136 | 148 | ||
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c index b78a526910fb..5ef8ce74aae4 100644 --- a/drivers/usb/storage/usual-tables.c +++ b/drivers/usb/storage/usual-tables.c | |||
@@ -41,6 +41,20 @@ | |||
41 | #define USUAL_DEV(useProto, useTrans) \ | 41 | #define USUAL_DEV(useProto, useTrans) \ |
42 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) } | 42 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) } |
43 | 43 | ||
44 | /* Define the device is matched with Vendor ID and interface descriptors */ | ||
45 | #define UNUSUAL_VENDOR_INTF(id_vendor, cl, sc, pr, \ | ||
46 | vendorName, productName, useProtocol, useTransport, \ | ||
47 | initFunction, flags) \ | ||
48 | { \ | ||
49 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ | ||
50 | | USB_DEVICE_ID_MATCH_VENDOR, \ | ||
51 | .idVendor = (id_vendor), \ | ||
52 | .bInterfaceClass = (cl), \ | ||
53 | .bInterfaceSubClass = (sc), \ | ||
54 | .bInterfaceProtocol = (pr), \ | ||
55 | .driver_info = (flags) \ | ||
56 | } | ||
57 | |||
44 | struct usb_device_id usb_storage_usb_ids[] = { | 58 | struct usb_device_id usb_storage_usb_ids[] = { |
45 | # include "unusual_devs.h" | 59 | # include "unusual_devs.h" |
46 | { } /* Terminating entry */ | 60 | { } /* Terminating entry */ |
@@ -50,6 +64,7 @@ MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids); | |||
50 | #undef UNUSUAL_DEV | 64 | #undef UNUSUAL_DEV |
51 | #undef COMPLIANT_DEV | 65 | #undef COMPLIANT_DEV |
52 | #undef USUAL_DEV | 66 | #undef USUAL_DEV |
67 | #undef UNUSUAL_VENDOR_INTF | ||
53 | 68 | ||
54 | /* | 69 | /* |
55 | * The table of devices to ignore | 70 | * The table of devices to ignore |