From: "Michał Kępień" <kernel@kempniu.pl>
To: Jonathan Woithe <jwoithe@just42.net>, Darren Hart <dvhart@infradead.org>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] platform/x86: fujitsu-laptop: break up complex loop condition
Date: Wed, 11 Jan 2017 09:59:32 +0100 [thread overview]
Message-ID: <20170111085933.2486-4-kernel@kempniu.pl> (raw)
In-Reply-To: <20170111085933.2486-1-kernel@kempniu.pl>
The loop condition in acpi_fujitsu_hotkey_release() includes an
assignment, a four-argument function call and a comparison, making it
hard to read. Separate the assignment from the comparison to improve
readability.
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/fujitsu-laptop.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index e57d3724d2ce..06653a8594ed 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -1054,11 +1054,13 @@ static void acpi_fujitsu_hotkey_release(void)
struct input_dev *input = fujitsu_hotkey->input;
int keycode, status;
- while ((status = kfifo_out_locked(&fujitsu_hotkey->fifo,
+ while (true) {
+ status = kfifo_out_locked(&fujitsu_hotkey->fifo,
(unsigned char *)&keycode,
sizeof(keycode),
- &fujitsu_hotkey->fifo_lock))
- == sizeof(keycode)) {
+ &fujitsu_hotkey->fifo_lock);
+ if (status != sizeof(keycode))
+ return;
input_report_key(input, keycode, 0);
input_sync(input);
vdbg_printk(FUJLAPTOP_DBG_TRACE,
--
2.11.0
next prev parent reply other threads:[~2017-01-11 9:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 8:59 [PATCH 0/4] fujitsu-laptop: acpi_fujitsu_hotkey_notify() cleanup Michał Kępień
2017-01-11 8:59 ` [PATCH 1/4] platform/x86: fujitsu-laptop: decrease indentation in acpi_fujitsu_hotkey_notify() Michał Kępień
2017-01-13 12:38 ` Jonathan Woithe
2017-01-11 8:59 ` [PATCH 2/4] platform/x86: fujitsu-laptop: move keycode processing to separate functions Michał Kępień
2017-01-13 12:38 ` Jonathan Woithe
2017-01-11 8:59 ` Michał Kępień [this message]
2017-01-13 12:38 ` [PATCH 3/4] platform/x86: fujitsu-laptop: break up complex loop condition Jonathan Woithe
2017-01-11 8:59 ` [PATCH 4/4] platform/x86: fujitsu-laptop: make hotkey handling functions more similar Michał Kępień
2017-01-13 12:38 ` Jonathan Woithe
2017-01-11 11:58 ` [PATCH 0/4] fujitsu-laptop: acpi_fujitsu_hotkey_notify() cleanup Jonathan Woithe
2017-01-11 12:26 ` Michał Kępień
2017-01-11 12:48 ` Jonathan Woithe
2017-01-13 21:51 ` Darren Hart
2017-01-13 22:09 ` Darren Hart
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=20170111085933.2486-4-kernel@kempniu.pl \
--to=kernel@kempniu.pl \
--cc=dvhart@infradead.org \
--cc=jwoithe@just42.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox