Skip to content

Commit 6dd4a29

Browse files
committed
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 <[email protected]>
1 parent f4f3548 commit 6dd4a29

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

drivers/acpi/device_pm.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,8 @@ int acpi_device_set_power(struct acpi_device *device, int state)
173173
/* Make sure this is a valid target state */
174174

175175
/* There is a special case for D0 addressed below. */
176-
if (state > ACPI_STATE_D0 && state == device->power.state) {
177-
acpi_handle_debug(device->handle, "Already in %s\n",
178-
acpi_power_state_string(state));
179-
return 0;
180-
}
176+
if (state > ACPI_STATE_D0 && state == device->power.state)
177+
goto no_change;
181178

182179
if (state == ACPI_STATE_D3_COLD) {
183180
/*
@@ -249,7 +246,7 @@ int acpi_device_set_power(struct acpi_device *device, int state)
249246

250247
/* Nothing to do here if _PSC is not present. */
251248
if (!device->power.flags.explicit_get)
252-
return 0;
249+
goto no_change;
253250

254251
/*
255252
* 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)
264261
*/
265262
result = acpi_dev_pm_explicit_get(device, &psc);
266263
if (result || psc == ACPI_STATE_D0)
267-
return 0;
264+
goto no_change;
268265
}
269266

270267
result = acpi_dev_pm_explicit_set(device, ACPI_STATE_D0);
271268
}
272269

273-
end:
270+
end:
274271
if (result) {
275272
acpi_handle_debug(device->handle,
276273
"Failed to change power state to %s\n",
@@ -282,6 +279,11 @@ int acpi_device_set_power(struct acpi_device *device, int state)
282279
}
283280

284281
return result;
282+
283+
no_change:
284+
acpi_handle_debug(device->handle, "Already in %s\n",
285+
acpi_power_state_string(state));
286+
return 0;
285287
}
286288
EXPORT_SYMBOL(acpi_device_set_power);
287289

0 commit comments

Comments
 (0)