platform/x86: thinkpad_acpi: Don't register keyboard_lang unnecessarily
authorHans de Goede <hdegoede@redhat.com>
Mon, 25 Jan 2021 20:52:58 +0000 (21:52 +0100)
committerHans de Goede <hdegoede@redhat.com>
Tue, 2 Feb 2021 14:03:12 +0000 (15:03 +0100)
commit9e9c64131f47b0016911b76cebfcda6b1bb3b7b7
tree5e2c77a23648cce245cba0bb075dc09fdfd3fb12
parent64b0efa18f8c3b1baac369b8d74d0fdae02bc4bc
platform/x86: thinkpad_acpi: Don't register keyboard_lang unnecessarily

All recent ThinkPad BIOS-es support the GSKL method used to query the
keyboard-layout used by the ECFW for the SHIFT + other-key key-press
emulation for special keys such as e.g. the '=', '(' and ')' keys
above the numpad on 15" models.

So just checking for the method is not a good indicator of the
model supporting getting/setting the keyboard_lang.

On models where this is not supported GSKL succeeds, but it returns
METHOD_ERR in the returned integer to indicate that this is not
supported on this model.

Add a check for METHOD_ERR and return -ENODEV if it is set to
avoid registering a non-working keyboard_lang sysfs-attr on models
where this is not supported.

Cc: Nitin Joshi <njoshi1@lenovo.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210125205258.135664-1-hdegoede@redhat.com
drivers/platform/x86/thinkpad_acpi.c