diff options
Diffstat (limited to 'drivers/ide/ide-acpi.c')
-rw-r--r-- | drivers/ide/ide-acpi.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index ac12d30f2105..25aaeae1e830 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -39,7 +39,6 @@ struct GTM_buffer { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct ide_acpi_drive_link { | 41 | struct ide_acpi_drive_link { |
42 | ide_drive_t *drive; | ||
43 | acpi_handle obj_handle; | 42 | acpi_handle obj_handle; |
44 | u8 idbuff[512]; | 43 | u8 idbuff[512]; |
45 | }; | 44 | }; |
@@ -675,11 +674,6 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on) | |||
675 | */ | 674 | */ |
676 | void ide_acpi_init(ide_hwif_t *hwif) | 675 | void ide_acpi_init(ide_hwif_t *hwif) |
677 | { | 676 | { |
678 | int unit; | ||
679 | int err; | ||
680 | struct ide_acpi_drive_link *master; | ||
681 | struct ide_acpi_drive_link *slave; | ||
682 | |||
683 | ide_acpi_blacklist(); | 677 | ide_acpi_blacklist(); |
684 | 678 | ||
685 | hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); | 679 | hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); |
@@ -691,40 +685,38 @@ void ide_acpi_init(ide_hwif_t *hwif) | |||
691 | DEBPRINT("no ACPI object for %s found\n", hwif->name); | 685 | DEBPRINT("no ACPI object for %s found\n", hwif->name); |
692 | kfree(hwif->acpidata); | 686 | kfree(hwif->acpidata); |
693 | hwif->acpidata = NULL; | 687 | hwif->acpidata = NULL; |
694 | return; | ||
695 | } | 688 | } |
689 | } | ||
690 | |||
691 | void ide_acpi_port_init_devices(ide_hwif_t *hwif) | ||
692 | { | ||
693 | ide_drive_t *drive; | ||
694 | int i, err; | ||
695 | |||
696 | if (hwif->acpidata == NULL) | ||
697 | return; | ||
696 | 698 | ||
697 | /* | 699 | /* |
698 | * The ACPI spec mandates that we send information | 700 | * The ACPI spec mandates that we send information |
699 | * for both drives, regardless whether they are connected | 701 | * for both drives, regardless whether they are connected |
700 | * or not. | 702 | * or not. |
701 | */ | 703 | */ |
702 | hwif->acpidata->master.drive = &hwif->drives[0]; | ||
703 | hwif->drives[0].acpidata = &hwif->acpidata->master; | 704 | hwif->drives[0].acpidata = &hwif->acpidata->master; |
704 | master = &hwif->acpidata->master; | ||
705 | |||
706 | hwif->acpidata->slave.drive = &hwif->drives[1]; | ||
707 | hwif->drives[1].acpidata = &hwif->acpidata->slave; | 705 | hwif->drives[1].acpidata = &hwif->acpidata->slave; |
708 | slave = &hwif->acpidata->slave; | ||
709 | |||
710 | 706 | ||
711 | /* | 707 | /* |
712 | * Send IDENTIFY for each drive | 708 | * Send IDENTIFY for each drive |
713 | */ | 709 | */ |
714 | if (master->drive->present) { | 710 | for (i = 0; i < MAX_DRIVES; i++) { |
715 | err = taskfile_lib_get_identify(master->drive, master->idbuff); | 711 | drive = &hwif->drives[i]; |
716 | if (err) { | 712 | |
717 | DEBPRINT("identify device %s failed (%d)\n", | 713 | if (!drive->present) |
718 | master->drive->name, err); | 714 | continue; |
719 | } | ||
720 | } | ||
721 | 715 | ||
722 | if (slave->drive->present) { | 716 | err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff); |
723 | err = taskfile_lib_get_identify(slave->drive, slave->idbuff); | 717 | if (err) |
724 | if (err) { | ||
725 | DEBPRINT("identify device %s failed (%d)\n", | 718 | DEBPRINT("identify device %s failed (%d)\n", |
726 | slave->drive->name, err); | 719 | drive->name, err); |
727 | } | ||
728 | } | 720 | } |
729 | 721 | ||
730 | if (ide_noacpionboot) { | 722 | if (ide_noacpionboot) { |
@@ -740,12 +732,11 @@ void ide_acpi_init(ide_hwif_t *hwif) | |||
740 | ide_acpi_get_timing(hwif); | 732 | ide_acpi_get_timing(hwif); |
741 | ide_acpi_push_timing(hwif); | 733 | ide_acpi_push_timing(hwif); |
742 | 734 | ||
743 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 735 | for (i = 0; i < MAX_DRIVES; i++) { |
744 | ide_drive_t *drive = &hwif->drives[unit]; | 736 | drive = &hwif->drives[i]; |
745 | 737 | ||
746 | if (drive->present) { | 738 | if (drive->present) |
747 | /* Execute ACPI startup code */ | 739 | /* Execute ACPI startup code */ |
748 | ide_acpi_exec_tfs(drive); | 740 | ide_acpi_exec_tfs(drive); |
749 | } | ||
750 | } | 741 | } |
751 | } | 742 | } |