===================================================================
@@ -589,7 +589,8 @@ static inline u32 acpi_target_system_sta
static inline bool acpi_device_power_manageable(struct acpi_device *adev)
{
- return adev->flags.power_manageable;
+ return adev->flags.power_manageable
+ && (adev->status.present || adev->status.functional);
}
static inline bool acpi_device_can_wakeup(struct acpi_device *adev)
===================================================================
@@ -68,7 +68,8 @@ int acpi_device_get_power(struct acpi_de
{
int result = ACPI_STATE_UNKNOWN;
- if (!device || !state)
+ if (!device || !state
+ || !(device->status.present || device->status.functional))
return -EINVAL;
if (!device->flags.power_manageable) {
@@ -156,7 +157,7 @@ int acpi_device_set_power(struct acpi_de
int result = 0;
bool cut_power = false;
- if (!device || !device->flags.power_manageable
+ if (!device || !acpi_device_power_manageable(device)
|| (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
return -EINVAL;
@@ -361,7 +362,7 @@ bool acpi_bus_power_manageable(acpi_hand
int result;
result = acpi_bus_get_device(handle, &device);
- return result ? false : device->flags.power_manageable;
+ return result ? false : acpi_device_power_manageable(device);
}
EXPORT_SYMBOL(acpi_bus_power_manageable);