linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit()
@ 2017-05-09 14:17 Andy Shevchenko
  2017-05-09 14:17 ` [PATCH v1 2/3] platform/x86: thinkpad_acpi: Join string literals back Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Andy Shevchenko @ 2017-05-09 14:17 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh, Darren Hart
  Cc: Andy Shevchenko, Andy Shevchenko, ibm-acpi-devel,
	platform-driver-x86, linux-kernel

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.

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");
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-05-10 13:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 14:17 [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit() Andy Shevchenko
2017-05-09 14:17 ` [PATCH v1 2/3] platform/x86: thinkpad_acpi: Join string literals back Andy Shevchenko
2017-05-09 17:10   ` Henrique de Moraes Holschuh
2017-05-09 17:33     ` Andy Shevchenko
2017-05-10  0:24       ` Henrique de Moraes Holschuh
2017-05-10 10:51         ` Andy Shevchenko
2017-05-10 13:21           ` Henrique de Moraes Holschuh
2017-05-09 14:17 ` [PATCH v1 3/3] platform/x86: thinkpad_acpi: Add a comment about 0 in module_param_call() Andy Shevchenko
2017-05-09 17:03   ` Henrique de Moraes Holschuh
2017-05-09 17:02 ` [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit() Henrique de Moraes Holschuh
2017-05-09 17:28   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).