aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Lee <albertcc@tw.ibm.com>2005-12-05 02:38:02 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-12-06 04:49:22 -0500
commita22e2eb0710798009b8e696ae911aef745089dd6 (patch)
tree93421443499249db0301868e07f24156c456cf7a
parentc14b8331ec4843e4f2b67a4d847a0d812a50e43c (diff)
[PATCH] libata: move err_mask to ata_queued_cmd
- remove err_mask from the parameter list of the complete functions - move err_mask to ata_queued_cmd - initialize qc->err_mask when needed - for each function call to ata_qc_complete(), replace the err_mask parameter with qc->err_mask. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> =============== Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--drivers/scsi/ahci.c12
-rw-r--r--drivers/scsi/libata-core.c32
-rw-r--r--drivers/scsi/libata-scsi.c18
-rw-r--r--drivers/scsi/libata.h2
-rw-r--r--drivers/scsi/pdc_adma.c11
-rw-r--r--drivers/scsi/sata_mv.c9
-rw-r--r--drivers/scsi/sata_promise.c14
-rw-r--r--drivers/scsi/sata_qstor.c7
-rw-r--r--drivers/scsi/sata_sil24.c15
-rw-r--r--drivers/scsi/sata_sx4.c15
-rw-r--r--include/linux/libata.h7
11 files changed, 86 insertions, 56 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index cfbdd3f071b6..887eaa2a3ebf 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -643,7 +643,8 @@ static void ahci_eng_timeout(struct ata_port *ap)
643 * not being called from the SCSI EH. 643 * not being called from the SCSI EH.
644 */ 644 */
645 qc->scsidone = scsi_finish_command; 645 qc->scsidone = scsi_finish_command;
646 ata_qc_complete(qc, AC_ERR_OTHER); 646 qc->err_mask |= AC_ERR_OTHER;
647 ata_qc_complete(qc);
647 } 648 }
648 649
649 spin_unlock_irqrestore(&host_set->lock, flags); 650 spin_unlock_irqrestore(&host_set->lock, flags);
@@ -664,7 +665,8 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
664 ci = readl(port_mmio + PORT_CMD_ISSUE); 665 ci = readl(port_mmio + PORT_CMD_ISSUE);
665 if (likely((ci & 0x1) == 0)) { 666 if (likely((ci & 0x1) == 0)) {
666 if (qc) { 667 if (qc) {
667 ata_qc_complete(qc, 0); 668 assert(qc->err_mask == 0);
669 ata_qc_complete(qc);
668 qc = NULL; 670 qc = NULL;
669 } 671 }
670 } 672 }
@@ -681,8 +683,10 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
681 /* command processing has stopped due to error; restart */ 683 /* command processing has stopped due to error; restart */
682 ahci_restart_port(ap, status); 684 ahci_restart_port(ap, status);
683 685
684 if (qc) 686 if (qc) {
685 ata_qc_complete(qc, err_mask); 687 qc->err_mask |= AC_ERR_OTHER;
688 ata_qc_complete(qc);
689 }
686 } 690 }
687 691
688 return 1; 692 return 1;
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 0a959566f964..f56b4daf4189 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1053,9 +1053,9 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc,
1053 1053
1054 if (wait_for_completion_timeout(wait, 30 * HZ) < 1) { 1054 if (wait_for_completion_timeout(wait, 30 * HZ) < 1) {
1055 /* timeout handling */ 1055 /* timeout handling */
1056 unsigned int err_mask = ac_err_mask(ata_chk_status(qc->ap)); 1056 qc->err_mask |= ac_err_mask(ata_chk_status(qc->ap));
1057 1057
1058 if (!err_mask) { 1058 if (!qc->err_mask) {
1059 printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n", 1059 printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n",
1060 qc->ap->id, qc->tf.command); 1060 qc->ap->id, qc->tf.command);
1061 } else { 1061 } else {
@@ -1064,7 +1064,7 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc,
1064 rc = -EIO; 1064 rc = -EIO;
1065 } 1065 }
1066 1066
1067 ata_qc_complete(qc, err_mask); 1067 ata_qc_complete(qc);
1068 } 1068 }
1069 1069
1070 return rc; 1070 return rc;
@@ -1175,6 +1175,7 @@ retry:
1175 qc->cursg_ofs = 0; 1175 qc->cursg_ofs = 0;
1176 qc->cursect = 0; 1176 qc->cursect = 0;
1177 qc->nsect = 1; 1177 qc->nsect = 1;
1178 qc->err_mask = 0;
1178 goto retry; 1179 goto retry;
1179 } 1180 }
1180 } 1181 }
@@ -2777,7 +2778,7 @@ skip_map:
2777 * None. (grabs host lock) 2778 * None. (grabs host lock)
2778 */ 2779 */
2779 2780
2780void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) 2781void ata_poll_qc_complete(struct ata_queued_cmd *qc)
2781{ 2782{
2782 struct ata_port *ap = qc->ap; 2783 struct ata_port *ap = qc->ap;
2783 unsigned long flags; 2784 unsigned long flags;
@@ -2785,7 +2786,7 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask)
2785 spin_lock_irqsave(&ap->host_set->lock, flags); 2786 spin_lock_irqsave(&ap->host_set->lock, flags);
2786 ap->flags &= ~ATA_FLAG_NOINTR; 2787 ap->flags &= ~ATA_FLAG_NOINTR;
2787 ata_irq_on(ap); 2788 ata_irq_on(ap);
2788 ata_qc_complete(qc, err_mask); 2789 ata_qc_complete(qc);
2789 spin_unlock_irqrestore(&ap->host_set->lock, flags); 2790 spin_unlock_irqrestore(&ap->host_set->lock, flags);
2790} 2791}
2791 2792
@@ -2885,7 +2886,8 @@ static int ata_pio_complete (struct ata_port *ap)
2885 2886
2886 ap->hsm_task_state = HSM_ST_IDLE; 2887 ap->hsm_task_state = HSM_ST_IDLE;
2887 2888
2888 ata_poll_qc_complete(qc, 0); 2889 assert(qc->err_mask == 0);
2890 ata_poll_qc_complete(qc);
2889 2891
2890 /* another command may start at this point */ 2892 /* another command may start at this point */
2891 2893
@@ -3261,7 +3263,8 @@ static void ata_pio_error(struct ata_port *ap)
3261 3263
3262 ap->hsm_task_state = HSM_ST_IDLE; 3264 ap->hsm_task_state = HSM_ST_IDLE;
3263 3265
3264 ata_poll_qc_complete(qc, AC_ERR_ATA_BUS); 3266 qc->err_mask |= AC_ERR_ATA_BUS;
3267 ata_poll_qc_complete(qc);
3265} 3268}
3266 3269
3267static void ata_pio_task(void *_data) 3270static void ata_pio_task(void *_data)
@@ -3363,7 +3366,8 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
3363 ap->id, qc->tf.command, drv_stat, host_stat); 3366 ap->id, qc->tf.command, drv_stat, host_stat);
3364 3367
3365 /* complete taskfile transaction */ 3368 /* complete taskfile transaction */
3366 ata_qc_complete(qc, ac_err_mask(drv_stat)); 3369 qc->err_mask |= ac_err_mask(drv_stat);
3370 ata_qc_complete(qc);
3367 break; 3371 break;
3368 } 3372 }
3369 3373
@@ -3462,7 +3466,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
3462 return qc; 3466 return qc;
3463} 3467}
3464 3468
3465int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask) 3469int ata_qc_complete_noop(struct ata_queued_cmd *qc)
3466{ 3470{
3467 return 0; 3471 return 0;
3468} 3472}
@@ -3521,7 +3525,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
3521 * spin_lock_irqsave(host_set lock) 3525 * spin_lock_irqsave(host_set lock)
3522 */ 3526 */
3523 3527
3524void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) 3528void ata_qc_complete(struct ata_queued_cmd *qc)
3525{ 3529{
3526 int rc; 3530 int rc;
3527 3531
@@ -3538,7 +3542,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask)
3538 qc->flags &= ~ATA_QCFLAG_ACTIVE; 3542 qc->flags &= ~ATA_QCFLAG_ACTIVE;
3539 3543
3540 /* call completion callback */ 3544 /* call completion callback */
3541 rc = qc->complete_fn(qc, err_mask); 3545 rc = qc->complete_fn(qc);
3542 3546
3543 /* if callback indicates not to complete command (non-zero), 3547 /* if callback indicates not to complete command (non-zero),
3544 * return immediately 3548 * return immediately
@@ -3976,7 +3980,8 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
3976 ap->ops->irq_clear(ap); 3980 ap->ops->irq_clear(ap);
3977 3981
3978 /* complete taskfile transaction */ 3982 /* complete taskfile transaction */
3979 ata_qc_complete(qc, ac_err_mask(status)); 3983 qc->err_mask |= ac_err_mask(status);
3984 ata_qc_complete(qc);
3980 break; 3985 break;
3981 3986
3982 default: 3987 default:
@@ -4111,7 +4116,8 @@ static void atapi_packet_task(void *_data)
4111err_out_status: 4116err_out_status:
4112 status = ata_chk_status(ap); 4117 status = ata_chk_status(ap);
4113err_out: 4118err_out:
4114 ata_poll_qc_complete(qc, __ac_err_mask(status)); 4119 qc->err_mask |= __ac_err_mask(status);
4120 ata_poll_qc_complete(qc);
4115} 4121}
4116 4122
4117 4123
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index ef763ed9a0e5..2aef41112c43 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -1203,12 +1203,11 @@ nothing_to_do:
1203 return 1; 1203 return 1;
1204} 1204}
1205 1205
1206static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, 1206static int ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1207 unsigned int err_mask)
1208{ 1207{
1209 struct scsi_cmnd *cmd = qc->scsicmd; 1208 struct scsi_cmnd *cmd = qc->scsicmd;
1210 u8 *cdb = cmd->cmnd; 1209 u8 *cdb = cmd->cmnd;
1211 int need_sense = (err_mask != 0); 1210 int need_sense = (qc->err_mask != 0);
1212 1211
1213 /* For ATA pass thru (SAT) commands, generate a sense block if 1212 /* For ATA pass thru (SAT) commands, generate a sense block if
1214 * user mandated it or if there's an error. Note that if we 1213 * user mandated it or if there's an error. Note that if we
@@ -1955,9 +1954,9 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8
1955 done(cmd); 1954 done(cmd);
1956} 1955}
1957 1956
1958static int atapi_sense_complete(struct ata_queued_cmd *qc,unsigned int err_mask) 1957static int atapi_sense_complete(struct ata_queued_cmd *qc)
1959{ 1958{
1960 if (err_mask && ((err_mask & AC_ERR_DEV) == 0)) 1959 if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0))
1961 /* FIXME: not quite right; we don't want the 1960 /* FIXME: not quite right; we don't want the
1962 * translation of taskfile registers into 1961 * translation of taskfile registers into
1963 * a sense descriptors, since that's only 1962 * a sense descriptors, since that's only
@@ -2015,15 +2014,18 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
2015 2014
2016 qc->complete_fn = atapi_sense_complete; 2015 qc->complete_fn = atapi_sense_complete;
2017 2016
2018 if (ata_qc_issue(qc)) 2017 if (ata_qc_issue(qc)) {
2019 ata_qc_complete(qc, AC_ERR_OTHER); 2018 qc->err_mask |= AC_ERR_OTHER;
2019 ata_qc_complete(qc);
2020 }
2020 2021
2021 DPRINTK("EXIT\n"); 2022 DPRINTK("EXIT\n");
2022} 2023}
2023 2024
2024static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) 2025static int atapi_qc_complete(struct ata_queued_cmd *qc)
2025{ 2026{
2026 struct scsi_cmnd *cmd = qc->scsicmd; 2027 struct scsi_cmnd *cmd = qc->scsicmd;
2028 unsigned int err_mask = qc->err_mask;
2027 2029
2028 VPRINTK("ENTER, err_mask 0x%X\n", err_mask); 2030 VPRINTK("ENTER, err_mask 0x%X\n", err_mask);
2029 2031
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 8ebaa694d18e..686255df76b8 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -39,7 +39,7 @@ struct ata_scsi_args {
39 39
40/* libata-core.c */ 40/* libata-core.c */
41extern int atapi_enabled; 41extern int atapi_enabled;
42extern int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask); 42extern int ata_qc_complete_noop(struct ata_queued_cmd *qc);
43extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, 43extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
44 struct ata_device *dev); 44 struct ata_device *dev);
45extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc); 45extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc);
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index f557f17ca00c..e8df0c9ec1e6 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -464,14 +464,12 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set)
464 continue; 464 continue;
465 qc = ata_qc_from_tag(ap, ap->active_tag); 465 qc = ata_qc_from_tag(ap, ap->active_tag);
466 if (qc && (!(qc->tf.ctl & ATA_NIEN))) { 466 if (qc && (!(qc->tf.ctl & ATA_NIEN))) {
467 unsigned int err_mask = 0;
468
469 if ((status & (aPERR | aPSD | aUIRQ))) 467 if ((status & (aPERR | aPSD | aUIRQ)))
470 err_mask = AC_ERR_OTHER; 468 qc->err_mask |= AC_ERR_OTHER;
471 else if (pp->pkt[0] != cDONE) 469 else if (pp->pkt[0] != cDONE)
472 err_mask = AC_ERR_OTHER; 470 qc->err_mask |= AC_ERR_OTHER;
473 471
474 ata_qc_complete(qc, err_mask); 472 ata_qc_complete(qc);
475 } 473 }
476 } 474 }
477 return handled; 475 return handled;
@@ -501,7 +499,8 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set)
501 499
502 /* complete taskfile transaction */ 500 /* complete taskfile transaction */
503 pp->state = adma_state_idle; 501 pp->state = adma_state_idle;
504 ata_qc_complete(qc, ac_err_mask(status)); 502 qc->err_mask |= ac_err_mask(status);
503 ata_qc_complete(qc);
505 handled = 1; 504 handled = 1;
506 } 505 }
507 } 506 }
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index c94176693d1f..3e7866b51ac6 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -1242,8 +1242,10 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1242 VPRINTK("port %u IRQ found for qc, " 1242 VPRINTK("port %u IRQ found for qc, "
1243 "ata_status 0x%x\n", port,ata_status); 1243 "ata_status 0x%x\n", port,ata_status);
1244 /* mark qc status appropriately */ 1244 /* mark qc status appropriately */
1245 if (!(qc->tf.ctl & ATA_NIEN)) 1245 if (!(qc->tf.ctl & ATA_NIEN)) {
1246 ata_qc_complete(qc, err_mask); 1246 qc->err_mask |= err_mask;
1247 ata_qc_complete(qc);
1248 }
1247 } 1249 }
1248 } 1250 }
1249 } 1251 }
@@ -1864,7 +1866,8 @@ static void mv_eng_timeout(struct ata_port *ap)
1864 */ 1866 */
1865 spin_lock_irqsave(&ap->host_set->lock, flags); 1867 spin_lock_irqsave(&ap->host_set->lock, flags);
1866 qc->scsidone = scsi_finish_command; 1868 qc->scsidone = scsi_finish_command;
1867 ata_qc_complete(qc, AC_ERR_OTHER); 1869 qc->err_mask |= AC_ERR_OTHER;
1870 ata_qc_complete(qc);
1868 spin_unlock_irqrestore(&ap->host_set->lock, flags); 1871 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1869 } 1872 }
1870} 1873}
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 02089069b0f6..e2e146a14f97 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -401,7 +401,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
401 case ATA_PROT_NODATA: 401 case ATA_PROT_NODATA:
402 printk(KERN_ERR "ata%u: command timeout\n", ap->id); 402 printk(KERN_ERR "ata%u: command timeout\n", ap->id);
403 drv_stat = ata_wait_idle(ap); 403 drv_stat = ata_wait_idle(ap);
404 ata_qc_complete(qc, __ac_err_mask(drv_stat)); 404 qc->err_mask |= __ac_err_mask(drv_stat);
405 ata_qc_complete(qc);
405 break; 406 break;
406 407
407 default: 408 default:
@@ -410,7 +411,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
410 printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", 411 printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
411 ap->id, qc->tf.command, drv_stat); 412 ap->id, qc->tf.command, drv_stat);
412 413
413 ata_qc_complete(qc, ac_err_mask(drv_stat)); 414 qc->err_mask |= ac_err_mask(drv_stat);
415 ata_qc_complete(qc);
414 break; 416 break;
415 } 417 }
416 418
@@ -422,21 +424,21 @@ out:
422static inline unsigned int pdc_host_intr( struct ata_port *ap, 424static inline unsigned int pdc_host_intr( struct ata_port *ap,
423 struct ata_queued_cmd *qc) 425 struct ata_queued_cmd *qc)
424{ 426{
425 unsigned int handled = 0, err_mask = 0; 427 unsigned int handled = 0;
426 u32 tmp; 428 u32 tmp;
427 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; 429 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL;
428 430
429 tmp = readl(mmio); 431 tmp = readl(mmio);
430 if (tmp & PDC_ERR_MASK) { 432 if (tmp & PDC_ERR_MASK) {
431 err_mask = AC_ERR_DEV; 433 qc->err_mask |= AC_ERR_DEV;
432 pdc_reset_port(ap); 434 pdc_reset_port(ap);
433 } 435 }
434 436
435 switch (qc->tf.protocol) { 437 switch (qc->tf.protocol) {
436 case ATA_PROT_DMA: 438 case ATA_PROT_DMA:
437 case ATA_PROT_NODATA: 439 case ATA_PROT_NODATA:
438 err_mask |= ac_err_mask(ata_wait_idle(ap)); 440 qc->err_mask |= ac_err_mask(ata_wait_idle(ap));
439 ata_qc_complete(qc, err_mask); 441 ata_qc_complete(qc);
440 handled = 1; 442 handled = 1;
441 break; 443 break;
442 444
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index 6b9c3ae07cb3..de05e2883f9c 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -409,8 +409,8 @@ static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set)
409 case 3: /* device error */ 409 case 3: /* device error */
410 pp->state = qs_state_idle; 410 pp->state = qs_state_idle;
411 qs_enter_reg_mode(qc->ap); 411 qs_enter_reg_mode(qc->ap);
412 ata_qc_complete(qc, 412 qc->err_mask |= ac_err_mask(sDST);
413 ac_err_mask(sDST)); 413 ata_qc_complete(qc);
414 break; 414 break;
415 default: 415 default:
416 break; 416 break;
@@ -447,7 +447,8 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set)
447 447
448 /* complete taskfile transaction */ 448 /* complete taskfile transaction */
449 pp->state = qs_state_idle; 449 pp->state = qs_state_idle;
450 ata_qc_complete(qc, ac_err_mask(status)); 450 qc->err_mask |= ac_err_mask(status);
451 ata_qc_complete(qc);
451 handled = 1; 452 handled = 1;
452 } 453 }
453 } 454 }
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index e0d6f194f54f..a0ad3ed2200a 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -654,7 +654,8 @@ static void sil24_eng_timeout(struct ata_port *ap)
654 */ 654 */
655 printk(KERN_ERR "ata%u: command timeout\n", ap->id); 655 printk(KERN_ERR "ata%u: command timeout\n", ap->id);
656 qc->scsidone = scsi_finish_command; 656 qc->scsidone = scsi_finish_command;
657 ata_qc_complete(qc, AC_ERR_OTHER); 657 qc->err_mask |= AC_ERR_OTHER;
658 ata_qc_complete(qc);
658 659
659 sil24_reset_controller(ap); 660 sil24_reset_controller(ap);
660} 661}
@@ -711,8 +712,10 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat)
711 sil24_reset_controller(ap); 712 sil24_reset_controller(ap);
712 } 713 }
713 714
714 if (qc) 715 if (qc) {
715 ata_qc_complete(qc, err_mask); 716 qc->err_mask |= err_mask;
717 ata_qc_complete(qc);
718 }
716} 719}
717 720
718static inline void sil24_host_intr(struct ata_port *ap) 721static inline void sil24_host_intr(struct ata_port *ap)
@@ -734,8 +737,10 @@ static inline void sil24_host_intr(struct ata_port *ap)
734 */ 737 */
735 sil24_update_tf(ap); 738 sil24_update_tf(ap);
736 739
737 if (qc) 740 if (qc) {
738 ata_qc_complete(qc, ac_err_mask(pp->tf.command)); 741 qc->err_mask |= ac_err_mask(pp->tf.command);
742 ata_qc_complete(qc);
743 }
739 } else 744 } else
740 sil24_error_intr(ap, slot_stat); 745 sil24_error_intr(ap, slot_stat);
741} 746}
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index 7c4b53575510..58da854a7c68 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -718,7 +718,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
718 VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id, 718 VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id,
719 readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); 719 readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
720 /* get drive status; clear intr; complete txn */ 720 /* get drive status; clear intr; complete txn */
721 ata_qc_complete(qc, ac_err_mask(ata_wait_idle(ap))); 721 qc->err_mask |= ac_err_mask(ata_wait_idle(ap));
722 ata_qc_complete(qc);
722 pdc20621_pop_hdma(qc); 723 pdc20621_pop_hdma(qc);
723 } 724 }
724 725
@@ -756,7 +757,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
756 VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id, 757 VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id,
757 readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); 758 readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
758 /* get drive status; clear intr; complete txn */ 759 /* get drive status; clear intr; complete txn */
759 ata_qc_complete(qc, ac_err_mask(ata_wait_idle(ap))); 760 qc->err_mask |= ac_err_mask(ata_wait_idle(ap));
761 ata_qc_complete(qc);
760 pdc20621_pop_hdma(qc); 762 pdc20621_pop_hdma(qc);
761 } 763 }
762 handled = 1; 764 handled = 1;
@@ -766,7 +768,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
766 768
767 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 769 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
768 DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); 770 DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
769 ata_qc_complete(qc, ac_err_mask(status)); 771 qc->err_mask |= ac_err_mask(status);
772 ata_qc_complete(qc);
770 handled = 1; 773 handled = 1;
771 774
772 } else { 775 } else {
@@ -881,7 +884,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
881 case ATA_PROT_DMA: 884 case ATA_PROT_DMA:
882 case ATA_PROT_NODATA: 885 case ATA_PROT_NODATA:
883 printk(KERN_ERR "ata%u: command timeout\n", ap->id); 886 printk(KERN_ERR "ata%u: command timeout\n", ap->id);
884 ata_qc_complete(qc, __ac_err_mask(ata_wait_idle(ap))); 887 qc->err_mask |= __ac_err_mask(ata_wait_idle(ap));
888 ata_qc_complete(qc);
885 break; 889 break;
886 890
887 default: 891 default:
@@ -890,7 +894,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
890 printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", 894 printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
891 ap->id, qc->tf.command, drv_stat); 895 ap->id, qc->tf.command, drv_stat);
892 896
893 ata_qc_complete(qc, ac_err_mask(drv_stat)); 897 qc->err_mask |= ac_err_mask(drv_stat);
898 ata_qc_complete(qc);
894 break; 899 break;
895 } 900 }
896 901
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 83a83babff84..e18ce039cdfd 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -194,7 +194,7 @@ struct ata_port;
194struct ata_queued_cmd; 194struct ata_queued_cmd;
195 195
196/* typedefs */ 196/* typedefs */
197typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask); 197typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
198 198
199struct ata_ioports { 199struct ata_ioports {
200 unsigned long cmd_addr; 200 unsigned long cmd_addr;
@@ -279,6 +279,8 @@ struct ata_queued_cmd {
279 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */ 279 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */
280 struct scatterlist *__sg; 280 struct scatterlist *__sg;
281 281
282 unsigned int err_mask;
283
282 ata_qc_cb_t complete_fn; 284 ata_qc_cb_t complete_fn;
283 285
284 struct completion *waiting; 286 struct completion *waiting;
@@ -475,7 +477,7 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc);
475extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 477extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
476extern u8 ata_bmdma_status(struct ata_port *ap); 478extern u8 ata_bmdma_status(struct ata_port *ap);
477extern void ata_bmdma_irq_clear(struct ata_port *ap); 479extern void ata_bmdma_irq_clear(struct ata_port *ap);
478extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask); 480extern void ata_qc_complete(struct ata_queued_cmd *qc);
479extern void ata_eng_timeout(struct ata_port *ap); 481extern void ata_eng_timeout(struct ata_port *ap);
480extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, 482extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd,
481 void (*done)(struct scsi_cmnd *)); 483 void (*done)(struct scsi_cmnd *));
@@ -667,6 +669,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
667 qc->cursect = qc->cursg = qc->cursg_ofs = 0; 669 qc->cursect = qc->cursg = qc->cursg_ofs = 0;
668 qc->nsect = 0; 670 qc->nsect = 0;
669 qc->nbytes = qc->curbytes = 0; 671 qc->nbytes = qc->curbytes = 0;
672 qc->err_mask = 0;
670 673
671 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); 674 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
672} 675}