aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-timings.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:19 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:19 -0400
commit4dde4492d850a4c9bcaa92e5bd7f4eebe3e2f5ab (patch)
treeee3be70390e4c617b44329edef0a05039f59c81a /drivers/ide/ide-timings.c
parent5b90e990928919ae411a68b865e8a6ecac09a603 (diff)
ide: make drive->id an union (take 2)
Make drive->id an unnamed union so id can be accessed either by using 'u16 *id' or 'struct hd_driveid *driveid'. Then convert all existing drive->id users accordingly (using 'u16 *id' when possible). This is an intermediate step to make ide 'struct hd_driveid'-free. While at it: - Add missing KERN_CONTs in it821x.c. - Use ATA_ID_WORDS and ATA_ID_*_LEN defines. - Remove unnecessary checks for drive->id. - s/drive_table/table/ in ide_in_drive_list(). - Cleanup ide_config_drive_speed() a bit. - s/drive1/dev1/ & s/drive0/dev0/ in ide_undecoded_slave(). v2: Fix typo in drivers/ide/ppc/pmac.c. (From Stephen Rothwell) There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-timings.c')
-rw-r--r--drivers/ide/ide-timings.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/ide/ide-timings.c b/drivers/ide/ide-timings.c
index 8c2f8327f487..d64f345f2fc0 100644
--- a/drivers/ide/ide-timings.c
+++ b/drivers/ide/ide-timings.c
@@ -78,15 +78,15 @@ EXPORT_SYMBOL_GPL(ide_timing_find_mode);
78 78
79u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio) 79u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio)
80{ 80{
81 struct hd_driveid *id = drive->id; 81 u16 *id = drive->id;
82 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio); 82 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
83 u16 cycle = 0; 83 u16 cycle = 0;
84 84
85 if (id->field_valid & 2) { 85 if (id[ATA_ID_FIELD_VALID] & 2) {
86 if (id->capability & 8) 86 if (drive->driveid->capability & 8)
87 cycle = id->eide_pio_iordy; 87 cycle = id[ATA_ID_EIDE_PIO_IORDY];
88 else 88 else
89 cycle = id->eide_pio; 89 cycle = id[ATA_ID_EIDE_PIO];
90 90
91 /* conservative "downgrade" for all pre-ATA2 drives */ 91 /* conservative "downgrade" for all pre-ATA2 drives */
92 if (pio < 3 && cycle < t->cycle) 92 if (pio < 3 && cycle < t->cycle)
@@ -138,7 +138,7 @@ EXPORT_SYMBOL_GPL(ide_timing_merge);
138int ide_timing_compute(ide_drive_t *drive, u8 speed, 138int ide_timing_compute(ide_drive_t *drive, u8 speed,
139 struct ide_timing *t, int T, int UT) 139 struct ide_timing *t, int T, int UT)
140{ 140{
141 struct hd_driveid *id = drive->id; 141 u16 *id = drive->id;
142 struct ide_timing *s, p; 142 struct ide_timing *s, p;
143 143
144 /* 144 /*
@@ -157,16 +157,15 @@ int ide_timing_compute(ide_drive_t *drive, u8 speed,
157 * If the drive is an EIDE drive, it can tell us it needs extended 157 * If the drive is an EIDE drive, it can tell us it needs extended
158 * PIO/MWDMA cycle timing. 158 * PIO/MWDMA cycle timing.
159 */ 159 */
160 if (id && id->field_valid & 2) { /* EIDE drive */ 160 if (id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */
161
162 memset(&p, 0, sizeof(p)); 161 memset(&p, 0, sizeof(p));
163 162
164 if (speed <= XFER_PIO_2) 163 if (speed <= XFER_PIO_2)
165 p.cycle = p.cyc8b = id->eide_pio; 164 p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO];
166 else if (speed <= XFER_PIO_5) 165 else if (speed <= XFER_PIO_5)
167 p.cycle = p.cyc8b = id->eide_pio_iordy; 166 p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO_IORDY];
168 else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) 167 else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
169 p.cycle = id->eide_dma_min; 168 p.cycle = id[ATA_ID_EIDE_DMA_MIN];
170 169
171 ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B); 170 ide_timing_merge(&p, t, t, IDE_TIMING_CYCLE | IDE_TIMING_CYC8B);
172 } 171 }