]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers-platform-x86-sony-laptopc-fix-scancodes-v2
authorJohn Hughes <john@calvaedi.com>
Fri, 16 Dec 2011 04:49:30 +0000 (15:49 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 19 Dec 2011 07:19:16 +0000 (18:19 +1100)
Signed-off-by: John Hughes <john@calva.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mattia Dongili <malattia@linux.it>
Cc: John Hughes <john@Calva.COM>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/platform/x86/sony-laptop.c

index 26ef0f34e1bef7cab5752513ae1c0f94bd38a5f3..b8f1b4704d04b98df6f384cfd47885826cf16dcc 100644 (file)
@@ -347,7 +347,7 @@ static void sony_laptop_report_input_event(u8 event)
        struct input_dev *jog_dev = sony_laptop_input.jog_dev;
        struct input_dev *key_dev = sony_laptop_input.key_dev;
        struct sony_laptop_keypress kp = { NULL };
-       int scancode;
+       int scancode = -1;
 
        if (event == SONYPI_EVENT_FNKEY_RELEASED ||
                        event == SONYPI_EVENT_ANYBUTTON_RELEASED) {
@@ -391,8 +391,10 @@ static void sony_laptop_report_input_event(u8 event)
        }
 
        if (kp.dev) {
-               /* we emit the scancode so we can always remap the key */
-               input_event(kp.dev, EV_MSC, MSC_SCAN, scancode);
+               /* if we have a scancode we emit it so we can always
+                   remap the key */
+               if (scancode != -1)
+                       input_event(kp.dev, EV_MSC, MSC_SCAN, scancode);
                input_report_key(kp.dev, kp.key, 1);
                input_sync(kp.dev);
 
@@ -468,7 +470,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)
        jog_dev->name = "Sony Vaio Jogdial";
        jog_dev->id.bustype = BUS_ISA;
        jog_dev->id.vendor = PCI_VENDOR_ID_SONY;
-       key_dev->dev.parent = &acpi_device->dev;
+       jog_dev->dev.parent = &acpi_device->dev;
 
        input_set_capability(jog_dev, EV_KEY, BTN_MIDDLE);
        input_set_capability(jog_dev, EV_REL, REL_WHEEL);