diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:19 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:19 -0400 |
commit | 4dde4492d850a4c9bcaa92e5bd7f4eebe3e2f5ab (patch) | |
tree | ee3be70390e4c617b44329edef0a05039f59c81a /drivers/ide/legacy | |
parent | 5b90e990928919ae411a68b865e8a6ecac09a603 (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/legacy')
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 2338f344ea24..ef4e84053a81 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -151,12 +151,14 @@ static int qd_find_disk_type (ide_drive_t *drive, | |||
151 | int *active_time, int *recovery_time) | 151 | int *active_time, int *recovery_time) |
152 | { | 152 | { |
153 | struct qd65xx_timing_s *p; | 153 | struct qd65xx_timing_s *p; |
154 | char model[40]; | 154 | char *m = (char *)&drive->id[ATA_ID_PROD]; |
155 | char model[ATA_ID_PROD_LEN]; | ||
155 | 156 | ||
156 | if (!*drive->id->model) return 0; | 157 | if (*m == 0) |
158 | return 0; | ||
157 | 159 | ||
158 | strncpy(model,drive->id->model,40); | 160 | strncpy(model, m, ATA_ID_PROD_LEN); |
159 | ide_fixstring(model,40,1); /* byte-swap */ | 161 | ide_fixstring(model, ATA_ID_PROD_LEN, 1); /* byte-swap */ |
160 | 162 | ||
161 | for (p = qd65xx_timing ; p->offset != -1 ; p++) { | 163 | for (p = qd65xx_timing ; p->offset != -1 ; p++) { |
162 | if (!strncmp(p->model, model+p->offset, 4)) { | 164 | if (!strncmp(p->model, model+p->offset, 4)) { |
@@ -185,20 +187,20 @@ static void qd_set_timing (ide_drive_t *drive, u8 timing) | |||
185 | 187 | ||
186 | static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio) | 188 | static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio) |
187 | { | 189 | { |
190 | u16 *id = drive->id; | ||
188 | int active_time = 175; | 191 | int active_time = 175; |
189 | int recovery_time = 415; /* worst case values from the dos driver */ | 192 | int recovery_time = 415; /* worst case values from the dos driver */ |
190 | 193 | ||
191 | /* | 194 | /* |
192 | * FIXME: use "pio" value | 195 | * FIXME: use "pio" value |
193 | */ | 196 | */ |
194 | if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time) | 197 | if (!qd_find_disk_type(drive, &active_time, &recovery_time) && |
195 | && drive->id->tPIO && (drive->id->field_valid & 0x02) | 198 | drive->driveid->tPIO && (id[ATA_ID_FIELD_VALID] & 2) && |
196 | && drive->id->eide_pio >= 240) { | 199 | id[ATA_ID_EIDE_PIO] >= 240) { |
197 | |||
198 | printk(KERN_INFO "%s: PIO mode%d\n", drive->name, | 200 | printk(KERN_INFO "%s: PIO mode%d\n", drive->name, |
199 | drive->id->tPIO); | 201 | drive->driveid->tPIO); |
200 | active_time = 110; | 202 | active_time = 110; |
201 | recovery_time = drive->id->eide_pio - 120; | 203 | recovery_time = drive->id[ATA_ID_EIDE_PIO] - 120; |
202 | } | 204 | } |
203 | 205 | ||
204 | qd_set_timing(drive, qd6500_compute_timing(HWIF(drive), active_time, recovery_time)); | 206 | qd_set_timing(drive, qd6500_compute_timing(HWIF(drive), active_time, recovery_time)); |