aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-01-22 23:09:36 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-26 22:36:27 -0500
commit9a3d9eb0177eb10500d49cd283b35576082a522d (patch)
tree3a8279ea3f263338cd02918131a36ee716cad1a8 /drivers/scsi
parent11a56d2439259892319df81cf1582687d7e7fde5 (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.c4
-rw-r--r--drivers/scsi/libata-core.c17
-rw-r--r--drivers/scsi/libata-scsi.c10
-rw-r--r--drivers/scsi/libata.h2
-rw-r--r--drivers/scsi/pdc_adma.c4
-rw-r--r--drivers/scsi/sata_mv.c4
-rw-r--r--drivers/scsi/sata_promise.c4
-rw-r--r--drivers/scsi/sata_qstor.c4
-rw-r--r--drivers/scsi/sata_sil24.c4
-rw-r--r--drivers/scsi/sata_sx4.c4
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 {
184static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg); 184static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg);
185static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 185static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
186static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 186static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
187static int ahci_qc_issue(struct ata_queued_cmd *qc); 187static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc);
188static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 188static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
189static void ahci_phy_reset(struct ata_port *ap); 189static void ahci_phy_reset(struct ata_port *ap);
190static void ahci_irq_clear(struct ata_port *ap); 190static 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
803static int ahci_qc_issue(struct ata_queued_cmd *qc) 803static 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
3680int ata_qc_issue(struct ata_queued_cmd *qc) 3679unsigned 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
3703sg_err: 3702sg_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
3727int ata_qc_issue_prot(struct ata_queued_cmd *qc) 3726unsigned 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);
46extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); 46extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc);
47extern void ata_qc_free(struct ata_queued_cmd *qc); 47extern void ata_qc_free(struct ata_queued_cmd *qc);
48extern int ata_qc_issue(struct ata_queued_cmd *qc); 48extern unsigned int ata_qc_issue(struct ata_queued_cmd *qc);
49extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); 49extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
50extern void ata_dev_select(struct ata_port *ap, unsigned int device, 50extern 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);
131static void adma_port_stop(struct ata_port *ap); 131static void adma_port_stop(struct ata_port *ap);
132static void adma_phy_reset(struct ata_port *ap); 132static void adma_phy_reset(struct ata_port *ap);
133static void adma_qc_prep(struct ata_queued_cmd *qc); 133static void adma_qc_prep(struct ata_queued_cmd *qc);
134static int adma_qc_issue(struct ata_queued_cmd *qc); 134static unsigned int adma_qc_issue(struct ata_queued_cmd *qc);
135static int adma_check_atapi_dma(struct ata_queued_cmd *qc); 135static int adma_check_atapi_dma(struct ata_queued_cmd *qc);
136static void adma_bmdma_stop(struct ata_queued_cmd *qc); 136static void adma_bmdma_stop(struct ata_queued_cmd *qc);
137static u8 adma_bmdma_status(struct ata_port *ap); 137static 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
422static int adma_qc_issue(struct ata_queued_cmd *qc) 422static 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);
328static int mv_port_start(struct ata_port *ap); 328static int mv_port_start(struct ata_port *ap);
329static void mv_port_stop(struct ata_port *ap); 329static void mv_port_stop(struct ata_port *ap);
330static void mv_qc_prep(struct ata_queued_cmd *qc); 330static void mv_qc_prep(struct ata_queued_cmd *qc);
331static int mv_qc_issue(struct ata_queued_cmd *qc); 331static unsigned int mv_qc_issue(struct ata_queued_cmd *qc);
332static irqreturn_t mv_interrupt(int irq, void *dev_instance, 332static irqreturn_t mv_interrupt(int irq, void *dev_instance,
333 struct pt_regs *regs); 333 struct pt_regs *regs);
334static void mv_eng_timeout(struct ata_port *ap); 334static 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 */
1043static int mv_qc_issue(struct ata_queued_cmd *qc) 1043static 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);
95static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 95static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
96static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 96static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
97static void pdc_irq_clear(struct ata_port *ap); 97static void pdc_irq_clear(struct ata_port *ap);
98static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); 98static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
99 99
100 100
101static struct scsi_host_template pdc_ata_sht = { 101static 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
547static int pdc_qc_issue_prot(struct ata_queued_cmd *qc) 547static 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);
120static void qs_port_stop(struct ata_port *ap); 120static void qs_port_stop(struct ata_port *ap);
121static void qs_phy_reset(struct ata_port *ap); 121static void qs_phy_reset(struct ata_port *ap);
122static void qs_qc_prep(struct ata_queued_cmd *qc); 122static void qs_qc_prep(struct ata_queued_cmd *qc);
123static int qs_qc_issue(struct ata_queued_cmd *qc); 123static unsigned int qs_qc_issue(struct ata_queued_cmd *qc);
124static int qs_check_atapi_dma(struct ata_queued_cmd *qc); 124static int qs_check_atapi_dma(struct ata_queued_cmd *qc);
125static void qs_bmdma_stop(struct ata_queued_cmd *qc); 125static void qs_bmdma_stop(struct ata_queued_cmd *qc);
126static u8 qs_bmdma_status(struct ata_port *ap); 126static 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
355static int qs_qc_issue(struct ata_queued_cmd *qc) 355static 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);
251static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); 251static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
252static void sil24_phy_reset(struct ata_port *ap); 252static void sil24_phy_reset(struct ata_port *ap);
253static void sil24_qc_prep(struct ata_queued_cmd *qc); 253static void sil24_qc_prep(struct ata_queued_cmd *qc);
254static int sil24_qc_issue(struct ata_queued_cmd *qc); 254static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc);
255static void sil24_irq_clear(struct ata_port *ap); 255static void sil24_irq_clear(struct ata_port *ap);
256static void sil24_eng_timeout(struct ata_port *ap); 256static void sil24_eng_timeout(struct ata_port *ap);
257static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs); 257static 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
560static int sil24_qc_issue(struct ata_queued_cmd *qc) 560static 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,
174static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, 174static void pdc20621_put_to_dimm(struct ata_probe_ent *pe,
175 void *psource, u32 offset, u32 size); 175 void *psource, u32 offset, u32 size);
176static void pdc20621_irq_clear(struct ata_port *ap); 176static void pdc20621_irq_clear(struct ata_port *ap);
177static int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc); 177static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc);
178 178
179 179
180static struct scsi_host_template pdc_sata_sht = { 180static 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
681static int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc) 681static 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: