From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Wan Jiabing <wanjiabing@vivo.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
David Sterba <dsterba@suse.com>,
Max Filippov <jcmvbkbc@gmail.com>, Alex Elder <elder@linaro.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "kael_w@yeah.net" <kael_w@yeah.net>
Subject: Re: [PATCH] tty: hvcs: simplify if-if to if-else
Date: Mon, 2 May 2022 14:33:44 +0000 [thread overview]
Message-ID: <123409e8-e7ad-0256-9c83-2778dbf03219@csgroup.eu> (raw)
In-Reply-To: <20220424091310.98780-1-wanjiabing@vivo.com>
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);
prev parent reply other threads:[~2022-05-02 14:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 9:13 [PATCH] tty: hvcs: simplify if-if to if-else Wan Jiabing
2022-05-02 14:33 ` Christophe Leroy [this message]
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=123409e8-e7ad-0256-9c83-2778dbf03219@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=dsterba@suse.com \
--cc=elder@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jcmvbkbc@gmail.com \
--cc=jirislaby@kernel.org \
--cc=kael_w@yeah.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=wanjiabing@vivo.com \
/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;
as well as URLs for NNTP newsgroup(s).