Skip to content

Commit f4f3548

Browse files
committed
ACPI: PM: Unify debug messages in acpi_device_set_power()
Convert all of the debug messages printed by acpi_device_set_power() to acpi_handle_debug() and adjust them slightly for consistency with acpi_device_get_power() and other acpi_device_set_power() debug messages. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 255a04c commit f4f3548

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

drivers/acpi/device_pm.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ int acpi_device_set_power(struct acpi_device *device, int state)
174174

175175
/* There is a special case for D0 addressed below. */
176176
if (state > ACPI_STATE_D0 && state == device->power.state) {
177-
dev_dbg(&device->dev, "Device already in %s\n",
178-
acpi_power_state_string(state));
177+
acpi_handle_debug(device->handle, "Already in %s\n",
178+
acpi_power_state_string(state));
179179
return 0;
180180
}
181181

@@ -189,17 +189,17 @@ int acpi_device_set_power(struct acpi_device *device, int state)
189189
if (!device->power.states[ACPI_STATE_D3_COLD].flags.valid)
190190
target_state = state;
191191
} else if (!device->power.states[state].flags.valid) {
192-
dev_warn(&device->dev, "Power state %s not supported\n",
193-
acpi_power_state_string(state));
192+
acpi_handle_debug(device->handle, "Power state %s not supported\n",
193+
acpi_power_state_string(state));
194194
return -ENODEV;
195195
}
196196

197-
if (!device->power.flags.ignore_parent &&
198-
device->parent && (state < device->parent->power.state)) {
199-
dev_warn(&device->dev,
200-
"Cannot transition to power state %s for parent in %s\n",
201-
acpi_power_state_string(state),
202-
acpi_power_state_string(device->parent->power.state));
197+
if (!device->power.flags.ignore_parent && device->parent &&
198+
state < device->parent->power.state) {
199+
acpi_handle_debug(device->handle,
200+
"Cannot transition to %s for parent in %s\n",
201+
acpi_power_state_string(state),
202+
acpi_power_state_string(device->parent->power.state));
203203
return -ENODEV;
204204
}
205205

@@ -216,9 +216,10 @@ int acpi_device_set_power(struct acpi_device *device, int state)
216216
* (deeper) states to higher-power (shallower) states.
217217
*/
218218
if (state < device->power.state) {
219-
dev_warn(&device->dev, "Cannot transition from %s to %s\n",
220-
acpi_power_state_string(device->power.state),
221-
acpi_power_state_string(state));
219+
acpi_handle_debug(device->handle,
220+
"Cannot transition from %s to %s\n",
221+
acpi_power_state_string(device->power.state),
222+
acpi_power_state_string(state));
222223
return -ENODEV;
223224
}
224225

@@ -271,12 +272,13 @@ int acpi_device_set_power(struct acpi_device *device, int state)
271272

272273
end:
273274
if (result) {
274-
dev_warn(&device->dev, "Failed to change power state to %s\n",
275-
acpi_power_state_string(target_state));
275+
acpi_handle_debug(device->handle,
276+
"Failed to change power state to %s\n",
277+
acpi_power_state_string(target_state));
276278
} else {
277279
device->power.state = target_state;
278-
dev_dbg(&device->dev, "Power state changed to %s\n",
279-
acpi_power_state_string(target_state));
280+
acpi_handle_debug(device->handle, "Power state changed to %s\n",
281+
acpi_power_state_string(target_state));
280282
}
281283

282284
return result;

0 commit comments

Comments
 (0)