From 5bfb151f1f565e6082304a30e8c81dfb6ed0b0c8 Mon Sep 17 00:00:00 2001 From: Joao Ramos Date: Mon, 15 Jun 2009 22:13:44 +0200 Subject: 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 [bart: fix qd65xx build, cast to 'unsigned long', minor Coding Style fixups] Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/qd65xx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'drivers/ide/qd65xx.c') diff --git a/drivers/ide/qd65xx.c b/drivers/ide/qd65xx.c index c9a13498689..74696edc8d1 100644 --- a/drivers/ide/qd65xx.c +++ b/drivers/ide/qd65xx.c @@ -180,8 +180,11 @@ static int qd_find_disk_type (ide_drive_t *drive, static void qd_set_timing (ide_drive_t *drive, u8 timing) { - drive->drive_data &= 0xff00; - drive->drive_data |= timing; + unsigned long data = (unsigned long)ide_get_drivedata(drive); + + data &= 0xff00; + data |= timing; + ide_set_drivedata(drive, (void *)data); printk(KERN_DEBUG "%s: %#x\n", drive->name, timing); } @@ -292,7 +295,7 @@ static void __init qd6500_init_dev(ide_drive_t *drive) u8 base = (hwif->config_data & 0xff00) >> 8; u8 config = QD_CONFIG(hwif); - drive->drive_data = QD6500_DEF_DATA; + ide_set_drivedata(drive, (void *)QD6500_DEF_DATA); } static void __init qd6580_init_dev(ide_drive_t *drive) @@ -308,7 +311,7 @@ static void __init qd6580_init_dev(ide_drive_t *drive) } else t2 = t1 = hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA; - drive->drive_data = (drive->dn & 1) ? t2 : t1; + ide_set_drivedata(drive, (void *)((drive->dn & 1) ? t2 : t1)); } static const struct ide_tp_ops qd65xx_tp_ops = { -- cgit