Commit 4da75a7f authored by Haowen Bai's avatar Haowen Bai Committed by Heiko Carstens

s390/cio: simplify the calculation of variables

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: default avatarHaowen Bai <baihaowen@meizu.com>
Reviewed-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
Link: https://lore.kernel.org/r/1649297808-5048-1-git-send-email-baihaowen@meizu.com
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 7714e16f
...@@ -508,9 +508,21 @@ static inline int scsw_cmd_is_valid_zcc(union scsw *scsw) ...@@ -508,9 +508,21 @@ static inline int scsw_cmd_is_valid_zcc(union scsw *scsw)
*/ */
static inline int scsw_cmd_is_valid_ectl(union scsw *scsw) static inline int scsw_cmd_is_valid_ectl(union scsw *scsw)
{ {
return (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) && /* Must be status pending. */
!(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) && if (!(scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND))
(scsw->cmd.stctl & SCSW_STCTL_ALERT_STATUS); return 0;
/* Must have alert status. */
if (!(scsw->cmd.stctl & SCSW_STCTL_ALERT_STATUS))
return 0;
/* Must be alone or together with primary, secondary or both,
* => no intermediate status.
*/
if (scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS)
return 0;
return 1;
} }
/** /**
...@@ -522,10 +534,25 @@ static inline int scsw_cmd_is_valid_ectl(union scsw *scsw) ...@@ -522,10 +534,25 @@ static inline int scsw_cmd_is_valid_ectl(union scsw *scsw)
*/ */
static inline int scsw_cmd_is_valid_pno(union scsw *scsw) static inline int scsw_cmd_is_valid_pno(union scsw *scsw)
{ {
return (scsw->cmd.fctl != 0) && /* Must indicate at least one I/O function. */
(scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) && if (!scsw->cmd.fctl)
(!(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) || return 0;
(scsw->cmd.actl & SCSW_ACTL_SUSPENDED));
/* Must be status pending. */
if (!(scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND))
return 0;
/* Can be status pending alone, or with any combination of primary,
* secondary and alert => no intermediate status.
*/
if (!(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS))
return 1;
/* If intermediate, must be suspended. */
if (scsw->cmd.actl & SCSW_ACTL_SUSPENDED)
return 1;
return 0;
} }
/** /**
...@@ -675,9 +702,21 @@ static inline int scsw_tm_is_valid_q(union scsw *scsw) ...@@ -675,9 +702,21 @@ static inline int scsw_tm_is_valid_q(union scsw *scsw)
*/ */
static inline int scsw_tm_is_valid_ectl(union scsw *scsw) static inline int scsw_tm_is_valid_ectl(union scsw *scsw)
{ {
return (scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) && /* Must be status pending. */
!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) && if (!(scsw->tm.stctl & SCSW_STCTL_STATUS_PEND))
(scsw->tm.stctl & SCSW_STCTL_ALERT_STATUS); return 0;
/* Must have alert status. */
if (!(scsw->tm.stctl & SCSW_STCTL_ALERT_STATUS))
return 0;
/* Must be alone or together with primary, secondary or both,
* => no intermediate status.
*/
if (scsw->tm.stctl & SCSW_STCTL_INTER_STATUS)
return 0;
return 1;
} }
/** /**
...@@ -689,11 +728,25 @@ static inline int scsw_tm_is_valid_ectl(union scsw *scsw) ...@@ -689,11 +728,25 @@ static inline int scsw_tm_is_valid_ectl(union scsw *scsw)
*/ */
static inline int scsw_tm_is_valid_pno(union scsw *scsw) static inline int scsw_tm_is_valid_pno(union scsw *scsw)
{ {
return (scsw->tm.fctl != 0) && /* Must indicate at least one I/O function. */
(scsw->tm.stctl & SCSW_STCTL_STATUS_PEND) && if (!scsw->tm.fctl)
(!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) || return 0;
((scsw->tm.stctl & SCSW_STCTL_INTER_STATUS) &&
(scsw->tm.actl & SCSW_ACTL_SUSPENDED))); /* Must be status pending. */
if (!(scsw->tm.stctl & SCSW_STCTL_STATUS_PEND))
return 0;
/* Can be status pending alone, or with any combination of primary,
* secondary and alert => no intermediate status.
*/
if (!(scsw->tm.stctl & SCSW_STCTL_INTER_STATUS))
return 1;
/* If intermediate, must be suspended. */
if (scsw->tm.actl & SCSW_ACTL_SUSPENDED)
return 1;
return 0;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment