nvme-pci: cleanup nvme_should_reset
Christoph Hellwig
maintainerPATCH 1/1 nvme-pci: cleanup nvme_should_reset
Both the comments and the code flow in this function are rather confusing. Directly return the expression that the reset is keyed off, and update a comment to match it.
Signed-off-by Christoph Hellwig <[email protected]>
--- drivers/nvme/host/pci.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/nvme/host/pci.c +5 -11
@@ -1229,11 +1229,6 @@ static enum rq_end_io_ret abort_endio(struct request *req, blk_status_t error)static bool nvme_should_reset (struct nvme_dev *dev,u32 csts) { -/* If true, indicates loss of adapter communication, possibly by a -* NVMe Subsystem reset. -*/ -bool nssro = dev->subsystem && (csts &NVME_CSTS_NSSRO ); -/* If there is a reset/reinit ongoing, we shouldn't reset again. */ switch (dev->ctrl.state) {case NVME_CTRL_RESETTING :
@@ -1243,13 +1238,12 @@ static bool nvme_should_reset(struct nvme_dev *dev, u32 csts)break ; } -/* We shouldn't reset unless the controller is on fatal error state -* _or_ if we lost the communication with it. +/* +* Don't reset unless the controller is in a fatal error state or +* affected by a subsystem reset. */ -if (!(csts &NVME_CSTS_CFS ) && !nssro) -return false; - -return true; +return (csts &NVME_CSTS_CFS ) || + (dev->subsystem && (csts &NVME_CSTS_NSSRO )); }static void nvme_warn_reset (struct nvme_dev *dev,u32 csts)
Signature · 1 line
2.39.2
Quoted 6 lines · Christoph Hellwig
Both the comments and the code flow in this function are rather confusing. Directly return the expression that the reset is keyed off, and update a comment to match it.
Signed-off-by Christoph Hellwig <[email protected]>---
Looks good.
Reviewed-by Chaitanya Kulkarni <[email protected]>
-ck