[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170509141721.15841-1-andriy.shevchenko@linux.intel.com>
Date: Tue, 9 May 2017 17:17:19 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Henrique de Moraes Holschuh <ibm-acpi@....eng.br>,
Darren Hart <dvhart@...radead.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Andy Shevchenko <andy@...radead.org>,
ibm-acpi-devel@...ts.sourceforge.net,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit()
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@...ux.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
Powered by blists - more mailing lists