diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-04-14 15:58:42 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-04-21 21:18:43 +0300 |
commit | 6dd4a29d26200d303d354ee8fc806113b5fcc882 (patch) | |
tree | cfcb050c71b5c035d5681ce071f27bc9d7ef9117 /drivers/acpi | |
parent | f4f3548dc8d53d683770b058fdafa01fd7c07669 (diff) | |
download | linux-6dd4a29d26200d303d354ee8fc806113b5fcc882.tar.xz |
ACPI: PM: Always print final debug message in acpi_device_set_power()
acpi_device_set_power() prints debug messages regarding its outcome
(whether or not the power state has been changed and how) in all
cases except when the device whose power state is being changed to D0
is in that power state already.
Make acpi_device_set_power() print a final debug message in that case
too and while at it, fix the indentation of the "end" label in this
function.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/device_pm.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index fef309fcd944..f9ac7682d362 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -173,11 +173,8 @@ int acpi_device_set_power(struct acpi_device *device, int state) /* Make sure this is a valid target state */ /* There is a special case for D0 addressed below. */ - if (state > ACPI_STATE_D0 && state == device->power.state) { - acpi_handle_debug(device->handle, "Already in %s\n", - acpi_power_state_string(state)); - return 0; - } + if (state > ACPI_STATE_D0 && state == device->power.state) + goto no_change; if (state == ACPI_STATE_D3_COLD) { /* @@ -249,7 +246,7 @@ int acpi_device_set_power(struct acpi_device *device, int state) /* Nothing to do here if _PSC is not present. */ if (!device->power.flags.explicit_get) - return 0; + goto no_change; /* * The power state of the device was set to D0 last @@ -264,13 +261,13 @@ int acpi_device_set_power(struct acpi_device *device, int state) */ result = acpi_dev_pm_explicit_get(device, &psc); if (result || psc == ACPI_STATE_D0) - return 0; + goto no_change; } result = acpi_dev_pm_explicit_set(device, ACPI_STATE_D0); } - end: +end: if (result) { acpi_handle_debug(device->handle, "Failed to change power state to %s\n", @@ -282,6 +279,11 @@ int acpi_device_set_power(struct acpi_device *device, int state) } return result; + +no_change: + acpi_handle_debug(device->handle, "Already in %s\n", + acpi_power_state_string(state)); + return 0; } EXPORT_SYMBOL(acpi_device_set_power); |