aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-17 08:11:05 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-17 08:11:05 -0500
commitbc9b6407bd6df3ab7189e5622816bbc11ae9d2d8 (patch)
tree8f44ae6c9750b271eb423787e19db1288b53c42e /drivers/ata
parent6a8dd80821c215bc49bf6b108e85c1738c82bf43 (diff)
ACPI / PM: Rework the handling of devices depending on power resources
Commit 0090def6 (ACPI: Add interface to register/unregister device to/from power resources) made it possible to indicate to the ACPI core that if the given device depends on any power resources, then it should be resumed as soon as all of the power resources required by it to transition to the D0 power state have been turned on. Unfortunately, however, this was a mistake, because all devices depending on power resources should be treated this way (i.e. they should be resumed when all power resources required by their D0 state have been turned on) and for the majority of those devices the ACPI core can figure out by itself which (physical) devices depend on what power resources. For this reason, replace the code added by commit 0090def6 with a new, much more straightforward, mechanism that will be used internally by the ACPI core and remove all references to that code from kernel subsystems using ACPI. For the cases when there are (physical) devices that should be resumed whenever a not directly related ACPI device node goes into D0 as a result of power resources configuration changes, like in the SATA case, add two new routines, acpi_dev_pm_add_dependent() and acpi_dev_pm_remove_dependent(), allowing subsystems to manage such dependencies. Convert the SATA subsystem to use the new functions accordingly. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-acpi.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index ef01ac07502e..6fc67f7efb22 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -1029,30 +1029,20 @@ static void ata_acpi_register_power_resource(struct ata_device *dev)
1029{ 1029{
1030 struct scsi_device *sdev = dev->sdev; 1030 struct scsi_device *sdev = dev->sdev;
1031 acpi_handle handle; 1031 acpi_handle handle;
1032 struct device *device;
1033 1032
1034 handle = ata_dev_acpi_handle(dev); 1033 handle = ata_dev_acpi_handle(dev);
1035 if (!handle) 1034 if (handle)
1036 return; 1035 acpi_dev_pm_remove_dependent(handle, &sdev->sdev_gendev);
1037
1038 device = &sdev->sdev_gendev;
1039
1040 acpi_power_resource_register_device(device, handle);
1041} 1036}
1042 1037
1043static void ata_acpi_unregister_power_resource(struct ata_device *dev) 1038static void ata_acpi_unregister_power_resource(struct ata_device *dev)
1044{ 1039{
1045 struct scsi_device *sdev = dev->sdev; 1040 struct scsi_device *sdev = dev->sdev;
1046 acpi_handle handle; 1041 acpi_handle handle;
1047 struct device *device;
1048 1042
1049 handle = ata_dev_acpi_handle(dev); 1043 handle = ata_dev_acpi_handle(dev);
1050 if (!handle) 1044 if (handle)
1051 return; 1045 acpi_dev_pm_remove_dependent(handle, &sdev->sdev_gendev);
1052
1053 device = &sdev->sdev_gendev;
1054
1055 acpi_power_resource_unregister_device(device, handle);
1056} 1046}
1057 1047
1058void ata_acpi_bind(struct ata_device *dev) 1048void ata_acpi_bind(struct ata_device *dev)