diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-02 13:56:43 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-02 13:56:43 -0500 |
commit | eafd88a3b5d86ba2dd515d430b57a01349d0867b (patch) | |
tree | 6325ee98037bb046025100f3d05cc10154ec9225 /drivers/ide/ide-acpi.c | |
parent | 070ecb841c4f15817f4e2365785173eea56ab3e6 (diff) |
ide: factor out devices setup from ide_acpi_init()
* Factor out devices setup from ide_acpi_init() to
ide_acpi_port_init_devices().
* Call ide_acpi_port_init_devices() in ide_device_add_all().
While at it:
* Remove no longer needed 'drive' field from struct ide_acpi_drive_link.
There should be no functionality 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 | 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 | } |