diff options
author | 2012-06-25 16:13:07 +0800 | |
---|---|---|
committer | 2012-06-29 11:38:15 -0400 | |
commit | a606dac368eed5696fb38e16b1394f1d049c09e9 (patch) | |
tree | c65ac7fe74e7aadbdf36e5078f34bfb47a9f3333 /drivers/ata/libata-acpi.c | |
parent | libata-acpi: add ata port runtime D3Cold support (diff) | |
download | linux-a606dac368eed5696fb38e16b1394f1d049c09e9.tar.gz linux-a606dac368eed5696fb38e16b1394f1d049c09e9.tar.bz2 linux-a606dac368eed5696fb38e16b1394f1d049c09e9.zip |
libata-acpi: register/unregister device to/from power resource
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.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index e01807a1ef31..f36284e3290d 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c @@ -1025,14 +1025,46 @@ static void ata_acpi_remove_pm_notifier(struct ata_device *dev) } } +static void ata_acpi_register_power_resource(struct ata_device *dev) +{ + struct scsi_device *sdev = dev->sdev; + acpi_handle handle; + struct device *device; + + handle = ata_dev_acpi_handle(dev); + if (!handle) + return; + + device = &sdev->sdev_gendev; + + acpi_power_resource_register_device(device, handle); +} + +static void ata_acpi_unregister_power_resource(struct ata_device *dev) +{ + struct scsi_device *sdev = dev->sdev; + acpi_handle handle; + struct device *device; + + handle = ata_dev_acpi_handle(dev); + if (!handle) + return; + + device = &sdev->sdev_gendev; + + acpi_power_resource_unregister_device(device, handle); +} + void ata_acpi_bind(struct ata_device *dev) { ata_acpi_add_pm_notifier(dev); + ata_acpi_register_power_resource(dev); } void ata_acpi_unbind(struct ata_device *dev) { ata_acpi_remove_pm_notifier(dev); + ata_acpi_unregister_power_resource(dev); } static int compat_pci_ata(struct ata_port *ap) |