Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
[deliverable/linux.git] / drivers / hid / hid-multitouch.c
index 351ddd297792c24e15d009eae6995cd5de518c7b..296d4991560e45a9fed565c8a2d3cd463efb9ff1 100644 (file)
@@ -272,7 +272,7 @@ static ssize_t mt_show_quirks(struct device *dev,
                           struct device_attribute *attr,
                           char *buf)
 {
-       struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+       struct hid_device *hdev = to_hid_device(dev);
        struct mt_device *td = hid_get_drvdata(hdev);
 
        return sprintf(buf, "%u\n", td->mtclass.quirks);
@@ -282,7 +282,7 @@ static ssize_t mt_set_quirks(struct device *dev,
                          struct device_attribute *attr,
                          const char *buf, size_t count)
 {
-       struct hid_device *hdev = container_of(dev, struct hid_device, dev);
+       struct hid_device *hdev = to_hid_device(dev);
        struct mt_device *td = hid_get_drvdata(hdev);
 
        unsigned long val;
@@ -357,8 +357,19 @@ static void mt_feature_mapping(struct hid_device *hdev,
                        break;
                }
 
-               td->inputmode = field->report->id;
-               td->inputmode_index = usage->usage_index;
+               if (td->inputmode < 0) {
+                       td->inputmode = field->report->id;
+                       td->inputmode_index = usage->usage_index;
+               } else {
+                       /*
+                        * Some elan panels wrongly declare 2 input mode
+                        * features, and silently ignore when we set the
+                        * value in the second field. Skip the second feature
+                        * and hope for the best.
+                        */
+                       dev_info(&hdev->dev,
+                                "Ignoring the extra HID_DG_INPUTMODE\n");
+               }
 
                break;
        case HID_DG_CONTACTMAX:
This page took 0.026588 seconds and 5 git commands to generate.