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_sis.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_sis.c')
-rw-r--r-- | drivers/ata/sata_sis.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index 33716b00c6b7..31a2f55aae66 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
@@ -64,8 +64,8 @@ enum { | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 66 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); |
67 | static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg); | 67 | static int sis_scr_read (struct ata_port *ap, unsigned int sc_reg, u32 *val); |
68 | static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 68 | static int sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
69 | 69 | ||
70 | static const struct pci_device_id sis_pci_tbl[] = { | 70 | static const struct pci_device_id sis_pci_tbl[] = { |
71 | { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */ | 71 | { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */ |
@@ -207,36 +207,37 @@ static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val | |||
207 | pci_write_config_dword(pdev, cfg_addr+0x10, val); | 207 | pci_write_config_dword(pdev, cfg_addr+0x10, val); |
208 | } | 208 | } |
209 | 209 | ||
210 | static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg) | 210 | static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) |
211 | { | 211 | { |
212 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 212 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
213 | u32 val, val2 = 0; | ||
214 | u8 pmr; | 213 | u8 pmr; |
215 | 214 | ||
216 | if (sc_reg > SCR_CONTROL) | 215 | if (sc_reg > SCR_CONTROL) |
217 | return 0xffffffffU; | 216 | return -EINVAL; |
218 | 217 | ||
219 | if (ap->flags & SIS_FLAG_CFGSCR) | 218 | if (ap->flags & SIS_FLAG_CFGSCR) |
220 | return sis_scr_cfg_read(ap, sc_reg); | 219 | return sis_scr_cfg_read(ap, sc_reg); |
221 | 220 | ||
222 | pci_read_config_byte(pdev, SIS_PMR, &pmr); | 221 | pci_read_config_byte(pdev, SIS_PMR, &pmr); |
223 | 222 | ||
224 | val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4)); | 223 | *val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4)); |
225 | 224 | ||
226 | if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || | 225 | if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || |
227 | (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) | 226 | (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) |
228 | val2 = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4) + 0x10); | 227 | *val |= ioread32(ap->ioaddr.scr_addr + (sc_reg * 4) + 0x10); |
228 | |||
229 | *val &= 0xfffffffb; | ||
229 | 230 | ||
230 | return (val | val2) & 0xfffffffb; | 231 | return 0; |
231 | } | 232 | } |
232 | 233 | ||
233 | static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | 234 | static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) |
234 | { | 235 | { |
235 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 236 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
236 | u8 pmr; | 237 | u8 pmr; |
237 | 238 | ||
238 | if (sc_reg > SCR_CONTROL) | 239 | if (sc_reg > SCR_CONTROL) |
239 | return; | 240 | return -EINVAL; |
240 | 241 | ||
241 | pci_read_config_byte(pdev, SIS_PMR, &pmr); | 242 | pci_read_config_byte(pdev, SIS_PMR, &pmr); |
242 | 243 | ||
@@ -248,6 +249,7 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | |||
248 | (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) | 249 | (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) |
249 | iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10); | 250 | iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10); |
250 | } | 251 | } |
252 | return 0; | ||
251 | } | 253 | } |
252 | 254 | ||
253 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 255 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |