diff options
| author | Joe Perches <joe@perches.com> | 2011-04-04 13:06:25 -0400 |
|---|---|---|
| committer | Matthew Garrett <mjg@redhat.com> | 2011-05-27 12:35:54 -0400 |
| commit | 0978e012cfbaca8bd312933e98cdea2d11778e11 (patch) | |
| tree | b698c36967b645be9710aafaaef1124041fee3a2 /drivers/platform | |
| parent | 112a6ee053f9e9f014ab64f2549d3a25551aa349 (diff) | |
thinkpad_acpi: Convert printks to pr_<level>
Add pr_fmt.
Removed local TPACPI_<level> #defines, convert to pr_<level>.
Neaten dbg_<foo> macros.
Added a few missing newlines to logging messages.
Added static inline str_supported for !CONFIG_THINKPAD_ACPI_DEBUG vdbg_printk
defect reported by Sedat Dilek <sedat.dilek@googlemail.com>.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
| -rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 472 |
1 files changed, 188 insertions, 284 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 7693e89459f0..77f6e707a2a9 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | * 02110-1301, USA. | 21 | * 02110-1301, USA. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 25 | |||
| 24 | #define TPACPI_VERSION "0.24" | 26 | #define TPACPI_VERSION "0.24" |
| 25 | #define TPACPI_SYSFS_VERSION 0x020700 | 27 | #define TPACPI_SYSFS_VERSION 0x020700 |
| 26 | 28 | ||
| @@ -224,17 +226,6 @@ enum tpacpi_hkey_event_t { | |||
| 224 | 226 | ||
| 225 | #define TPACPI_MAX_ACPI_ARGS 3 | 227 | #define TPACPI_MAX_ACPI_ARGS 3 |
| 226 | 228 | ||
| 227 | /* printk headers */ | ||
| 228 | #define TPACPI_LOG TPACPI_FILE ": " | ||
| 229 | #define TPACPI_EMERG KERN_EMERG TPACPI_LOG | ||
| 230 | #define TPACPI_ALERT KERN_ALERT TPACPI_LOG | ||
| 231 | #define TPACPI_CRIT KERN_CRIT TPACPI_LOG | ||
| 232 | #define TPACPI_ERR KERN_ERR TPACPI_LOG | ||
| 233 | #define TPACPI_WARN KERN_WARNING TPACPI_LOG | ||
| 234 | #define TPACPI_NOTICE KERN_NOTICE TPACPI_LOG | ||
| 235 | #define TPACPI_INFO KERN_INFO TPACPI_LOG | ||
| 236 | #define TPACPI_DEBUG KERN_DEBUG TPACPI_LOG | ||
| 237 | |||
| 238 | /* Debugging printk groups */ | 229 | /* Debugging printk groups */ |
| 239 | #define TPACPI_DBG_ALL 0xffff | 230 | #define TPACPI_DBG_ALL 0xffff |
| 240 | #define TPACPI_DBG_DISCLOSETASK 0x8000 | 231 | #define TPACPI_DBG_DISCLOSETASK 0x8000 |
| @@ -389,34 +380,36 @@ static int tpacpi_uwb_emulstate; | |||
| 389 | * Debugging helpers | 380 | * Debugging helpers |
| 390 | */ | 381 | */ |
| 391 | 382 | ||
| 392 | #define dbg_printk(a_dbg_level, format, arg...) \ | 383 | #define dbg_printk(a_dbg_level, format, arg...) \ |
| 393 | do { if (dbg_level & (a_dbg_level)) \ | 384 | do { \ |
| 394 | printk(TPACPI_DEBUG "%s: " format, __func__ , ## arg); \ | 385 | if (dbg_level & (a_dbg_level)) \ |
| 395 | } while (0) | 386 | printk(KERN_DEBUG pr_fmt("%s: " format), \ |
| 387 | __func__, ##arg); \ | ||
| 388 | } while (0) | ||
| 396 | 389 | ||
| 397 | #ifdef CONFIG_THINKPAD_ACPI_DEBUG | 390 | #ifdef CONFIG_THINKPAD_ACPI_DEBUG |
| 398 | #define vdbg_printk dbg_printk | 391 | #define vdbg_printk dbg_printk |
| 399 | static const char *str_supported(int is_supported); | 392 | static const char *str_supported(int is_supported); |
| 400 | #else | 393 | #else |
| 401 | #define vdbg_printk(a_dbg_level, format, arg...) \ | 394 | static inline const char *str_supported(int is_supported) { return ""; } |
| 402 | do { } while (0) | 395 | #define vdbg_printk(a_dbg_level, format, arg...) \ |
| 396 | no_printk(format, ##arg) | ||
| 403 | #endif | 397 | #endif |
| 404 | 398 | ||
| 405 | static void tpacpi_log_usertask(const char * const what) | 399 | static void tpacpi_log_usertask(const char * const what) |
| 406 | { | 400 | { |
| 407 | printk(TPACPI_DEBUG "%s: access by process with PID %d\n", | 401 | printk(KERN_DEBUG pr_fmt("%s: access by process with PID %d\n"), |
| 408 | what, task_tgid_vnr(current)); | 402 | what, task_tgid_vnr(current)); |
| 409 | } | 403 | } |
| 410 | 404 | ||
| 411 | #define tpacpi_disclose_usertask(what, format, arg...) \ | 405 | #define tpacpi_disclose_usertask(what, format, arg...) \ |
| 412 | do { \ | 406 | do { \ |
| 413 | if (unlikely( \ | 407 | if (unlikely((dbg_level & TPACPI_DBG_DISCLOSETASK) && \ |
| 414 | (dbg_level & TPACPI_DBG_DISCLOSETASK) && \ | 408 | (tpacpi_lifecycle == TPACPI_LIFE_RUNNING))) { \ |
| 415 | (tpacpi_lifecycle == TPACPI_LIFE_RUNNING))) { \ | 409 | printk(KERN_DEBUG pr_fmt("%s: PID %d: " format), \ |
| 416 | printk(TPACPI_DEBUG "%s: PID %d: " format, \ | 410 | what, task_tgid_vnr(current), ## arg); \ |
| 417 | what, task_tgid_vnr(current), ## arg); \ | 411 | } \ |
| 418 | } \ | 412 | } while (0) |
| 419 | } while (0) | ||
| 420 | 413 | ||
| 421 | /* | 414 | /* |
| 422 | * Quirk handling helpers | 415 | * Quirk handling helpers |
| @@ -554,7 +547,7 @@ static int acpi_evalf(acpi_handle handle, | |||
| 554 | int quiet; | 547 | int quiet; |
| 555 | 548 | ||
| 556 | if (!*fmt) { | 549 | if (!*fmt) { |
| 557 | printk(TPACPI_ERR "acpi_evalf() called with empty format\n"); | 550 | pr_err("acpi_evalf() called with empty format\n"); |
| 558 | return 0; | 551 | return 0; |
| 559 | } | 552 | } |
| 560 | 553 | ||
| @@ -579,7 +572,7 @@ static int acpi_evalf(acpi_handle handle, | |||
| 579 | break; | 572 | break; |
| 580 | /* add more types as needed */ | 573 | /* add more types as needed */ |
| 581 | default: | 574 | default: |
| 582 | printk(TPACPI_ERR "acpi_evalf() called " | 575 | pr_err("acpi_evalf() called " |
| 583 | "with invalid format character '%c'\n", c); | 576 | "with invalid format character '%c'\n", c); |
| 584 | va_end(ap); | 577 | va_end(ap); |
| 585 | return 0; | 578 | return 0; |
| @@ -608,13 +601,13 @@ static int acpi_evalf(acpi_handle handle, | |||
| 608 | break; | 601 | break; |
| 609 | /* add more types as needed */ | 602 | /* add more types as needed */ |
| 610 | default: | 603 | default: |
| 611 | printk(TPACPI_ERR "acpi_evalf() called " | 604 | pr_err("acpi_evalf() called " |
| 612 | "with invalid format character '%c'\n", res_type); | 605 | "with invalid format character '%c'\n", res_type); |
| 613 | return 0; | 606 | return 0; |
| 614 | } | 607 | } |
| 615 | 608 | ||
| 616 | if (!success && !quiet) | 609 | if (!success && !quiet) |
| 617 | printk(TPACPI_ERR "acpi_evalf(%s, %s, ...) failed: %s\n", | 610 | pr_err("acpi_evalf(%s, %s, ...) failed: %s\n", |
| 618 | method, fmt0, acpi_format_exception(status)); | 611 | method, fmt0, acpi_format_exception(status)); |
| 619 | 612 | ||
| 620 | return success; | 613 | return success; |
| @@ -758,8 +751,7 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm) | |||
| 758 | 751 | ||
| 759 | rc = acpi_bus_get_device(*ibm->acpi->handle, &ibm->acpi->device); | 752 | rc = acpi_bus_get_device(*ibm->acpi->handle, &ibm->acpi->device); |
| 760 | if (rc < 0) { | 753 | if (rc < 0) { |
| 761 | printk(TPACPI_ERR "acpi_bus_get_device(%s) failed: %d\n", | 754 | pr_err("acpi_bus_get_device(%s) failed: %d\n", ibm->name, rc); |
| 762 | ibm->name, rc); | ||
| 763 | return -ENODEV; | 755 | return -ENODEV; |
| 764 | } | 756 | } |
| 765 | 757 | ||
| @@ -772,12 +764,10 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm) | |||
| 772 | ibm->acpi->type, dispatch_acpi_notify, ibm); | 764 | ibm->acpi->type, dispatch_acpi_notify, ibm); |
| 773 | if (ACPI_FAILURE(status)) { | 765 | if (ACPI_FAILURE(status)) { |
| 774 | if (status == AE_ALREADY_EXISTS) { | 766 | if (status == AE_ALREADY_EXISTS) { |
| 775 | printk(TPACPI_NOTICE | 767 | pr_notice("another device driver is already " |
| 776 | "another device driver is already " | 768 | "handling %s events\n", ibm->name); |
| 777 | "handling %s events\n", ibm->name); | ||
| 778 | } else { | 769 | } else { |
| 779 | printk(TPACPI_ERR | 770 | pr_err("acpi_install_notify_handler(%s) failed: %s\n", |
| 780 | "acpi_install_notify_handler(%s) failed: %s\n", | ||
| 781 | ibm->name, acpi_format_exception(status)); | 771 | ibm->name, acpi_format_exception(status)); |
| 782 | } | 772 | } |
| 783 | return -ENODEV; | 773 | return -ENODEV; |
| @@ -802,8 +792,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm) | |||
| 802 | 792 | ||
| 803 | ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); | 793 | ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); |
| 804 | if (!ibm->acpi->driver) { | 794 | if (!ibm->acpi->driver) { |
| 805 | printk(TPACPI_ERR | 795 | pr_err("failed to allocate memory for ibm->acpi->driver\n"); |
| 806 | "failed to allocate memory for ibm->acpi->driver\n"); | ||
| 807 | return -ENOMEM; | 796 | return -ENOMEM; |
| 808 | } | 797 | } |
| 809 | 798 | ||
| @@ -814,7 +803,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm) | |||
| 814 | 803 | ||
| 815 | rc = acpi_bus_register_driver(ibm->acpi->driver); | 804 | rc = acpi_bus_register_driver(ibm->acpi->driver); |
| 816 | if (rc < 0) { | 805 | if (rc < 0) { |
