mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-18 11:47:28 +07:00
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>
This commit is contained in:
parent
f4305749ca
commit
a064a6470b
@ -5093,22 +5093,20 @@ mpt3sas_wait_for_ioc(struct MPT3SAS_ADAPTER *ioc, int timeout)
|
|||||||
int wait_state_count = 0;
|
int wait_state_count = 0;
|
||||||
u32 ioc_state;
|
u32 ioc_state;
|
||||||
|
|
||||||
|
do {
|
||||||
ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
|
ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
|
||||||
while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
|
if (ioc_state == MPI2_IOC_STATE_OPERATIONAL)
|
||||||
|
break;
|
||||||
if (wait_state_count++ == timeout) {
|
|
||||||
ioc_err(ioc, "%s: failed due to ioc not operational\n",
|
|
||||||
__func__);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
ssleep(1);
|
ssleep(1);
|
||||||
ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
|
|
||||||
ioc_info(ioc, "%s: waiting for operational state(count=%d)\n",
|
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)
|
if (wait_state_count)
|
||||||
ioc_info(ioc, "ioc is operational\n");
|
ioc_info(ioc, "ioc is operational\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user