aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-acpi.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 11:20:56 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 11:20:56 -0500
commit2bd24a1cfc99d242c2cff9a6b74ca49fcaac3fb6 (patch)
treed4797f56699e9da367e12b5e1d01b108241424f6 /drivers/ide/ide-acpi.c
parent5e7f3a46690f7f6c9f2781c700ab4370874aa0e8 (diff)
ide: add port and host iterators
Add ide_port_for_each_dev() / ide_host_for_each_port() iterators and update IDE code to use them. While at it: - s/unit/i/ variable in ide_port_wait_ready(), ide_probe_port(), ide_port_tune_devices(), ide_port_init_devices_data(), do_reset1(), ide_acpi_set_state() and scc_dma_end() - s/d/i/ variable in ide_proc_port_register_devices() 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.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index fd155b8a256c..2f9e941968d6 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -641,7 +641,8 @@ void ide_acpi_push_timing(ide_hwif_t *hwif)
641 */ 641 */
642void ide_acpi_set_state(ide_hwif_t *hwif, int on) 642void ide_acpi_set_state(ide_hwif_t *hwif, int on)
643{ 643{
644 int unit; 644 ide_drive_t *drive;
645 int i;
645 646
646 if (ide_noacpi || ide_noacpi_psx) 647 if (ide_noacpi || ide_noacpi_psx)
647 return; 648 return;
@@ -655,9 +656,8 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
655 /* channel first and then drives for power on and verse versa for power off */ 656 /* channel first and then drives for power on and verse versa for power off */
656 if (on) 657 if (on)
657 acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0); 658 acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0);
658 for (unit = 0; unit < MAX_DRIVES; ++unit) {
659 ide_drive_t *drive = hwif->devices[unit];
660 659
660 ide_port_for_each_dev(i, drive, hwif) {
661 if (!drive->acpidata->obj_handle) 661 if (!drive->acpidata->obj_handle)
662 drive->acpidata->obj_handle = ide_acpi_drive_get_handle(drive); 662 drive->acpidata->obj_handle = ide_acpi_drive_get_handle(drive);
663 663
@@ -717,9 +717,7 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif)
717 /* 717 /*
718 * Send IDENTIFY for each drive 718 * Send IDENTIFY for each drive
719 */ 719 */
720 for (i = 0; i < MAX_DRIVES; i++) { 720 ide_port_for_each_dev(i, drive, hwif) {
721 drive = hwif->devices[i];
722
723 memset(drive->acpidata, 0, sizeof(*drive->acpidata)); 721 memset(drive->acpidata, 0, sizeof(*drive->acpidata));
724 722
725 if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) 723 if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0)
@@ -744,9 +742,7 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif)
744 ide_acpi_get_timing(hwif); 742 ide_acpi_get_timing(hwif);
745 ide_acpi_push_timing(hwif); 743 ide_acpi_push_timing(hwif);
746 744
747 for (i = 0; i < MAX_DRIVES; i++) { 745 ide_port_for_each_dev(i, drive, hwif) {
748 drive = hwif->devices[i];
749
750 if (drive->dev_flags & IDE_DFLAG_PRESENT) 746 if (drive->dev_flags & IDE_DFLAG_PRESENT)
751 /* Execute ACPI startup code */ 747 /* Execute ACPI startup code */
752 ide_acpi_exec_tfs(drive); 748 ide_acpi_exec_tfs(drive);