Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638293

Re: [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit()

From Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Newsgroups linux.kernel
Subject Re: [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit()
Date 2017-05-09 19:10 +0200
Message-ID <tFgO5-4HS-11@gated-at.bofh.it> (permalink)
References <tFe9A-2OU-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 09 May 2017, Andy Shevchenko wrote:
> The commit 4be73005e4dc
> 
> 	("thinkpad-acpi: remove uneeded tp_features.hotkey tests in hotkey_exit")
> 
> adds a complex logic behind hotkey status check in a way
> it started mixing logical operations with bitwise ones.
> 
> Refactor the code to make it straight and slightly clearer.

Eh, I find this actually less clear, given the comment that was in the
old code, which you deleted.

Please keep the important part of the comment at the very least.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/platform/x86/thinkpad_acpi.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 7b6cb0c69b02..7740b5e1b998 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -3090,6 +3090,8 @@ static void tpacpi_send_radiosw_update(void)
>  
>  static void hotkey_exit(void)
>  {
> +	int res;
> +
>  #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
>  	mutex_lock(&hotkey_mutex);
>  	hotkey_poll_stop_sync();
> @@ -3101,11 +3103,8 @@ static void hotkey_exit(void)
>  
>  	dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY,
>  		   "restoring original HKEY status and mask\n");
> -	/* yes, there is a bitwise or below, we want the
> -	 * functions to be called even if one of them fail */
> -	if (((tp_features.hotkey_mask &&
> -	      hotkey_mask_set(hotkey_orig_mask)) |
> -	     hotkey_status_set(false)) != 0)
> +	res = tp_features.hotkey_mask ? hotkey_mask_set(hotkey_orig_mask) : 0;
> +	if (hotkey_status_set(false) || res)
>  		pr_err("failed to restore hot key mask "
>  		       "to BIOS defaults\n");
>  }

-- 
  Henrique Holschuh

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-09 16:20 +0200
  [PATCH v1 3/3] platform/x86: thinkpad_acpi: Add a comment about 0 in module_param_call() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-09 16:30 +0200
    Re: [PATCH v1 3/3] platform/x86: thinkpad_acpi: Add a comment about  0 in module_param_call() Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2017-05-09 19:10 +0200
  [PATCH v1 2/3] platform/x86: thinkpad_acpi: Join string literals back Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-09 16:30 +0200
    Re: [PATCH v1 2/3] platform/x86: thinkpad_acpi: Join string literals  back Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2017-05-09 19:20 +0200
      Re: [PATCH v1 2/3] platform/x86: thinkpad_acpi: Join string  literals back Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-09 19:40 +0200
        Re: [PATCH v1 2/3] platform/x86: thinkpad_acpi: Join string literals  back Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2017-05-10 02:30 +0200
          Re: [PATCH v1 2/3] platform/x86: thinkpad_acpi: Join string  literals back Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-10 13:00 +0200
            Re: [PATCH v1 2/3] platform/x86: thinkpad_acpi: Join string literals  back Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2017-05-10 15:30 +0200
  Re: [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight  in hotkey_exit() Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2017-05-09 19:10 +0200
    Re: [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight  in hotkey_exit() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-09 19:40 +0200

csiph-web