summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt3sas
diff options
context:
space:
mode:
authorSuganath Prabu <suganath-prabu.subramani@broadcom.com>2018-10-31 18:53:34 +0530
committerMartin K. Petersen <martin.petersen@oracle.com>2018-11-06 20:16:01 -0500
commita064a6470be32981470c05082d1119da320e1d7e (patch)
treecc262f505fd7c23c564fc032d2a0840509c06e54 /drivers/scsi/mpt3sas
parentf4305749cafa93167f0f80d76c788dc75f65318b (diff)
downloadlinux-a064a6470be32981470c05082d1119da320e1d7e.tar.gz
linux-a064a6470be32981470c05082d1119da320e1d7e.tar.bz2
linux-a064a6470be32981470c05082d1119da320e1d7e.zip
scsi: mpt3sas: Refactor mpt3sas_wait_for_ioc function
No functional change. Doing code refactor of function mpt3sas_wait_for_ioc() for better readability. Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com> Reviewed-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/mpt3sas')
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_base.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 3b5f28a8fbcc..f25bc3c4f5ac 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -5093,22 +5093,20 @@ mpt3sas_wait_for_ioc(struct MPT3SAS_ADAPTER *ioc, int timeout)
int wait_state_count = 0;
u32 ioc_state;
- ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
- while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
-
- if (wait_state_count++ == timeout) {
- ioc_err(ioc, "%s: failed due to ioc not operational\n",
- __func__);
- return -EFAULT;
- }
- ssleep(1);
+ do {
ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
+ if (ioc_state == MPI2_IOC_STATE_OPERATIONAL)
+ break;
+ ssleep(1);
ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
- __func__, wait_state_count);
+ __func__, ++wait_state_count);
+ } while (--timeout);
+ if (!timeout) {
+ ioc_err(ioc, "%s: failed due to ioc not operational\n", __func__);
+ return -EFAULT;
}
if (wait_state_count)
ioc_info(ioc, "ioc is operational\n");
-
return 0;
}