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 | |
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')
-rw-r--r-- | drivers/scsi/ahci.c | 4 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 17 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 10 | ||||
-rw-r--r-- | drivers/scsi/libata.h | 2 | ||||
-rw-r--r-- | drivers/scsi/pdc_adma.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sata_mv.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sata_promise.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sata_qstor.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sata_sil24.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sata_sx4.c | 4 |
10 files changed, 27 insertions, 30 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index bb3686ae1885..0f6e4dd22901 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -184,7 +184,7 @@ struct ahci_port_priv { | |||
184 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg); | 184 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg); |
185 | static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 185 | static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
186 | static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 186 | static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); |
187 | static int ahci_qc_issue(struct ata_queued_cmd *qc); | 187 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); |
188 | static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *regs); | 188 | static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *regs); |
189 | static void ahci_phy_reset(struct ata_port *ap); | 189 | static void ahci_phy_reset(struct ata_port *ap); |
190 | static void ahci_irq_clear(struct ata_port *ap); | 190 | static void ahci_irq_clear(struct ata_port *ap); |
@@ -800,7 +800,7 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs * | |||
800 | return IRQ_RETVAL(handled); | 800 | return IRQ_RETVAL(handled); |
801 | } | 801 | } |
802 | 802 | ||
803 | static int ahci_qc_issue(struct ata_queued_cmd *qc) | 803 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) |
804 | { | 804 | { |
805 | struct ata_port *ap = qc->ap; | 805 | struct ata_port *ap = qc->ap; |
806 | void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; | 806 | void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; |
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; |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index c496309f691a..95e3c278dd43 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1322,10 +1322,9 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev, | |||
1322 | goto early_finish; | 1322 | goto early_finish; |
1323 | 1323 | ||
1324 | /* select device, send command to hardware */ | 1324 | /* select device, send command to hardware */ |
1325 | if (ata_qc_issue(qc)) { | 1325 | qc->err_mask = ata_qc_issue(qc); |
1326 | qc->err_mask |= AC_ERR_OTHER; | 1326 | if (qc->err_mask) |
1327 | ata_qc_complete(qc); | 1327 | ata_qc_complete(qc); |
1328 | } | ||
1329 | 1328 | ||
1330 | VPRINTK("EXIT\n"); | 1329 | VPRINTK("EXIT\n"); |
1331 | return; | 1330 | return; |
@@ -2044,10 +2043,9 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) | |||
2044 | 2043 | ||
2045 | qc->complete_fn = atapi_sense_complete; | 2044 | qc->complete_fn = atapi_sense_complete; |
2046 | 2045 | ||
2047 | if (ata_qc_issue(qc)) { | 2046 | qc->err_mask = ata_qc_issue(qc); |
2048 | qc->err_mask |= AC_ERR_OTHER; | 2047 | if (qc->err_mask) |
2049 | ata_qc_complete(qc); | 2048 | ata_qc_complete(qc); |
2050 | } | ||
2051 | 2049 | ||
2052 | DPRINTK("EXIT\n"); | 2050 | DPRINTK("EXIT\n"); |
2053 | } | 2051 | } |
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index e03ce48b7b4b..9d76923a2253 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -45,7 +45,7 @@ extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | |||
45 | struct ata_device *dev); | 45 | struct ata_device *dev); |
46 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); | 46 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); |
47 | extern void ata_qc_free(struct ata_queued_cmd *qc); | 47 | extern void ata_qc_free(struct ata_queued_cmd *qc); |
48 | extern int ata_qc_issue(struct ata_queued_cmd *qc); | 48 | extern unsigned int ata_qc_issue(struct ata_queued_cmd *qc); |
49 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); | 49 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); |
50 | extern void ata_dev_select(struct ata_port *ap, unsigned int device, | 50 | extern void ata_dev_select(struct ata_port *ap, unsigned int device, |
51 | unsigned int wait, unsigned int can_sleep); | 51 | unsigned int wait, unsigned int can_sleep); |
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index e8df0c9ec1e6..3a6bf58dc37b 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c | |||
@@ -131,7 +131,7 @@ static void adma_host_stop(struct ata_host_set *host_set); | |||
131 | static void adma_port_stop(struct ata_port *ap); | 131 | static void adma_port_stop(struct ata_port *ap); |
132 | static void adma_phy_reset(struct ata_port *ap); | 132 | static void adma_phy_reset(struct ata_port *ap); |
133 | static void adma_qc_prep(struct ata_queued_cmd *qc); | 133 | static void adma_qc_prep(struct ata_queued_cmd *qc); |
134 | static int adma_qc_issue(struct ata_queued_cmd *qc); | 134 | static unsigned int adma_qc_issue(struct ata_queued_cmd *qc); |
135 | static int adma_check_atapi_dma(struct ata_queued_cmd *qc); | 135 | static int adma_check_atapi_dma(struct ata_queued_cmd *qc); |
136 | static void adma_bmdma_stop(struct ata_queued_cmd *qc); | 136 | static void adma_bmdma_stop(struct ata_queued_cmd *qc); |
137 | static u8 adma_bmdma_status(struct ata_port *ap); | 137 | static u8 adma_bmdma_status(struct ata_port *ap); |
@@ -419,7 +419,7 @@ static inline void adma_packet_start(struct ata_queued_cmd *qc) | |||
419 | writew(aPIOMD4 | aGO, chan + ADMA_CONTROL); | 419 | writew(aPIOMD4 | aGO, chan + ADMA_CONTROL); |
420 | } | 420 | } |
421 | 421 | ||
422 | static int adma_qc_issue(struct ata_queued_cmd *qc) | 422 | static unsigned int adma_qc_issue(struct ata_queued_cmd *qc) |
423 | { | 423 | { |
424 | struct adma_port_priv *pp = qc->ap->private_data; | 424 | struct adma_port_priv *pp = qc->ap->private_data; |
425 | 425 | ||
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 89bcd85fa58c..281223a0e45f 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -328,7 +328,7 @@ static void mv_host_stop(struct ata_host_set *host_set); | |||
328 | static int mv_port_start(struct ata_port *ap); | 328 | static int mv_port_start(struct ata_port *ap); |
329 | static void mv_port_stop(struct ata_port *ap); | 329 | static void mv_port_stop(struct ata_port *ap); |
330 | static void mv_qc_prep(struct ata_queued_cmd *qc); | 330 | static void mv_qc_prep(struct ata_queued_cmd *qc); |
331 | static int mv_qc_issue(struct ata_queued_cmd *qc); | 331 | static unsigned int mv_qc_issue(struct ata_queued_cmd *qc); |
332 | static irqreturn_t mv_interrupt(int irq, void *dev_instance, | 332 | static irqreturn_t mv_interrupt(int irq, void *dev_instance, |
333 | struct pt_regs *regs); | 333 | struct pt_regs *regs); |
334 | static void mv_eng_timeout(struct ata_port *ap); | 334 | static void mv_eng_timeout(struct ata_port *ap); |
@@ -1040,7 +1040,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
1040 | * LOCKING: | 1040 | * LOCKING: |
1041 | * Inherited from caller. | 1041 | * Inherited from caller. |
1042 | */ | 1042 | */ |
1043 | static int mv_qc_issue(struct ata_queued_cmd *qc) | 1043 | static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) |
1044 | { | 1044 | { |
1045 | void __iomem *port_mmio = mv_ap_base(qc->ap); | 1045 | void __iomem *port_mmio = mv_ap_base(qc->ap); |
1046 | struct mv_port_priv *pp = qc->ap->private_data; | 1046 | struct mv_port_priv *pp = qc->ap->private_data; |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index b0b0a69b3563..bac36d5b7c3e 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -95,7 +95,7 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc); | |||
95 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 95 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
96 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 96 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
97 | static void pdc_irq_clear(struct ata_port *ap); | 97 | static void pdc_irq_clear(struct ata_port *ap); |
98 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); | 98 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); |
99 | 99 | ||
100 | 100 | ||
101 | static struct scsi_host_template pdc_ata_sht = { | 101 | static struct scsi_host_template pdc_ata_sht = { |
@@ -544,7 +544,7 @@ static inline void pdc_packet_start(struct ata_queued_cmd *qc) | |||
544 | readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ | 544 | readl((void __iomem *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ |
545 | } | 545 | } |
546 | 546 | ||
547 | static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) | 547 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc) |
548 | { | 548 | { |
549 | switch (qc->tf.protocol) { | 549 | switch (qc->tf.protocol) { |
550 | case ATA_PROT_DMA: | 550 | case ATA_PROT_DMA: |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index de05e2883f9c..2afbeb77f6fe 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -120,7 +120,7 @@ static void qs_host_stop(struct ata_host_set *host_set); | |||
120 | static void qs_port_stop(struct ata_port *ap); | 120 | static void qs_port_stop(struct ata_port *ap); |
121 | static void qs_phy_reset(struct ata_port *ap); | 121 | static void qs_phy_reset(struct ata_port *ap); |
122 | static void qs_qc_prep(struct ata_queued_cmd *qc); | 122 | static void qs_qc_prep(struct ata_queued_cmd *qc); |
123 | static int qs_qc_issue(struct ata_queued_cmd *qc); | 123 | static unsigned int qs_qc_issue(struct ata_queued_cmd *qc); |
124 | static int qs_check_atapi_dma(struct ata_queued_cmd *qc); | 124 | static int qs_check_atapi_dma(struct ata_queued_cmd *qc); |
125 | static void qs_bmdma_stop(struct ata_queued_cmd *qc); | 125 | static void qs_bmdma_stop(struct ata_queued_cmd *qc); |
126 | static u8 qs_bmdma_status(struct ata_port *ap); | 126 | static u8 qs_bmdma_status(struct ata_port *ap); |
@@ -352,7 +352,7 @@ static inline void qs_packet_start(struct ata_queued_cmd *qc) | |||
352 | readl(chan + QS_CCT_CFF); /* flush */ | 352 | readl(chan + QS_CCT_CFF); /* flush */ |
353 | } | 353 | } |
354 | 354 | ||
355 | static int qs_qc_issue(struct ata_queued_cmd *qc) | 355 | static unsigned int qs_qc_issue(struct ata_queued_cmd *qc) |
356 | { | 356 | { |
357 | struct qs_port_priv *pp = qc->ap->private_data; | 357 | struct qs_port_priv *pp = qc->ap->private_data; |
358 | 358 | ||
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index fb59012b9fbe..5a7a7b1d4add 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -251,7 +251,7 @@ static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); | |||
251 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | 251 | static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); |
252 | static void sil24_phy_reset(struct ata_port *ap); | 252 | static void sil24_phy_reset(struct ata_port *ap); |
253 | static void sil24_qc_prep(struct ata_queued_cmd *qc); | 253 | static void sil24_qc_prep(struct ata_queued_cmd *qc); |
254 | static int sil24_qc_issue(struct ata_queued_cmd *qc); | 254 | static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc); |
255 | static void sil24_irq_clear(struct ata_port *ap); | 255 | static void sil24_irq_clear(struct ata_port *ap); |
256 | static void sil24_eng_timeout(struct ata_port *ap); | 256 | static void sil24_eng_timeout(struct ata_port *ap); |
257 | static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs); | 257 | static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs); |
@@ -557,7 +557,7 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc) | |||
557 | sil24_fill_sg(qc, sge); | 557 | sil24_fill_sg(qc, sge); |
558 | } | 558 | } |
559 | 559 | ||
560 | static int sil24_qc_issue(struct ata_queued_cmd *qc) | 560 | static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc) |
561 | { | 561 | { |
562 | struct ata_port *ap = qc->ap; | 562 | struct ata_port *ap = qc->ap; |
563 | void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; | 563 | void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; |
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index bc87c16c80d2..3175c6bb4fec 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -174,7 +174,7 @@ static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, | |||
174 | static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, | 174 | static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, |
175 | void *psource, u32 offset, u32 size); | 175 | void *psource, u32 offset, u32 size); |
176 | static void pdc20621_irq_clear(struct ata_port *ap); | 176 | static void pdc20621_irq_clear(struct ata_port *ap); |
177 | static int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc); | 177 | static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc); |
178 | 178 | ||
179 | 179 | ||
180 | static struct scsi_host_template pdc_sata_sht = { | 180 | static struct scsi_host_template pdc_sata_sht = { |
@@ -678,7 +678,7 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc) | |||
678 | } | 678 | } |
679 | } | 679 | } |
680 | 680 | ||
681 | static int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc) | 681 | static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc) |
682 | { | 682 | { |
683 | switch (qc->tf.protocol) { | 683 | switch (qc->tf.protocol) { |
684 | case ATA_PROT_DMA: | 684 | case ATA_PROT_DMA: |