diff options
author | Suganath Prabu <suganath-prabu.subramani@broadcom.com> | 2018-10-31 09:23:34 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-11-06 20:16:01 -0500 |
commit | a064a6470be32981470c05082d1119da320e1d7e (patch) | |
tree | cc262f505fd7c23c564fc032d2a0840509c06e54 /drivers/scsi/mpt3sas | |
parent | f4305749cafa93167f0f80d76c788dc75f65318b (diff) |
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.c | 20 |
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) | |||
5093 | int wait_state_count = 0; | 5093 | int wait_state_count = 0; |
5094 | u32 ioc_state; | 5094 | u32 ioc_state; |
5095 | 5095 | ||
5096 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); | 5096 | do { |
5097 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { | ||
5098 | |||
5099 | if (wait_state_count++ == timeout) { | ||
5100 | ioc_err(ioc, "%s: failed due to ioc not operational\n", | ||
5101 | __func__); | ||
5102 | return -EFAULT; | ||
5103 | } | ||
5104 | ssleep(1); | ||
5105 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); | 5097 | ioc_state = mpt3sas_base_get_iocstate(ioc, 1); |
5098 | if (ioc_state == MPI2_IOC_STATE_OPERATIONAL) | ||
5099 | break; | ||
5100 | ssleep(1); | ||
5106 | ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", | 5101 | ioc_info(ioc, "%s: waiting for operational state(count=%d)\n", |
5107 | __func__, wait_state_count); | 5102 | __func__, ++wait_state_count); |
5103 | } while (--timeout); | ||
5104 | if (!timeout) { | ||
5105 | ioc_err(ioc, "%s: failed due to ioc not operational\n", __func__); | ||
5106 | return -EFAULT; | ||
5108 | } | 5107 | } |
5109 | if (wait_state_count) | 5108 | if (wait_state_count) |
5110 | ioc_info(ioc, "ioc is operational\n"); | 5109 | ioc_info(ioc, "ioc is operational\n"); |
5111 | |||
5112 | return 0; | 5110 | return 0; |
5113 | } | 5111 | } |
5114 | 5112 | ||