Re: [PATCH 2/6] thinkpad_acpi: Factor out get/set adaptive kbd mode
From: Darren Hart
Date: Fri Feb 20 2015 - 00:23:13 EST
On Wed, Feb 18, 2015 at 09:53:35PM +0100, Bastien Nocera wrote:
Please provide a commit message. There is always something to say beyond what is
in the subject. In this case, I suggest the motivation and justification for the
change.
While I appreciate the abstraction, it makes the code at the call site easier to
read, note that you added more code than you removed.
So, please provide a justificaiton.
Under no circumstances will I accept a patch without a commit message body.
> Signed-off-by: Bastien Nocera <hadess@xxxxxxxxxx>
> ---
> drivers/platform/x86/thinkpad_acpi.c | 61 ++++++++++++++++++++++--------------
> 1 file changed, 38 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 80db3ce..a6dd017 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -3480,6 +3480,32 @@ const int adaptive_keyboard_modes[] = {
> static bool adaptive_keyboard_mode_is_saved;
> static int adaptive_keyboard_prev_mode;
>
> +static int adaptive_keyboard_get_mode(void)
> +{
> + u32 mode = 0;
acpi_evalf second argument takes an "int" and this function returns "int". Is
there a reason to use u32 for mode?
...
> @@ -3509,39 +3535,28 @@ static bool adaptive_keyboard_hotkey_notify_hotkey(unsigned int scancode)
> new_mode = adaptive_keyboard_prev_mode;
> adaptive_keyboard_mode_is_saved = false;
> } else {
> - if (!acpi_evalf(
> - hkey_handle, ¤t_mode,
> - "GTRW", "dd", 0)) {
> - pr_err("Cannot read adaptive keyboard mode\n");
> + current_mode = adaptive_keyboard_get_mode();
> + if (current_mode < 0)
> return false;
> - } else {
> - new_mode = adaptive_keyboard_get_next_mode(
> - current_mode);
> - }
> + new_mode = adaptive_keyboard_get_next_mode(
> + current_mode);
This now fits on one line I believe.
...
--
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/