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>
This commit is contained in:
committed by
Bartlomiej Zolnierkiewicz
parent
3779f818a4
commit
5bfb151f1f
@@ -118,8 +118,9 @@ static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio)
|
||||
ide_hwif_t *hwif = drive->hwif;
|
||||
struct pci_dev *dev = to_pci_dev(hwif->dev);
|
||||
struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
|
||||
unsigned long setup_count;
|
||||
unsigned int cycle_time;
|
||||
u8 setup_count, arttim = 0;
|
||||
u8 arttim = 0;
|
||||
|
||||
static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0};
|
||||
static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23};
|
||||
@@ -140,10 +141,11 @@ static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio)
|
||||
if (hwif->channel) {
|
||||
ide_drive_t *pair = ide_get_pair_dev(drive);
|
||||
|
||||
drive->drive_data = setup_count;
|
||||
ide_set_drivedata(drive, (void *)setup_count);
|
||||
|
||||
if (pair)
|
||||
setup_count = max_t(u8, setup_count, pair->drive_data);
|
||||
setup_count = max_t(u8, setup_count,
|
||||
(unsigned long)ide_get_drivedata(pair));
|
||||
}
|
||||
|
||||
if (setup_count > 5) /* shouldn't actually happen... */
|
||||
|
Reference in New Issue
Block a user