diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-01-01 23:38:28 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-01-05 22:49:52 +0100 |
commit | 1b1f3e1699a9886f1070f94171097ab4ccdbfc95 (patch) | |
tree | 0ccf1f4b98c4dd98d639445b13fd70b6616d1004 /drivers/acpi/pmic | |
parent | b7392d2247cfe6771f95d256374f1a8e6a6f48d6 (diff) | |
download | op-kernel-dev-1b1f3e1699a9886f1070f94171097ab4ccdbfc95.zip op-kernel-dev-1b1f3e1699a9886f1070f94171097ab4ccdbfc95.tar.gz |
ACPI / PM: Fix PM initialization for devices that are not present
If an ACPI device object whose _STA returns 0 (not present and not
functional) has _PR0 or _PS0, its power_manageable flag will be set
and acpi_bus_init_power() will return 0 for it. Consequently, if
such a device object is passed to the ACPI device PM functions, they
will attempt to carry out the requested operation on the device,
although they should not do that for devices that are not present.
To fix that problem make acpi_bus_init_power() return an error code
for devices that are not present which will cause power_manageable to
be cleared for them as appropriate in acpi_bus_get_power_flags().
However, the lists of power resources should not be freed for the
device in that case, so modify acpi_bus_get_power_flags() to keep
those lists even if acpi_bus_init_power() returns an error.
Accordingly, when deciding whether or not the lists of power
resources need to be freed, acpi_free_power_resources_lists()
should check the power.flags.power_resources flag instead of
flags.power_manageable, so make that change too.
Furthermore, if acpi_bus_attach() sees that flags.initialized is
unset for the given device, it should reset the power management
settings of the device and re-initialize them from scratch instead
of relying on the previous settings (the device may have appeared
after being not present previously, for example), so make it use
the 'valid' flag of the D0 power state as the initial value of
flags.power_manageable for it and call acpi_bus_init_power() to
discover its current power state.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
Diffstat (limited to 'drivers/acpi/pmic')
0 files changed, 0 insertions, 0 deletions