linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: speakup: One function call less in speakup_win_enable()
@ 2019-07-06  8:15 Markus Elfring
  2019-07-06  9:00 ` Samuel Thibault
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2019-07-06  8:15 UTC (permalink / raw)
  To: speakup, devel, Bhagyashri Dighole, Chris Brannon,
	Greg Kroah-Hartman, Kirk Reiser, Okash Khawaja, Samuel Thibault,
	William Hubbs
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 6 Jul 2019 10:03:56 +0200

Avoid an extra function call by using a ternary operator instead of
a conditional statement.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/staging/speakup/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 488f2539aa9a..03bbc9a4dbb3 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1917,10 +1917,9 @@ static void speakup_win_enable(struct vc_data *vc)
 		return;
 	}
 	win_enabled ^= 1;
-	if (win_enabled)
-		synth_printf("%s\n", spk_msg_get(MSG_WINDOW_SILENCED));
-	else
-		synth_printf("%s\n", spk_msg_get(MSG_WINDOW_SILENCE_DISABLED));
+	synth_printf("%s\n", spk_msg_get(win_enabled
+					 ? MSG_WINDOW_SILENCED
+					 : MSG_WINDOW_SILENCE_DISABLED));
 }

 static void speakup_bits(struct vc_data *vc)
--
2.22.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: speakup: One function call less in speakup_win_enable()
  2019-07-06  8:15 [PATCH] staging: speakup: One function call less in speakup_win_enable() Markus Elfring
@ 2019-07-06  9:00 ` Samuel Thibault
  2019-07-06  9:28   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Thibault @ 2019-07-06  9:00 UTC (permalink / raw)
  To: Markus Elfring
  Cc: speakup, devel, Bhagyashri Dighole, Chris Brannon,
	Greg Kroah-Hartman, Kirk Reiser, Okash Khawaja, William Hubbs,
	LKML, kernel-janitors

Markus Elfring, le sam. 06 juil. 2019 10:15:30 +0200, a ecrit:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 6 Jul 2019 10:03:56 +0200
> 
> Avoid an extra function call by using a ternary operator instead of
> a conditional statement.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  drivers/staging/speakup/main.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index 488f2539aa9a..03bbc9a4dbb3 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1917,10 +1917,9 @@ static void speakup_win_enable(struct vc_data *vc)
>  		return;
>  	}
>  	win_enabled ^= 1;
> -	if (win_enabled)
> -		synth_printf("%s\n", spk_msg_get(MSG_WINDOW_SILENCED));
> -	else
> -		synth_printf("%s\n", spk_msg_get(MSG_WINDOW_SILENCE_DISABLED));
> +	synth_printf("%s\n", spk_msg_get(win_enabled
> +					 ? MSG_WINDOW_SILENCED
> +					 : MSG_WINDOW_SILENCE_DISABLED));
>  }
> 
>  static void speakup_bits(struct vc_data *vc)
> --
> 2.22.0
> 

-- 
Samuel
--- christ gives channel operator status to Dieu
 -+- #ens-mim and hell -+-

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: speakup: One function call less in speakup_win_enable()
  2019-07-06  9:00 ` Samuel Thibault
@ 2019-07-06  9:28   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-06  9:28 UTC (permalink / raw)
  To: Samuel Thibault, Markus Elfring, speakup, devel,
	Bhagyashri Dighole, Chris Brannon, Kirk Reiser, Okash Khawaja,
	William Hubbs, LKML, kernel-janitors

On Sat, Jul 06, 2019 at 11:00:19AM +0200, Samuel Thibault wrote:
> Markus Elfring, le sam. 06 juil. 2019 10:15:30 +0200, a ecrit:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Sat, 6 Jul 2019 10:03:56 +0200
> > 
> > Avoid an extra function call by using a ternary operator instead of
> > a conditional statement.
> > 
> > This issue was detected by using the Coccinelle software.
> > 
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> 
> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Sorry, but this author/bot is in my kill-file and I no longer accept
patches from them.

And I HATE ternary operators anyway, so it's not like I would take this
patch if it came from someone else :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-06  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-06  8:15 [PATCH] staging: speakup: One function call less in speakup_win_enable() Markus Elfring
2019-07-06  9:00 ` Samuel Thibault
2019-07-06  9:28   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).