platform/x86: fujitsu-laptop: break up complex loop condition
authorMichał Kępień <kernel@kempniu.pl>
Wed, 11 Jan 2017 08:59:32 +0000 (09:59 +0100)
committerDarren Hart <dvhart@linux.intel.com>
Sat, 4 Feb 2017 01:47:18 +0000 (02:47 +0100)
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>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
drivers/platform/x86/fujitsu-laptop.c

index f46ef5782e04fc191b1d5a0af4742610ef10931d..1e54dddf51defcf2168a293df19b06dbea933eb3 100644 (file)
@@ -1059,11 +1059,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,