Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1558380

Re: [PATCH 3/4] platform/x86: fujitsu-laptop: break up complex loop condition

From Jonathan Woithe <jwoithe@just42.net>
Newsgroups linux.kernel
Subject Re: [PATCH 3/4] platform/x86: fujitsu-laptop: break up complex loop condition
Date 2017-01-13 13:50 +0100
Message-ID <sZ9sS-Vi-19@gated-at.bofh.it> (permalink)
References <sYmVc-4JW-11@gated-at.bofh.it> <sYn4S-52M-43@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jan 11, 2017 at 09:59:32AM +0100, Micha?? K??pie?? wrote:
> 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>

> ---
>  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

-- 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] fujitsu-laptop: acpi_fujitsu_hotkey_notify() cleanup Michał Kępień <kernel@kempniu.pl> - 2017-01-11 10:10 +0100
  [PATCH 3/4] platform/x86: fujitsu-laptop: break up complex loop condition Michał Kępień <kernel@kempniu.pl> - 2017-01-11 10:10 +0100
    Re: [PATCH 3/4] platform/x86: fujitsu-laptop: break up complex loop  condition Jonathan Woithe <jwoithe@just42.net> - 2017-01-13 13:50 +0100
  [PATCH 2/4] platform/x86: fujitsu-laptop: move keycode processing to separate functions Michał Kępień <kernel@kempniu.pl> - 2017-01-11 10:10 +0100
    Re: [PATCH 2/4] platform/x86: fujitsu-laptop: move keycode  processing to separate functions Jonathan Woithe <jwoithe@just42.net> - 2017-01-13 14:00 +0100
  Re: [PATCH 0/4] fujitsu-laptop: acpi_fujitsu_hotkey_notify() cleanup Jonathan Woithe <jwoithe@just42.net> - 2017-01-11 13:00 +0100
    Re: [PATCH 0/4] fujitsu-laptop: acpi_fujitsu_hotkey_notify() cleanup Michał Kępień <kernel@kempniu.pl> - 2017-01-11 13:30 +0100
      Re: [PATCH 0/4] fujitsu-laptop: acpi_fujitsu_hotkey_notify() cleanup Jonathan Woithe <jwoithe@just42.net> - 2017-01-11 13:50 +0100
        Re: [PATCH 0/4] fujitsu-laptop: acpi_fujitsu_hotkey_notify() cleanup Darren Hart <dvhart@infradead.org> - 2017-01-13 23:00 +0100
        Re: [PATCH 0/4] fujitsu-laptop: acpi_fujitsu_hotkey_notify() cleanup Darren Hart <dvhart@infradead.org> - 2017-01-13 23:10 +0100

csiph-web