Commit 289a5989 authored by Hans de Goede's avatar Hans de Goede

platform/x86: ideapad-laptop: Refactor ideapad_sync_touchpad_state()

Add an error exit for read_ec_data() failing instead of putting the main
body in an if (success) block.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
Tested-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
Tested-by: default avatarMaxim Mikityanskiy <maxtram95@gmail.com>
Link: https://lore.kernel.org/r/20221117110244.67811-2-hdegoede@redhat.com
parent 7fdc03a7
...@@ -1490,13 +1490,17 @@ static void ideapad_kbd_bl_exit(struct ideapad_private *priv) ...@@ -1490,13 +1490,17 @@ static void ideapad_kbd_bl_exit(struct ideapad_private *priv)
static void ideapad_sync_touchpad_state(struct ideapad_private *priv) static void ideapad_sync_touchpad_state(struct ideapad_private *priv)
{ {
unsigned long value; unsigned long value;
unsigned char param;
int ret;
if (!priv->features.touchpad_ctrl_via_ec) if (!priv->features.touchpad_ctrl_via_ec)
return; return;
/* Without reading from EC touchpad LED doesn't switch state */ /* Without reading from EC touchpad LED doesn't switch state */
if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) { ret = read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value);
unsigned char param; if (ret)
return;
/* /*
* Some IdeaPads don't really turn off touchpad - they only * Some IdeaPads don't really turn off touchpad - they only
* switch the LED state. We (de)activate KBC AUX port to turn * switch the LED state. We (de)activate KBC AUX port to turn
...@@ -1506,7 +1510,6 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv) ...@@ -1506,7 +1510,6 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv)
i8042_command(&param, value ? I8042_CMD_AUX_ENABLE : I8042_CMD_AUX_DISABLE); i8042_command(&param, value ? I8042_CMD_AUX_ENABLE : I8042_CMD_AUX_DISABLE);
ideapad_input_report(priv, value ? 67 : 66); ideapad_input_report(priv, value ? 67 : 66);
sysfs_notify(&priv->platform_device->dev.kobj, NULL, "touchpad"); sysfs_notify(&priv->platform_device->dev.kobj, NULL, "touchpad");
}
} }
static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data) static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment