From: Heiko Carstens <hca@linux.ibm.com>
To: Haowen Bai <baihaowen@meizu.com>,
Peter Oberparleiter <oberpar@linux.ibm.com>,
Vineeth Vijayan <vneethv@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] s390: Simplify the calculation of variables
Date: Wed, 6 Apr 2022 10:45:46 +0200 [thread overview]
Message-ID: <Yk1TOpjLnmUcRQt3@osiris> (raw)
In-Reply-To: <1649212651-32038-1-git-send-email-baihaowen@meizu.com>
On Wed, Apr 06, 2022 at 10:37:31AM +0800, Haowen Bai wrote:
> Fix the following coccicheck warnings:
> ./arch/s390/include/asm/scsw.h:695:47-49: WARNING
> !A || A && B is equivalent to !A || B
>
> I apply a readable version just to get rid of a warning.
>
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>
> ---
> V1->V2: apply a readable and simple version as suggestion.
>
> arch/s390/include/asm/scsw.h | 47 ++++++++++++++++++++++++++++++--------------
> 1 file changed, 32 insertions(+), 15 deletions(-)
[full quote below]
Vineeth, Peter, could one of you please Review and or ACK the patch
below?
Thank you!
> diff --git a/arch/s390/include/asm/scsw.h b/arch/s390/include/asm/scsw.h
> index a7c3ccf681da..b7e65f96de3c 100644
> --- a/arch/s390/include/asm/scsw.h
> +++ b/arch/s390/include/asm/scsw.h
> @@ -508,9 +508,13 @@ static inline int scsw_cmd_is_valid_zcc(union scsw *scsw)
> */
> static inline int scsw_cmd_is_valid_ectl(union scsw *scsw)
> {
> - return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
> - !(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) &&
> - (scsw->cmd.stctl & SCSW_STCTL_ALERT_STATUS);
> + if (!(scsw->tm.stctl & SCSW_STCTL_STATUS_PEND))
> + return 0;
> + if (scsw->tm.stctl & SCSW_STCTL_INTER_STATUS)
> + return 0;
> + if (scsw->tm.stctl & SCSW_STCTL_ALERT_STATUS)
> + return 1;
> + return 0;
> }
>
> /**
> @@ -522,10 +526,15 @@ static inline int scsw_cmd_is_valid_ectl(union scsw *scsw)
> */
> static inline int scsw_cmd_is_valid_pno(union scsw *scsw)
> {
> - return (scsw->cmd.fctl != 0) &&
> - (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) &&
> - (!(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) ||
> - (scsw->cmd.actl & SCSW_ACTL_SUSPENDED));
> + if (!scsw->tm.fctl)
> + return 0;
> + if (!(scsw->tm.stctl & SCSW_STCTL_STATUS_PEND))
> + return 0;
> + if (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS))
> + return 1;
> + if (scsw->tm.actl & SCSW_ACTL_SUSPENDED)
> + return 1;
> + return 0;
> }
>
> /**
> @@ -675,9 +684,13 @@ static inline int scsw_tm_is_valid_q(union scsw *scsw)
> */
> static inline int scsw_tm_is_valid_ectl(union scsw *scsw)
> {
> - return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
> - !(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
> - (scsw->tm.stctl & SCSW_STCTL_ALERT_STATUS);
> + if (!(scsw->tm.stctl & SCSW_STCTL_STATUS_PEND))
> + return 0;
> + if (scsw->tm.stctl & SCSW_STCTL_INTER_STATUS)
> + return 0;
> + if (scsw->tm.stctl & SCSW_STCTL_ALERT_STATUS)
> + return 1;
> + return 0;
> }
>
> /**
> @@ -689,11 +702,15 @@ static inline int scsw_tm_is_valid_ectl(union scsw *scsw)
> */
> static inline int scsw_tm_is_valid_pno(union scsw *scsw)
> {
> - return (scsw->tm.fctl != 0) &&
> - (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) &&
> - (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) ||
> - ((scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
> - (scsw->tm.actl & SCSW_ACTL_SUSPENDED)));
> + if (!scsw->tm.fctl)
> + return 0;
> + if (!(scsw->tm.stctl & SCSW_STCTL_STATUS_PEND))
> + return 0;
> + if (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS))
> + return 1;
> + if (scsw->tm.actl & SCSW_ACTL_SUSPENDED)
> + return 1;
> + return 0;
> }
>
> /**
> --
> 2.7.4
>
next prev parent reply other threads:[~2022-04-06 12:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-28 2:36 [PATCH] s390: Simplify the calculation of variables Haowen Bai
2022-03-28 5:37 ` kernel test robot
2022-03-28 6:08 ` kernel test robot
2022-03-28 12:15 ` David Laight
2022-04-04 9:10 ` Heiko Carstens
2022-04-06 2:37 ` [PATCH V2] " Haowen Bai
2022-04-06 8:45 ` Heiko Carstens [this message]
2022-04-06 16:44 ` Peter Oberparleiter
2022-04-07 2:16 ` [PATCH V3] " Haowen Bai
2022-04-08 12:53 ` Peter Oberparleiter
2022-04-08 14:32 ` Heiko Carstens
2022-04-07 2:19 ` [PATCH V2] " baihaowen
-- strict thread matches above, loose matches on Subject: below --
2022-03-28 6:19 Haowen Bai
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=Yk1TOpjLnmUcRQt3@osiris \
--to=hca@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=baihaowen@meizu.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=oberpar@linux.ibm.com \
--cc=svens@linux.ibm.com \
--cc=vneethv@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.