diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:41 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:41 -0400 |
commit | 7ed5b157d9dff55bf477b4c8b4708d5d45476677 (patch) | |
tree | cbfd113108efd3b4d0b634f02ca8f09e99b7fdc7 /drivers/ide/ide-acpi.c | |
parent | 8cd3c605624035b7f57deb8894e17c5ba6d05b2e (diff) |
ide: add ide_for_each_present_dev() iterator
* Add ide_for_each_present_dev() iterator and convert IDE code to use it.
* Do some drive-by CodingStyle fixups in ide-acpi.c while at it.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-acpi.c')
-rw-r--r-- | drivers/ide/ide-acpi.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index a3bebba18425..8d6d31fcbfba 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -608,17 +608,17 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on) | |||
608 | DEBPRINT("no ACPI data for %s\n", hwif->name); | 608 | DEBPRINT("no ACPI data for %s\n", hwif->name); |
609 | return; | 609 | return; |
610 | } | 610 | } |
611 | |||
611 | /* channel first and then drives for power on and verse versa for power off */ | 612 | /* channel first and then drives for power on and verse versa for power off */ |
612 | if (on) | 613 | if (on) |
613 | acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0); | 614 | acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0); |
614 | 615 | ||
615 | ide_port_for_each_dev(i, drive, hwif) { | 616 | ide_port_for_each_present_dev(i, drive, hwif) { |
616 | if (drive->acpidata->obj_handle && | 617 | if (drive->acpidata->obj_handle) |
617 | (drive->dev_flags & IDE_DFLAG_PRESENT)) { | ||
618 | acpi_bus_set_power(drive->acpidata->obj_handle, | 618 | acpi_bus_set_power(drive->acpidata->obj_handle, |
619 | on? ACPI_STATE_D0: ACPI_STATE_D3); | 619 | on ? ACPI_STATE_D0 : ACPI_STATE_D3); |
620 | } | ||
621 | } | 620 | } |
621 | |||
622 | if (!on) | 622 | if (!on) |
623 | acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D3); | 623 | acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D3); |
624 | } | 624 | } |
@@ -667,12 +667,9 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif) | |||
667 | hwif->devices[1]->acpidata = &hwif->acpidata->slave; | 667 | hwif->devices[1]->acpidata = &hwif->acpidata->slave; |
668 | 668 | ||
669 | /* get _ADR info for each device */ | 669 | /* get _ADR info for each device */ |
670 | ide_port_for_each_dev(i, drive, hwif) { | 670 | ide_port_for_each_present_dev(i, drive, hwif) { |
671 | acpi_handle dev_handle; | 671 | acpi_handle dev_handle; |
672 | 672 | ||
673 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | ||
674 | continue; | ||
675 | |||
676 | DEBPRINT("ENTER: %s at channel#: %d port#: %d\n", | 673 | DEBPRINT("ENTER: %s at channel#: %d port#: %d\n", |
677 | drive->name, hwif->channel, drive->dn & 1); | 674 | drive->name, hwif->channel, drive->dn & 1); |
678 | 675 | ||
@@ -685,13 +682,8 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif) | |||
685 | drive->acpidata->obj_handle = dev_handle; | 682 | drive->acpidata->obj_handle = dev_handle; |
686 | } | 683 | } |
687 | 684 | ||
688 | /* | 685 | /* send IDENTIFY for each device */ |
689 | * Send IDENTIFY for each drive | 686 | ide_port_for_each_present_dev(i, drive, hwif) { |
690 | */ | ||
691 | ide_port_for_each_dev(i, drive, hwif) { | ||
692 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | ||
693 | continue; | ||
694 | |||
695 | err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff); | 687 | err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff); |
696 | if (err) | 688 | if (err) |
697 | DEBPRINT("identify device %s failed (%d)\n", | 689 | DEBPRINT("identify device %s failed (%d)\n", |
@@ -711,9 +703,7 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif) | |||
711 | ide_acpi_get_timing(hwif); | 703 | ide_acpi_get_timing(hwif); |
712 | ide_acpi_push_timing(hwif); | 704 | ide_acpi_push_timing(hwif); |
713 | 705 | ||
714 | ide_port_for_each_dev(i, drive, hwif) { | 706 | ide_port_for_each_present_dev(i, drive, hwif) { |
715 | if (drive->dev_flags & IDE_DFLAG_PRESENT) | 707 | ide_acpi_exec_tfs(drive); |
716 | /* Execute ACPI startup code */ | ||
717 | ide_acpi_exec_tfs(drive); | ||
718 | } | 708 | } |
719 | } | 709 | } |