mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ACPI: PM: Drop parent state update from acpi_device_get_power()
The parent state update in acpi_device_get_power(), that occurs when the child device turns out to be in D0 and the parent's power state is still unknown, is highly questionable because it may cause the reference counters of the power resources used by the parent in D0 (if any) to underflow when the parent goes into a low-power state later. Moreover, there is no reason to do it on reads from the real_power_state sysfs attribute of the child. That check had been added by commit8f7412a792("ACPI / PM: Infer parent power state from child if unknown, v2") before starting to handle the "missing _PSC and no power resources" case directly in acpi_bus_init_power(), as of commitb378549226("ACPI / PM: Do not power manage devices in unknown initial states"). It is not necessary any more and commitb378549226should have removed it. Drop it now. Fixes:b378549226("ACPI / PM: Do not power manage devices in unknown initial states") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Peixin Xie <peixin.xie@linux.spacemit.com> Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com> Link: https://patch.msgid.link/5147279.31r3eYUQgx@rafael.j.wysocki Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
36bca20746
commit
5636eebb7b
|
|
@ -75,15 +75,14 @@ static int acpi_dev_pm_explicit_get(struct acpi_device *device, int *state)
|
|||
int acpi_device_get_power(struct acpi_device *device, int *state)
|
||||
{
|
||||
int result = ACPI_STATE_UNKNOWN;
|
||||
struct acpi_device *parent;
|
||||
int error;
|
||||
|
||||
if (!device || !state)
|
||||
return -EINVAL;
|
||||
|
||||
parent = acpi_dev_parent(device);
|
||||
|
||||
if (!device->flags.power_manageable) {
|
||||
struct acpi_device *parent = acpi_dev_parent(device);
|
||||
|
||||
/* TBD: Non-recursive algorithm for walking up hierarchy. */
|
||||
*state = parent ? parent->power.state : ACPI_STATE_D0;
|
||||
goto out;
|
||||
|
|
@ -119,16 +118,6 @@ int acpi_device_get_power(struct acpi_device *device, int *state)
|
|||
result = psc > ACPI_STATE_D2 ? ACPI_STATE_D3_HOT : psc;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we were unsure about the device parent's power state up to this
|
||||
* point, the fact that the device is in D0 implies that the parent has
|
||||
* to be in D0 too, except if ignore_parent is set.
|
||||
*/
|
||||
if (!device->power.flags.ignore_parent && parent &&
|
||||
parent->power.state == ACPI_STATE_UNKNOWN &&
|
||||
result == ACPI_STATE_D0)
|
||||
parent->power.state = ACPI_STATE_D0;
|
||||
|
||||
*state = result;
|
||||
|
||||
out:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user