diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-19 19:11:55 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-07-19 19:11:55 -0400 |
commit | 2229833c1365346b64357a9263fa724f74f5e376 (patch) | |
tree | 50f06ee86c940ef415561e548dabaaafd81a49a3 /drivers/ide/ide-lib.c | |
parent | 342cdb6d4739cee430efc3eafcacd1605db66036 (diff) |
ide: add ide_dev_has_iordy() helper (take 4)
* Add ide_dev_has_iordy() helper and use it sl82c105 host driver.
* Remove no longer needed ide_pio_data_t.use_iordy field.
v2/v3:
* Fix issues noticed by Sergei:
- correct patch description
- fix comment in ide_get_best_pio_mode()
v4:
* Fix "ata_" prefix (Noticed by Jeff).
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-lib.c')
-rw-r--r-- | drivers/ide/ide-lib.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index d45bbad9ffe7..d5cc96bb4298 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -267,18 +267,15 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p | |||
267 | { | 267 | { |
268 | int pio_mode; | 268 | int pio_mode; |
269 | int cycle_time = 0; | 269 | int cycle_time = 0; |
270 | int use_iordy = 0; | ||
271 | struct hd_driveid* id = drive->id; | 270 | struct hd_driveid* id = drive->id; |
272 | int overridden = 0; | 271 | int overridden = 0; |
273 | 272 | ||
274 | if (mode_wanted != 255) { | 273 | if (mode_wanted != 255) { |
275 | pio_mode = mode_wanted; | 274 | pio_mode = mode_wanted; |
276 | use_iordy = (pio_mode > 2); | ||
277 | } else if (!drive->id) { | 275 | } else if (!drive->id) { |
278 | pio_mode = 0; | 276 | pio_mode = 0; |
279 | } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { | 277 | } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { |
280 | printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); | 278 | printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); |
281 | use_iordy = (pio_mode > 2); | ||
282 | } else { | 279 | } else { |
283 | pio_mode = id->tPIO; | 280 | pio_mode = id->tPIO; |
284 | if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ | 281 | if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ |
@@ -286,8 +283,7 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p | |||
286 | overridden = 1; | 283 | overridden = 1; |
287 | } | 284 | } |
288 | if (id->field_valid & 2) { /* drive implements ATA2? */ | 285 | if (id->field_valid & 2) { /* drive implements ATA2? */ |
289 | if (id->capability & 8) { /* drive supports use_iordy? */ | 286 | if (id->capability & 8) { /* IORDY supported? */ |
290 | use_iordy = 1; | ||
291 | cycle_time = id->eide_pio_iordy; | 287 | cycle_time = id->eide_pio_iordy; |
292 | if (id->eide_pio_modes & 7) { | 288 | if (id->eide_pio_modes & 7) { |
293 | overridden = 0; | 289 | overridden = 0; |
@@ -325,7 +321,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p | |||
325 | if (d) { | 321 | if (d) { |
326 | d->pio_mode = pio_mode; | 322 | d->pio_mode = pio_mode; |
327 | d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; | 323 | d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; |
328 | d->use_iordy = use_iordy; | ||
329 | } | 324 | } |
330 | return pio_mode; | 325 | return pio_mode; |
331 | } | 326 | } |