Commit a606dac3 authored by Lin Ming's avatar Lin Ming Committed by Jeff Garzik

libata-acpi: register/unregister device to/from power resource

Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 3bd46600
...@@ -390,6 +390,7 @@ void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handl ...@@ -390,6 +390,7 @@ void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handl
__acpi_power_resource_unregister_device(dev, __acpi_power_resource_unregister_device(dev,
list->handles[i]); list->handles[i]);
} }
EXPORT_SYMBOL_GPL(acpi_power_resource_unregister_device);
static int __acpi_power_resource_register_device( static int __acpi_power_resource_register_device(
struct acpi_power_managed_device *powered_device, acpi_handle handle) struct acpi_power_managed_device *powered_device, acpi_handle handle)
...@@ -460,6 +461,7 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle) ...@@ -460,6 +461,7 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle)
printk(KERN_WARNING PREFIX "Invalid Power Resource to register!"); printk(KERN_WARNING PREFIX "Invalid Power Resource to register!");
return -ENODEV; return -ENODEV;
} }
EXPORT_SYMBOL_GPL(acpi_power_resource_register_device);
/** /**
* acpi_device_sleep_wake - execute _DSW (Device Sleep Wake) or (deprecated in * acpi_device_sleep_wake - execute _DSW (Device Sleep Wake) or (deprecated in
......
...@@ -1025,14 +1025,46 @@ static void ata_acpi_remove_pm_notifier(struct ata_device *dev) ...@@ -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) void ata_acpi_bind(struct ata_device *dev)
{ {
ata_acpi_add_pm_notifier(dev); ata_acpi_add_pm_notifier(dev);
ata_acpi_register_power_resource(dev);
} }
void ata_acpi_unbind(struct ata_device *dev) void ata_acpi_unbind(struct ata_device *dev)
{ {
ata_acpi_remove_pm_notifier(dev); ata_acpi_remove_pm_notifier(dev);
ata_acpi_unregister_power_resource(dev);
} }
static int compat_pci_ata(struct ata_port *ap) static int compat_pci_ata(struct ata_port *ap)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment