aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-acpi.c
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2012-06-25 04:13:05 -0400
committerJeff Garzik <jgarzik@redhat.com>2012-06-29 11:38:12 -0400
commitfebe53ba6b781862c12686c7ea1972bdedee457a (patch)
treebe8477a4f681204ecb088d240612d2ee07b3a032 /drivers/ata/libata-acpi.c
parent30dcf76acc695cbd2fa919e294670fe9552e16e7 (diff)
libata-acpi: set acpi state for SATA port
Currently, ata_acpi_set_state() only sets acpi sate for IDE port. Remove this limitation. Acked-by: Aaron Lu <aaron.lu@amd.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-acpi.c')
-rw-r--r--drivers/ata/libata-acpi.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index c6f0101fd253..bb20fd597eb1 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -852,23 +852,25 @@ void ata_acpi_on_resume(struct ata_port *ap)
852void ata_acpi_set_state(struct ata_port *ap, pm_message_t state) 852void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
853{ 853{
854 struct ata_device *dev; 854 struct ata_device *dev;
855 855 acpi_handle handle;
856 if (!ata_ap_acpi_handle(ap) || (ap->flags & ATA_FLAG_ACPI_SATA))
857 return;
858 856
859 /* channel first and then drives for power on and vica versa 857 /* channel first and then drives for power on and vica versa
860 for power off */ 858 for power off */
861 if (state.event == PM_EVENT_ON) 859 handle = ata_ap_acpi_handle(ap);
862 acpi_bus_set_power(ata_ap_acpi_handle(ap), ACPI_STATE_D0); 860 if (handle && state.event == PM_EVENT_ON)
861 acpi_bus_set_power(handle, ACPI_STATE_D0);
863 862
864 ata_for_each_dev(dev, &ap->link, ENABLED) { 863 ata_for_each_dev(dev, &ap->link, ENABLED) {
865 if (ata_dev_acpi_handle(dev)) 864 handle = ata_dev_acpi_handle(dev);
866 acpi_bus_set_power(ata_dev_acpi_handle(dev), 865 if (handle)
866 acpi_bus_set_power(handle,
867 state.event == PM_EVENT_ON ? 867 state.event == PM_EVENT_ON ?
868 ACPI_STATE_D0 : ACPI_STATE_D3); 868 ACPI_STATE_D0 : ACPI_STATE_D3);
869 } 869 }
870 if (state.event != PM_EVENT_ON) 870
871 acpi_bus_set_power(ata_ap_acpi_handle(ap), ACPI_STATE_D3); 871 handle = ata_ap_acpi_handle(ap);
872 if (handle && state.event != PM_EVENT_ON)
873 acpi_bus_set_power(handle, ACPI_STATE_D3);
872} 874}
873 875
874/** 876/**