From: John Hughes Date: Thu, 8 Dec 2011 04:32:11 +0000 (+1100) Subject: drivers-platform-x86-sony-laptopc-fix-scancodes-v2 X-Git-Tag: next-20111212~1^2~208 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0c4ce17aea7694398c778bb6229429ad9f502a8f;p=karo-tx-linux.git drivers-platform-x86-sony-laptopc-fix-scancodes-v2 Signed-off-by: John Hughes Cc: Dan Carpenter Cc: Mattia Dongili Cc: John Hughes Cc: Matthew Garrett Signed-off-by: Andrew Morton --- diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 26ef0f34e1be..b8f1b4704d04 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -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);