diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:54 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:54 -0400 |
commit | 1f2efb82af3cfbac995f590a8f8d3beb6fa5678b (patch) | |
tree | c5345a326f9898abff9c355eb5f2ef3140050891 /drivers | |
parent | 92eb43800a3c1300bd5cb8a2a27e6f2a84f7042e (diff) |
ide: add ide_read_device() helper
Add ide_read_device() helper and convert do_probe() to use it
instead of ->INB.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-probe.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 970464317bd7..21cea45e9f21 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -410,6 +410,18 @@ static int ide_busy_sleep(ide_hwif_t *hwif) | |||
410 | return 1; | 410 | return 1; |
411 | } | 411 | } |
412 | 412 | ||
413 | static u8 ide_read_device(ide_drive_t *drive) | ||
414 | { | ||
415 | ide_task_t task; | ||
416 | |||
417 | memset(&task, 0, sizeof(task)); | ||
418 | task.tf_flags = IDE_TFLAG_IN_DEVICE; | ||
419 | |||
420 | drive->hwif->tf_read(drive, &task); | ||
421 | |||
422 | return task.tf.device; | ||
423 | } | ||
424 | |||
413 | /** | 425 | /** |
414 | * do_probe - probe an IDE device | 426 | * do_probe - probe an IDE device |
415 | * @drive: drive to probe | 427 | * @drive: drive to probe |
@@ -434,7 +446,6 @@ static int ide_busy_sleep(ide_hwif_t *hwif) | |||
434 | static int do_probe (ide_drive_t *drive, u8 cmd) | 446 | static int do_probe (ide_drive_t *drive, u8 cmd) |
435 | { | 447 | { |
436 | ide_hwif_t *hwif = HWIF(drive); | 448 | ide_hwif_t *hwif = HWIF(drive); |
437 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
438 | int rc; | 449 | int rc; |
439 | u8 stat; | 450 | u8 stat; |
440 | 451 | ||
@@ -455,8 +466,8 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
455 | msleep(50); | 466 | msleep(50); |
456 | SELECT_DRIVE(drive); | 467 | SELECT_DRIVE(drive); |
457 | msleep(50); | 468 | msleep(50); |
458 | if (hwif->INB(io_ports->device_addr) != drive->select.all && | 469 | |
459 | !drive->present) { | 470 | if (ide_read_device(drive) != drive->select.all && !drive->present) { |
460 | if (drive->select.b.unit != 0) { | 471 | if (drive->select.b.unit != 0) { |
461 | /* exit with drive0 selected */ | 472 | /* exit with drive0 selected */ |
462 | SELECT_DRIVE(&hwif->drives[0]); | 473 | SELECT_DRIVE(&hwif->drives[0]); |