diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/utils.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 462f7e300363..744371304313 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/hardirq.h> | ||
32 | #include <linux/acpi.h> | ||
31 | #include <acpi/acpi_bus.h> | 33 | #include <acpi/acpi_bus.h> |
32 | #include <acpi/acpi_drivers.h> | 34 | #include <acpi/acpi_drivers.h> |
33 | 35 | ||
@@ -457,3 +459,39 @@ acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, | |||
457 | #endif | 459 | #endif |
458 | } | 460 | } |
459 | EXPORT_SYMBOL(acpi_evaluate_hotplug_ost); | 461 | EXPORT_SYMBOL(acpi_evaluate_hotplug_ost); |
462 | |||
463 | /** | ||
464 | * acpi_handle_printk: Print message with ACPI prefix and object path | ||
465 | * | ||
466 | * This function is called through acpi_handle_<level> macros and prints | ||
467 | * a message with ACPI prefix and object path. This function acquires | ||
468 | * the global namespace mutex to obtain an object path. In interrupt | ||
469 | * context, it shows the object path as <n/a>. | ||
470 | */ | ||
471 | void | ||
472 | acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...) | ||
473 | { | ||
474 | struct va_format vaf; | ||
475 | va_list args; | ||
476 | struct acpi_buffer buffer = { | ||
477 | .length = ACPI_ALLOCATE_BUFFER, | ||
478 | .pointer = NULL | ||
479 | }; | ||
480 | const char *path; | ||
481 | |||
482 | va_start(args, fmt); | ||
483 | vaf.fmt = fmt; | ||
484 | vaf.va = &args; | ||
485 | |||
486 | if (in_interrupt() || | ||
487 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer) != AE_OK) | ||
488 | path = "<n/a>"; | ||
489 | else | ||
490 | path = buffer.pointer; | ||
491 | |||
492 | printk("%sACPI: %s: %pV", level, path, &vaf); | ||
493 | |||
494 | va_end(args); | ||
495 | kfree(buffer.pointer); | ||
496 | } | ||
497 | EXPORT_SYMBOL(acpi_handle_printk); | ||