]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/hid/hid-ntrig.c
HID: ntrig: apply NO_INIT_REPORTS quirk
[mv-sheeva.git] / drivers / hid / hid-ntrig.c
index 69169efa1e16eee2653bdf11e28bd0684c2fd80d..f152b5114f0537a87cbe51f81edc9a95af724ea5 100644 (file)
@@ -130,8 +130,7 @@ static void ntrig_report_version(struct hid_device *hdev)
        if (ret == 8) {
                ret = ntrig_version_string(&data[2], buf);
 
-               dev_info(&hdev->dev,
-                        "Firmware version: %s (%02x%02x %02x%02x)\n",
+               hid_info(hdev, "Firmware version: %s (%02x%02x %02x%02x)\n",
                         buf, data[2], data[3], data[4], data[5]);
        }
 
@@ -540,8 +539,19 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
 static int ntrig_event (struct hid_device *hid, struct hid_field *field,
                        struct hid_usage *usage, __s32 value)
 {
-       struct input_dev *input = field->hidinput->input;
        struct ntrig_data *nd = hid_get_drvdata(hid);
+       struct input_dev *input;
+
+       /* Skip processing if not a claimed input */
+       if (!(hid->claimed & HID_CLAIMED_INPUT))
+               goto not_claimed_input;
+
+       /* This function is being called before the structures are fully
+        * initialized */
+       if(!(field->hidinput && field->hidinput->input))
+               return -EINVAL;
+
+       input = field->hidinput->input;
 
        /* No special handling needed for the pen */
        if (field->application == HID_DG_PEN)
@@ -811,6 +821,8 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
                }
        }
 
+not_claimed_input:
+
        /* we have handled the hidinput part, now remains hiddev */
        if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_hid_event)
                hid->hiddev_hid_event(hid, field, usage, value);
@@ -827,11 +839,12 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
        struct hid_report *report;
 
        if (id->driver_data)
-               hdev->quirks |= HID_QUIRK_MULTI_INPUT;
+               hdev->quirks |= HID_QUIRK_MULTI_INPUT
+                               | HID_QUIRK_NO_INIT_REPORTS;
 
        nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL);
        if (!nd) {
-               dev_err(&hdev->dev, "cannot allocate N-Trig data\n");
+               hid_err(hdev, "cannot allocate N-Trig data\n");
                return -ENOMEM;
        }
 
@@ -850,13 +863,13 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
 
        ret = hid_parse(hdev);
        if (ret) {
-               dev_err(&hdev->dev, "parse failed\n");
+               hid_err(hdev, "parse failed\n");
                goto err_free;
        }
 
        ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
        if (ret) {
-               dev_err(&hdev->dev, "hw start failed\n");
+               hid_err(hdev, "hw start failed\n");
                goto err_free;
        }