aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/sl82c105.c
diff options
context:
space:
mode:
authorJoao Ramos <joao.ramos@inov.pt>2009-06-15 16:13:44 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-06-15 16:13:44 -0400
commit5bfb151f1f565e6082304a30e8c81dfb6ed0b0c8 (patch)
tree331727c29645788035c4f4b0e617f8f0c9c52e1d /drivers/ide/sl82c105.c
parent3779f818a42879038c4be8bc83123432b774279d (diff)
ide: do not access ide_drive_t 'drive_data' field directly
Change ide_drive_t 'drive_data' field from 'unsigned int' type to 'void *' type, allowing a wider range of values/types to be stored in this field. Added 'ide_get_drivedata' and 'ide_set_drivedata' helpers to get and set the 'drive_data' field. Fixed all host drivers to maintain coherency with the change in the 'drive_data' field type. Signed-off-by: Joao Ramos <joao.ramos@inov.pt> [bart: fix qd65xx build, cast to 'unsigned long', minor Coding Style fixups] Acked-by: Sergei Shtylyov <sshtylyov@ru.montavista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/sl82c105.c')
-rw-r--r--drivers/ide/sl82c105.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c
index 6246bea585c4..d698da470d6f 100644
--- a/drivers/ide/sl82c105.c
+++ b/drivers/ide/sl82c105.c
@@ -73,6 +73,7 @@ static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio)
73static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio) 73static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio)
74{ 74{
75 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 75 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
76 unsigned long timings = (unsigned long)ide_get_drivedata(drive);
76 int reg = 0x44 + drive->dn * 4; 77 int reg = 0x44 + drive->dn * 4;
77 u16 drv_ctrl; 78 u16 drv_ctrl;
78 79
@@ -82,8 +83,9 @@ static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio)
82 * Store the PIO timings so that we can restore them 83 * Store the PIO timings so that we can restore them
83 * in case DMA will be turned off... 84 * in case DMA will be turned off...
84 */ 85 */
85 drive->drive_data &= 0xffff0000; 86 timings &= 0xffff0000;
86 drive->drive_data |= drv_ctrl; 87 timings |= drv_ctrl;
88 ide_set_drivedata(drive, (void *)timings);
87 89
88 pci_write_config_word(dev, reg, drv_ctrl); 90 pci_write_config_word(dev, reg, drv_ctrl);
89 pci_read_config_word (dev, reg, &drv_ctrl); 91 pci_read_config_word (dev, reg, &drv_ctrl);
@@ -99,6 +101,7 @@ static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio)
99static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed) 101static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed)
100{ 102{
101 static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200}; 103 static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200};
104 unsigned long timings = (unsigned long)ide_get_drivedata(drive);
102 u16 drv_ctrl; 105 u16 drv_ctrl;
103 106
104 DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n", 107 DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n",
@@ -110,8 +113,9 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed)
110 * Store the DMA timings so that we can actually program 113 * Store the DMA timings so that we can actually program
111 * them when DMA will be turned on... 114 * them when DMA will be turned on...
112 */ 115 */
113 drive->drive_data &= 0x0000ffff; 116 timings &= 0x0000ffff;
114 drive->drive_data |= (unsigned long)drv_ctrl << 16; 117 timings |= (unsigned long)drv_ctrl << 16;
118 ide_set_drivedata(drive, (void *)timings);
115} 119}
116 120
117static int sl82c105_test_irq(ide_hwif_t *hwif) 121static int sl82c105_test_irq(ide_hwif_t *hwif)
@@ -194,7 +198,8 @@ static void sl82c105_dma_start(ide_drive_t *drive)
194 198
195 DBG(("%s(drive:%s)\n", __func__, drive->name)); 199 DBG(("%s(drive:%s)\n", __func__, drive->name));
196 200
197 pci_write_config_word(dev, reg, drive->drive_data >> 16); 201 pci_write_config_word(dev, reg,
202 (unsigned long)ide_get_drivedata(drive) >> 16);
198 203
199 sl82c105_reset_host(dev); 204 sl82c105_reset_host(dev);
200 ide_dma_start(drive); 205 ide_dma_start(drive);
@@ -219,7 +224,8 @@ static int sl82c105_dma_end(ide_drive_t *drive)
219 224
220 ret = ide_dma_end(drive); 225 ret = ide_dma_end(drive);
221 226
222 pci_write_config_word(dev, reg, drive->drive_data); 227 pci_write_config_word(dev, reg,
228 (unsigned long)ide_get_drivedata(drive));
223 229
224 return ret; 230 return ret;
225} 231}