diff options
author | Hans de Goede <hdegoede@redhat.com> | 2024-04-24 15:28:24 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2024-04-29 12:44:13 +0300 |
commit | 56b3667d4ed34fe21de878b49eb964facc75b0d4 (patch) | |
tree | a85770b167d7a499141f8ecb8c57bb0a886e6e70 /drivers/platform | |
parent | c1a8c7f1dc2ff4e0041fd333317bca06615fbb9e (diff) | |
download | linux-56b3667d4ed34fe21de878b49eb964facc75b0d4.tar.xz |
platform/x86: thinkpad_acpi: Move tpacpi_driver_event() call to tpacpi_input_send_key()
All callers of tpacpi_input_send_key() first call tpacpi_driver_event(),
move the tpacpi_driver_event() inside tpacpi_input_send_key() to avoid
code duplication.
For the original hotkey codes 0x1001 - 0x1020 tpacpi_driver_event() never
returns true. So the added "return true;" inside tpacpi_input_send_key()
never happens when called from tpacpi_hotkey_send_key() so behavior does
not change.
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20240424122834.19801-15-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 313880ccd363..91ede19ba9b9 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -2254,6 +2254,9 @@ static bool tpacpi_input_send_key(const u32 hkey) { unsigned int keycode, scancode; + if (tpacpi_driver_event(hkey)) + return true; + if (hkey >= TP_HKEY_EV_ORIG_KEY_START && hkey <= TP_HKEY_EV_ORIG_KEY_END) { scancode = hkey - TP_HKEY_EV_ORIG_KEY_START; @@ -2295,7 +2298,6 @@ static struct tp_acpi_drv_struct ibm_hotkey_acpidriver; /* Do NOT call without validating scancode first */ static void tpacpi_hotkey_send_key(unsigned int scancode) { - tpacpi_driver_event(TP_HKEY_EV_ORIG_KEY_START + scancode); tpacpi_input_send_key(TP_HKEY_EV_ORIG_KEY_START + scancode); } @@ -3732,9 +3734,6 @@ static bool hotkey_notify_hotkey(const u32 hkey, bool *send_acpi_ev) return true; } - if (tpacpi_driver_event(hkey)) - return true; - return tpacpi_input_send_key(hkey); } |