scsi: megaraid_sas: Fix msleep granularity
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Wed, 17 Oct 2018 06:37:41 +0000 (23:37 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 7 Nov 2018 01:33:56 +0000 (20:33 -0500)
In megasas_transition_to_ready() driver waits 180seconds for controller to
change FW state. Here we are calling msleep(1) in a loop for this.  As
explained in timers-howto.txt, msleep(1) will actually sleep longer than
1ms. If a faulty controller is connected, we will end up waiting for much
more than 180 seconds causing unnecessary delays during load.

Change the granularity of msleep() call from 1ms to 1000ms.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_sas_base.c

index 3ddf71b8c38d1f97fface8e2cfeb8e7a9883d3a0..23cdeca26c532c389ca437e0d34ba5feefadd67a 100644 (file)
@@ -3891,12 +3891,12 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
                /*
                 * The cur_state should not last for more than max_wait secs
                 */
-               for (i = 0; i < (max_wait * 1000); i++) {
+               for (i = 0; i < max_wait; i++) {
                        curr_abs_state = instance->instancet->
                                read_fw_status_reg(instance->reg_set);
 
                        if (abs_state == curr_abs_state) {
-                               msleep(1);
+                               msleep(1000);
                        } else
                                break;
                }