[PATCH] sata_sil24: lengthen softreset timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sil24 softreset timeout was > 100ms (100 loops with msleep(1)), which
turned out to be too short for some devices (ASI ARAID99 2000).  This
patch converts sil24 softreset waiting loop to use proper timeout
condition and lengthen the timeout to 5 secs and check interval to
100ms.  Chisato Yamauchi discovered the problem and supplied initial
patch.

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>
Cc: Chisato Yamauchi <cyamauch@xxxxxxxxxxxxxxxxx>

---

Jeff, this patch is against the current #linus-git.  This doesn't
really count as regression but I think this should go upstream ASAP.
However, if that's not an option, this patch also applies to #upstream
with some offsets.

Chisato, thanks a lot for spotting it and sending fix.  :-)

 drivers/scsi/sata_sil24.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 9231301..13cdd22 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -433,8 +433,8 @@ static int sil24_issue_SRST(struct ata_p
 	struct sil24_port_priv *pp = ap->private_data;
 	struct sil24_prb *prb = &pp->cmd_block[0].ata.prb;
 	dma_addr_t paddr = pp->cmd_block_dma;
+	unsigned long timeout = jiffies + 5 * HZ;
 	u32 irq_enable, irq_stat;
-	int cnt;
 
 	/* temporarily turn off IRQs during SRST */
 	irq_enable = readl(port + PORT_IRQ_ENABLE_SET);
@@ -451,7 +451,7 @@ static int sil24_issue_SRST(struct ata_p
 
 	writel((u32)paddr, port + PORT_CMD_ACTIVATE);
 
-	for (cnt = 0; cnt < 100; cnt++) {
+	do {
 		irq_stat = readl(port + PORT_IRQ_STAT);
 		writel(irq_stat, port + PORT_IRQ_STAT);		/* clear irq */
 
@@ -459,8 +459,8 @@ static int sil24_issue_SRST(struct ata_p
 		if (irq_stat & (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR))
 			break;
 
-		msleep(1);
-	}
+		msleep(100);
+	} while (time_before(jiffies, timeout));
 
 	/* restore IRQs */
 	writel(irq_enable, port + PORT_IRQ_ENABLE_SET);
-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux