diff options
author | Tejun Heo <htejun@gmail.com> | 2006-01-22 23:09:36 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-26 22:36:27 -0500 |
commit | 9a3d9eb0177eb10500d49cd283b35576082a522d (patch) | |
tree | 3a8279ea3f263338cd02918131a36ee716cad1a8 /drivers/scsi/libata-core.c | |
parent | 11a56d2439259892319df81cf1582687d7e7fde5 (diff) |
[PATCH] libata: return AC_ERR_* from issue functions
Return AC_ERR_* mask from issue fuctions instead of 0/-1. This
enables things like failing a qc with AC_ERR_HSM when the device
doesn't set DRDY when the qc is about to be issued.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index f5519f01491c..b29bf0dc948a 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1125,10 +1125,9 @@ ata_exec_internal(struct ata_port *ap, struct ata_device *dev, | |||
1125 | qc->private_data = &wait; | 1125 | qc->private_data = &wait; |
1126 | qc->complete_fn = ata_qc_complete_internal; | 1126 | qc->complete_fn = ata_qc_complete_internal; |
1127 | 1127 | ||
1128 | if (ata_qc_issue(qc)) { | 1128 | qc->err_mask = ata_qc_issue(qc); |
1129 | qc->err_mask = AC_ERR_OTHER; | 1129 | if (qc->err_mask) |
1130 | ata_qc_complete(qc); | 1130 | ata_qc_complete(qc); |
1131 | } | ||
1132 | 1131 | ||
1133 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 1132 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
1134 | 1133 | ||
@@ -3674,10 +3673,10 @@ static inline int ata_should_dma_map(struct ata_queued_cmd *qc) | |||
3674 | * spin_lock_irqsave(host_set lock) | 3673 | * spin_lock_irqsave(host_set lock) |
3675 | * | 3674 | * |
3676 | * RETURNS: | 3675 | * RETURNS: |
3677 | * Zero on success, negative on error. | 3676 | * Zero on success, AC_ERR_* mask on failure |
3678 | */ | 3677 | */ |
3679 | 3678 | ||
3680 | int ata_qc_issue(struct ata_queued_cmd *qc) | 3679 | unsigned int ata_qc_issue(struct ata_queued_cmd *qc) |
3681 | { | 3680 | { |
3682 | struct ata_port *ap = qc->ap; | 3681 | struct ata_port *ap = qc->ap; |
3683 | 3682 | ||
@@ -3702,7 +3701,7 @@ int ata_qc_issue(struct ata_queued_cmd *qc) | |||
3702 | 3701 | ||
3703 | sg_err: | 3702 | sg_err: |
3704 | qc->flags &= ~ATA_QCFLAG_DMAMAP; | 3703 | qc->flags &= ~ATA_QCFLAG_DMAMAP; |
3705 | return -1; | 3704 | return AC_ERR_SYSTEM; |
3706 | } | 3705 | } |
3707 | 3706 | ||
3708 | 3707 | ||
@@ -3721,10 +3720,10 @@ sg_err: | |||
3721 | * spin_lock_irqsave(host_set lock) | 3720 | * spin_lock_irqsave(host_set lock) |
3722 | * | 3721 | * |
3723 | * RETURNS: | 3722 | * RETURNS: |
3724 | * Zero on success, negative on error. | 3723 | * Zero on success, AC_ERR_* mask on failure |
3725 | */ | 3724 | */ |
3726 | 3725 | ||
3727 | int ata_qc_issue_prot(struct ata_queued_cmd *qc) | 3726 | unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc) |
3728 | { | 3727 | { |
3729 | struct ata_port *ap = qc->ap; | 3728 | struct ata_port *ap = qc->ap; |
3730 | 3729 | ||
@@ -3769,7 +3768,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
3769 | 3768 | ||
3770 | default: | 3769 | default: |
3771 | WARN_ON(1); | 3770 | WARN_ON(1); |
3772 | return -1; | 3771 | return AC_ERR_SYSTEM; |
3773 | } | 3772 | } |
3774 | 3773 | ||
3775 | return 0; | 3774 | return 0; |