diff options
-rw-r--r-- | drivers/ata/libata-sff.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 3cc385dbfe2a..a4700af43d10 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -2379,7 +2379,7 @@ void ata_sff_error_handler(struct ata_port *ap) | |||
2379 | ata_reset_fn_t hardreset = ap->ops->hardreset; | 2379 | ata_reset_fn_t hardreset = ap->ops->hardreset; |
2380 | struct ata_queued_cmd *qc; | 2380 | struct ata_queued_cmd *qc; |
2381 | unsigned long flags; | 2381 | unsigned long flags; |
2382 | int thaw = 0; | 2382 | bool thaw = false; |
2383 | 2383 | ||
2384 | qc = __ata_qc_from_tag(ap, ap->link.active_tag); | 2384 | qc = __ata_qc_from_tag(ap, ap->link.active_tag); |
2385 | if (qc && !(qc->flags & ATA_QCFLAG_FAILED)) | 2385 | if (qc && !(qc->flags & ATA_QCFLAG_FAILED)) |
@@ -2405,15 +2405,22 @@ void ata_sff_error_handler(struct ata_port *ap) | |||
2405 | if (qc->err_mask == AC_ERR_TIMEOUT | 2405 | if (qc->err_mask == AC_ERR_TIMEOUT |
2406 | && (host_stat & ATA_DMA_ERR)) { | 2406 | && (host_stat & ATA_DMA_ERR)) { |
2407 | qc->err_mask = AC_ERR_HOST_BUS; | 2407 | qc->err_mask = AC_ERR_HOST_BUS; |
2408 | thaw = 1; | 2408 | thaw = true; |
2409 | } | 2409 | } |
2410 | 2410 | ||
2411 | ap->ops->bmdma_stop(qc); | 2411 | ap->ops->bmdma_stop(qc); |
2412 | |||
2413 | /* if we're gonna thaw, make sure IRQ is clear */ | ||
2414 | if (thaw) { | ||
2415 | ap->ops->sff_check_status(ap); | ||
2416 | ap->ops->sff_irq_clear(ap); | ||
2417 | |||
2418 | spin_unlock_irqrestore(ap->lock, flags); | ||
2419 | ata_eh_thaw_port(ap); | ||
2420 | spin_lock_irqsave(ap->lock, flags); | ||
2421 | } | ||
2412 | } | 2422 | } |
2413 | 2423 | ||
2414 | ata_sff_sync(ap); /* FIXME: We don't need this */ | ||
2415 | ap->ops->sff_check_status(ap); | ||
2416 | ap->ops->sff_irq_clear(ap); | ||
2417 | /* We *MUST* do FIFO draining before we issue a reset as several | 2424 | /* We *MUST* do FIFO draining before we issue a reset as several |
2418 | * devices helpfully clear their internal state and will lock solid | 2425 | * devices helpfully clear their internal state and will lock solid |
2419 | * if we touch the data port post reset. Pass qc in case anyone wants | 2426 | * if we touch the data port post reset. Pass qc in case anyone wants |
@@ -2424,9 +2431,6 @@ void ata_sff_error_handler(struct ata_port *ap) | |||
2424 | 2431 | ||
2425 | spin_unlock_irqrestore(ap->lock, flags); | 2432 | spin_unlock_irqrestore(ap->lock, flags); |
2426 | 2433 | ||
2427 | if (thaw) | ||
2428 | ata_eh_thaw_port(ap); | ||
2429 | |||
2430 | /* PIO and DMA engines have been stopped, perform recovery */ | 2434 | /* PIO and DMA engines have been stopped, perform recovery */ |
2431 | 2435 | ||
2432 | /* Ignore ata_sff_softreset if ctl isn't accessible and | 2436 | /* Ignore ata_sff_softreset if ctl isn't accessible and |