diff options
author | Tejun Heo <htejun@gmail.com> | 2007-07-16 01:29:40 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-20 08:02:11 -0400 |
commit | da3dbb17a0e9a9ec7f5aed95f1fddadb790edc9d (patch) | |
tree | 289239e1eb60168321e905c545aa2e2f3a2b5475 /drivers/ata/sata_promise.c | |
parent | 5335b729064e03319cd2d5219770451dbb1d7f67 (diff) |
libata: make ->scr_read/write callbacks return error code
Convert ->scr_read/write callbacks to return error code to better
indicate failure. This will help handling of SCR_NOTIFICATION.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_promise.c')
-rw-r--r-- | drivers/ata/sata_promise.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index d2fcb9a6bec2..d39ebc23c4a9 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -128,8 +128,8 @@ struct pdc_port_priv { | |||
128 | dma_addr_t pkt_dma; | 128 | dma_addr_t pkt_dma; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); | 131 | static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); |
132 | static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 132 | static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
133 | static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 133 | static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); |
134 | static int pdc_common_port_start(struct ata_port *ap); | 134 | static int pdc_common_port_start(struct ata_port *ap); |
135 | static int pdc_sata_port_start(struct ata_port *ap); | 135 | static int pdc_sata_port_start(struct ata_port *ap); |
@@ -427,19 +427,20 @@ static int pdc_sata_cable_detect(struct ata_port *ap) | |||
427 | return ATA_CBL_SATA; | 427 | return ATA_CBL_SATA; |
428 | } | 428 | } |
429 | 429 | ||
430 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | 430 | static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) |
431 | { | 431 | { |
432 | if (sc_reg > SCR_CONTROL) | 432 | if (sc_reg > SCR_CONTROL) |
433 | return 0xffffffffU; | 433 | return -EINVAL; |
434 | return readl(ap->ioaddr.scr_addr + (sc_reg * 4)); | 434 | *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4)); |
435 | return 0; | ||
435 | } | 436 | } |
436 | 437 | ||
437 | static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, | 438 | static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) |
438 | u32 val) | ||
439 | { | 439 | { |
440 | if (sc_reg > SCR_CONTROL) | 440 | if (sc_reg > SCR_CONTROL) |
441 | return; | 441 | return -EINVAL; |
442 | writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); | 442 | writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); |
443 | return 0; | ||
443 | } | 444 | } |
444 | 445 | ||
445 | static void pdc_atapi_pkt(struct ata_queued_cmd *qc) | 446 | static void pdc_atapi_pkt(struct ata_queued_cmd *qc) |
@@ -642,8 +643,12 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc, | |||
642 | | PDC_PCI_SYS_ERR | PDC1_PCI_PARITY_ERR)) | 643 | | PDC_PCI_SYS_ERR | PDC1_PCI_PARITY_ERR)) |
643 | ac_err_mask |= AC_ERR_HOST_BUS; | 644 | ac_err_mask |= AC_ERR_HOST_BUS; |
644 | 645 | ||
645 | if (sata_scr_valid(ap)) | 646 | if (sata_scr_valid(ap)) { |
646 | ehi->serror |= pdc_sata_scr_read(ap, SCR_ERROR); | 647 | u32 serror; |
648 | |||
649 | pdc_sata_scr_read(ap, SCR_ERROR, &serror); | ||
650 | ehi->serror |= serror; | ||
651 | } | ||
647 | 652 | ||
648 | qc->err_mask |= ac_err_mask; | 653 | qc->err_mask |= ac_err_mask; |
649 | 654 | ||