diff options
Diffstat (limited to 'drivers/hid/usbhid/hid-quirks.c')
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 9287a9e684e5..c4fdccdda858 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -447,6 +447,34 @@ static const struct hid_blacklist { | |||
447 | 447 | ||
448 | { 0, 0 } | 448 | { 0, 0 } |
449 | }; | 449 | }; |
450 | /** | ||
451 | * usbhid_exists_squirk: return any static quirks for a USB HID device | ||
452 | * @idVendor: the 16-bit USB vendor ID, in native byteorder | ||
453 | * @idProduct: the 16-bit USB product ID, in native byteorder | ||
454 | * | ||
455 | * Description: | ||
456 | * Given a USB vendor ID and product ID, return a pointer to | ||
457 | * the hid_blacklist entry associated with that device. | ||
458 | * | ||
459 | * Returns: pointer if quirk found, or NULL if no quirks found. | ||
460 | */ | ||
461 | static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor, | ||
462 | const u16 idProduct) | ||
463 | { | ||
464 | const struct hid_blacklist *bl_entry = NULL; | ||
465 | int n = 0; | ||
466 | |||
467 | for (; hid_blacklist[n].idVendor; n++) | ||
468 | if (hid_blacklist[n].idVendor == idVendor && | ||
469 | hid_blacklist[n].idProduct == idProduct) | ||
470 | bl_entry = &hid_blacklist[n]; | ||
471 | |||
472 | if (bl_entry != NULL) | ||
473 | dbg("Found squirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n", | ||
474 | bl_entry->quirks, bl_entry->idVendor, | ||
475 | bl_entry->idProduct); | ||
476 | return bl_entry; | ||
477 | } | ||
450 | 478 | ||
451 | /** | 479 | /** |
452 | * usbhid_lookup_quirk: return any quirks associated with a USB HID device | 480 | * usbhid_lookup_quirk: return any quirks associated with a USB HID device |
@@ -462,7 +490,7 @@ static const struct hid_blacklist { | |||
462 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct) | 490 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct) |
463 | { | 491 | { |
464 | u32 quirks = 0; | 492 | u32 quirks = 0; |
465 | int n = 0; | 493 | const struct hid_blacklist *bl_entry = NULL; |
466 | 494 | ||
467 | /* Ignore all Wacom devices */ | 495 | /* Ignore all Wacom devices */ |
468 | if (idVendor == USB_VENDOR_ID_WACOM) | 496 | if (idVendor == USB_VENDOR_ID_WACOM) |
@@ -474,10 +502,9 @@ u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct) | |||
474 | idProduct <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) | 502 | idProduct <= USB_DEVICE_ID_CODEMERCS_IOW_LAST) |
475 | return HID_QUIRK_IGNORE; | 503 | return HID_QUIRK_IGNORE; |
476 | 504 | ||
477 | for (; hid_blacklist[n].idVendor; n++) | 505 | bl_entry = usbhid_exists_squirk(idVendor, idProduct); |
478 | if (hid_blacklist[n].idVendor == idVendor && | 506 | if (bl_entry) |
479 | hid_blacklist[n].idProduct == idProduct) | 507 | quirks = bl_entry->quirks; |
480 | quirks = hid_blacklist[n].quirks; | ||
481 | |||
482 | return quirks; | 508 | return quirks; |
483 | } | 509 | } |
510 | |||