Commit 1cc160e1 authored by Finn Thain's avatar Finn Thain Committed by Martin K. Petersen

ncr5380: Fix !REQ timeout in do_abort()

NCR5380_poll_politely() never returns -1. That means do_abort() can fail
to handle a timeout after waiting for the target to negate REQ. Fix this
and cleanup other NCR5380_poll_politely() call sites.
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Tested-by: default avatarOndrej Zary <linux@rainbow-software.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 340b9612
...@@ -1271,7 +1271,7 @@ static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) ...@@ -1271,7 +1271,7 @@ static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd)
err = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, HZ); err = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, HZ);
spin_lock_irq(instance->host_lock); spin_lock_irq(instance->host_lock);
if(err) { if (err < 0) {
printk(KERN_ERR "scsi%d: timeout at NCR5380.c:%d\n", instance->host_no, __LINE__); printk(KERN_ERR "scsi%d: timeout at NCR5380.c:%d\n", instance->host_no, __LINE__);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
return -1; return -1;
...@@ -1490,8 +1490,7 @@ static int do_abort(struct Scsi_Host *instance) ...@@ -1490,8 +1490,7 @@ static int do_abort(struct Scsi_Host *instance)
*/ */
rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 60 * HZ); rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 60 * HZ);
if (rc < 0)
if(rc < 0)
return -1; return -1;
tmp = (unsigned char)rc; tmp = (unsigned char)rc;
...@@ -1502,7 +1501,7 @@ static int do_abort(struct Scsi_Host *instance) ...@@ -1502,7 +1501,7 @@ static int do_abort(struct Scsi_Host *instance)
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, 0, 3 * HZ); rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, 0, 3 * HZ);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
if(rc == -1) if (rc < 0)
return -1; return -1;
} }
tmp = ABORT; tmp = ABORT;
...@@ -2199,7 +2198,8 @@ static void NCR5380_reselect(struct Scsi_Host *instance) { ...@@ -2199,7 +2198,8 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
* FIXME: timeout needed and fail to work queeu * FIXME: timeout needed and fail to work queeu
*/ */
if(NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 2*HZ)) if (NCR5380_poll_politely(instance,
STATUS_REG, SR_REQ, SR_REQ, 2 * HZ) < 0)
abort = 1; abort = 1;
len = 1; len = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment