aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/opti621.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/opti621.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/opti621.c')
-rw-r--r--drivers/ide/opti621.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/ide/opti621.c b/drivers/ide/opti621.c
index 6048eda3cd61..f1d70d6630fe 100644
--- a/drivers/ide/opti621.c
+++ b/drivers/ide/opti621.c
@@ -138,6 +138,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
138 ide_hwif_t *hwif = drive->hwif; 138 ide_hwif_t *hwif = drive->hwif;
139 ide_drive_t *pair = ide_get_pair_dev(drive); 139 ide_drive_t *pair = ide_get_pair_dev(drive);
140 unsigned long flags; 140 unsigned long flags;
141 unsigned long mode = XFER_PIO_0 + pio, pair_mode;
141 u8 tim, misc, addr_pio = pio, clk; 142 u8 tim, misc, addr_pio = pio, clk;
142 143
143 /* DRDY is default 2 (by OPTi Databook) */ 144 /* DRDY is default 2 (by OPTi Databook) */
@@ -150,11 +151,12 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
150 { 0x48, 0x34, 0x21, 0x10, 0x10 } /* 25 MHz */ 151 { 0x48, 0x34, 0x21, 0x10, 0x10 } /* 25 MHz */
151 }; 152 };
152 153
153 drive->drive_data = XFER_PIO_0 + pio; 154 ide_set_drivedata(drive, (void *)mode);
154 155
155 if (pair) { 156 if (pair) {
156 if (pair->drive_data && pair->drive_data < drive->drive_data) 157 pair_mode = (unsigned long)ide_get_drivedata(pair);
157 addr_pio = pair->drive_data - XFER_PIO_0; 158 if (pair_mode && pair_mode < mode)
159 addr_pio = pair_mode - XFER_PIO_0;
158 } 160 }
159 161
160 spin_lock_irqsave(&opti621_lock, flags); 162 spin_lock_irqsave(&opti621_lock, flags);