linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty: hvcs: simplify if-if to if-else
@ 2022-04-24  9:13 Wan Jiabing
  2022-05-02 14:33 ` Christophe Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Wan Jiabing @ 2022-04-24  9:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, David Sterba, Max Filippov,
	Alex Elder, Wan Jiabing, linuxppc-dev, linux-kernel
  Cc: kael_w

Use if and else instead of if(A) and if (!A) and fix a coding style.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
 drivers/tty/hvc/hvcs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 245da1dfd818..9b7e8246a464 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -581,10 +581,9 @@ static int hvcs_io(struct hvcs_struct *hvcsd)
 
 	spin_unlock_irqrestore(&hvcsd->lock, flags);
 	/* This is synch -- FIXME :js: it is not! */
-	if(got)
+	if (got)
 		tty_flip_buffer_push(&hvcsd->port);
-
-	if (!got) {
+	else {
 		/* Do this _after_ the flip_buffer_push */
 		spin_lock_irqsave(&hvcsd->lock, flags);
 		vio_enable_interrupts(hvcsd->vdev);
-- 
2.35.1


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

* Re: [PATCH] tty: hvcs: simplify if-if to if-else
  2022-04-24  9:13 [PATCH] tty: hvcs: simplify if-if to if-else Wan Jiabing
@ 2022-05-02 14:33 ` Christophe Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Leroy @ 2022-05-02 14:33 UTC (permalink / raw)
  To: Wan Jiabing, Greg Kroah-Hartman, Jiri Slaby, David Sterba,
	Max Filippov, Alex Elder, linuxppc-dev, linux-kernel
  Cc: kael_w



Le 24/04/2022 à 11:13, Wan Jiabing a écrit :
> Use if and else instead of if(A) and if (!A) and fix a coding style.
> 
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>


Did you run 'checkpatch' on your patch ?

Should be

	if (something)
		do_something();
	else
		do_something_else();
		

or

	if (something) {
		do_something();
	} else {
		do_something_else();
		do_more();
	}


However, are you sure that those two things are going together and are 
worth an if/else ? Did you look at commit 
33f0f88f1c51ae5c2d593d26960c760ea154c2e2 ?


> ---
>   drivers/tty/hvc/hvcs.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
> index 245da1dfd818..9b7e8246a464 100644
> --- a/drivers/tty/hvc/hvcs.c
> +++ b/drivers/tty/hvc/hvcs.c
> @@ -581,10 +581,9 @@ static int hvcs_io(struct hvcs_struct *hvcsd)
>   
>   	spin_unlock_irqrestore(&hvcsd->lock, flags);
>   	/* This is synch -- FIXME :js: it is not! */
> -	if(got)
> +	if (got)
>   		tty_flip_buffer_push(&hvcsd->port);
> -
> -	if (!got) {
> +	else {
>   		/* Do this _after_ the flip_buffer_push */
>   		spin_lock_irqsave(&hvcsd->lock, flags);
>   		vio_enable_interrupts(hvcsd->vdev);

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

end of thread, other threads:[~2022-05-02 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24  9:13 [PATCH] tty: hvcs: simplify if-if to if-else Wan Jiabing
2022-05-02 14:33 ` Christophe Leroy

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