ACPI: Introduce acpi_bus_power_manageable function
authorRafael J. Wysocki <rjw@sisk.pl>
Mon, 7 Jul 2008 01:30:55 +0000 (03:30 +0200)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Mon, 7 Jul 2008 23:25:02 +0000 (16:25 -0700)
Introduce function acpi_bus_power_manageable() allowing other
(dependent) subsystems to check if ACPI is able to power manage given
device.  This may be useful, for example, for PCI device power
management.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/acpi/bus.c
include/acpi/acpi_bus.h

index a6dbcf4d9ef57dcdfa93ecc045e51fd60a4b20d1..b9b69d9629b585a461b09af679533eb9d0c386a9 100644 (file)
@@ -295,6 +295,17 @@ int acpi_bus_set_power(acpi_handle handle, int state)
 
 EXPORT_SYMBOL(acpi_bus_set_power);
 
+bool acpi_bus_power_manageable(acpi_handle handle)
+{
+       struct acpi_device *device;
+       int result;
+
+       result = acpi_bus_get_device(handle, &device);
+       return result ? false : device->flags.power_manageable;
+}
+
+EXPORT_SYMBOL(acpi_bus_power_manageable);
+
 /* --------------------------------------------------------------------------
                                 Event Management
    -------------------------------------------------------------------------- */
index db90a74f8714052fadfc424aff91c862b328a80d..0c21ea3bb672c94f47d11ee3f8d2d1e804c2ab5b 100644 (file)
@@ -335,6 +335,7 @@ void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context);
 int acpi_bus_get_status(struct acpi_device *device);
 int acpi_bus_get_power(acpi_handle handle, int *state);
 int acpi_bus_set_power(acpi_handle handle, int state);
+bool acpi_bus_power_manageable(acpi_handle handle);
 #ifdef CONFIG_ACPI_PROC_EVENT
 int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
 int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data);