Skip to content

Commit c301b02

Browse files
Vikas ChaudharyJames Bottomley
authored andcommitted
[SCSI] qla4xxx: Updated firmware ready timeout algorithm
Updated firmware ready timeout algorithm to prevent long delays and use jiffies to time out instead of counter. Also use msleep_interruptible instead of msleep. Signed-off-by: Karen Higgins <karen.higgins@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Signed-off-by: Ravi Anand <ravi.anand@qlogic.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
1 parent c2393cd commit c301b02

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

drivers/scsi/qla4xxx/ql4_init.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ static void qla4x00_pci_config(struct scsi_qla_host *ha)
10461046
static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha)
10471047
{
10481048
int status = QLA_ERROR;
1049-
uint32_t max_wait_time;
1049+
unsigned long max_wait_time;
10501050
unsigned long flags;
10511051
uint32_t mbox_status;
10521052

@@ -1078,7 +1078,10 @@ static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha)
10781078
spin_unlock_irqrestore(&ha->hardware_lock, flags);
10791079

10801080
/* Wait for firmware to come UP. */
1081-
max_wait_time = FIRMWARE_UP_TOV * 4;
1081+
DEBUG2(printk(KERN_INFO "scsi%ld: %s: Wait up to %d seconds for "
1082+
"boot firmware to complete...\n",
1083+
ha->host_no, __func__, FIRMWARE_UP_TOV));
1084+
max_wait_time = jiffies + (FIRMWARE_UP_TOV * HZ);
10821085
do {
10831086
uint32_t ctrl_status;
10841087

@@ -1092,16 +1095,15 @@ static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha)
10921095
if (mbox_status == MBOX_STS_COMMAND_COMPLETE)
10931096
break;
10941097

1095-
DEBUG2(printk("scsi%ld: %s: Waiting for boot firmware to "
1096-
"complete... ctrl_sts=0x%x, remaining=%d\n",
1097-
ha->host_no, __func__, ctrl_status,
1098-
max_wait_time));
1098+
DEBUG2(printk(KERN_INFO "scsi%ld: %s: Waiting for boot "
1099+
"firmware to complete... ctrl_sts=0x%x\n",
1100+
ha->host_no, __func__, ctrl_status));
10991101

1100-
msleep(250);
1101-
} while ((max_wait_time--));
1102+
msleep_interruptible(250);
1103+
} while (!time_after_eq(jiffies, max_wait_time));
11021104

11031105
if (mbox_status == MBOX_STS_COMMAND_COMPLETE) {
1104-
DEBUG(printk("scsi%ld: %s: Firmware has started\n",
1106+
DEBUG(printk(KERN_INFO "scsi%ld: %s: Firmware has started\n",
11051107
ha->host_no, __func__));
11061108

11071109
spin_lock_irqsave(&ha->hardware_lock, flags);

0 commit comments

Comments
 (0)