[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yk1TOpjLnmUcRQt3@osiris>
Date: Wed, 6 Apr 2022 10:45:46 +0200
From: Heiko Carstens <hca@...ux.ibm.com>
To: Haowen Bai <baihaowen@...zu.com>,
Peter Oberparleiter <oberpar@...ux.ibm.com>,
Vineeth Vijayan <vneethv@...ux.ibm.com>
Cc: Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] s390: Simplify the calculation of variables
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@...zu.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
>
Powered by blists - more mailing lists