From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>,
Darren Hart <dvhart@infradead.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andy Shevchenko <andy@infradead.org>,
ibm-acpi-devel@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit()
Date: Tue, 9 May 2017 17:17:19 +0300 [thread overview]
Message-ID: <20170509141721.15841-1-andriy.shevchenko@linux.intel.com> (raw)
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
next reply other threads:[~2017-05-09 14:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 14:17 Andy Shevchenko [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170509141721.15841-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andy@infradead.org \
--cc=dvhart@infradead.org \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ibm-acpi@hmh.eng.br \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.