s390x: refactor error handling for XSCH handler

Simplify the error handling of the XSCH.  Let the code detecting the
condition tell (in a less ambiguous way) how it's to be handled. No
changes in behavior.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Message-Id: <20171017140453.51099-5-pasic@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
This commit is contained in:
Halil Pasic 2017-10-17 16:04:50 +02:00 committed by Cornelia Huck
parent 66dc50f705
commit 963764081d
3 changed files with 10 additions and 32 deletions

View file

@ -1402,20 +1402,17 @@ out:
return ret;
}
int css_do_xsch(SubchDev *sch)
IOInstEnding css_do_xsch(SubchDev *sch)
{
SCSW *s = &sch->curr_status.scsw;
PMCW *p = &sch->curr_status.pmcw;
int ret;
if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {
ret = -ENODEV;
goto out;
return IOINST_CC_NOT_OPERATIONAL;
}
if (s->ctrl & SCSW_CTRL_MASK_STCTL) {
ret = -EINPROGRESS;
goto out;
return IOINST_CC_STATUS_PRESENT;
}
if (!(s->ctrl & SCSW_CTRL_MASK_FCTL) ||
@ -1423,8 +1420,7 @@ int css_do_xsch(SubchDev *sch)
(!(s->ctrl &
(SCSW_ACTL_RESUME_PEND | SCSW_ACTL_START_PEND | SCSW_ACTL_SUSP))) ||
(s->ctrl & SCSW_ACTL_SUBCH_ACTIVE)) {
ret = -EBUSY;
goto out;
return IOINST_CC_BUSY;
}
/* Cancel the current operation. */
@ -1436,10 +1432,7 @@ int css_do_xsch(SubchDev *sch)
sch->last_cmd_valid = false;
s->dstat = 0;
s->cstat = 0;
ret = 0;
out:
return ret;
return IOINST_CC_EXPECTED;
}
int css_do_csch(SubchDev *sch)