Skip to content

Commit fad40a6

Browse files
committed
ACPI: power: Use acpi_handle_debug() to print debug messages
Use acpi_handle_debug() to print diagnostic messages regarding ACPI power resources so as to make it easier to correlate the kernel messages with the power resource objects in the ACPI namespace that they are about. Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent e22ce8e commit fad40a6

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

drivers/acpi/power.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -356,18 +356,19 @@ void acpi_device_power_remove_dependent(struct acpi_device *adev,
356356

357357
static int __acpi_power_on(struct acpi_power_resource *resource)
358358
{
359+
acpi_handle handle = resource->device.handle;
359360
struct acpi_power_dependent_device *dep;
360361
acpi_status status = AE_OK;
361362

362-
status = acpi_evaluate_object(resource->device.handle, "_ON", NULL, NULL);
363+
status = acpi_evaluate_object(handle, "_ON", NULL, NULL);
363364
if (ACPI_FAILURE(status)) {
364365
resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
365366
return -ENODEV;
366367
}
367368

368369
resource->state = ACPI_POWER_RESOURCE_STATE_ON;
369370

370-
pr_debug("Power resource [%s] turned on\n", resource->name);
371+
acpi_handle_debug(handle, "Power resource turned on\n");
371372

372373
/*
373374
* If there are other dependents on this power resource we need to
@@ -392,7 +393,8 @@ static int acpi_power_on_unlocked(struct acpi_power_resource *resource)
392393
int result = 0;
393394

394395
if (resource->ref_count++) {
395-
pr_debug("Power resource [%s] already on\n", resource->name);
396+
acpi_handle_debug(resource->device.handle,
397+
"Power resource already on\n");
396398
} else {
397399
result = __acpi_power_on(resource);
398400
if (result)
@@ -413,18 +415,18 @@ static int acpi_power_on(struct acpi_power_resource *resource)
413415

414416
static int __acpi_power_off(struct acpi_power_resource *resource)
415417
{
418+
acpi_handle handle = resource->device.handle;
416419
acpi_status status;
417420

418-
status = acpi_evaluate_object(resource->device.handle, "_OFF",
419-
NULL, NULL);
421+
status = acpi_evaluate_object(handle, "_OFF", NULL, NULL);
420422
if (ACPI_FAILURE(status)) {
421423
resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
422424
return -ENODEV;
423425
}
424426

425427
resource->state = ACPI_POWER_RESOURCE_STATE_OFF;
426428

427-
pr_debug("Power resource [%s] turned off\n", resource->name);
429+
acpi_handle_debug(handle, "Power resource turned off\n");
428430

429431
return 0;
430432
}
@@ -434,12 +436,14 @@ static int acpi_power_off_unlocked(struct acpi_power_resource *resource)
434436
int result = 0;
435437

436438
if (!resource->ref_count) {
437-
pr_debug("Power resource [%s] already off\n", resource->name);
439+
acpi_handle_debug(resource->device.handle,
440+
"Power resource already off\n");
438441
return 0;
439442
}
440443

441444
if (--resource->ref_count) {
442-
pr_debug("Power resource [%s] still in use\n", resource->name);
445+
acpi_handle_debug(resource->device.handle,
446+
"Power resource still in use\n");
443447
} else {
444448
result = __acpi_power_off(resource);
445449
if (result)
@@ -1004,7 +1008,7 @@ void acpi_resume_power_resources(void)
10041008

10051009
if (state == ACPI_POWER_RESOURCE_STATE_OFF
10061010
&& resource->ref_count) {
1007-
dev_dbg(&resource->device.dev, "Turning ON\n");
1011+
acpi_handle_debug(resource->device.handle, "Turning ON\n");
10081012
__acpi_power_on(resource);
10091013
}
10101014

@@ -1034,7 +1038,7 @@ void acpi_turn_off_unused_power_resources(void)
10341038
*/
10351039
if (!resource->ref_count &&
10361040
resource->state != ACPI_POWER_RESOURCE_STATE_OFF) {
1037-
dev_dbg(&resource->device.dev, "Turning OFF\n");
1041+
acpi_handle_debug(resource->device.handle, "Turning OFF\n");
10381042
__acpi_power_off(resource);
10391043
}
10401044

0 commit comments

Comments
 (0)