aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/atari_NCR5380.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2016-01-03 16:06:03 +1100
committerMartin K. Petersen <martin.petersen@oracle.com>2016-01-06 21:43:08 -0500
commit62717f537e1b325665711166c33cd2d06fd6a5cd (patch)
tree1a6a3a1da3fe7842c06e770cac974d9961aa2d26 /drivers/scsi/atari_NCR5380.c
parentncr5380: Fix EH during arbitration and selection (diff)
downloadlinux-dev-62717f537e1b325665711166c33cd2d06fd6a5cd.tar.xz
linux-dev-62717f537e1b325665711166c33cd2d06fd6a5cd.zip
ncr5380: Implement new eh_bus_reset_handler
NCR5380.c lacks a sane eh_bus_reset_handler. The atari_NCR5380.c code is much better but it should not throw out the issue queue (that would be a host reset) and it neglects to set the result code for commands that it throws out. Fix these bugs and keep the two core drivers in sync. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.com> Tested-by: Ondrej Zary <linux@rainbow-software.org> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/atari_NCR5380.c')
-rw-r--r--drivers/scsi/atari_NCR5380.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 4a88a7a355eb..d6717610a65e 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -2694,11 +2694,12 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
struct NCR5380_hostdata *hostdata = shost_priv(instance);
int i;
unsigned long flags;
+ struct NCR5380_cmd *ncmd;
spin_lock_irqsave(&hostdata->lock, flags);
#if (NDEBUG & NDEBUG_ANY)
- scmd_printk(KERN_INFO, cmd, "performing bus reset\n");
+ scmd_printk(KERN_INFO, cmd, __func__);
#endif
NCR5380_dprint(NDEBUG_ANY, instance);
NCR5380_dprint_phase(NDEBUG_ANY, instance);
@@ -2718,26 +2719,31 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
hostdata->selecting = NULL;
- if (hostdata->connected)
- dsprintk(NDEBUG_ABORT, instance, "reset aborted a connected command\n");
- hostdata->connected = NULL;
+ list_for_each_entry(ncmd, &hostdata->disconnected, list) {
+ struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
- if (hostdata->sensing) {
- complete_cmd(instance, hostdata->sensing);
- hostdata->sensing = NULL;
+ set_host_byte(cmd, DID_RESET);
+ cmd->scsi_done(cmd);
}
- if (!list_empty(&hostdata->autosense))
- dsprintk(NDEBUG_ABORT, instance, "reset aborted autosense list\n");
- INIT_LIST_HEAD(&hostdata->autosense);
+ list_for_each_entry(ncmd, &hostdata->autosense, list) {
+ struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
- if (!list_empty(&hostdata->unissued))
- dsprintk(NDEBUG_ABORT, instance, "reset aborted unissued list\n");
- INIT_LIST_HEAD(&hostdata->unissued);
+ set_host_byte(cmd, DID_RESET);
+ cmd->scsi_done(cmd);
+ }
- if (!list_empty(&hostdata->disconnected))
- dsprintk(NDEBUG_ABORT, instance, "reset aborted disconnected list\n");
- INIT_LIST_HEAD(&hostdata->disconnected);
+ if (hostdata->connected) {
+ set_host_byte(hostdata->connected, DID_RESET);
+ complete_cmd(instance, hostdata->connected);
+ hostdata->connected = NULL;
+ }
+
+ if (hostdata->sensing) {
+ set_host_byte(hostdata->connected, DID_RESET);
+ complete_cmd(instance, hostdata->sensing);
+ hostdata->sensing = NULL;
+ }
#ifdef SUPPORT_TAGS
free_all_tags(hostdata);
@@ -2748,6 +2754,7 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
hostdata->dma_len = 0;
#endif
+ queue_work(hostdata->work_q, &hostdata->main_task);
maybe_release_dma_irq(instance);
spin_unlock_irqrestore(&hostdata->lock, flags);