aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/thinkpad_acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/thinkpad_acpi.c')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c490
1 files changed, 197 insertions, 293 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 562fcf0dd2b5..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)) \ 384do { \
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
399static const char *str_supported(int is_supported); 392static const char *str_supported(int is_supported);
400#else 393#else
401#define vdbg_printk(a_dbg_level, format, arg...) \ 394static 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
405static void tpacpi_log_usertask(const char * const what) 399static 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 { \ 406do { \
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
@@ -535,15 +528,6 @@ TPACPI_HANDLE(hkey, ec, "\\_SB.HKEY", /* 600e/x, 770e, 770x */
535 "HKEY", /* all others */ 528 "HKEY", /* all others */
536 ); /* 570 */ 529 ); /* 570 */
537 530
538TPACPI_HANDLE(vid, root, "\\_SB.PCI.AGP.VGA", /* 570 */
539 "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */
540 "\\_SB.PCI0.VID0", /* 770e */
541 "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */
542 "\\_SB.PCI0.AGP.VGA", /* X100e and a few others */
543 "\\_SB.PCI0.AGP.VID", /* all others */
544 ); /* R30, R31 */
545
546
547/************************************************************************* 531/*************************************************************************
548 * ACPI helpers 532 * ACPI helpers
549 */ 533 */
@@ -563,7 +547,7 @@ static int acpi_evalf(acpi_handle handle,
563 int quiet; 547 int quiet;
564 548
565 if (!*fmt) { 549 if (!*fmt) {
566 printk(TPACPI_ERR "acpi_evalf() called with empty format\n"); 550 pr_err("acpi_evalf() called with empty format\n");
567 return 0; 551 return 0;
568 } 552 }
569 553
@@ -588,7 +572,7 @@ static int acpi_evalf(acpi_handle handle,
588 break; 572 break;
589 /* add more types as needed */ 573 /* add more types as needed */
590 default: 574 default:
591 printk(TPACPI_ERR "acpi_evalf() called " 575 pr_err("acpi_evalf() called "
592 "with invalid format character '%c'\n", c); 576 "with invalid format character '%c'\n", c);
593 va_end(ap); 577 va_end(ap);
594 return 0; 578 return 0;
@@ -617,13 +601,13 @@ static int acpi_evalf(acpi_handle handle,
617 break; 601 break;
618 /* add more types as needed */ 602 /* add more types as needed */
619 default: 603 default:
620 printk(TPACPI_ERR "acpi_evalf() called " 604 pr_err("acpi_evalf() called "
621 "with invalid format character '%c'\n", res_type); 605 "with invalid format character '%c'\n", res_type);
622 return 0; 606 return 0;
623 } 607 }
624 608
625 if (!success && !quiet) 609 if (!success && !quiet)
626 printk(TPACPI_ERR "acpi_evalf(%s, %s, ...) failed: %s\n", 610 pr_err("acpi_evalf(%s, %s, ...) failed: %s\n",
627 method, fmt0, acpi_format_exception(status)); 611 method, fmt0, acpi_format_exception(status));
628 612
629 return success; 613 return success;
@@ -767,8 +751,7 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm)
767 751
768 rc = acpi_bus_get_device(*ibm->acpi->handle, &ibm->acpi->device); 752 rc = acpi_bus_get_device(*ibm->acpi->handle, &ibm->acpi->device);
769 if (rc < 0) { 753 if (rc < 0) {
770 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);
771 ibm->name, rc);
772 return -ENODEV; 755 return -ENODEV;
773 } 756 }
774 757
@@ -781,12 +764,10 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm)
781 ibm->acpi->type, dispatch_acpi_notify, ibm); 764 ibm->acpi->type, dispatch_acpi_notify, ibm);
782 if (ACPI_FAILURE(status)) { 765 if (ACPI_FAILURE(status)) {
783 if (status == AE_ALREADY_EXISTS) { 766 if (status == AE_ALREADY_EXISTS) {
784 printk(TPACPI_NOTICE 767 pr_notice("another device driver is already "
785 "another device driver is already " 768 "handling %s events\n", ibm->name);
786 "handling %s events\n", ibm->name);
787 } else { 769 } else {
788 printk(TPACPI_ERR 770 pr_err("acpi_install_notify_handler(%s) failed: %s\n",
789 "acpi_install_notify_handler(%s) failed: %s\n",
790 ibm->name, acpi_format_exception(status)); 771 ibm->name, acpi_format_exception(status));
791 } 772 }
792 return -ENODEV; 773 return -ENODEV;
@@ -811,8 +792,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm)
811 792
812 ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL); 793 ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
813 if (!ibm->acpi->driver) { 794 if (!ibm->acpi->driver) {
814 printk(TPACPI_ERR 795 pr_err("failed to allocate memory for ibm->acpi->driver\n");
815 "failed to allocate memory for ibm->acpi->driver\n");
816 return -ENOMEM; 796 return -ENOMEM;
817 } 797 }
818 798
@@ -823,7 +803,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm)
823 803
824 rc = acpi_bus_register_driver(ibm->acpi->driver); 804 rc = acpi_bus_register_driver(ibm->acpi->driver);
825 if (rc < 0) { 805 if (rc < 0) {
826 printk(TPACPI_ERR "acpi_bus_register_driver(%s) failed: %d\n", 806 pr_err("acpi_bus_register_driver(%s) failed: %d\n",
827 ibm->name, rc); 807 ibm->name, rc);
828 kfree(ibm->acpi->driver); 808 kfree(ibm->acpi->driver);
829 ibm->acpi->driver = NULL; 809 ibm->acpi->driver = NULL;
@@ -1081,15 +1061,14 @@ static int parse_strtoul(const char *buf,
1081static void tpacpi_disable_brightness_delay(void) 1061static void tpacpi_disable_brightness_delay(void)
1082{ 1062{
1083 if (acpi_evalf(hkey_handle, NULL, "PWMS", "qvd", 0)) 1063 if (acpi_evalf(hkey_handle, NULL, "PWMS", "qvd", 0))
1084 printk(TPACPI_NOTICE 1064 pr_notice("ACPI backlight control delay disabled\n");
1085 "ACPI backlight control delay disabled\n");
1086} 1065}
1087 1066
1088static void printk_deprecated_attribute(const char * const what, 1067static void printk_deprecated_attribute(const char * const what,
1089 const char * const details) 1068 const char * const details)
1090{ 1069{
1091 tpacpi_log_usertask("deprecated sysfs attribute"); 1070 tpacpi_log_usertask("deprecated sysfs attribute");
1092 printk(TPACPI_WARN "WARNING: sysfs attribute %s is deprecated and " 1071 pr_warn("WARNING: sysfs attribute %s is deprecated and "
1093 "will be removed. %s\n", 1072 "will be removed. %s\n",
1094 what, details); 1073 what, details);
1095} 1074}
@@ -1264,8 +1243,7 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id,
1264 &tpacpi_rfk_rfkill_ops, 1243 &tpacpi_rfk_rfkill_ops,
1265 atp_rfk); 1244 atp_rfk);
1266 if (!atp_rfk || !atp_rfk->rfkill) { 1245 if (!atp_rfk || !atp_rfk->rfkill) {
1267 printk(TPACPI_ERR 1246 pr_err("failed to allocate memory for rfkill class\n");
1268 "failed to allocate memory for rfkill class\n");
1269 kfree(atp_rfk); 1247 kfree(atp_rfk);
1270 return -ENOMEM; 1248 return -ENOMEM;
1271 } 1249 }
@@ -1275,9 +1253,8 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id,
1275 1253
1276 sw_status = (tp_rfkops->get_status)(); 1254 sw_status = (tp_rfkops->get_status)();
1277 if (sw_status < 0) { 1255 if (sw_status < 0) {
1278 printk(TPACPI_ERR 1256 pr_err("failed to read initial state for %s, error %d\n",
1279 "failed to read initial state for %s, error %d\n", 1257 name, sw_status);
1280 name, sw_status);
1281 } else { 1258 } else {
1282 sw_state = (sw_status == TPACPI_RFK_RADIO_OFF); 1259 sw_state = (sw_status == TPACPI_RFK_RADIO_OFF);
1283 if (set_default) { 1260 if (set_default) {
@@ -1291,9 +1268,7 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id,
1291 1268
1292 res = rfkill_register(atp_rfk->rfkill); 1269 res = rfkill_register(atp_rfk->rfkill);
1293 if (res < 0) { 1270 if (res < 0) {
1294 printk(TPACPI_ERR 1271 pr_err("failed to register %s rfkill switch: %d\n", name, res);
1295 "failed to register %s rfkill switch: %d\n",
1296 name, res);
1297 rfkill_destroy(atp_rfk->rfkill); 1272 rfkill_destroy(atp_rfk->rfkill);
1298 kfree(atp_rfk); 1273 kfree(atp_rfk);
1299 return res; 1274 return res;
@@ -1301,7 +1276,7 @@ static int __init tpacpi_new_rfkill(const enum tpacpi_rfk_id id,
1301 1276
1302 tpacpi_rfkill_switches[id] = atp_rfk; 1277 tpacpi_rfkill_switches[id] = atp_rfk;
1303 1278
1304 printk(TPACPI_INFO "rfkill switch %s: radio is %sblocked\n", 1279 pr_info("rfkill switch %s: radio is %sblocked\n",
1305 name, (sw_state || hw_state) ? "" : "un"); 1280 name, (sw_state || hw_state) ? "" : "un");
1306 return 0; 1281 return 0;
1307} 1282}
@@ -1825,10 +1800,8 @@ static void __init tpacpi_check_outdated_fw(void)
1825 * broken, or really stable to begin with, so it is 1800 * broken, or really stable to begin with, so it is
1826 * best if the user upgrades the firmware anyway. 1801 * best if the user upgrades the firmware anyway.
1827 */ 1802 */
1828 printk(TPACPI_WARN 1803 pr_warn("WARNING: Outdated ThinkPad BIOS/EC firmware\n");
1829 "WARNING: Outdated ThinkPad BIOS/EC firmware\n"); 1804 pr_warn("WARNING: This firmware may be missing critical bug "
1830 printk(TPACPI_WARN
1831 "WARNING: This firmware may be missing critical bug "
1832 "fixes and/or important features\n"); 1805 "fixes and/or important features\n");
1833 } 1806 }
1834} 1807}
@@ -2117,9 +2090,7 @@ void static hotkey_mask_warn_incomplete_mask(void)
2117 (hotkey_all_mask | TPACPI_HKEY_NVRAM_KNOWN_MASK); 2090 (hotkey_all_mask | TPACPI_HKEY_NVRAM_KNOWN_MASK);
2118 2091
2119 if (wantedmask) 2092 if (wantedmask)
2120 printk(TPACPI_NOTICE 2093 pr_notice("required events 0x%08x not enabled!\n", wantedmask);
2121 "required events 0x%08x not enabled!\n",
2122 wantedmask);
2123} 2094}
2124 2095
2125/* 2096/*
@@ -2157,10 +2128,9 @@ static int hotkey_mask_set(u32 mask)
2157 * a given event. 2128 * a given event.
2158 */ 2129 */
2159 if (!hotkey_mask_get() && !rc && (fwmask & ~hotkey_acpi_mask)) { 2130 if (!hotkey_mask_get() && !rc && (fwmask & ~hotkey_acpi_mask)) {
2160 printk(TPACPI_NOTICE 2131 pr_notice("asked for hotkey mask 0x%08x, but "
2161 "asked for hotkey mask 0x%08x, but " 2132 "firmware forced it to 0x%08x\n",
2162 "firmware forced it to 0x%08x\n", 2133 fwmask, hotkey_acpi_mask);
2163 fwmask, hotkey_acpi_mask);
2164 } 2134 }
2165 2135
2166 if (tpacpi_lifecycle != TPACPI_LIFE_EXITING) 2136 if (tpacpi_lifecycle != TPACPI_LIFE_EXITING)
@@ -2184,13 +2154,11 @@ static int hotkey_user_mask_set(const u32 mask)
2184 (mask == 0xffff || mask == 0xffffff || 2154 (mask == 0xffff || mask == 0xffffff ||
2185 mask == 0xffffffff)) { 2155 mask == 0xffffffff)) {
2186 tp_warned.hotkey_mask_ff = 1; 2156 tp_warned.hotkey_mask_ff = 1;
2187 printk(TPACPI_NOTICE 2157 pr_notice("setting the hotkey mask to 0x%08x is likely "
2188 "setting the hotkey mask to 0x%08x is likely " 2158 "not the best way to go about it\n", mask);
2189 "not the best way to go about it\n", mask); 2159 pr_notice("please consider using the driver defaults, "
2190 printk(TPACPI_NOTICE 2160 "and refer to up-to-date thinkpad-acpi "
2191 "please consider using the driver defaults, " 2161 "documentation\n");
2192 "and refer to up-to-date thinkpad-acpi "
2193 "documentation\n");
2194 } 2162 }
2195 2163
2196 /* Try to enable what the user asked for, plus whatever we need. 2164 /* Try to enable what the user asked for, plus whatever we need.
@@ -2574,8 +2542,7 @@ static void hotkey_poll_setup(const bool may_warn)
2574 NULL, TPACPI_NVRAM_KTHREAD_NAME); 2542 NULL, TPACPI_NVRAM_KTHREAD_NAME);
2575 if (IS_ERR(tpacpi_hotkey_task)) { 2543 if (IS_ERR(tpacpi_hotkey_task)) {
2576 tpacpi_hotkey_task = NULL; 2544 tpacpi_hotkey_task = NULL;
2577 printk(TPACPI_ERR 2545 pr_err("could not create kernel thread "
2578 "could not create kernel thread "
2579 "for hotkey polling\n"); 2546 "for hotkey polling\n");
2580 } 2547 }
2581 } 2548 }
@@ -2583,11 +2550,10 @@ static void hotkey_poll_setup(const bool may_warn)
2583 hotkey_poll_stop_sync(); 2550 hotkey_poll_stop_sync();
2584 if (may_warn && (poll_driver_mask || poll_user_mask) && 2551 if (may_warn && (poll_driver_mask || poll_user_mask) &&
2585 hotkey_poll_freq == 0) { 2552 hotkey_poll_freq == 0) {
2586 printk(TPACPI_NOTICE 2553 pr_notice("hot keys 0x%08x and/or events 0x%08x "
2587 "hot keys 0x%08x and/or events 0x%08x " 2554 "require polling, which is currently "
2588 "require polling, which is currently " 2555 "disabled\n",
2589 "disabled\n", 2556 poll_user_mask, poll_driver_mask);
2590 poll_user_mask, poll_driver_mask);
2591 } 2557 }
2592 } 2558 }
2593} 2559}
@@ -2811,13 +2777,13 @@ static ssize_t hotkey_source_mask_store(struct device *dev,
2811 mutex_unlock(&hotkey_mutex); 2777 mutex_unlock(&hotkey_mutex);
2812 2778
2813 if (rc < 0) 2779 if (rc < 0)
2814 printk(TPACPI_ERR "hotkey_source_mask: failed to update the" 2780 pr_err("hotkey_source_mask: "
2815 "firmware event mask!\n"); 2781 "failed to update the firmware event mask!\n");
2816 2782
2817 if (r_ev) 2783 if (r_ev)
2818 printk(TPACPI_NOTICE "hotkey_source_mask: " 2784 pr_notice("hotkey_source_mask: "
2819 "some important events were disabled: " 2785 "some important events were disabled: 0x%04x\n",
2820 "0x%04x\n", r_ev); 2786 r_ev);
2821 2787
2822 tpacpi_disclose_usertask("hotkey_source_mask", "set to 0x%08lx\n", t); 2788 tpacpi_disclose_usertask("hotkey_source_mask", "set to 0x%08lx\n", t);
2823 2789
@@ -3048,8 +3014,7 @@ static void hotkey_exit(void)
3048 if (((tp_features.hotkey_mask && 3014 if (((tp_features.hotkey_mask &&
3049 hotkey_mask_set(hotkey_orig_mask)) | 3015 hotkey_mask_set(hotkey_orig_mask)) |
3050 hotkey_status_set(false)) != 0) 3016 hotkey_status_set(false)) != 0)
3051 printk(TPACPI_ERR 3017 pr_err("failed to restore hot key mask "
3052 "failed to restore hot key mask "
3053 "to BIOS defaults\n"); 3018 "to BIOS defaults\n");
3054} 3019}
3055 3020
@@ -3288,10 +3253,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
3288 for HKEY interface version 0x100 */ 3253 for HKEY interface version 0x100 */
3289 if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) { 3254 if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
3290 if ((hkeyv >> 8) != 1) { 3255 if ((hkeyv >> 8) != 1) {
3291 printk(TPACPI_ERR "unknown version of the " 3256 pr_err("unknown version of the HKEY interface: 0x%x\n",
3292 "HKEY interface: 0x%x\n", hkeyv); 3257 hkeyv);
3293 printk(TPACPI_ERR "please report this to %s\n", 3258 pr_err("please report this to %s\n", TPACPI_MAIL);
3294 TPACPI_MAIL);
3295 } else { 3259 } else {
3296 /* 3260 /*
3297 * MHKV 0x100 in A31, R40, R40e, 3261 * MHKV 0x100 in A31, R40, R40e,
@@ -3304,8 +3268,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
3304 /* Paranoia check AND init hotkey_all_mask */ 3268 /* Paranoia check AND init hotkey_all_mask */
3305 if (!acpi_evalf(hkey_handle, &hotkey_all_mask, 3269 if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
3306 "MHKA", "qd")) { 3270 "MHKA", "qd")) {
3307 printk(TPACPI_ERR 3271 pr_err("missing MHKA handler, "
3308 "missing MHKA handler, "
3309 "please report this to %s\n", 3272 "please report this to %s\n",
3310 TPACPI_MAIL); 3273 TPACPI_MAIL);
3311 /* Fallback: pre-init for FN+F3,F4,F12 */ 3274 /* Fallback: pre-init for FN+F3,F4,F12 */
@@ -3343,16 +3306,14 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
3343 if (dbg_wlswemul) { 3306 if (dbg_wlswemul) {
3344 tp_features.hotkey_wlsw = 1; 3307 tp_features.hotkey_wlsw = 1;
3345 radiosw_state = !!tpacpi_wlsw_emulstate; 3308 radiosw_state = !!tpacpi_wlsw_emulstate;
3346 printk(TPACPI_INFO 3309 pr_info("radio switch emulation enabled\n");
3347 "radio switch emulation enabled\n");
3348 } else 3310 } else
3349#endif 3311#endif
3350 /* Not all thinkpads have a hardware radio switch */ 3312 /* Not all thinkpads have a hardware radio switch */
3351 if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { 3313 if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) {
3352 tp_features.hotkey_wlsw = 1; 3314 tp_features.hotkey_wlsw = 1;
3353 radiosw_state = !!status; 3315 radiosw_state = !!status;
3354 printk(TPACPI_INFO 3316 pr_info("radio switch found; radios are %s\n",
3355 "radio switch found; radios are %s\n",
3356 enabled(status, 0)); 3317 enabled(status, 0));
3357 } 3318 }
3358 if (tp_features.hotkey_wlsw) 3319 if (tp_features.hotkey_wlsw)
@@ -3363,8 +3324,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
3363 if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { 3324 if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) {
3364 tp_features.hotkey_tablet = 1; 3325 tp_features.hotkey_tablet = 1;
3365 tabletsw_state = !!(status & TP_HOTKEY_TABLET_MASK); 3326 tabletsw_state = !!(status & TP_HOTKEY_TABLET_MASK);
3366 printk(TPACPI_INFO 3327 pr_info("possible tablet mode switch found; "
3367 "possible tablet mode switch found; "
3368 "ThinkPad in %s mode\n", 3328 "ThinkPad in %s mode\n",
3369 (tabletsw_state) ? "tablet" : "laptop"); 3329 (tabletsw_state) ? "tablet" : "laptop");
3370 res = add_to_attr_set(hotkey_dev_attributes, 3330 res = add_to_attr_set(hotkey_dev_attributes,
@@ -3382,8 +3342,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
3382 hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE, 3342 hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE,
3383 GFP_KERNEL); 3343 GFP_KERNEL);
3384 if (!hotkey_keycode_map) { 3344 if (!hotkey_keycode_map) {
3385 printk(TPACPI_ERR 3345 pr_err("failed to allocate memory for key map\n");
3386 "failed to allocate memory for key map\n");
3387 res = -ENOMEM; 3346 res = -ENOMEM;
3388 goto err_exit; 3347 goto err_exit;
3389 } 3348 }
@@ -3426,13 +3385,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
3426 * userspace. tpacpi_detect_brightness_capabilities() must have 3385 * userspace. tpacpi_detect_brightness_capabilities() must have
3427 * been called before this point */ 3386 * been called before this point */
3428 if (tp_features.bright_acpimode && acpi_video_backlight_support()) { 3387 if (tp_features.bright_acpimode && acpi_video_backlight_support()) {
3429 printk(TPACPI_INFO 3388 pr_info("This ThinkPad has standard ACPI backlight "
3430 "This ThinkPad has standard ACPI backlight " 3389 "brightness control, supported by the ACPI "
3431 "brightness control, supported by the ACPI " 3390 "video driver\n");
3432 "video driver\n"); 3391 pr_notice("Disabling thinkpad-acpi brightness events "
3433 printk(TPACPI_NOTICE 3392 "by default...\n");
3434 "Disabling thinkpad-acpi brightness events "
3435 "by default...\n");
3436 3393
3437 /* Disable brightness up/down on Lenovo thinkpads when 3394 /* Disable brightness up/down on Lenovo thinkpads when
3438 * ACPI is handling them, otherwise it is plain impossible 3395 * ACPI is handling them, otherwise it is plain impossible
@@ -3539,8 +3496,7 @@ static bool hotkey_notify_wakeup(const u32 hkey,
3539 3496
3540 case TP_HKEY_EV_WKUP_S3_BATLOW: /* Battery on critical low level/S3 */ 3497 case TP_HKEY_EV_WKUP_S3_BATLOW: /* Battery on critical low level/S3 */
3541 case TP_HKEY_EV_WKUP_S4_BATLOW: /* Battery on critical low level/S4 */ 3498 case TP_HKEY_EV_WKUP_S4_BATLOW: /* Battery on critical low level/S4 */
3542 printk(TPACPI_ALERT 3499 pr_alert("EMERGENCY WAKEUP: battery almost empty\n");
3543 "EMERGENCY WAKEUP: battery almost empty\n");
3544 /* how to auto-heal: */ 3500 /* how to auto-heal: */
3545 /* 2313: woke up from S3, go to S4/S5 */ 3501 /* 2313: woke up from S3, go to S4/S5 */
3546 /* 2413: woke up from S4, go to S5 */ 3502 /* 2413: woke up from S4, go to S5 */
@@ -3551,9 +3507,7 @@ static bool hotkey_notify_wakeup(const u32 hkey,
3551 } 3507 }
3552 3508
3553 if (hotkey_wakeup_reason != TP_ACPI_WAKEUP_NONE) { 3509 if (hotkey_wakeup_reason != TP_ACPI_WAKEUP_NONE) {
3554 printk(TPACPI_INFO 3510 pr_info("woke up due to a hot-unplug request...\n");
3555 "woke up due to a hot-unplug "
3556 "request...\n");
3557 hotkey_wakeup_reason_notify_change(); 3511 hotkey_wakeup_reason_notify_change();
3558 } 3512 }
3559 return true; 3513 return true;
@@ -3605,37 +3559,31 @@ static bool hotkey_notify_thermal(const u32 hkey,
3605 3559
3606 switch (hkey) { 3560 switch (hkey) {
3607 case TP_HKEY_EV_THM_TABLE_CHANGED: 3561 case TP_HKEY_EV_THM_TABLE_CHANGED:
3608 printk(TPACPI_INFO 3562 pr_info("EC reports that Thermal Table has changed\n");
3609 "EC reports that Thermal Table has changed\n");
3610 /* recommended action: do nothing, we don't have 3563 /* recommended action: do nothing, we don't have
3611 * Lenovo ATM information */ 3564 * Lenovo ATM information */
3612 return true; 3565 return true;
3613 case TP_HKEY_EV_ALARM_BAT_HOT: 3566 case TP_HKEY_EV_ALARM_BAT_HOT:
3614 printk(TPACPI_CRIT 3567 pr_crit("THERMAL ALARM: battery is too hot!\n");
3615 "THERMAL ALARM: battery is too hot!\n");
3616 /* recommended action: warn user through gui */ 3568 /* recommended action: warn user through gui */
3617 break; 3569 break;
3618 case TP_HKEY_EV_ALARM_BAT_XHOT: 3570 case TP_HKEY_EV_ALARM_BAT_XHOT:
3619 printk(TPACPI_ALERT 3571 pr_alert("THERMAL EMERGENCY: battery is extremely hot!\n");
3620 "THERMAL EMERGENCY: battery is extremely hot!\n");
3621 /* recommended action: immediate sleep/hibernate */ 3572 /* recommended action: immediate sleep/hibernate */
3622 break; 3573 break;
3623 case TP_HKEY_EV_ALARM_SENSOR_HOT: 3574 case TP_HKEY_EV_ALARM_SENSOR_HOT:
3624 printk(TPACPI_CRIT 3575 pr_crit("THERMAL ALARM: "
3625 "THERMAL ALARM: "
3626 "a sensor reports something is too hot!\n"); 3576 "a sensor reports something is too hot!\n");
3627 /* recommended action: warn user through gui, that */ 3577 /* recommended action: warn user through gui, that */
3628 /* some internal component is too hot */ 3578 /* some internal component is too hot */
3629 break; 3579 break;
3630 case TP_HKEY_EV_ALARM_SENSOR_XHOT: 3580 case TP_HKEY_EV_ALARM_SENSOR_XHOT:
3631 printk(TPACPI_ALERT 3581 pr_alert("THERMAL EMERGENCY: "
3632 "THERMAL EMERGENCY: " 3582 "a sensor reports something is extremely hot!\n");
3633 "a sensor reports something is extremely hot!\n");
3634 /* recommended action: immediate sleep/hibernate */ 3583 /* recommended action: immediate sleep/hibernate */
3635 break; 3584 break;
3636 default: 3585 default:
3637 printk(TPACPI_ALERT 3586 pr_alert("THERMAL ALERT: unknown thermal alarm received\n");
3638 "THERMAL ALERT: unknown thermal alarm received\n");
3639 known = false; 3587 known = false;
3640 } 3588 }
3641 3589
@@ -3652,8 +3600,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
3652 bool known_ev; 3600 bool known_ev;
3653 3601
3654 if (event != 0x80) { 3602 if (event != 0x80) {
3655 printk(TPACPI_ERR 3603 pr_err("unknown HKEY notification event %d\n", event);
3656 "unknown HKEY notification event %d\n", event);
3657 /* forward it to userspace, maybe it knows how to handle it */ 3604 /* forward it to userspace, maybe it knows how to handle it */
3658 acpi_bus_generate_netlink_event( 3605 acpi_bus_generate_netlink_event(
3659 ibm->acpi->device->pnp.device_class, 3606 ibm->acpi->device->pnp.device_class,
@@ -3664,7 +3611,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
3664 3611
3665 while (1) { 3612 while (1) {
3666 if (!acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) { 3613 if (!acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
3667 printk(TPACPI_ERR "failed to retrieve HKEY event\n"); 3614 pr_err("failed to retrieve HKEY event\n");
3668 return; 3615 return;
3669 } 3616 }
3670 3617
@@ -3692,8 +3639,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
3692 switch (hkey) { 3639 switch (hkey) {
3693 case TP_HKEY_EV_BAYEJ_ACK: 3640 case TP_HKEY_EV_BAYEJ_ACK:
3694 hotkey_autosleep_ack = 1; 3641 hotkey_autosleep_ack = 1;
3695 printk(TPACPI_INFO 3642 pr_info("bay ejected\n");
3696 "bay ejected\n");
3697 hotkey_wakeup_hotunplug_complete_notify_change(); 3643 hotkey_wakeup_hotunplug_complete_notify_change();
3698 known_ev = true; 3644 known_ev = true;
3699 break; 3645 break;
@@ -3709,8 +3655,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
3709 /* 0x4000-0x4FFF: dock-related wakeups */ 3655 /* 0x4000-0x4FFF: dock-related wakeups */
3710 if (hkey == TP_HKEY_EV_UNDOCK_ACK) { 3656 if (hkey == TP_HKEY_EV_UNDOCK_ACK) {
3711 hotkey_autosleep_ack = 1; 3657 hotkey_autosleep_ack = 1;
3712 printk(TPACPI_INFO 3658 pr_info("undocked\n");
3713 "undocked\n");
3714 hotkey_wakeup_hotunplug_complete_notify_change(); 3659 hotkey_wakeup_hotunplug_complete_notify_change();
3715 known_ev = true; 3660 known_ev = true;
3716 } else { 3661 } else {
@@ -3741,11 +3686,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
3741 known_ev = false; 3686 known_ev = false;
3742 } 3687 }
3743 if (!known_ev) { 3688 if (!known_ev) {
3744 printk(TPACPI_NOTICE 3689 pr_notice("unhandled HKEY event 0x%04x\n", hkey);
3745 "unhandled HKEY event 0x%04x\n", hkey); 3690 pr_notice("please report the conditions when this "
3746 printk(TPACPI_NOTICE 3691 "event happened to %s\n", TPACPI_MAIL);
3747 "please report the conditions when this "
3748 "event happened to %s\n", TPACPI_MAIL);
3749 } 3692 }
3750 3693
3751 /* Legacy events */ 3694 /* Legacy events */
@@ -3778,8 +3721,7 @@ static void hotkey_resume(void)
3778 3721
3779 if (hotkey_status_set(true) < 0 || 3722 if (hotkey_status_set(true) < 0 ||
3780 hotkey_mask_set(hotkey_acpi_mask) < 0) 3723 hotkey_mask_set(hotkey_acpi_mask) < 0)
3781 printk(TPACPI_ERR 3724 pr_err("error while attempting to reset the event "
3782 "error while attempting to reset the event "
3783 "firmware interface\n"); 3725 "firmware interface\n");
3784 3726
3785 tpacpi_send_radiosw_update(); 3727 tpacpi_send_radiosw_update();
@@ -3824,14 +3766,12 @@ static void hotkey_enabledisable_warn(bool enable)
3824{ 3766{
3825 tpacpi_log_usertask("procfs hotkey enable/disable"); 3767 tpacpi_log_usertask("procfs hotkey enable/disable");
3826 if (!WARN((tpacpi_lifecycle == TPACPI_LIFE_RUNNING || !enable), 3768 if (!WARN((tpacpi_lifecycle == TPACPI_LIFE_RUNNING || !enable),
3827 TPACPI_WARN 3769 pr_fmt("hotkey enable/disable functionality has been "
3828 "hotkey enable/disable functionality has been " 3770 "removed from the driver. "
3829 "removed from the driver. Hotkeys are always " 3771 "Hotkeys are always enabled.\n")))
3830 "enabled\n")) 3772 pr_err("Please remove the hotkey=enable module "
3831 printk(TPACPI_ERR 3773 "parameter, it is deprecated. "
3832 "Please remove the hotkey=enable module " 3774 "Hotkeys are always enabled.\n");
3833 "parameter, it is deprecated. Hotkeys are always "
3834 "enabled\n");
3835} 3775}
3836 3776
3837static int hotkey_write(char *buf) 3777static int hotkey_write(char *buf)
@@ -4011,8 +3951,7 @@ static void bluetooth_shutdown(void)
4011 /* Order firmware to save current state to NVRAM */ 3951 /* Order firmware to save current state to NVRAM */
4012 if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd", 3952 if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd",
4013 TP_ACPI_BLTH_SAVE_STATE)) 3953 TP_ACPI_BLTH_SAVE_STATE))
4014 printk(TPACPI_NOTICE 3954 pr_notice("failed to save bluetooth state to NVRAM\n");
4015 "failed to save bluetooth state to NVRAM\n");
4016 else 3955 else
4017 vdbg_printk(TPACPI_DBG_RFKILL, 3956 vdbg_printk(TPACPI_DBG_RFKILL,
4018 "bluestooth state saved to NVRAM\n"); 3957 "bluestooth state saved to NVRAM\n");
@@ -4051,8 +3990,7 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm)
4051#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES 3990#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
4052 if (dbg_bluetoothemul) { 3991 if (dbg_bluetoothemul) {
4053 tp_features.bluetooth = 1; 3992 tp_features.bluetooth = 1;
4054 printk(TPACPI_INFO 3993 pr_info("bluetooth switch emulation enabled\n");
4055 "bluetooth switch emulation enabled\n");
4056 } else 3994 } else
4057#endif 3995#endif
4058 if (tp_features.bluetooth && 3996 if (tp_features.bluetooth &&
@@ -4203,8 +4141,7 @@ static void wan_shutdown(void)
4203 /* Order firmware to save current state to NVRAM */ 4141 /* Order firmware to save current state to NVRAM */
4204 if (!acpi_evalf(NULL, NULL, "\\WGSV", "vd", 4142 if (!acpi_evalf(NULL, NULL, "\\WGSV", "vd",
4205 TP_ACPI_WGSV_SAVE_STATE)) 4143 TP_ACPI_WGSV_SAVE_STATE))
4206 printk(TPACPI_NOTICE 4144 pr_notice("failed to save WWAN state to NVRAM\n");
4207 "failed to save WWAN state to NVRAM\n");
4208 else 4145 else
4209 vdbg_printk(TPACPI_DBG_RFKILL, 4146 vdbg_printk(TPACPI_DBG_RFKILL,
4210 "WWAN state saved to NVRAM\n"); 4147 "WWAN state saved to NVRAM\n");
@@ -4241,8 +4178,7 @@ static int __init wan_init(struct ibm_init_struct *iibm)
4241#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES 4178#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
4242 if (dbg_wwanemul) { 4179 if (dbg_wwanemul) {
4243 tp_features.wan = 1; 4180 tp_features.wan = 1;
4244 printk(TPACPI_INFO 4181 pr_info("wwan switch emulation enabled\n");
4245 "wwan switch emulation enabled\n");
4246 } else 4182 } else
4247#endif 4183#endif
4248 if (tp_features.wan && 4184 if (tp_features.wan &&
@@ -4382,8 +4318,7 @@ static int __init uwb_init(struct ibm_init_struct *iibm)
4382#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES 4318#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
4383 if (dbg_uwbemul) { 4319 if (dbg_uwbemul) {
4384 tp_features.uwb = 1; 4320 tp_features.uwb = 1;
4385 printk(TPACPI_INFO 4321 pr_info("uwb switch emulation enabled\n");
4386 "uwb switch emulation enabled\n");
4387 } else 4322 } else
4388#endif 4323#endif
4389 if (tp_features.uwb && 4324 if (tp_features.uwb &&
@@ -4444,6 +4379,15 @@ static int video_orig_autosw;
4444static int video_autosw_get(void); 4379static int video_autosw_get(void);
4445static int video_autosw_set(int enable); 4380static int video_autosw_set(int enable);
4446 4381
4382TPACPI_HANDLE(vid, root,
4383 "\\_SB.PCI.AGP.VGA", /* 570 */
4384 "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */
4385 "\\_SB.PCI0.VID0", /* 770e */
4386 "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */
4387 "\\_SB.PCI0.AGP.VGA", /* X100e and a few others */
4388 "\\_SB.PCI0.AGP.VID", /* all others */
4389 ); /* R30, R31 */
4390
4447TPACPI_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */ 4391TPACPI_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */
4448 4392
4449static int __init video_init(struct ibm_init_struct *iibm) 4393static int __init video_init(struct ibm_init_struct *iibm)
@@ -4487,7 +4431,7 @@ static void video_exit(void)
4487 dbg_printk(TPACPI_DBG_EXIT, 4431 dbg_printk(TPACPI_DBG_EXIT,
4488 "restoring original video autoswitch mode\n"); 4432 "restoring original video autoswitch mode\n");
4489 if (video_autosw_set(video_orig_autosw)) 4433 if (video_autosw_set(video_orig_autosw))
4490 printk(TPACPI_ERR "error while trying to restore original " 4434 pr_err("error while trying to restore original "
4491 "video autoswitch mode\n"); 4435 "video autoswitch mode\n");
4492} 4436}
4493 4437
@@ -4560,8 +4504,7 @@ static int video_outputsw_set(int status)
4560 res = acpi_evalf(vid_handle, NULL, 4504 res = acpi_evalf(vid_handle, NULL,
4561 "ASWT", "vdd", status * 0x100, 0); 4505 "ASWT", "vdd", status * 0x100, 0);
4562 if (!autosw && video_autosw_set(autosw)) { 4506 if (!autosw && video_autosw_set(autosw)) {
4563 printk(TPACPI_ERR 4507 pr_err("video auto-switch left enabled due to error\n");
4564 "video auto-switch left enabled due to error\n");
4565 return -EIO; 4508 return -EIO;
4566 } 4509 }
4567 break; 4510 break;
@@ -4630,8 +4573,7 @@ static int video_outputsw_cycle(void)
4630 return -ENOSYS; 4573 return -ENOSYS;
4631 } 4574 }
4632 if (!autosw && video_autosw_set(autosw)) { 4575 if (!autosw && video_autosw_set(autosw)) {
4633 printk(TPACPI_ERR 4576 pr_err("video auto-switch left enabled due to error\n");
4634 "video auto-switch left enabled due to error\n");
4635 return -EIO; 4577 return -EIO;
4636 } 4578 }
4637 4579
@@ -5348,7 +5290,7 @@ static int __init led_init(struct ibm_init_struct *iibm)
5348 tpacpi_leds = kzalloc(sizeof(*tpacpi_leds) * TPACPI_LED_NUMLEDS, 5290 tpacpi_leds = kzalloc(sizeof(*tpacpi_leds) * TPACPI_LED_NUMLEDS,
5349 GFP_KERNEL); 5291 GFP_KERNEL);
5350 if (!tpacpi_leds) { 5292 if (!tpacpi_leds) {
5351 printk(TPACPI_ERR "Out of memory for LED data\n"); 5293 pr_err("Out of memory for LED data\n");
5352 return -ENOMEM; 5294 return -ENOMEM;
5353 } 5295 }
5354 5296
@@ -5367,9 +5309,8 @@ static int __init led_init(struct ibm_init_struct *iibm)
5367 } 5309 }
5368 5310
5369#ifdef CONFIG_THINKPAD_ACPI_UNSAFE_LEDS 5311#ifdef CONFIG_THINKPAD_ACPI_UNSAFE_LEDS
5370 printk(TPACPI_NOTICE 5312 pr_notice("warning: userspace override of important "
5371 "warning: userspace override of important " 5313 "firmware LEDs is enabled\n");
5372 "firmware LEDs is enabled\n");
5373#endif 5314#endif
5374 return 0; 5315 return 0;
5375} 5316}
@@ -5639,17 +5580,16 @@ static void thermal_dump_all_sensors(void)
5639 if (n <= 0) 5580 if (n <= 0)
5640 return; 5581 return;
5641 5582
5642 printk(TPACPI_NOTICE 5583 pr_notice("temperatures (Celsius):");
5643 "temperatures (Celsius):");
5644 5584
5645 for (i = 0; i < n; i++) { 5585 for (i = 0; i < n; i++) {
5646 if (t.temp[i] != TPACPI_THERMAL_SENSOR_NA) 5586 if (t.temp[i] != TPACPI_THERMAL_SENSOR_NA)
5647 printk(KERN_CONT " %d", (int)(t.temp[i] / 1000)); 5587 pr_cont(" %d", (int)(t.temp[i] / 1000));
5648 else 5588 else
5649 printk(KERN_CONT " N/A"); 5589 pr_cont(" N/A");
5650 } 5590 }
5651 5591
5652 printk(KERN_CONT "\n"); 5592 pr_cont("\n");
5653} 5593}
5654 5594
5655/* sysfs temp##_input -------------------------------------------------- */ 5595/* sysfs temp##_input -------------------------------------------------- */
@@ -5769,14 +5709,12 @@ static int __init thermal_init(struct ibm_init_struct *iibm)
5769 if (ta1 == 0) { 5709 if (ta1 == 0) {
5770 /* This is sheer paranoia, but we handle it anyway */ 5710 /* This is sheer paranoia, but we handle it anyway */
5771 if (acpi_tmp7) { 5711 if (acpi_tmp7) {
5772 printk(TPACPI_ERR 5712 pr_err("ThinkPad ACPI EC access misbehaving, "
5773 "ThinkPad ACPI EC access misbehaving, "
5774 "falling back to ACPI TMPx access " 5713 "falling back to ACPI TMPx access "
5775 "mode\n"); 5714 "mode\n");
5776 thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07; 5715 thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07;
5777 } else { 5716 } else {
5778 printk(TPACPI_ERR 5717 pr_err("ThinkPad ACPI EC access misbehaving, "
5779 "ThinkPad ACPI EC access misbehaving, "
5780 "disabling thermal sensors access\n"); 5718 "disabling thermal sensors access\n");
5781 thermal_read_mode = TPACPI_THERMAL_NONE; 5719 thermal_read_mode = TPACPI_THERMAL_NONE;
5782 } 5720 }
@@ -6129,8 +6067,8 @@ static int __init tpacpi_query_bcl_levels(acpi_handle handle)
6129 if (ACPI_SUCCESS(acpi_evaluate_object(handle, "_BCL", NULL, &buffer))) { 6067 if (ACPI_SUCCESS(acpi_evaluate_object(handle, "_BCL", NULL, &buffer))) {
6130 obj = (union acpi_object *)buffer.pointer; 6068 obj = (union acpi_object *)buffer.pointer;
6131 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { 6069 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
6132 printk(TPACPI_ERR "Unknown _BCL data, " 6070 pr_err("Unknown _BCL data, please report this to %s\n",
6133 "please report this to %s\n", TPACPI_MAIL); 6071 TPACPI_MAIL);
6134 rc = 0; 6072 rc = 0;
6135 } else { 6073 } else {
6136 rc = obj->package.count; 6074 rc = obj->package.count;
@@ -6214,18 +6152,15 @@ static void __init tpacpi_detect_brightness_capabilities(void)
6214 switch (b) { 6152 switch (b) {
6215 case 16: 6153 case 16:
6216 bright_maxlvl = 15; 6154 bright_maxlvl = 15;
6217 printk(TPACPI_INFO 6155 pr_info("detected a 16-level brightness capable ThinkPad\n");
6218 "detected a 16-level brightness capable ThinkPad\n");
6219 break; 6156 break;
6220 case 8: 6157 case 8:
6221 case 0: 6158 case 0:
6222 bright_maxlvl = 7; 6159 bright_maxlvl = 7;
6223 printk(TPACPI_INFO 6160 pr_info("detected a 8-level brightness capable ThinkPad\n");
6224 "detected a 8-level brightness capable ThinkPad\n");
6225 break; 6161 break;
6226 default: 6162 default:
6227 printk(TPACPI_ERR 6163 pr_err("Unsupported brightness interface, "
6228 "Unsupported brightness interface, "
6229 "please contact %s\n", TPACPI_MAIL); 6164 "please contact %s\n", TPACPI_MAIL);
6230 tp_features.bright_unkfw = 1; 6165 tp_features.bright_unkfw = 1;
6231 bright_maxlvl = b - 1; 6166 bright_maxlvl = b - 1;
@@ -6260,22 +6195,19 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
6260 6195
6261 if (acpi_video_backlight_support()) { 6196 if (acpi_video_backlight_support()) {
6262 if (brightness_enable > 1) { 6197 if (brightness_enable > 1) {
6263 printk(TPACPI_INFO 6198 pr_info("Standard ACPI backlight interface "
6264 "Standard ACPI backlight interface " 6199 "available, not loading native one\n");
6265 "available, not loading native one.\n");
6266 return 1; 6200 return 1;
6267 } else if (brightness_enable == 1) { 6201 } else if (brightness_enable == 1) {
6268 printk(TPACPI_WARN 6202 pr_warn("Cannot enable backlight brightness support, "
6269 "Cannot enable backlight brightness support, "
6270 "ACPI is already handling it. Refer to the " 6203 "ACPI is already handling it. Refer to the "
6271 "acpi_backlight kernel parameter\n"); 6204 "acpi_backlight kernel parameter.\n");
6272 return 1; 6205 return 1;
6273 } 6206 }
6274 } else if (tp_features.bright_acpimode && brightness_enable > 1) { 6207 } else if (tp_features.bright_acpimode && brightness_enable > 1) {
6275 printk(TPACPI_NOTICE 6208 pr_notice("Standard ACPI backlight interface not "
6276 "Standard ACPI backlight interface not " 6209 "available, thinkpad_acpi native "
6277 "available, thinkpad_acpi native " 6210 "brightness control enabled\n");
6278 "brightness control enabled\n");
6279 } 6211 }
6280 6212
6281 /* 6213 /*
@@ -6319,19 +6251,17 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
6319 if (IS_ERR(ibm_backlight_device)) { 6251 if (IS_ERR(ibm_backlight_device)) {
6320 int rc = PTR_ERR(ibm_backlight_device); 6252 int rc = PTR_ERR(ibm_backlight_device);
6321 ibm_backlight_device = NULL; 6253 ibm_backlight_device = NULL;
6322 printk(TPACPI_ERR "Could not register backlight device\n"); 6254 pr_err("Could not register backlight device\n");
6323 return rc; 6255 return rc;
6324 } 6256 }
6325 vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT, 6257 vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_BRGHT,
6326 "brightness is supported\n"); 6258 "brightness is supported\n");
6327 6259
6328 if (quirks & TPACPI_BRGHT_Q_ASK) { 6260 if (quirks & TPACPI_BRGHT_Q_ASK) {
6329 printk(TPACPI_NOTICE 6261 pr_notice("brightness: will use unverified default: "
6330 "brightness: will use unverified default: " 6262 "brightness_mode=%d\n", brightness_mode);
6331 "brightness_mode=%d\n", brightness_mode); 6263 pr_notice("brightness: please report to %s whether it works well "
6332 printk(TPACPI_NOTICE 6264 "or not on your ThinkPad\n", TPACPI_MAIL);
6333 "brightness: please report to %s whether it works well "
6334 "or not on your ThinkPad\n", TPACPI_MAIL);
6335 } 6265 }
6336 6266
6337 /* Added by mistake in early 2007. Probably useless, but it could 6267 /* Added by mistake in early 2007. Probably useless, but it could
@@ -6804,8 +6734,7 @@ static int __init volume_create_alsa_mixer(void)
6804 rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, 6734 rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE,
6805 sizeof(struct tpacpi_alsa_data), &card); 6735 sizeof(struct tpacpi_alsa_data), &card);
6806 if (rc < 0 || !card) { 6736 if (rc < 0 || !card) {
6807 printk(TPACPI_ERR 6737 pr_err("Failed to create ALSA card structures: %d\n", rc);
6808 "Failed to create ALSA card structures: %d\n", rc);
6809 return 1; 6738 return 1;
6810 } 6739 }
6811 6740
@@ -6839,9 +6768,8 @@ static int __init volume_create_alsa_mixer(void)
6839 ctl_vol = snd_ctl_new1(&volume_alsa_control_vol, NULL); 6768 ctl_vol = snd_ctl_new1(&volume_alsa_control_vol, NULL);
6840 rc = snd_ctl_add(card, ctl_vol); 6769 rc = snd_ctl_add(card, ctl_vol);
6841 if (rc < 0) { 6770 if (rc < 0) {
6842 printk(TPACPI_ERR 6771 pr_err("Failed to create ALSA volume control: %d\n",
6843 "Failed to create ALSA volume control: %d\n", 6772 rc);
6844 rc);
6845 goto err_exit; 6773 goto err_exit;
6846 } 6774 }
6847 data->ctl_vol_id = &ctl_vol->id; 6775 data->ctl_vol_id = &ctl_vol->id;
@@ -6850,8 +6778,7 @@ static int __init volume_create_alsa_mixer(void)
6850 ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); 6778 ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL);
6851 rc = snd_ctl_add(card, ctl_mute); 6779 rc = snd_ctl_add(card, ctl_mute);
6852 if (rc < 0) { 6780 if (rc < 0) {
6853 printk(TPACPI_ERR "Failed to create ALSA mute control: %d\n", 6781 pr_err("Failed to create ALSA mute control: %d\n", rc);
6854 rc);
6855 goto err_exit; 6782 goto err_exit;
6856 } 6783 }
6857 data->ctl_mute_id = &ctl_mute->id; 6784 data->ctl_mute_id = &ctl_mute->id;
@@ -6859,7 +6786,7 @@ static int __init volume_create_alsa_mixer(void)
6859 snd_card_set_dev(card, &tpacpi_pdev->dev); 6786 snd_card_set_dev(card, &tpacpi_pdev->dev);
6860 rc = snd_card_register(card); 6787 rc = snd_card_register(card);
6861 if (rc < 0) { 6788 if (rc < 0) {
6862 printk(TPACPI_ERR "Failed to register ALSA card: %d\n", rc); 6789 pr_err("Failed to register ALSA card: %d\n", rc);
6863 goto err_exit; 6790 goto err_exit;
6864 } 6791 }
6865 6792
@@ -6915,9 +6842,8 @@ static int __init volume_init(struct ibm_init_struct *iibm)
6915 return -EINVAL; 6842 return -EINVAL;
6916 6843
6917 if (volume_mode == TPACPI_VOL_MODE_UCMS_STEP) { 6844 if (volume_mode == TPACPI_VOL_MODE_UCMS_STEP) {
6918 printk(TPACPI_ERR 6845 pr_err("UCMS step volume mode not implemented, "
6919 "UCMS step volume mode not implemented, " 6846 "please contact %s\n", TPACPI_MAIL);
6920 "please contact %s\n", TPACPI_MAIL);
6921 return 1; 6847 return 1;
6922 } 6848 }
6923 6849
@@ -6981,13 +6907,11 @@ static int __init volume_init(struct ibm_init_struct *iibm)
6981 6907
6982 rc = volume_create_alsa_mixer(); 6908 rc = volume_create_alsa_mixer();
6983 if (rc) { 6909 if (rc) {
6984 printk(TPACPI_ERR 6910 pr_err("Could not create the ALSA mixer interface\n");
6985 "Could not create the ALSA mixer interface\n");
6986 return rc; 6911 return rc;
6987 } 6912 }
6988 6913
6989 printk(TPACPI_INFO 6914 pr_info("Console audio control enabled, mode: %s\n",
6990 "Console audio control enabled, mode: %s\n",
6991 (volume_control_allowed) ? 6915 (volume_control_allowed) ?
6992 "override (read/write)" : 6916 "override (read/write)" :
6993 "monitor (read only)"); 6917 "monitor (read only)");
@@ -7049,12 +6973,10 @@ static int volume_write(char *buf)
7049 if (!volume_control_allowed && tpacpi_lifecycle != TPACPI_LIFE_INIT) { 6973 if (!volume_control_allowed && tpacpi_lifecycle != TPACPI_LIFE_INIT) {
7050 if (unlikely(!tp_warned.volume_ctrl_forbidden)) { 6974 if (unlikely(!tp_warned.volume_ctrl_forbidden)) {
7051 tp_warned.volume_ctrl_forbidden = 1; 6975 tp_warned.volume_ctrl_forbidden = 1;
7052 printk(TPACPI_NOTICE 6976 pr_notice("Console audio control in monitor mode, "
7053 "Console audio control in monitor mode, " 6977 "changes are not allowed\n");
7054 "changes are not allowed.\n"); 6978 pr_notice("Use the volume_control=1 module parameter "
7055 printk(TPACPI_NOTICE 6979 "to enable volume control\n");
7056 "Use the volume_control=1 module parameter "
7057 "to enable volume control\n");
7058 } 6980 }
7059 return -EPERM; 6981 return -EPERM;
7060 } 6982 }
@@ -7129,8 +7051,7 @@ static void inline volume_alsa_notify_change(void)
7129 7051
7130static int __init volume_init(struct ibm_init_struct *iibm) 7052static int __init volume_init(struct ibm_init_struct *iibm)
7131{ 7053{
7132 printk(TPACPI_INFO 7054 pr_info("volume: disabled as there is no ALSA support in this kernel\n");
7133 "volume: disabled as there is no ALSA support in this kernel\n");
7134 7055
7135 return 1; 7056 return 1;
7136} 7057}
@@ -7337,9 +7258,8 @@ TPACPI_HANDLE(sfan, ec, "SFAN", /* 570 */
7337static void fan_quirk1_setup(void) 7258static void fan_quirk1_setup(void)
7338{ 7259{
7339 if (fan_control_initial_status == 0x07) { 7260 if (fan_control_initial_status == 0x07) {
7340 printk(TPACPI_NOTICE 7261 pr_notice("fan_init: initial fan status is unknown, "
7341 "fan_init: initial fan status is unknown, " 7262 "assuming it is in auto mode\n");
7342 "assuming it is in auto mode\n");
7343 tp_features.fan_ctrl_status_undef = 1; 7263 tp_features.fan_ctrl_status_undef = 1;
7344 } 7264 }
7345} 7265}
@@ -7726,8 +7646,7 @@ static void fan_watchdog_reset(void)
7726 if (!queue_delayed_work(tpacpi_wq, &fan_watchdog_task, 7646 if (!queue_delayed_work(tpacpi_wq, &fan_watchdog_task,
7727 msecs_to_jiffies(fan_watchdog_maxinterval 7647 msecs_to_jiffies(fan_watchdog_maxinterval
7728 * 1000))) { 7648 * 1000))) {
7729 printk(TPACPI_ERR 7649 pr_err("failed to queue the fan watchdog, "
7730 "failed to queue the fan watchdog, "
7731 "watchdog will not trigger\n"); 7650 "watchdog will not trigger\n");
7732 } 7651 }
7733 } else 7652 } else
@@ -7741,11 +7660,11 @@ static void fan_watchdog_fire(struct work_struct *ignored)
7741 if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING) 7660 if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING)
7742 return; 7661 return;
7743 7662
7744 printk(TPACPI_NOTICE "fan watchdog: enabling fan\n"); 7663 pr_notice("fan watchdog: enabling fan\n");
7745 rc = fan_set_enable(); 7664 rc = fan_set_enable();
7746 if (rc < 0) { 7665 if (rc < 0) {
7747 printk(TPACPI_ERR "fan watchdog: error %d while enabling fan, " 7666 pr_err("fan watchdog: error %d while enabling fan, "
7748 "will try again later...\n", -rc); 7667 "will try again later...\n", -rc);
7749 /* reschedule for later */ 7668 /* reschedule for later */
7750 fan_watchdog_reset(); 7669 fan_watchdog_reset();
7751 } 7670 }
@@ -8049,8 +7968,7 @@ static int __init fan_init(struct ibm_init_struct *iibm)
8049 "secondary fan support enabled\n"); 7968 "secondary fan support enabled\n");
8050 } 7969 }
8051 } else { 7970 } else {
8052 printk(TPACPI_ERR 7971 pr_err("ThinkPad ACPI EC access misbehaving, "
8053 "ThinkPad ACPI EC access misbehaving, "
8054 "fan status and control unavailable\n"); 7972 "fan status and control unavailable\n");
8055 return 1; 7973 return 1;
8056 } 7974 }
@@ -8150,9 +8068,8 @@ static void fan_suspend(pm_message_t state)
8150 fan_control_resume_level = 0; 8068 fan_control_resume_level = 0;
8151 rc = fan_get_status_safe(&fan_control_resume_level); 8069 rc = fan_get_status_safe(&fan_control_resume_level);
8152 if (rc < 0) 8070 if (rc < 0)
8153 printk(TPACPI_NOTICE 8071 pr_notice("failed to read fan level for later "
8154 "failed to read fan level for later " 8072 "restore during resume: %d\n", rc);
8155 "restore during resume: %d\n", rc);
8156 8073
8157 /* if it is undefined, don't attempt to restore it. 8074 /* if it is undefined, don't attempt to restore it.
8158 * KEEP THIS LAST */ 8075 * KEEP THIS LAST */
@@ -8207,13 +8124,11 @@ static void fan_resume(void)
8207 return; 8124 return;
8208 } 8125 }
8209 if (do_set) { 8126 if (do_set) {
8210 printk(TPACPI_NOTICE 8127 pr_notice("restoring fan level to 0x%02x\n",
8211 "restoring fan level to 0x%02x\n", 8128 fan_control_resume_level);
8212 fan_control_resume_level);
8213 rc = fan_set_level_safe(fan_control_resume_level); 8129 rc = fan_set_level_safe(fan_control_resume_level);
8214 if (rc < 0) 8130 if (rc < 0)
8215 printk(TPACPI_NOTICE 8131 pr_notice("failed to restore fan level: %d\n", rc);
8216 "failed to restore fan level: %d\n", rc);
8217 } 8132 }
8218} 8133}
8219 8134
@@ -8305,8 +8220,8 @@ static int fan_write_cmd_level(const char *cmd, int *rc)
8305 8220
8306 *rc = fan_set_level_safe(level); 8221 *rc = fan_set_level_safe(level);
8307 if (*rc == -ENXIO) 8222 if (*rc == -ENXIO)
8308 printk(TPACPI_ERR "level command accepted for unsupported " 8223 pr_err("level command accepted for unsupported access mode %d\n",
8309 "access mode %d", fan_control_access_mode); 8224 fan_control_access_mode);
8310 else if (!*rc) 8225 else if (!*rc)
8311 tpacpi_disclose_usertask("procfs fan", 8226 tpacpi_disclose_usertask("procfs fan",
8312 "set level to %d\n", level); 8227 "set level to %d\n", level);
@@ -8321,8 +8236,8 @@ static int fan_write_cmd_enable(const char *cmd, int *rc)
8321 8236
8322 *rc = fan_set_enable(); 8237 *rc = fan_set_enable();
8323 if (*rc == -ENXIO) 8238 if (*rc == -ENXIO)
8324 printk(TPACPI_ERR "enable command accepted for unsupported " 8239 pr_err("enable command accepted for unsupported access mode %d\n",
8325 "access mode %d", fan_control_access_mode); 8240 fan_control_access_mode);
8326 else if (!*rc) 8241 else if (!*rc)
8327 tpacpi_disclose_usertask("procfs fan", "enable\n"); 8242 tpacpi_disclose_usertask("procfs fan", "enable\n");
8328 8243
@@ -8336,8 +8251,8 @@ static int fan_write_cmd_disable(const char *cmd, int *rc)
8336 8251
8337 *rc = fan_set_disable(); 8252 *rc = fan_set_disable();
8338 if (*rc == -ENXIO) 8253 if (*rc == -ENXIO)
8339 printk(TPACPI_ERR "disable command accepted for unsupported " 8254 pr_err("disable command accepted for unsupported access mode %d\n",
8340 "access mode %d", fan_control_access_mode); 8255 fan_control_access_mode);
8341 else if (!*rc) 8256 else if (!*rc)
8342 tpacpi_disclose_usertask("procfs fan", "disable\n"); 8257 tpacpi_disclose_usertask("procfs fan", "disable\n");
8343 8258
@@ -8356,8 +8271,8 @@ static int fan_write_cmd_speed(const char *cmd, int *rc)
8356 8271
8357 *rc = fan_set_speed(speed); 8272 *rc = fan_set_speed(speed);
8358 if (*rc == -ENXIO) 8273 if (*rc == -ENXIO)
8359 printk(TPACPI_ERR "speed command accepted for unsupported " 8274 pr_err("speed command accepted for unsupported access mode %d\n",
8360 "access mode %d", fan_control_access_mode); 8275 fan_control_access_mode);
8361 else if (!*rc) 8276 else if (!*rc)
8362 tpacpi_disclose_usertask("procfs fan", 8277 tpacpi_disclose_usertask("procfs fan",
8363 "set speed to %d\n", speed); 8278 "set speed to %d\n", speed);
@@ -8560,8 +8475,8 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
8560 if (ibm->acpi->notify) { 8475 if (ibm->acpi->notify) {
8561 ret = setup_acpi_notify(ibm); 8476 ret = setup_acpi_notify(ibm);
8562 if (ret == -ENODEV) { 8477 if (ret == -ENODEV) {
8563 printk(TPACPI_NOTICE "disabling subdriver %s\n", 8478 pr_notice("disabling subdriver %s\n",
8564 ibm->name); 8479 ibm->name);
8565 ret = 0; 8480 ret = 0;
8566 goto err_out; 8481 goto err_out;
8567 } 8482 }
@@ -8583,8 +8498,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
8583 entry = proc_create_data(ibm->name, mode, proc_dir, 8498 entry = proc_create_data(ibm->name, mode, proc_dir,
8584 &dispatch_proc_fops, ibm); 8499 &dispatch_proc_fops, ibm);
8585 if (!entry) { 8500 if (!entry) {
8586 printk(TPACPI_ERR "unable to create proc entry %s\n", 8501 pr_err("unable to create proc entry %s\n", ibm->name);
8587 ibm->name);
8588 ret = -ENODEV; 8502 ret = -ENODEV;
8589 goto err_out; 8503 goto err_out;
8590 } 8504 }
@@ -8683,13 +8597,11 @@ static int __must_check __init get_thinkpad_model_data(
8683 tp->ec_release = (ec_fw_string[4] << 8) 8597 tp->ec_release = (ec_fw_string[4] << 8)
8684 | ec_fw_string[5]; 8598 | ec_fw_string[5];
8685 } else { 8599 } else {
8686 printk(TPACPI_NOTICE 8600 pr_notice("ThinkPad firmware release %s "
8687 "ThinkPad firmware release %s " 8601 "doesn't match the known patterns\n",
8688 "doesn't match the known patterns\n", 8602 ec_fw_string);
8689 ec_fw_string); 8603 pr_notice("please report this to %s\n",
8690 printk(TPACPI_NOTICE 8604 TPACPI_MAIL);
8691 "please report this to %s\n",
8692 TPACPI_MAIL);
8693 } 8605 }
8694 break; 8606 break;
8695 } 8607 }
@@ -8733,8 +8645,7 @@ static int __init probe_for_thinkpad(void)
8733 tpacpi_acpi_handle_locate("ec", TPACPI_ACPI_EC_HID, &ec_handle); 8645 tpacpi_acpi_handle_locate("ec", TPACPI_ACPI_EC_HID, &ec_handle);
8734 if (!ec_handle) { 8646 if (!ec_handle) {
8735 if (is_thinkpad) 8647 if (is_thinkpad)
8736 printk(TPACPI_ERR 8648 pr_err("Not yet supported ThinkPad detected!\n");
8737 "Not yet supported ThinkPad detected!\n");
8738 return -ENODEV; 8649 return -ENODEV;
8739 } 8650 }
8740 8651
@@ -8746,10 +8657,10 @@ static int __init probe_for_thinkpad(void)
8746 8657
8747static void __init thinkpad_acpi_init_banner(void) 8658static void __init thinkpad_acpi_init_banner(void)
8748{ 8659{
8749 printk(TPACPI_INFO "%s v%s\n", TPACPI_DESC, TPACPI_VERSION); 8660 pr_info("%s v%s\n", TPACPI_DESC, TPACPI_VERSION);
8750 printk(TPACPI_INFO "%s\n", TPACPI_URL); 8661 pr_info("%s\n", TPACPI_URL);
8751 8662
8752 printk(TPACPI_INFO "ThinkPad BIOS %s, EC %s\n", 8663 pr_info("ThinkPad BIOS %s, EC %s\n",
8753 (thinkpad_id.bios_version_str) ? 8664 (thinkpad_id.bios_version_str) ?
8754 thinkpad_id.bios_version_str : "unknown", 8665 thinkpad_id.bios_version_str : "unknown",
8755 (thinkpad_id.ec_version_str) ? 8666 (thinkpad_id.ec_version_str) ?
@@ -8758,7 +8669,7 @@ static void __init thinkpad_acpi_init_banner(void)
8758 BUG_ON(!thinkpad_id.vendor); 8669 BUG_ON(!thinkpad_id.vendor);
8759 8670
8760 if (thinkpad_id.model_str) 8671 if (thinkpad_id.model_str)
8761 printk(TPACPI_INFO "%s %s, model %s\n", 8672 pr_info("%s %s, model %s\n",
8762 (thinkpad_id.vendor == PCI_VENDOR_ID_IBM) ? 8673 (thinkpad_id.vendor == PCI_VENDOR_ID_IBM) ?
8763 "IBM" : ((thinkpad_id.vendor == 8674 "IBM" : ((thinkpad_id.vendor ==
8764 PCI_VENDOR_ID_LENOVO) ? 8675 PCI_VENDOR_ID_LENOVO) ?
@@ -9024,8 +8935,7 @@ static int __init thinkpad_acpi_module_init(void)
9024 8935
9025 ret = get_thinkpad_model_data(&thinkpad_id); 8936 ret = get_thinkpad_model_data(&thinkpad_id);
9026 if (ret) { 8937 if (ret) {
9027 printk(TPACPI_ERR 8938 pr_err("unable to get DMI data: %d\n", ret);
9028 "unable to get DMI data: %d\n", ret);
9029 thinkpad_acpi_module_exit(); 8939 thinkpad_acpi_module_exit();
9030 return ret; 8940 return ret;
9031 } 8941 }
@@ -9051,16 +8961,14 @@ static int __init thinkpad_acpi_module_init(void)
9051 8961
9052 proc_dir = proc_mkdir(TPACPI_PROC_DIR, acpi_root_dir); 8962 proc_dir = proc_mkdir(TPACPI_PROC_DIR, acpi_root_dir);
9053 if (!proc_dir) { 8963 if (!proc_dir) {
9054 printk(TPACPI_ERR 8964 pr_err("unable to create proc dir " TPACPI_PROC_DIR "\n");
9055 "unable to create proc dir " TPACPI_PROC_DIR);
9056 thinkpad_acpi_module_exit(); 8965 thinkpad_acpi_module_exit();
9057 return -ENODEV; 8966 return -ENODEV;
9058 } 8967 }
9059 8968
9060 ret = platform_driver_register(&tpacpi_pdriver); 8969 ret = platform_driver_register(&tpacpi_pdriver);
9061 if (ret) { 8970 if (ret) {
9062 printk(TPACPI_ERR 8971 pr_err("unable to register main platform driver\n");
9063 "unable to register main platform driver\n");
9064 thinkpad_acpi_module_exit(); 8972 thinkpad_acpi_module_exit();
9065 return ret; 8973 return ret;
9066 } 8974 }
@@ -9068,8 +8976,7 @@ static int __init thinkpad_acpi_module_init(void)
9068 8976
9069 ret = platform_driver_register(&tpacpi_hwmon_pdriver); 8977 ret = platform_driver_register(&tpacpi_hwmon_pdriver);
9070 if (ret) { 8978 if (ret) {
9071 printk(TPACPI_ERR 8979 pr_err("unable to register hwmon platform driver\n");
9072 "unable to register hwmon platform driver\n");
9073 thinkpad_acpi_module_exit(); 8980 thinkpad_acpi_module_exit();
9074 return ret; 8981 return ret;
9075 } 8982 }
@@ -9082,8 +8989,7 @@ static int __init thinkpad_acpi_module_init(void)
9082 &tpacpi_hwmon_pdriver.driver); 8989 &tpacpi_hwmon_pdriver.driver);
9083 } 8990 }
9084 if (ret) { 8991 if (ret) {
9085 printk(TPACPI_ERR 8992 pr_err("unable to create sysfs driver attributes\n");
9086 "unable to create sysfs driver attributes\n");
9087 thinkpad_acpi_module_exit(); 8993 thinkpad_acpi_module_exit();
9088 return ret; 8994 return ret;
9089 } 8995 }
@@ -9096,7 +9002,7 @@ static int __init thinkpad_acpi_module_init(void)
9096 if (IS_ERR(tpacpi_pdev)) { 9002 if (IS_ERR(tpacpi_pdev)) {
9097 ret = PTR_ERR(tpacpi_pdev); 9003 ret = PTR_ERR(tpacpi_pdev);
9098 tpacpi_pdev = NULL; 9004 tpacpi_pdev = NULL;
9099 printk(TPACPI_ERR "unable to register platform device\n"); 9005 pr_err("unable to register platform device\n");
9100 thinkpad_acpi_module_exit(); 9006 thinkpad_acpi_module_exit();
9101 return ret; 9007 return ret;
9102 } 9008 }
@@ -9106,16 +9012,14 @@ static int __init thinkpad_acpi_module_init(void)
9106 if (IS_ERR(tpacpi_sensors_pdev)) { 9012 if (IS_ERR(tpacpi_sensors_pdev)) {
9107 ret = PTR_ERR(tpacpi_sensors_pdev); 9013 ret = PTR_ERR(tpacpi_sensors_pdev);
9108 tpacpi_sensors_pdev = NULL; 9014 tpacpi_sensors_pdev = NULL;
9109 printk(TPACPI_ERR 9015 pr_err("unable to register hwmon platform device\n");
9110 "unable to register hwmon platform device\n");
9111 thinkpad_acpi_module_exit(); 9016 thinkpad_acpi_module_exit();
9112 return ret; 9017 return ret;
9113 } 9018 }
9114 ret = device_create_file(&tpacpi_sensors_pdev->dev, 9019 ret = device_create_file(&tpacpi_sensors_pdev->dev,
9115 &dev_attr_thinkpad_acpi_pdev_name); 9020 &dev_attr_thinkpad_acpi_pdev_name);
9116 if (ret) { 9021 if (ret) {
9117 printk(TPACPI_ERR 9022 pr_err("unable to create sysfs hwmon device attributes\n");
9118 "unable to create sysfs hwmon device attributes\n");
9119 thinkpad_acpi_module_exit(); 9023 thinkpad_acpi_module_exit();
9120 return ret; 9024 return ret;
9121 } 9025 }
@@ -9124,14 +9028,14 @@ static int __init thinkpad_acpi_module_init(void)
9124 if (IS_ERR(tpacpi_hwmon)) { 9028 if (IS_ERR(tpacpi_hwmon)) {
9125 ret = PTR_ERR(tpacpi_hwmon); 9029 ret = PTR_ERR(tpacpi_hwmon);
9126 tpacpi_hwmon = NULL; 9030 tpacpi_hwmon = NULL;
9127 printk(TPACPI_ERR "unable to register hwmon device\n"); 9031 pr_err("unable to register hwmon device\n");
9128 thinkpad_acpi_module_exit(); 9032 thinkpad_acpi_module_exit();
9129 return ret; 9033 return ret;
9130 } 9034 }
9131 mutex_init(&tpacpi_inputdev_send_mutex); 9035 mutex_init(&tpacpi_inputdev_send_mutex);
9132 tpacpi_inputdev = input_allocate_device(); 9036 tpacpi_inputdev = input_allocate_device();
9133 if (!tpacpi_inputdev) { 9037 if (!tpacpi_inputdev) {
9134 printk(TPACPI_ERR "unable to allocate input device\n"); 9038 pr_err("unable to allocate input device\n");
9135 thinkpad_acpi_module_exit(); 9039 thinkpad_acpi_module_exit();
9136 return -ENOMEM; 9040 return -ENOMEM;
9137 } else { 9041 } else {
@@ -9163,7 +9067,7 @@ static int __init thinkpad_acpi_module_init(void)
9163 9067
9164 ret = input_register_device(tpacpi_inputdev); 9068 ret = input_register_device(tpacpi_inputdev);
9165 if (ret < 0) { 9069 if (ret < 0) {
9166 printk(TPACPI_ERR "unable to register input device\n"); 9070 pr_err("unable to register input device\n");
9167 thinkpad_acpi_module_exit(); 9071 thinkpad_acpi_module_exit();
9168 return ret; 9072 return ret;
9169 } else { 9073 } else {