Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-block.git] / drivers / hid / hid-quirks.c
index 1549c7a2f04c2ee83cd2f579c9960d189aa1c962..185a577c46f61b0fd7888de55ca9e86e526e9844 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
+#include <linux/input/elan-i2c-ids.h>
 
 #include "hid-ids.h"
 
@@ -916,6 +917,8 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
 
 bool hid_ignore(struct hid_device *hdev)
 {
+       int i;
+
        if (hdev->quirks & HID_QUIRK_NO_IGNORE)
                return false;
        if (hdev->quirks & HID_QUIRK_IGNORE)
@@ -980,18 +983,15 @@ bool hid_ignore(struct hid_device *hdev)
                break;
        case USB_VENDOR_ID_ELAN:
                /*
-                * Many Elan devices have a product id of 0x0401 and are handled
-                * by the elan_i2c input driver. But the ACPI HID ELAN0800 dev
-                * is not (and cannot be) handled by that driver ->
-                * Ignore all 0x0401 devs except for the ELAN0800 dev.
+                * Blacklist of everything that gets handled by the elan_i2c
+                * input driver.  This avoids disabling valid touchpads and
+                * other ELAN devices.
                 */
-               if (hdev->product == 0x0401 &&
-                   strncmp(hdev->name, "ELAN0800", 8) != 0)
-                       return true;
-               /* Same with product id 0x0400 */
-               if (hdev->product == 0x0400 &&
-                   strncmp(hdev->name, "QTEC0001", 8) != 0)
-                       return true;
+               if ((hdev->product == 0x0401 || hdev->product == 0x0400))
+                       for (i = 0; strlen(elan_acpi_id[i].id); ++i)
+                               if (!strncmp(hdev->name, elan_acpi_id[i].id,
+                                            strlen(elan_acpi_id[i].id)))
+                                       return true;
                break;
        }