1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-22 15:47:37 +00:00

nvme_ctrlr_enable: Small style nits

Rewrite the nested if's using the preferred FreeBSD style for branches
of ifs that return. NFC. Minor tweaks to the comments to better fit new
code layout.

Sponsored by:		Netflix
Reviewed by:		mav, chuck (prior rev, but comments rolled in)
Differential Revision:	https://reviews.freebsd.org/D32245
This commit is contained in:
Warner Losh 2021-10-01 10:51:24 -06:00
parent 26259f6ab9
commit a245627a4e

View File

@ -303,19 +303,17 @@ nvme_ctrlr_disable(struct nvme_controller *ctrlr)
* CSTS.RDY is 0 "has undefined results" So make sure that CSTS.RDY
* isn't the desired value. Short circuit if we're already disabled.
*/
if (en == 1) {
if (rdy == 0) {
/* EN == 1, wait for RDY == 1 or fail */
err = nvme_ctrlr_wait_for_ready(ctrlr, 1);
if (err != 0)
return (err);
}
} else {
/* EN == 0 already wait for RDY == 0 */
if (en == 0) {
/* Wait for RDY == 0 or timeout & fail */
if (rdy == 0)
return (0);
else
return (nvme_ctrlr_wait_for_ready(ctrlr, 0));
return (nvme_ctrlr_wait_for_ready(ctrlr, 0));
}
if (rdy == 0) {
/* EN == 1, wait for RDY == 1 or timeout & fail */
err = nvme_ctrlr_wait_for_ready(ctrlr, 1);
if (err != 0)
return (err);
}
cc &= ~NVME_CC_REG_EN_MASK;
@ -352,15 +350,14 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr)
if (en == 1) {
if (rdy == 1)
return (0);
else
return (nvme_ctrlr_wait_for_ready(ctrlr, 1));
} else {
/* EN == 0 already wait for RDY == 0 or fail */
err = nvme_ctrlr_wait_for_ready(ctrlr, 0);
if (err != 0)
return (err);
return (nvme_ctrlr_wait_for_ready(ctrlr, 1));
}
/* EN == 0 already wait for RDY == 0 or timeout & fail */
err = nvme_ctrlr_wait_for_ready(ctrlr, 0);
if (err != 0)
return (err);
nvme_mmio_write_8(ctrlr, asq, ctrlr->adminq.cmd_bus_addr);
nvme_mmio_write_8(ctrlr, acq, ctrlr->adminq.cpl_bus_addr);