aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2011-05-29 14:27:13 -0400
committerMatthew Garrett <mjg@redhat.com>2011-05-29 14:27:13 -0400
commit437cb0dbd104a1564e0e78f0d486b97677f80909 (patch)
treee066b3d65eb965ca68ecc8ef14581f2450ad3a61
parent139f37f5e14cd883eee2a8a36289f544b5390a44 (diff)
parent987dfbaa65b2c3568b85e29d2598da08a011ee09 (diff)
Merge branch 'x86-platform-next' into x86-platform
-rw-r--r--Documentation/laptops/acer-wmi.txt184
-rw-r--r--MAINTAINERS11
-rw-r--r--drivers/platform/x86/Kconfig11
-rw-r--r--drivers/platform/x86/Makefile3
-rw-r--r--drivers/platform/x86/acer-wmi.c184
-rw-r--r--drivers/platform/x86/acerhdf.c4
-rw-r--r--drivers/platform/x86/asus-laptop.c34
-rw-r--r--drivers/platform/x86/asus-wmi.c22
-rw-r--r--drivers/platform/x86/asus_acpi.c77
-rw-r--r--drivers/platform/x86/compal-laptop.c22
-rw-r--r--drivers/platform/x86/dell-laptop.c12
-rw-r--r--drivers/platform/x86/dell-wmi-aio.c3
-rw-r--r--drivers/platform/x86/dell-wmi.c17
-rw-r--r--drivers/platform/x86/eeepc-laptop.c21
-rw-r--r--drivers/platform/x86/eeepc-wmi.c14
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c39
-rw-r--r--drivers/platform/x86/hdaps.c19
-rw-r--r--drivers/platform/x86/hp-wmi.c43
-rw-r--r--drivers/platform/x86/ibm_rtl.c23
-rw-r--r--drivers/platform/x86/ideapad-laptop.c2
-rw-r--r--drivers/platform/x86/intel_menlow.c5
-rw-r--r--drivers/platform/x86/intel_mid_powerbtn.c72
-rw-r--r--drivers/platform/x86/intel_mid_thermal.c607
-rw-r--r--drivers/platform/x86/intel_oaktrail.c396
-rw-r--r--drivers/platform/x86/intel_pmic_gpio.c14
-rw-r--r--drivers/platform/x86/msi-laptop.c11
-rw-r--r--drivers/platform/x86/msi-wmi.c45
-rw-r--r--drivers/platform/x86/sony-laptop.c106
-rw-r--r--drivers/platform/x86/tc1100-wmi.c7
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c490
-rw-r--r--drivers/platform/x86/topstar-laptop.c2
-rw-r--r--drivers/platform/x86/toshiba_acpi.c59
-rw-r--r--drivers/platform/x86/toshiba_bluetooth.c11
-rw-r--r--drivers/platform/x86/wmi.c10
-rw-r--r--drivers/platform/x86/xo15-ebook.c5
35 files changed, 1393 insertions, 1192 deletions
diff --git a/Documentation/laptops/acer-wmi.txt b/Documentation/laptops/acer-wmi.txt
deleted file mode 100644
index 4beafa663dd6..000000000000
--- a/Documentation/laptops/acer-wmi.txt
+++ /dev/null
@@ -1,184 +0,0 @@
1Acer Laptop WMI Extras Driver
2http://code.google.com/p/aceracpi
3Version 0.3
44th April 2009
5
6Copyright 2007-2009 Carlos Corbacho <carlos@strangeworlds.co.uk>
7
8acer-wmi is a driver to allow you to control various parts of your Acer laptop
9hardware under Linux which are exposed via ACPI-WMI.
10
11This driver completely replaces the old out-of-tree acer_acpi, which I am
12currently maintaining for bug fixes only on pre-2.6.25 kernels. All development
13work is now focused solely on acer-wmi.
14
15Disclaimer
16**********
17
18Acer and Wistron have provided nothing towards the development acer_acpi or
19acer-wmi. All information we have has been through the efforts of the developers
20and the users to discover as much as possible about the hardware.
21
22As such, I do warn that this could break your hardware - this is extremely
23unlikely of course, but please bear this in mind.
24
25Background
26**********
27
28acer-wmi is derived from acer_acpi, originally developed by Mark
29Smith in 2005, then taken over by Carlos Corbacho in 2007, in order to activate
30the wireless LAN card under a 64-bit version of Linux, as acerhk[1] (the
31previous solution to the problem) relied on making 32 bit BIOS calls which are
32not possible in kernel space from a 64 bit OS.
33
34[1] acerhk: http://www.cakey.de/acerhk/
35
36Supported Hardware
37******************
38
39NOTE: The Acer Aspire One is not supported hardware. It cannot work with
40acer-wmi until Acer fix their ACPI-WMI implementation on them, so has been
41blacklisted until that happens.
42
43Please see the website for the current list of known working hardware:
44
45http://code.google.com/p/aceracpi/wiki/SupportedHardware
46
47If your laptop is not listed, or listed as unknown, and works with acer-wmi,
48please contact me with a copy of the DSDT.
49
50If your Acer laptop doesn't work with acer-wmi, I would also like to see the
51DSDT.
52
53To send me the DSDT, as root/sudo:
54
55cat /sys/firmware/acpi/tables/DSDT > dsdt
56
57And send me the resulting 'dsdt' file.
58
59Usage
60*****
61
62On Acer laptops, acer-wmi should already be autoloaded based on DMI matching.
63For non-Acer laptops, until WMI based autoloading support is added, you will
64need to manually load acer-wmi.
65
66acer-wmi creates /sys/devices/platform/acer-wmi, and fills it with various
67files whose usage is detailed below, which enables you to control some of the
68following (varies between models):
69
70* the wireless LAN card radio
71* inbuilt Bluetooth adapter
72* inbuilt 3G card
73* mail LED of your laptop
74* brightness of the LCD panel
75
76Wireless
77********
78
79With regards to wireless, all acer-wmi does is enable the radio on the card. It
80is not responsible for the wireless LED - once the radio is enabled, this is
81down to the wireless driver for your card. So the behaviour of the wireless LED,
82once you enable the radio, will depend on your hardware and driver combination.
83
84e.g. With the BCM4318 on the Acer Aspire 5020 series:
85
86ndiswrapper: Light blinks on when transmitting
87b43: Solid light, blinks off when transmitting
88
89Wireless radio control is unconditionally enabled - all Acer laptops that support
90acer-wmi come with built-in wireless. However, should you feel so inclined to
91ever wish to remove the card, or swap it out at some point, please get in touch
92with me, as we may well be able to gain some data on wireless card detection.
93
94The wireless radio is exposed through rfkill.
95
96Bluetooth
97*********
98
99For bluetooth, this is an internal USB dongle, so once enabled, you will get
100a USB device connection event, and a new USB device appears. When you disable
101bluetooth, you get the reverse - a USB device disconnect event, followed by the
102device disappearing again.
103
104Bluetooth is autodetected by acer-wmi, so if you do not have a bluetooth module
105installed in your laptop, this file won't exist (please be aware that it is
106quite common for Acer not to fit bluetooth to their laptops - so just because
107you have a bluetooth button on the laptop, doesn't mean that bluetooth is
108installed).
109
110For the adventurously minded - if you want to buy an internal bluetooth
111module off the internet that is compatible with your laptop and fit it, then
112it will work just fine with acer-wmi.
113
114Bluetooth is exposed through rfkill.
115
1163G
117**
118
1193G is currently not autodetected, so the 'threeg' file is always created under
120sysfs. So far, no-one in possession of an Acer laptop with 3G built-in appears to
121have tried Linux, or reported back, so we don't have any information on this.
122
123If you have an Acer laptop that does have a 3G card in, please contact me so we
124can properly detect these, and find out a bit more about them.
125
126To read the status of the 3G card (0=off, 1=on):
127cat /sys/devices/platform/acer-wmi/threeg
128
129To enable the 3G card:
130echo 1 > /sys/devices/platform/acer-wmi/threeg
131
132To disable the 3G card:
133echo 0 > /sys/devices/platform/acer-wmi/threeg
134
135To set the state of the 3G card when loading acer-wmi, pass:
136threeg=X (where X is 0 or 1)
137
138Mail LED
139********
140
141This can be found in most older Acer laptops supported by acer-wmi, and many
142newer ones - it is built into the 'mail' button, and blinks when active.
143
144On newer (WMID) laptops though, we have no way of detecting the mail LED. If
145your laptop identifies itself in dmesg as a WMID model, then please try loading
146acer_acpi with:
147
148force_series=2490
149
150This will use a known alternative method of reading/ writing the mail LED. If
151it works, please report back to me with the DMI data from your laptop so this
152can be added to acer-wmi.
153
154The LED is exposed through the LED subsystem, and can be found in:
155
156/sys/devices/platform/acer-wmi/leds/acer-wmi::mail/
157
158The mail LED is autodetected, so if you don't have one, the LED device won't
159be registered.
160
161Backlight
162*********
163
164The backlight brightness control is available on all acer-wmi supported
165hardware. The maximum brightness level is usually 15, but on some newer laptops
166it's 10 (this is again autodetected).
167
168The backlight is exposed through the backlight subsystem, and can be found in:
169
170/sys/devices/platform/acer-wmi/backlight/acer-wmi/
171
172Credits
173*******
174
175Olaf Tauber, who did the real hard work when he developed acerhk
176http://www.cakey.de/acerhk/
177All the authors of laptop ACPI modules in the kernel, whose work
178was an inspiration in the early days of acer_acpi
179Mathieu Segaud, who solved the problem with having to modprobe the driver
180twice in acer_acpi 0.2.
181Jim Ramsay, who added support for the WMID interface
182Mark Smith, who started the original acer_acpi
183
184And the many people who have used both acer_acpi and acer-wmi.
diff --git a/MAINTAINERS b/MAINTAINERS
index 2e94220898d7..29801f760b6f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -223,10 +223,8 @@ S: Maintained
223F: drivers/platform/x86/acerhdf.c 223F: drivers/platform/x86/acerhdf.c
224 224
225ACER WMI LAPTOP EXTRAS 225ACER WMI LAPTOP EXTRAS
226M: Carlos Corbacho <carlos@strangeworlds.co.uk> 226M: Joey Lee <jlee@novell.com>
227L: aceracpi@googlegroups.com (subscribers-only)
228L: platform-driver-x86@vger.kernel.org 227L: platform-driver-x86@vger.kernel.org
229W: http://code.google.com/p/aceracpi
230S: Maintained 228S: Maintained
231F: drivers/platform/x86/acer-wmi.c 229F: drivers/platform/x86/acer-wmi.c
232 230
@@ -271,10 +269,8 @@ S: Supported
271F: drivers/acpi/video.c 269F: drivers/acpi/video.c
272 270
273ACPI WMI DRIVER 271ACPI WMI DRIVER
274M: Carlos Corbacho <carlos@strangeworlds.co.uk>
275L: platform-driver-x86@vger.kernel.org 272L: platform-driver-x86@vger.kernel.org
276W: http://www.lesswatts.org/projects/acpi/ 273S: Orphan
277S: Maintained
278F: drivers/platform/x86/wmi.c 274F: drivers/platform/x86/wmi.c
279 275
280AD1889 ALSA SOUND DRIVER 276AD1889 ALSA SOUND DRIVER
@@ -3033,9 +3029,8 @@ S: Maintained
3033F: drivers/net/wireless/hostap/ 3029F: drivers/net/wireless/hostap/
3034 3030
3035HP COMPAQ TC1100 TABLET WMI EXTRAS DRIVER 3031HP COMPAQ TC1100 TABLET WMI EXTRAS DRIVER
3036M: Carlos Corbacho <carlos@strangeworlds.co.uk>
3037L: platform-driver-x86@vger.kernel.org 3032L: platform-driver-x86@vger.kernel.org
3038S: Odd Fixes 3033S: Orphan
3039F: drivers/platform/x86/tc1100-wmi.c 3034F: drivers/platform/x86/tc1100-wmi.c
3040 3035
3041HP100: Driver for HP 10/100 Mbit/s Voice Grade Network Adapter Series 3036HP100: Driver for HP 10/100 Mbit/s Voice Grade Network Adapter Series
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 5cb999b50f95..45e0191c35dd 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -39,7 +39,7 @@ config ACER_WMI
39 39
40config ACERHDF 40config ACERHDF
41 tristate "Acer Aspire One temperature and fan driver" 41 tristate "Acer Aspire One temperature and fan driver"
42 depends on THERMAL && THERMAL_HWMON && ACPI 42 depends on THERMAL && ACPI
43 ---help--- 43 ---help---
44 This is a driver for Acer Aspire One netbooks. It allows to access 44 This is a driver for Acer Aspire One netbooks. It allows to access
45 the temperature sensor and to control the fan. 45 the temperature sensor and to control the fan.
@@ -760,4 +760,13 @@ config MXM_WMI
760 MXM is a standard for laptop graphics cards, the WMI interface 760 MXM is a standard for laptop graphics cards, the WMI interface
761 is required for switchable nvidia graphics machines 761 is required for switchable nvidia graphics machines
762 762
763config INTEL_OAKTRAIL
764 tristate "Intel Oaktrail Platform Extras"
765 depends on ACPI
766 depends on RFKILL && BACKLIGHT_CLASS_DEVICE && ACPI
767 ---help---
768 Intel Oaktrail platform need this driver to provide interfaces to
769 enable/disable the Camera, WiFi, BT etc. devices. If in doubt, say Y
770 here; it will only load on supported platforms.
771
763endif # X86_PLATFORM_DEVICES 772endif # X86_PLATFORM_DEVICES
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index a7ab3bc7b3a1..afc1f832aa67 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -41,5 +41,6 @@ obj-$(CONFIG_XO1_RFKILL) += xo1-rfkill.o
41obj-$(CONFIG_XO15_EBOOK) += xo15-ebook.o 41obj-$(CONFIG_XO15_EBOOK) += xo15-ebook.o
42obj-$(CONFIG_IBM_RTL) += ibm_rtl.o 42obj-$(CONFIG_IBM_RTL) += ibm_rtl.o
43obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop.o 43obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop.o
44obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o
45obj-$(CONFIG_MXM_WMI) += mxm-wmi.o 44obj-$(CONFIG_MXM_WMI) += mxm-wmi.o
45obj-$(CONFIG_INTEL_MID_POWER_BUTTON) += intel_mid_powerbtn.o
46obj-$(CONFIG_INTEL_OAKTRAIL) += intel_oaktrail.o
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index ac4e7f83ce6c..005417bd429e 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -98,13 +98,26 @@ enum acer_wmi_event_ids {
98 98
99static const struct key_entry acer_wmi_keymap[] = { 99static const struct key_entry acer_wmi_keymap[] = {
100 {KE_KEY, 0x01, {KEY_WLAN} }, /* WiFi */ 100 {KE_KEY, 0x01, {KEY_WLAN} }, /* WiFi */
101 {KE_KEY, 0x03, {KEY_WLAN} }, /* WiFi */
101 {KE_KEY, 0x12, {KEY_BLUETOOTH} }, /* BT */ 102 {KE_KEY, 0x12, {KEY_BLUETOOTH} }, /* BT */
102 {KE_KEY, 0x21, {KEY_PROG1} }, /* Backup */ 103 {KE_KEY, 0x21, {KEY_PROG1} }, /* Backup */
103 {KE_KEY, 0x22, {KEY_PROG2} }, /* Arcade */ 104 {KE_KEY, 0x22, {KEY_PROG2} }, /* Arcade */
104 {KE_KEY, 0x23, {KEY_PROG3} }, /* P_Key */ 105 {KE_KEY, 0x23, {KEY_PROG3} }, /* P_Key */
105 {KE_KEY, 0x24, {KEY_PROG4} }, /* Social networking_Key */ 106 {KE_KEY, 0x24, {KEY_PROG4} }, /* Social networking_Key */
107 {KE_IGNORE, 0x41, {KEY_MUTE} },
108 {KE_IGNORE, 0x42, {KEY_PREVIOUSSONG} },
109 {KE_IGNORE, 0x43, {KEY_NEXTSONG} },
110 {KE_IGNORE, 0x44, {KEY_PLAYPAUSE} },
111 {KE_IGNORE, 0x45, {KEY_STOP} },
112 {KE_IGNORE, 0x48, {KEY_VOLUMEUP} },
113 {KE_IGNORE, 0x49, {KEY_VOLUMEDOWN} },
114 {KE_IGNORE, 0x61, {KEY_SWITCHVIDEOMODE} },
115 {KE_IGNORE, 0x62, {KEY_BRIGHTNESSUP} },
116 {KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} },
106 {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */ 117 {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */
118 {KE_IGNORE, 0x81, {KEY_SLEEP} },
107 {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad On/Off */ 119 {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad On/Off */
120 {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} },
108 {KE_END, 0} 121 {KE_END, 0}
109}; 122};
110 123
@@ -122,6 +135,7 @@ struct event_return_value {
122 */ 135 */
123#define ACER_WMID3_GDS_WIRELESS (1<<0) /* WiFi */ 136#define ACER_WMID3_GDS_WIRELESS (1<<0) /* WiFi */
124#define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */ 137#define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */
138#define ACER_WMID3_GDS_WIMAX (1<<7) /* WiMAX */
125#define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */ 139#define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */
126 140
127struct lm_input_params { 141struct lm_input_params {
@@ -737,8 +751,11 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
737 751
738 obj = (union acpi_object *) result.pointer; 752 obj = (union acpi_object *) result.pointer;
739 if (obj && obj->type == ACPI_TYPE_BUFFER && 753 if (obj && obj->type == ACPI_TYPE_BUFFER &&
740 obj->buffer.length == sizeof(u32)) { 754 (obj->buffer.length == sizeof(u32) ||
755 obj->buffer.length == sizeof(u64))) {
741 tmp = *((u32 *) obj->buffer.pointer); 756 tmp = *((u32 *) obj->buffer.pointer);
757 } else if (obj->type == ACPI_TYPE_INTEGER) {
758 tmp = (u32) obj->integer.value;
742 } else { 759 } else {
743 tmp = 0; 760 tmp = 0;
744 } 761 }
@@ -866,8 +883,11 @@ static acpi_status WMID_set_capabilities(void)
866 883
867 obj = (union acpi_object *) out.pointer; 884 obj = (union acpi_object *) out.pointer;
868 if (obj && obj->type == ACPI_TYPE_BUFFER && 885 if (obj && obj->type == ACPI_TYPE_BUFFER &&
869 obj->buffer.length == sizeof(u32)) { 886 (obj->buffer.length == sizeof(u32) ||
887 obj->buffer.length == sizeof(u64))) {
870 devices = *((u32 *) obj->buffer.pointer); 888 devices = *((u32 *) obj->buffer.pointer);
889 } else if (obj->type == ACPI_TYPE_INTEGER) {
890 devices = (u32) obj->integer.value;
871 } else { 891 } else {
872 kfree(out.pointer); 892 kfree(out.pointer);
873 return AE_ERROR; 893 return AE_ERROR;
@@ -876,7 +896,8 @@ static acpi_status WMID_set_capabilities(void)
876 dmi_walk(type_aa_dmi_decode, NULL); 896 dmi_walk(type_aa_dmi_decode, NULL);
877 if (!has_type_aa) { 897 if (!has_type_aa) {
878 interface->capability |= ACER_CAP_WIRELESS; 898 interface->capability |= ACER_CAP_WIRELESS;
879 interface->capability |= ACER_CAP_THREEG; 899 if (devices & 0x40)
900 interface->capability |= ACER_CAP_THREEG;
880 if (devices & 0x10) 901 if (devices & 0x10)
881 interface->capability |= ACER_CAP_BLUETOOTH; 902 interface->capability |= ACER_CAP_BLUETOOTH;
882 } 903 }
@@ -961,10 +982,12 @@ static void __init acer_commandline_init(void)
961 * These will all fail silently if the value given is invalid, or the 982 * These will all fail silently if the value given is invalid, or the
962 * capability isn't available on the given interface 983 * capability isn't available on the given interface
963 */ 984 */
964 set_u32(mailled, ACER_CAP_MAILLED); 985 if (mailled >= 0)
965 if (!has_type_aa) 986 set_u32(mailled, ACER_CAP_MAILLED);
987 if (!has_type_aa && threeg >= 0)
966 set_u32(threeg, ACER_CAP_THREEG); 988 set_u32(threeg, ACER_CAP_THREEG);
967 set_u32(brightness, ACER_CAP_BRIGHTNESS); 989 if (brightness >= 0)
990 set_u32(brightness, ACER_CAP_BRIGHTNESS);
968} 991}
969 992
970/* 993/*
@@ -1081,7 +1104,7 @@ static acpi_status wmid3_get_device_status(u32 *value, u16 device)
1081 return AE_ERROR; 1104 return AE_ERROR;
1082 } 1105 }
1083 if (obj->buffer.length != 8) { 1106 if (obj->buffer.length != 8) {
1084 pr_warning("Unknown buffer length %d\n", obj->buffer.length); 1107 pr_warn("Unknown buffer length %d\n", obj->buffer.length);
1085 kfree(obj); 1108 kfree(obj);
1086 return AE_ERROR; 1109 return AE_ERROR;
1087 } 1110 }
@@ -1090,8 +1113,8 @@ static acpi_status wmid3_get_device_status(u32 *value, u16 device)
1090 kfree(obj); 1113 kfree(obj);
1091 1114
1092 if (return_value.error_code || return_value.ec_return_value) 1115 if (return_value.error_code || return_value.ec_return_value)
1093 pr_warning("Get Device Status failed: " 1116 pr_warn("Get Device Status failed: 0x%x - 0x%x\n",
1094 "0x%x - 0x%x\n", return_value.error_code, 1117 return_value.error_code,
1095 return_value.ec_return_value); 1118 return_value.ec_return_value);
1096 else 1119 else
1097 *value = !!(return_value.devices & device); 1120 *value = !!(return_value.devices & device);
@@ -1124,6 +1147,114 @@ static acpi_status get_device_status(u32 *value, u32 cap)
1124 } 1147 }
1125} 1148}
1126 1149
1150static acpi_status wmid3_set_device_status(u32 value, u16 device)
1151{
1152 struct wmid3_gds_return_value return_value;
1153 acpi_status status;
1154 union acpi_object *obj;
1155 u16 devices;
1156 struct wmid3_gds_input_param params = {
1157 .function_num = 0x1,
1158 .hotkey_number = 0x01,
1159 .devices = ACER_WMID3_GDS_WIRELESS &
1160 ACER_WMID3_GDS_THREEG &
1161 ACER_WMID3_GDS_WIMAX &
1162 ACER_WMID3_GDS_BLUETOOTH,
1163 };
1164 struct acpi_buffer input = {
1165 sizeof(struct wmid3_gds_input_param),
1166 &params
1167 };
1168 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
1169 struct acpi_buffer output2 = { ACPI_ALLOCATE_BUFFER, NULL };
1170
1171 status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input, &output);
1172 if (ACPI_FAILURE(status))
1173 return status;
1174
1175 obj = output.pointer;
1176
1177 if (!obj)
1178 return AE_ERROR;
1179 else if (obj->type != ACPI_TYPE_BUFFER) {
1180 kfree(obj);
1181 return AE_ERROR;
1182 }
1183 if (obj->buffer.length != 8) {
1184 pr_warning("Unknown buffer length %d\n", obj->buffer.length);
1185 kfree(obj);
1186 return AE_ERROR;
1187 }
1188
1189 return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
1190 kfree(obj);
1191
1192 if (return_value.error_code || return_value.ec_return_value) {
1193 pr_warning("Get Current Device Status failed: "
1194 "0x%x - 0x%x\n", return_value.error_code,
1195 return_value.ec_return_value);
1196 return status;
1197 }
1198
1199 devices = return_value.devices;
1200 params.function_num = 0x2;
1201 params.hotkey_number = 0x01;
1202 params.devices = (value) ? (devices | device) : (devices & ~device);
1203
1204 status = wmi_evaluate_method(WMID_GUID3, 0, 0x1, &input, &output2);
1205 if (ACPI_FAILURE(status))
1206 return status;
1207
1208 obj = output2.pointer;
1209
1210 if (!obj)
1211 return AE_ERROR;
1212 else if (obj->type != ACPI_TYPE_BUFFER) {
1213 kfree(obj);
1214 return AE_ERROR;
1215 }
1216 if (obj->buffer.length != 4) {
1217 pr_warning("Unknown buffer length %d\n", obj->buffer.length);
1218 kfree(obj);
1219 return AE_ERROR;
1220 }
1221
1222 return_value = *((struct wmid3_gds_return_value *)obj->buffer.pointer);
1223 kfree(obj);
1224
1225 if (return_value.error_code || return_value.ec_return_value)
1226 pr_warning("Set Device Status failed: "
1227 "0x%x - 0x%x\n", return_value.error_code,
1228 return_value.ec_return_value);
1229
1230 return status;
1231}
1232
1233static acpi_status set_device_status(u32 value, u32 cap)
1234{
1235 if (wmi_has_guid(WMID_GUID3)) {
1236 u16 device;
1237
1238 switch (cap) {
1239 case ACER_CAP_WIRELESS:
1240 device = ACER_WMID3_GDS_WIRELESS;
1241 break;
1242 case ACER_CAP_BLUETOOTH:
1243 device = ACER_WMID3_GDS_BLUETOOTH;
1244 break;
1245 case ACER_CAP_THREEG:
1246 device = ACER_WMID3_GDS_THREEG;
1247 break;
1248 default:
1249 return AE_ERROR;
1250 }
1251 return wmid3_set_device_status(value, device);
1252
1253 } else {
1254 return set_u32(value, cap);
1255 }
1256}
1257
1127/* 1258/*
1128 * Rfkill devices 1259 * Rfkill devices
1129 */ 1260 */
@@ -1160,7 +1291,7 @@ static int acer_rfkill_set(void *data, bool blocked)
1160 u32 cap = (unsigned long)data; 1291 u32 cap = (unsigned long)data;
1161 1292
1162 if (rfkill_inited) { 1293 if (rfkill_inited) {
1163 status = set_u32(!blocked, cap); 1294 status = set_device_status(!blocked, cap);
1164 if (ACPI_FAILURE(status)) 1295 if (ACPI_FAILURE(status))
1165 return -ENODEV; 1296 return -ENODEV;
1166 } 1297 }
@@ -1317,7 +1448,7 @@ static void acer_wmi_notify(u32 value, void *context)
1317 1448
1318 status = wmi_get_event_data(value, &response); 1449 status = wmi_get_event_data(value, &response);
1319 if (status != AE_OK) { 1450 if (status != AE_OK) {
1320 pr_warning("bad event status 0x%x\n", status); 1451 pr_warn("bad event status 0x%x\n", status);
1321 return; 1452 return;
1322 } 1453 }
1323 1454
@@ -1326,12 +1457,12 @@ static void acer_wmi_notify(u32 value, void *context)
1326 if (!obj) 1457 if (!obj)
1327 return; 1458 return;
1328 if (obj->type != ACPI_TYPE_BUFFER) { 1459 if (obj->type != ACPI_TYPE_BUFFER) {
1329 pr_warning("Unknown response received %d\n", obj->type); 1460 pr_warn("Unknown response received %d\n", obj->type);
1330 kfree(obj); 1461 kfree(obj);
1331 return; 1462 return;
1332 } 1463 }
1333 if (obj->buffer.length != 8) { 1464 if (obj->buffer.length != 8) {
1334 pr_warning("Unknown buffer length %d\n", obj->buffer.length); 1465 pr_warn("Unknown buffer length %d\n", obj->buffer.length);
1335 kfree(obj); 1466 kfree(obj);
1336 return; 1467 return;
1337 } 1468 }
@@ -1343,7 +1474,7 @@ static void acer_wmi_notify(u32 value, void *context)
1343 case WMID_HOTKEY_EVENT: 1474 case WMID_HOTKEY_EVENT:
1344 if (return_value.device_state) { 1475 if (return_value.device_state) {
1345 u16 device_state = return_value.device_state; 1476 u16 device_state = return_value.device_state;
1346 pr_debug("deivces states: 0x%x\n", device_state); 1477 pr_debug("device state: 0x%x\n", device_state);
1347 if (has_cap(ACER_CAP_WIRELESS)) 1478 if (has_cap(ACER_CAP_WIRELESS))
1348 rfkill_set_sw_state(wireless_rfkill, 1479 rfkill_set_sw_state(wireless_rfkill,
1349 !(device_state & ACER_WMID3_GDS_WIRELESS)); 1480 !(device_state & ACER_WMID3_GDS_WIRELESS));
@@ -1356,11 +1487,11 @@ static void acer_wmi_notify(u32 value, void *context)
1356 } 1487 }
1357 if (!sparse_keymap_report_event(acer_wmi_input_dev, 1488 if (!sparse_keymap_report_event(acer_wmi_input_dev,
1358 return_value.key_num, 1, true)) 1489 return_value.key_num, 1, true))
1359 pr_warning("Unknown key number - 0x%x\n", 1490 pr_warn("Unknown key number - 0x%x\n",
1360 return_value.key_num); 1491 return_value.key_num);
1361 break; 1492 break;
1362 default: 1493 default:
1363 pr_warning("Unknown function number - %d - %d\n", 1494 pr_warn("Unknown function number - %d - %d\n",
1364 return_value.function, return_value.key_num); 1495 return_value.function, return_value.key_num);
1365 break; 1496 break;
1366 } 1497 }
@@ -1389,7 +1520,7 @@ wmid3_set_lm_mode(struct lm_input_params *params,
1389 return AE_ERROR; 1520 return AE_ERROR;
1390 } 1521 }
1391 if (obj->buffer.length != 4) { 1522 if (obj->buffer.length != 4) {
1392 pr_warning("Unknown buffer length %d\n", obj->buffer.length); 1523 pr_warn("Unknown buffer length %d\n", obj->buffer.length);
1393 kfree(obj); 1524 kfree(obj);
1394 return AE_ERROR; 1525 return AE_ERROR;
1395 } 1526 }
@@ -1414,11 +1545,11 @@ static int acer_wmi_enable_ec_raw(void)
1414 status = wmid3_set_lm_mode(&params, &return_value); 1545 status = wmid3_set_lm_mode(&params, &return_value);
1415 1546
1416 if (return_value.error_code || return_value.ec_return_value) 1547 if (return_value.error_code || return_value.ec_return_value)
1417 pr_warning("Enabling EC raw mode failed: " 1548 pr_warn("Enabling EC raw mode failed: 0x%x - 0x%x\n",
1418 "0x%x - 0x%x\n", return_value.error_code, 1549 return_value.error_code,
1419 return_value.ec_return_value); 1550 return_value.ec_return_value);
1420 else 1551 else
1421 pr_info("Enabled EC raw mode"); 1552 pr_info("Enabled EC raw mode\n");
1422 1553
1423 return status; 1554 return status;
1424} 1555}
@@ -1437,9 +1568,9 @@ static int acer_wmi_enable_lm(void)
1437 status = wmid3_set_lm_mode(&params, &return_value); 1568 status = wmid3_set_lm_mode(&params, &return_value);
1438 1569
1439 if (return_value.error_code || return_value.ec_return_value) 1570 if (return_value.error_code || return_value.ec_return_value)
1440 pr_warning("Enabling Launch Manager failed: " 1571 pr_warn("Enabling Launch Manager failed: 0x%x - 0x%x\n",
1441 "0x%x - 0x%x\n", return_value.error_code, 1572 return_value.error_code,
1442 return_value.ec_return_value); 1573 return_value.ec_return_value);
1443 1574
1444 return status; 1575 return status;
1445} 1576}
@@ -1506,8 +1637,11 @@ static u32 get_wmid_devices(void)
1506 1637
1507 obj = (union acpi_object *) out.pointer; 1638 obj = (union acpi_object *) out.pointer;
1508 if (obj && obj->type == ACPI_TYPE_BUFFER && 1639 if (obj && obj->type == ACPI_TYPE_BUFFER &&
1509 obj->buffer.length == sizeof(u32)) { 1640 (obj->buffer.length == sizeof(u32) ||
1641 obj->buffer.length == sizeof(u64))) {
1510 devices = *((u32 *) obj->buffer.pointer); 1642 devices = *((u32 *) obj->buffer.pointer);
1643 } else if (obj->type == ACPI_TYPE_INTEGER) {
1644 devices = (u32) obj->integer.value;
1511 } 1645 }
1512 1646
1513 kfree(out.pointer); 1647 kfree(out.pointer);
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 60f9cfcac93f..fca3489218b7 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -35,10 +35,8 @@
35 35
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/fs.h>
39#include <linux/dmi.h> 38#include <linux/dmi.h>
40#include <acpi/acpi_drivers.h> 39#include <linux/acpi.h>
41#include <linux/sched.h>
42#include <linux/thermal.h> 40#include <linux/thermal.h>
43#include <linux/platform_device.h> 41#include <linux/platform_device.h>
44 42
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index c53b3ff7978a..d65df92e2acc 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -318,7 +318,7 @@ static int acpi_check_handle(acpi_handle handle, const char *method,
318 318
319 if (status != AE_OK) { 319 if (status != AE_OK) {
320 if (ret) 320 if (ret)
321 pr_warning("Error finding %s\n", method); 321 pr_warn("Error finding %s\n", method);
322 return -ENODEV; 322 return -ENODEV;
323 } 323 }
324 return 0; 324 return 0;
@@ -383,7 +383,7 @@ static int asus_kled_lvl(struct asus_laptop *asus)
383 rv = acpi_evaluate_integer(asus->handle, METHOD_KBD_LIGHT_GET, 383 rv = acpi_evaluate_integer(asus->handle, METHOD_KBD_LIGHT_GET,
384 &params, &kblv); 384 &params, &kblv);
385 if (ACPI_FAILURE(rv)) { 385 if (ACPI_FAILURE(rv)) {
386 pr_warning("Error reading kled level\n"); 386 pr_warn("Error reading kled level\n");
387 return -ENODEV; 387 return -ENODEV;
388 } 388 }
389 return kblv; 389 return kblv;
@@ -397,7 +397,7 @@ static int asus_kled_set(struct asus_laptop *asus, int kblv)
397 kblv = 0; 397 kblv = 0;
398 398
399 if (write_acpi_int(asus->handle, METHOD_KBD_LIGHT_SET, kblv)) { 399 if (write_acpi_int(asus->handle, METHOD_KBD_LIGHT_SET, kblv)) {
400 pr_warning("Keyboard LED display write failed\n"); 400 pr_warn("Keyboard LED display write failed\n");
401 return -EINVAL; 401 return -EINVAL;
402 } 402 }
403 return 0; 403 return 0;
@@ -531,7 +531,7 @@ static int asus_read_brightness(struct backlight_device *bd)
531 rv = acpi_evaluate_integer(asus->handle, METHOD_BRIGHTNESS_GET, 531 rv = acpi_evaluate_integer(asus->handle, METHOD_BRIGHTNESS_GET,
532 NULL, &value); 532 NULL, &value);
533 if (ACPI_FAILURE(rv)) 533 if (ACPI_FAILURE(rv))
534 pr_warning("Error reading brightness\n"); 534 pr_warn("Error reading brightness\n");
535 535
536 return value; 536 return value;
537} 537}
@@ -541,7 +541,7 @@ static int asus_set_brightness(struct backlight_device *bd, int value)
541 struct asus_laptop *asus = bl_get_data(bd); 541 struct asus_laptop *asus = bl_get_data(bd);
542 542
543 if (write_acpi_int(asus->handle, METHOD_BRIGHTNESS_SET, value)) { 543 if (write_acpi_int(asus->handle, METHOD_BRIGHTNESS_SET, value)) {
544 pr_warning("Error changing brightness\n"); 544 pr_warn("Error changing brightness\n");
545 return -EIO; 545 return -EIO;
546 } 546 }
547 return 0; 547 return 0;
@@ -730,7 +730,7 @@ static ssize_t store_ledd(struct device *dev, struct device_attribute *attr,
730 rv = parse_arg(buf, count, &value); 730 rv = parse_arg(buf, count, &value);
731 if (rv > 0) { 731 if (rv > 0) {
732 if (write_acpi_int(asus->handle, METHOD_LEDD, value)) { 732 if (write_acpi_int(asus->handle, METHOD_LEDD, value)) {
733 pr_warning("LED display write failed\n"); 733 pr_warn("LED display write failed\n");
734 return -ENODEV; 734 return -ENODEV;
735 } 735 }
736 asus->ledd_status = (u32) value; 736 asus->ledd_status = (u32) value;
@@ -752,7 +752,7 @@ static int asus_wireless_status(struct asus_laptop *asus, int mask)
752 rv = acpi_evaluate_integer(asus->handle, METHOD_WL_STATUS, 752 rv = acpi_evaluate_integer(asus->handle, METHOD_WL_STATUS,
753 NULL, &status); 753 NULL, &status);
754 if (ACPI_FAILURE(rv)) { 754 if (ACPI_FAILURE(rv)) {
755 pr_warning("Error reading Wireless status\n"); 755 pr_warn("Error reading Wireless status\n");
756 return -EINVAL; 756 return -EINVAL;
757 } 757 }
758 return !!(status & mask); 758 return !!(status & mask);
@@ -764,7 +764,7 @@ static int asus_wireless_status(struct asus_laptop *asus, int mask)
764static int asus_wlan_set(struct asus_laptop *asus, int status) 764static int asus_wlan_set(struct asus_laptop *asus, int status)
765{ 765{
766 if (write_acpi_int(asus->handle, METHOD_WLAN, !!status)) { 766 if (write_acpi_int(asus->handle, METHOD_WLAN, !!status)) {
767 pr_warning("Error setting wlan status to %d", status); 767 pr_warn("Error setting wlan status to %d\n", status);
768 return -EIO; 768 return -EIO;
769 } 769 }
770 return 0; 770 return 0;
@@ -792,7 +792,7 @@ static ssize_t store_wlan(struct device *dev, struct device_attribute *attr,
792static int asus_bluetooth_set(struct asus_laptop *asus, int status) 792static int asus_bluetooth_set(struct asus_laptop *asus, int status)
793{ 793{
794 if (write_acpi_int(asus->handle, METHOD_BLUETOOTH, !!status)) { 794 if (write_acpi_int(asus->handle, METHOD_BLUETOOTH, !!status)) {
795 pr_warning("Error setting bluetooth status to %d", status); 795 pr_warn("Error setting bluetooth status to %d\n", status);
796 return -EIO; 796 return -EIO;
797 } 797 }
798 return 0; 798 return 0;
@@ -821,7 +821,7 @@ static ssize_t store_bluetooth(struct device *dev,
821static int asus_wimax_set(struct asus_laptop *asus, int status) 821static int asus_wimax_set(struct asus_laptop *asus, int status)
822{ 822{
823 if (write_acpi_int(asus->handle, METHOD_WIMAX, !!status)) { 823 if (write_acpi_int(asus->handle, METHOD_WIMAX, !!status)) {
824 pr_warning("Error setting wimax status to %d", status); 824 pr_warn("Error setting wimax status to %d\n", status);
825 return -EIO; 825 return -EIO;
826 } 826 }
827 return 0; 827 return 0;
@@ -850,7 +850,7 @@ static ssize_t store_wimax(struct device *dev,
850static int asus_wwan_set(struct asus_laptop *asus, int status) 850static int asus_wwan_set(struct asus_laptop *asus, int status)
851{ 851{
852 if (write_acpi_int(asus->handle, METHOD_WWAN, !!status)) { 852 if (write_acpi_int(asus->handle, METHOD_WWAN, !!status)) {
853 pr_warning("Error setting wwan status to %d", status); 853 pr_warn("Error setting wwan status to %d\n", status);
854 return -EIO; 854 return -EIO;
855 } 855 }
856 return 0; 856 return 0;
@@ -880,7 +880,7 @@ static void asus_set_display(struct asus_laptop *asus, int value)
880{ 880{
881 /* no sanity check needed for now */ 881 /* no sanity check needed for now */
882 if (write_acpi_int(asus->handle, METHOD_SWITCH_DISPLAY, value)) 882 if (write_acpi_int(asus->handle, METHOD_SWITCH_DISPLAY, value))
883 pr_warning("Error setting display\n"); 883 pr_warn("Error setting display\n");
884 return; 884 return;
885} 885}
886 886
@@ -909,7 +909,7 @@ static ssize_t store_disp(struct device *dev, struct device_attribute *attr,
909static void asus_als_switch(struct asus_laptop *asus, int value) 909static void asus_als_switch(struct asus_laptop *asus, int value)
910{ 910{
911 if (write_acpi_int(asus->handle, METHOD_ALS_CONTROL, value)) 911 if (write_acpi_int(asus->handle, METHOD_ALS_CONTROL, value))
912 pr_warning("Error setting light sensor switch\n"); 912 pr_warn("Error setting light sensor switch\n");
913 asus->light_switch = value; 913 asus->light_switch = value;
914} 914}
915 915
@@ -937,7 +937,7 @@ static ssize_t store_lssw(struct device *dev, struct device_attribute *attr,
937static void asus_als_level(struct asus_laptop *asus, int value) 937static void asus_als_level(struct asus_laptop *asus, int value)
938{ 938{
939 if (write_acpi_int(asus->handle, METHOD_ALS_LEVEL, value)) 939 if (write_acpi_int(asus->handle, METHOD_ALS_LEVEL, value))
940 pr_warning("Error setting light sensor level\n"); 940 pr_warn("Error setting light sensor level\n");
941 asus->light_level = value; 941 asus->light_level = value;
942} 942}
943 943
@@ -976,7 +976,7 @@ static int asus_gps_status(struct asus_laptop *asus)
976 rv = acpi_evaluate_integer(asus->handle, METHOD_GPS_STATUS, 976 rv = acpi_evaluate_integer(asus->handle, METHOD_GPS_STATUS,
977 NULL, &status); 977 NULL, &status);
978 if (ACPI_FAILURE(rv)) { 978 if (ACPI_FAILURE(rv)) {
979 pr_warning("Error reading GPS status\n"); 979 pr_warn("Error reading GPS status\n");
980 return -ENODEV; 980 return -ENODEV;
981 } 981 }
982 return !!status; 982 return !!status;
@@ -1284,7 +1284,7 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
1284 */ 1284 */
1285 status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus->dsdt_info); 1285 status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus->dsdt_info);
1286 if (ACPI_FAILURE(status)) 1286 if (ACPI_FAILURE(status))
1287 pr_warning("Couldn't get the DSDT table header\n"); 1287 pr_warn("Couldn't get the DSDT table header\n");
1288 1288
1289 /* We have to write 0 on init this far for all ASUS models */ 1289 /* We have to write 0 on init this far for all ASUS models */
1290 if (write_acpi_int_ret(asus->handle, "INIT", 0, &buffer)) { 1290 if (write_acpi_int_ret(asus->handle, "INIT", 0, &buffer)) {
@@ -1296,7 +1296,7 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
1296 status = 1296 status =
1297 acpi_evaluate_integer(asus->handle, "BSTS", NULL, &bsts_result); 1297 acpi_evaluate_integer(asus->handle, "BSTS", NULL, &bsts_result);
1298 if (ACPI_FAILURE(status)) 1298 if (ACPI_FAILURE(status))
1299 pr_warning("Error calling BSTS\n"); 1299 pr_warn("Error calling BSTS\n");
1300 else if (bsts_result) 1300 else if (bsts_result)
1301 pr_notice("BSTS called, 0x%02x returned\n", 1301 pr_notice("BSTS called, 0x%02x returned\n",
1302 (uint) bsts_result); 1302 (uint) bsts_result);
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 832a3fd7c1c8..00460cb9587b 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -425,7 +425,7 @@ static void asus_rfkill_hotplug(struct asus_wmi *asus)
425 if (asus->hotplug_slot) { 425 if (asus->hotplug_slot) {
426 bus = pci_find_bus(0, 1); 426 bus = pci_find_bus(0, 1);
427 if (!bus) { 427 if (!bus) {
428 pr_warning("Unable to find PCI bus 1?\n"); 428 pr_warn("Unable to find PCI bus 1?\n");
429 goto out_unlock; 429 goto out_unlock;
430 } 430 }
431 431
@@ -436,12 +436,12 @@ static void asus_rfkill_hotplug(struct asus_wmi *asus)
436 absent = (l == 0xffffffff); 436 absent = (l == 0xffffffff);
437 437
438 if (blocked != absent) { 438 if (blocked != absent) {
439 pr_warning("BIOS says wireless lan is %s, " 439 pr_warn("BIOS says wireless lan is %s, "
440 "but the pci device is %s\n", 440 "but the pci device is %s\n",
441 blocked ? "blocked" : "unblocked", 441 blocked ? "blocked" : "unblocked",
442 absent ? "absent" : "present"); 442 absent ? "absent" : "present");
443 pr_warning("skipped wireless hotplug as probably " 443 pr_warn("skipped wireless hotplug as probably "
444 "inappropriate for this model\n"); 444 "inappropriate for this model\n");
445 goto out_unlock; 445 goto out_unlock;
446 } 446 }
447 447
@@ -500,7 +500,7 @@ static int asus_register_rfkill_notifier(struct asus_wmi *asus, char *node)
500 ACPI_SYSTEM_NOTIFY, 500 ACPI_SYSTEM_NOTIFY,
501 asus_rfkill_notify, asus); 501 asus_rfkill_notify, asus);
502 if (ACPI_FAILURE(status)) 502 if (ACPI_FAILURE(status))
503 pr_warning("Failed to register notify on %s\n", node); 503 pr_warn("Failed to register notify on %s\n", node);
504 } else 504 } else
505 return -ENODEV; 505 return -ENODEV;
506 506
@@ -1223,7 +1223,7 @@ static int asus_wmi_sysfs_init(struct platform_device *device)
1223/* 1223/*
1224 * Platform device 1224 * Platform device
1225 */ 1225 */
1226static int __init asus_wmi_platform_init(struct asus_wmi *asus) 1226static int asus_wmi_platform_init(struct asus_wmi *asus)
1227{ 1227{
1228 int rv; 1228 int rv;
1229 1229
@@ -1583,12 +1583,12 @@ static int asus_wmi_probe(struct platform_device *pdev)
1583 int ret; 1583 int ret;
1584 1584
1585 if (!wmi_has_guid(ASUS_WMI_MGMT_GUID)) { 1585 if (!wmi_has_guid(ASUS_WMI_MGMT_GUID)) {
1586 pr_warning("Management GUID not found\n"); 1586 pr_warn("Management GUID not found\n");
1587 return -ENODEV; 1587 return -ENODEV;
1588 } 1588 }
1589 1589
1590 if (wdrv->event_guid && !wmi_has_guid(wdrv->event_guid)) { 1590 if (wdrv->event_guid && !wmi_has_guid(wdrv->event_guid)) {
1591 pr_warning("Event GUID not found\n"); 1591 pr_warn("Event GUID not found\n");
1592 return -ENODEV; 1592 return -ENODEV;
1593 } 1593 }
1594 1594
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c
index f503607c0645..d9312b3073e5 100644
--- a/drivers/platform/x86/asus_acpi.c
+++ b/drivers/platform/x86/asus_acpi.c
@@ -30,6 +30,8 @@
30 * 30 *
31 */ 31 */
32 32
33#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
34
33#include <linux/kernel.h> 35#include <linux/kernel.h>
34#include <linux/module.h> 36#include <linux/module.h>
35#include <linux/slab.h> 37#include <linux/slab.h>
@@ -581,8 +583,7 @@ static int read_led(const char *ledname, int ledmask)
581 if (read_acpi_int(NULL, ledname, &led_status)) 583 if (read_acpi_int(NULL, ledname, &led_status))
582 return led_status; 584 return led_status;
583 else 585 else
584 printk(KERN_WARNING "Asus ACPI: Error reading LED " 586 pr_warn("Error reading LED status\n");
585 "status\n");
586 } 587 }
587 return (hotk->status & ledmask) ? 1 : 0; 588 return (hotk->status & ledmask) ? 1 : 0;
588} 589}
@@ -621,8 +622,7 @@ write_led(const char __user *buffer, unsigned long count,
621 led_out = !led_out; 622 led_out = !led_out;
622 623
623 if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) 624 if (!write_acpi_int(hotk->handle, ledname, led_out, NULL))
624 printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", 625 pr_warn("LED (%s) write failed\n", ledname);
625 ledname);
626 626
627 return rv; 627 return rv;
628} 628}
@@ -679,8 +679,7 @@ static ssize_t ledd_proc_write(struct file *file, const char __user *buffer,
679 if (rv > 0) { 679 if (rv > 0) {
680 if (!write_acpi_int 680 if (!write_acpi_int
681 (hotk->handle, hotk->methods->mt_ledd, value, NULL)) 681 (hotk->handle, hotk->methods->mt_ledd, value, NULL))
682 printk(KERN_WARNING 682 pr_warn("LED display write failed\n");
683 "Asus ACPI: LED display write failed\n");
684 else 683 else
685 hotk->ledd_status = (u32) value; 684 hotk->ledd_status = (u32) value;
686 } 685 }
@@ -838,8 +837,7 @@ static int get_lcd_state(void)
838 } else { 837 } else {
839 /* We don't have to check anything if we are here */ 838 /* We don't have to check anything if we are here */
840 if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd)) 839 if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd))
841 printk(KERN_WARNING 840 pr_warn("Error reading LCD status\n");
842 "Asus ACPI: Error reading LCD status\n");
843 841
844 if (hotk->model == L2D) 842 if (hotk->model == L2D)
845 lcd = ~lcd; 843 lcd = ~lcd;
@@ -871,7 +869,7 @@ static int set_lcd_state(int value)
871 the exact behaviour is simulated here */ 869 the exact behaviour is simulated here */
872 } 870 }
873 if (ACPI_FAILURE(status)) 871 if (ACPI_FAILURE(status))
874 printk(KERN_WARNING "Asus ACPI: Error switching LCD\n"); 872 pr_warn("Error switching LCD\n");
875 } 873 }
876 return 0; 874 return 0;
877 875
@@ -915,13 +913,11 @@ static int read_brightness(struct backlight_device *bd)
915 if (hotk->methods->brightness_get) { /* SPLV/GPLV laptop */ 913 if (hotk->methods->brightness_get) { /* SPLV/GPLV laptop */
916 if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get, 914 if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get,
917 &value)) 915 &value))
918 printk(KERN_WARNING 916 pr_warn("Error reading brightness\n");
919 "Asus ACPI: Error reading brightness\n");
920 } else if (hotk->methods->brightness_status) { /* For D1 for example */ 917 } else if (hotk->methods->brightness_status) { /* For D1 for example */
921 if (!read_acpi_int(NULL, hotk->methods->brightness_status, 918 if (!read_acpi_int(NULL, hotk->methods->brightness_status,
922 &value)) 919 &value))
923 printk(KERN_WARNING 920 pr_warn("Error reading brightness\n");
924 "Asus ACPI: Error reading brightness\n");
925 } else /* No GPLV method */ 921 } else /* No GPLV method */
926 value = hotk->brightness; 922 value = hotk->brightness;
927 return value; 923 return value;
@@ -939,8 +935,7 @@ static int set_brightness(int value)
939 if (hotk->methods->brightness_set) { 935 if (hotk->methods->brightness_set) {
940 if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set, 936 if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set,
941 value, NULL)) { 937 value, NULL)) {
942 printk(KERN_WARNING 938 pr_warn("Error changing brightness\n");
943 "Asus ACPI: Error changing brightness\n");
944 ret = -EIO; 939 ret = -EIO;
945 } 940 }
946 goto out; 941 goto out;
@@ -955,8 +950,7 @@ static int set_brightness(int value)
955 NULL, NULL); 950 NULL, NULL);
956 (value > 0) ? value-- : value++; 951 (value > 0) ? value-- : value++;
957 if (ACPI_FAILURE(status)) { 952 if (ACPI_FAILURE(status)) {
958 printk(KERN_WARNING 953 pr_warn("Error changing brightness\n");
959 "Asus ACPI: Error changing brightness\n");
960 ret = -EIO; 954 ret = -EIO;
961 } 955 }
962 } 956 }
@@ -1008,7 +1002,7 @@ static void set_display(int value)
1008 /* no sanity check needed for now */ 1002 /* no sanity check needed for now */
1009 if (!write_acpi_int(hotk->handle, hotk->methods->display_set, 1003 if (!write_acpi_int(hotk->handle, hotk->methods->display_set,
1010 value, NULL)) 1004 value, NULL))
1011 printk(KERN_WARNING "Asus ACPI: Error setting display\n"); 1005 pr_warn("Error setting display\n");
1012 return; 1006 return;
1013} 1007}
1014 1008
@@ -1021,8 +1015,7 @@ static int disp_proc_show(struct seq_file *m, void *v)
1021 int value = 0; 1015 int value = 0;
1022 1016
1023 if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value)) 1017 if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value))
1024 printk(KERN_WARNING 1018 pr_warn("Error reading display status\n");
1025 "Asus ACPI: Error reading display status\n");
1026 value &= 0x07; /* needed for some models, shouldn't hurt others */ 1019 value &= 0x07; /* needed for some models, shouldn't hurt others */
1027 seq_printf(m, "%d\n", value); 1020 seq_printf(m, "%d\n", value);
1028 return 0; 1021 return 0;
@@ -1068,7 +1061,7 @@ asus_proc_add(char *name, const struct file_operations *proc_fops, mode_t mode,
1068 proc = proc_create_data(name, mode, acpi_device_dir(device), 1061 proc = proc_create_data(name, mode, acpi_device_dir(device),
1069 proc_fops, acpi_driver_data(device)); 1062 proc_fops, acpi_driver_data(device));
1070 if (!proc) { 1063 if (!proc) {
1071 printk(KERN_WARNING " Unable to create %s fs entry\n", name); 1064 pr_warn(" Unable to create %s fs entry\n", name);
1072 return -1; 1065 return -1;
1073 } 1066 }
1074 proc->uid = asus_uid; 1067 proc->uid = asus_uid;
@@ -1085,8 +1078,8 @@ static int asus_hotk_add_fs(struct acpi_device *device)
1085 mode = S_IFREG | S_IRUGO | S_IWUSR | S_IWGRP; 1078 mode = S_IFREG | S_IRUGO | S_IWUSR | S_IWGRP;
1086 } else { 1079 } else {
1087 mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; 1080 mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP;
1088 printk(KERN_WARNING " asus_uid and asus_gid parameters are " 1081 pr_warn(" asus_uid and asus_gid parameters are "
1089 "deprecated, use chown and chmod instead!\n"); 1082 "deprecated, use chown and chmod instead!\n");
1090 } 1083 }
1091 1084
1092 acpi_device_dir(device) = asus_proc_dir; 1085 acpi_device_dir(device) = asus_proc_dir;
@@ -1099,8 +1092,7 @@ static int asus_hotk_add_fs(struct acpi_device *device)
1099 proc->uid = asus_uid; 1092 proc->uid = asus_uid;
1100 proc->gid = asus_gid; 1093 proc->gid = asus_gid;
1101 } else { 1094 } else {
1102 printk(KERN_WARNING " Unable to create " PROC_INFO 1095 pr_warn(" Unable to create " PROC_INFO " fs entry\n");
1103 " fs entry\n");
1104 } 1096 }
1105 1097
1106 if (hotk->methods->mt_wled) { 1098 if (hotk->methods->mt_wled) {
@@ -1283,20 +1275,19 @@ static int asus_hotk_get_info(void)
1283 */ 1275 */
1284 status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus_info); 1276 status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus_info);
1285 if (ACPI_FAILURE(status)) 1277 if (ACPI_FAILURE(status))
1286 printk(KERN_WARNING " Couldn't get the DSDT table header\n"); 1278 pr_warn(" Couldn't get the DSDT table header\n");
1287 1279
1288 /* We have to write 0 on init this far for all ASUS models */ 1280 /* We have to write 0 on init this far for all ASUS models */
1289 if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { 1281 if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) {
1290 printk(KERN_ERR " Hotkey initialization failed\n"); 1282 pr_err(" Hotkey initialization failed\n");
1291 return -ENODEV; 1283 return -ENODEV;
1292 } 1284 }
1293 1285
1294 /* This needs to be called for some laptops to init properly */ 1286 /* This needs to be called for some laptops to init properly */
1295 if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result)) 1287 if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result))
1296 printk(KERN_WARNING " Error calling BSTS\n"); 1288 pr_warn(" Error calling BSTS\n");
1297 else if (bsts_result) 1289 else if (bsts_result)
1298 printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", 1290 pr_notice(" BSTS called, 0x%02x returned\n", bsts_result);
1299 bsts_result);
1300 1291
1301 /* 1292 /*
1302 * Try to match the object returned by INIT to the specific model. 1293 * Try to match the object returned by INIT to the specific model.
@@ -1324,23 +1315,21 @@ static int asus_hotk_get_info(void)
1324 if (asus_info && 1315 if (asus_info &&
1325 strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) { 1316 strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) {
1326 hotk->model = P30; 1317 hotk->model = P30;
1327 printk(KERN_NOTICE 1318 pr_notice(" Samsung P30 detected, supported\n");
1328 " Samsung P30 detected, supported\n");
1329 hotk->methods = &model_conf[hotk->model]; 1319 hotk->methods = &model_conf[hotk->model];
1330 kfree(model); 1320 kfree(model);
1331 return 0; 1321 return 0;
1332 } else { 1322 } else {
1333 hotk->model = M2E; 1323 hotk->model = M2E;
1334 printk(KERN_NOTICE " unsupported model %s, trying " 1324 pr_notice(" unsupported model %s, trying default values\n",
1335 "default values\n", string); 1325 string);
1336 printk(KERN_NOTICE 1326 pr_notice(" send /proc/acpi/dsdt to the developers\n");
1337 " send /proc/acpi/dsdt to the developers\n");
1338 kfree(model); 1327 kfree(model);
1339 return -ENODEV; 1328 return -ENODEV;
1340 } 1329 }
1341 } 1330 }
1342 hotk->methods = &model_conf[hotk->model]; 1331 hotk->methods = &model_conf[hotk->model];
1343 printk(KERN_NOTICE " %s model detected, supported\n", string); 1332 pr_notice(" %s model detected, supported\n", string);
1344 1333
1345 /* Sort of per-model blacklist */ 1334 /* Sort of per-model blacklist */
1346 if (strncmp(string, "L2B", 3) == 0) 1335 if (strncmp(string, "L2B", 3) == 0)
@@ -1385,7 +1374,7 @@ static int asus_hotk_check(void)
1385 if (hotk->device->status.present) { 1374 if (hotk->device->status.present) {
1386 result = asus_hotk_get_info(); 1375 result = asus_hotk_get_info();
1387 } else { 1376 } else {
1388 printk(KERN_ERR " Hotkey device not present, aborting\n"); 1377 pr_err(" Hotkey device not present, aborting\n");
1389 return -EINVAL; 1378 return -EINVAL;
1390 } 1379 }
1391 1380
@@ -1399,8 +1388,7 @@ static int asus_hotk_add(struct acpi_device *device)
1399 acpi_status status = AE_OK; 1388 acpi_status status = AE_OK;
1400 int result; 1389 int result;
1401 1390
1402 printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n", 1391 pr_notice("Asus Laptop ACPI Extras version %s\n", ASUS_ACPI_VERSION);
1403 ASUS_ACPI_VERSION);
1404 1392
1405 hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL); 1393 hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL);
1406 if (!hotk) 1394 if (!hotk)
@@ -1428,15 +1416,14 @@ static int asus_hotk_add(struct acpi_device *device)
1428 acpi_evaluate_object(NULL, hotk->methods->brightness_down, 1416 acpi_evaluate_object(NULL, hotk->methods->brightness_down,
1429 NULL, NULL); 1417 NULL, NULL);
1430 if (ACPI_FAILURE(status)) 1418 if (ACPI_FAILURE(status))
1431 printk(KERN_WARNING " Error changing brightness\n"); 1419 pr_warn(" Error changing brightness\n");
1432 else { 1420 else {
1433 status = 1421 status =
1434 acpi_evaluate_object(NULL, 1422 acpi_evaluate_object(NULL,
1435 hotk->methods->brightness_up, 1423 hotk->methods->brightness_up,
1436 NULL, NULL); 1424 NULL, NULL);
1437 if (ACPI_FAILURE(status)) 1425 if (ACPI_FAILURE(status))
1438 printk(KERN_WARNING " Strange, error changing" 1426 pr_warn(" Strange, error changing brightness\n");
1439 " brightness\n");
1440 } 1427 }
1441 } 1428 }
1442 1429
@@ -1488,7 +1475,7 @@ static int __init asus_acpi_init(void)
1488 1475
1489 asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); 1476 asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir);
1490 if (!asus_proc_dir) { 1477 if (!asus_proc_dir) {
1491 printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n"); 1478 pr_err("Unable to create /proc entry\n");
1492 acpi_bus_unregister_driver(&asus_hotk_driver); 1479 acpi_bus_unregister_driver(&asus_hotk_driver);
1493 return -ENODEV; 1480 return -ENODEV;
1494 } 1481 }
@@ -1513,7 +1500,7 @@ static int __init asus_acpi_init(void)
1513 &asus_backlight_data, 1500 &asus_backlight_data,
1514 &props); 1501 &props);
1515 if (IS_ERR(asus_backlight_device)) { 1502 if (IS_ERR(asus_backlight_device)) {
1516 printk(KERN_ERR "Could not register asus backlight device\n"); 1503 pr_err("Could not register asus backlight device\n");
1517 asus_backlight_device = NULL; 1504 asus_backlight_device = NULL;
1518 asus_acpi_exit(); 1505 asus_acpi_exit();
1519 return -ENODEV; 1506 return -ENODEV;
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index c16a27641ced..4c4a7422c5e8 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -68,6 +68,8 @@
68 * only enabled on a JHL90 board until it is verified that they work on the 68 * only enabled on a JHL90 board until it is verified that they work on the
69 * other boards too. See the extra_features variable. */ 69 * other boards too. See the extra_features variable. */
70 70
71#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
72
71#include <linux/module.h> 73#include <linux/module.h>
72#include <linux/kernel.h> 74#include <linux/kernel.h>
73#include <linux/init.h> 75#include <linux/init.h>
@@ -760,16 +762,14 @@ static struct rfkill *bt_rfkill;
760 762
761static int dmi_check_cb(const struct dmi_system_id *id) 763static int dmi_check_cb(const struct dmi_system_id *id)
762{ 764{
763 printk(KERN_INFO DRIVER_NAME": Identified laptop model '%s'\n", 765 pr_info("Identified laptop model '%s'\n", id->ident);
764 id->ident);
765 extra_features = false; 766 extra_features = false;
766 return 1; 767 return 1;
767} 768}
768 769
769static int dmi_check_cb_extra(const struct dmi_system_id *id) 770static int dmi_check_cb_extra(const struct dmi_system_id *id)
770{ 771{
771 printk(KERN_INFO DRIVER_NAME": Identified laptop model '%s', " 772 pr_info("Identified laptop model '%s', enabling extra features\n",
772 "enabling extra features\n",
773 id->ident); 773 id->ident);
774 extra_features = true; 774 extra_features = true;
775 return 1; 775 return 1;
@@ -956,14 +956,12 @@ static int __init compal_init(void)
956 int ret; 956 int ret;
957 957
958 if (acpi_disabled) { 958 if (acpi_disabled) {
959 printk(KERN_ERR DRIVER_NAME": ACPI needs to be enabled for " 959 pr_err("ACPI needs to be enabled for this driver to work!\n");
960 "this driver to work!\n");
961 return -ENODEV; 960 return -ENODEV;
962 } 961 }
963 962
964 if (!force && !dmi_check_system(compal_dmi_table)) { 963 if (!force && !dmi_check_system(compal_dmi_table)) {
965 printk(KERN_ERR DRIVER_NAME": Motherboard not recognized (You " 964 pr_err("Motherboard not recognized (You could try the module's force-parameter)\n");
966 "could try the module's force-parameter)");
967 return -ENODEV; 965 return -ENODEV;
968 } 966 }
969 967
@@ -998,8 +996,7 @@ static int __init compal_init(void)
998 if (ret) 996 if (ret)
999 goto err_rfkill; 997 goto err_rfkill;
1000 998
1001 printk(KERN_INFO DRIVER_NAME": Driver "DRIVER_VERSION 999 pr_info("Driver " DRIVER_VERSION " successfully loaded\n");
1002 " successfully loaded\n");
1003 return 0; 1000 return 0;
1004 1001
1005err_rfkill: 1002err_rfkill:
@@ -1064,7 +1061,7 @@ static void __exit compal_cleanup(void)
1064 rfkill_destroy(wifi_rfkill); 1061 rfkill_destroy(wifi_rfkill);
1065 rfkill_destroy(bt_rfkill); 1062 rfkill_destroy(bt_rfkill);
1066 1063
1067 printk(KERN_INFO DRIVER_NAME": Driver unloaded\n"); 1064 pr_info("Driver unloaded\n");
1068} 1065}
1069 1066
1070static int __devexit compal_remove(struct platform_device *pdev) 1067static int __devexit compal_remove(struct platform_device *pdev)
@@ -1074,8 +1071,7 @@ static int __devexit compal_remove(struct platform_device *pdev)
1074 if (!extra_features) 1071 if (!extra_features)
1075 return 0; 1072 return 0;
1076 1073
1077 printk(KERN_INFO DRIVER_NAME": Unloading: resetting fan control " 1074 pr_info("Unloading: resetting fan control to motherboard\n");
1078 "to motherboard\n");
1079 pwm_disable_control(); 1075 pwm_disable_control();
1080 1076
1081 data = platform_get_drvdata(pdev); 1077 data = platform_get_drvdata(pdev);
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index de301aa8e5c3..d3841de6a8cf 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -11,6 +11,8 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13
14#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15
14#include <linux/module.h> 16#include <linux/module.h>
15#include <linux/kernel.h> 17#include <linux/kernel.h>
16#include <linux/init.h> 18#include <linux/init.h>
@@ -434,8 +436,7 @@ static int __init dell_setup_rfkill(void)
434 int ret; 436 int ret;
435 437
436 if (dmi_check_system(dell_blacklist)) { 438 if (dmi_check_system(dell_blacklist)) {
437 printk(KERN_INFO "dell-laptop: Blacklisted hardware detected - " 439 pr_info("Blacklisted hardware detected - not enabling rfkill\n");
438 "not enabling rfkill\n");
439 return 0; 440 return 0;
440 } 441 }
441 442
@@ -606,7 +607,7 @@ static int __init dell_init(void)
606 dmi_walk(find_tokens, NULL); 607 dmi_walk(find_tokens, NULL);
607 608
608 if (!da_tokens) { 609 if (!da_tokens) {
609 printk(KERN_INFO "dell-laptop: Unable to find dmi tokens\n"); 610 pr_info("Unable to find dmi tokens\n");
610 return -ENODEV; 611 return -ENODEV;
611 } 612 }
612 613
@@ -636,14 +637,13 @@ static int __init dell_init(void)
636 ret = dell_setup_rfkill(); 637 ret = dell_setup_rfkill();
637 638
638 if (ret) { 639 if (ret) {
639 printk(KERN_WARNING "dell-laptop: Unable to setup rfkill\n"); 640 pr_warn("Unable to setup rfkill\n");
640 goto fail_rfkill; 641 goto fail_rfkill;
641 } 642 }
642 643
643 ret = i8042_install_filter(dell_laptop_i8042_filter); 644 ret = i8042_install_filter(dell_laptop_i8042_filter);
644 if (ret) { 645 if (ret) {
645 printk(KERN_WARNING 646 pr_warn("Unable to install key filter\n");
646 "dell-laptop: Unable to install key filter\n");
647 goto fail_filter; 647 goto fail_filter;
648 } 648 }
649 649
diff --git a/drivers/platform/x86/dell-wmi-aio.c b/drivers/platform/x86/dell-wmi-aio.c
index 0ed84573ae1f..3f945457f71c 100644
--- a/drivers/platform/x86/dell-wmi-aio.c
+++ b/drivers/platform/x86/dell-wmi-aio.c
@@ -15,6 +15,7 @@
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19 20
20#include <linux/kernel.h> 21#include <linux/kernel.h>
@@ -138,7 +139,7 @@ static int __init dell_wmi_aio_init(void)
138 139
139 guid = dell_wmi_aio_find(); 140 guid = dell_wmi_aio_find();
140 if (!guid) { 141 if (!guid) {
141 pr_warning("No known WMI GUID found\n"); 142 pr_warn("No known WMI GUID found\n");
142 return -ENXIO; 143 return -ENXIO;
143 } 144 }
144 145
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 77f1d55414c6..ce790827e199 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -23,6 +23,8 @@
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */ 24 */
25 25
26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
27
26#include <linux/kernel.h> 28#include <linux/kernel.h>
27#include <linux/module.h> 29#include <linux/module.h>
28#include <linux/init.h> 30#include <linux/init.h>
@@ -141,7 +143,7 @@ static void dell_wmi_notify(u32 value, void *context)
141 143
142 status = wmi_get_event_data(value, &response); 144 status = wmi_get_event_data(value, &response);
143 if (status != AE_OK) { 145 if (status != AE_OK) {
144 printk(KERN_INFO "dell-wmi: bad event status 0x%x\n", status); 146 pr_info("bad event status 0x%x\n", status);
145 return; 147 return;
146 } 148 }
147 149
@@ -153,8 +155,8 @@ static void dell_wmi_notify(u32 value, void *context)
153 u16 *buffer_entry = (u16 *)obj->buffer.pointer; 155 u16 *buffer_entry = (u16 *)obj->buffer.pointer;
154 156
155 if (dell_new_hk_type && (buffer_entry[1] != 0x10)) { 157 if (dell_new_hk_type && (buffer_entry[1] != 0x10)) {
156 printk(KERN_INFO "dell-wmi: Received unknown WMI event" 158 pr_info("Received unknown WMI event (0x%x)\n",
157 " (0x%x)\n", buffer_entry[1]); 159 buffer_entry[1]);
158 kfree(obj); 160 kfree(obj);
159 return; 161 return;
160 } 162 }
@@ -167,8 +169,7 @@ static void dell_wmi_notify(u32 value, void *context)
167 key = sparse_keymap_entry_from_scancode(dell_wmi_input_dev, 169 key = sparse_keymap_entry_from_scancode(dell_wmi_input_dev,
168 reported_key); 170 reported_key);
169 if (!key) { 171 if (!key) {
170 printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n", 172 pr_info("Unknown key %x pressed\n", reported_key);
171 reported_key);
172 } else if ((key->keycode == KEY_BRIGHTNESSUP || 173 } else if ((key->keycode == KEY_BRIGHTNESSUP ||
173 key->keycode == KEY_BRIGHTNESSDOWN) && acpi_video) { 174 key->keycode == KEY_BRIGHTNESSDOWN) && acpi_video) {
174 /* Don't report brightness notifications that will also 175 /* Don't report brightness notifications that will also
@@ -275,7 +276,7 @@ static int __init dell_wmi_init(void)
275 acpi_status status; 276 acpi_status status;
276 277
277 if (!wmi_has_guid(DELL_EVENT_GUID)) { 278 if (!wmi_has_guid(DELL_EVENT_GUID)) {
278 printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); 279 pr_warn("No known WMI GUID found\n");
279 return -ENODEV; 280 return -ENODEV;
280 } 281 }
281 282
@@ -290,9 +291,7 @@ static int __init dell_wmi_init(void)
290 dell_wmi_notify, NULL); 291 dell_wmi_notify, NULL);
291 if (ACPI_FAILURE(status)) { 292 if (ACPI_FAILURE(status)) {
292 dell_wmi_input_destroy(); 293 dell_wmi_input_destroy();
293 printk(KERN_ERR 294 pr_err("Unable to register notify handler - %d\n", status);
294 "dell-wmi: Unable to register notify handler - %d\n",
295 status);
296 return -ENODEV; 295 return -ENODEV;
297 } 296 }
298 297
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 2c1abf63957f..1c45d92e2163 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -228,7 +228,7 @@ static int set_acpi(struct eeepc_laptop *eeepc, int cm, int value)
228 return -ENODEV; 228 return -ENODEV;
229 229
230 if (write_acpi_int(eeepc->handle, method, value)) 230 if (write_acpi_int(eeepc->handle, method, value))
231 pr_warning("Error writing %s\n", method); 231 pr_warn("Error writing %s\n", method);
232 return 0; 232 return 0;
233} 233}
234 234
@@ -243,7 +243,7 @@ static int get_acpi(struct eeepc_laptop *eeepc, int cm)
243 return -ENODEV; 243 return -ENODEV;
244 244
245 if (read_acpi_int(eeepc->handle, method, &value)) 245 if (read_acpi_int(eeepc->handle, method, &value))
246 pr_warning("Error reading %s\n", method); 246 pr_warn("Error reading %s\n", method);
247 return value; 247 return value;
248} 248}
249 249
@@ -261,7 +261,7 @@ static int acpi_setter_handle(struct eeepc_laptop *eeepc, int cm,
261 status = acpi_get_handle(eeepc->handle, (char *)method, 261 status = acpi_get_handle(eeepc->handle, (char *)method,
262 handle); 262 handle);
263 if (status != AE_OK) { 263 if (status != AE_OK) {
264 pr_warning("Error finding %s\n", method); 264 pr_warn("Error finding %s\n", method);
265 return -ENODEV; 265 return -ENODEV;
266 } 266 }
267 return 0; 267 return 0;
@@ -417,7 +417,7 @@ static ssize_t store_cpufv_disabled(struct device *dev,
417 switch (value) { 417 switch (value) {
418 case 0: 418 case 0:
419 if (eeepc->cpufv_disabled) 419 if (eeepc->cpufv_disabled)
420 pr_warning("cpufv enabled (not officially supported " 420 pr_warn("cpufv enabled (not officially supported "
421 "on this model)\n"); 421 "on this model)\n");
422 eeepc->cpufv_disabled = false; 422 eeepc->cpufv_disabled = false;
423 return rv; 423 return rv;
@@ -609,7 +609,7 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle)
609 bus = port->subordinate; 609 bus = port->subordinate;
610 610
611 if (!bus) { 611 if (!bus) {
612 pr_warning("Unable to find PCI bus?\n"); 612 pr_warn("Unable to find PCI bus 1?\n");
613 goto out_unlock; 613 goto out_unlock;
614 } 614 }
615 615
@@ -621,12 +621,12 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle)
621 absent = (l == 0xffffffff); 621 absent = (l == 0xffffffff);
622 622
623 if (blocked != absent) { 623 if (blocked != absent) {
624 pr_warning("BIOS says wireless lan is %s, " 624 pr_warn("BIOS says wireless lan is %s, "
625 "but the pci device is %s\n", 625 "but the pci device is %s\n",
626 blocked ? "blocked" : "unblocked", 626 blocked ? "blocked" : "unblocked",
627 absent ? "absent" : "present"); 627 absent ? "absent" : "present");
628 pr_warning("skipped wireless hotplug as probably " 628 pr_warn("skipped wireless hotplug as probably "
629 "inappropriate for this model\n"); 629 "inappropriate for this model\n");
630 goto out_unlock; 630 goto out_unlock;
631 } 631 }
632 632
@@ -691,7 +691,8 @@ static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc,
691 eeepc_rfkill_notify, 691 eeepc_rfkill_notify,
692 eeepc); 692 eeepc);
693 if (ACPI_FAILURE(status)) 693 if (ACPI_FAILURE(status))
694 pr_warning("Failed to register notify on %s\n", node); 694 pr_warn("Failed to register notify on %s\n", node);
695
695 /* 696 /*
696 * Refresh pci hotplug in case the rfkill state was 697 * Refresh pci hotplug in case the rfkill state was
697 * changed during setup. 698 * changed during setup.
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 649dcadd8ea3..4aa867a9b88b 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -84,7 +84,7 @@ static const struct key_entry eeepc_wmi_keymap[] = {
84static acpi_status eeepc_wmi_parse_device(acpi_handle handle, u32 level, 84static acpi_status eeepc_wmi_parse_device(acpi_handle handle, u32 level,
85 void *context, void **retval) 85 void *context, void **retval)
86{ 86{
87 pr_warning("Found legacy ATKD device (%s)", EEEPC_ACPI_HID); 87 pr_warn("Found legacy ATKD device (%s)\n", EEEPC_ACPI_HID);
88 *(bool *)context = true; 88 *(bool *)context = true;
89 return AE_CTRL_TERMINATE; 89 return AE_CTRL_TERMINATE;
90} 90}
@@ -105,12 +105,12 @@ static int eeepc_wmi_check_atkd(void)
105static int eeepc_wmi_probe(struct platform_device *pdev) 105static int eeepc_wmi_probe(struct platform_device *pdev)
106{ 106{
107 if (eeepc_wmi_check_atkd()) { 107 if (eeepc_wmi_check_atkd()) {
108 pr_warning("WMI device present, but legacy ATKD device is also " 108 pr_warn("WMI device present, but legacy ATKD device is also "
109 "present and enabled."); 109 "present and enabled\n");
110 pr_warning("You probably booted with acpi_osi=\"Linux\" or " 110 pr_warn("You probably booted with acpi_osi=\"Linux\" or "
111 "acpi_osi=\"!Windows 2009\""); 111 "acpi_osi=\"!Windows 2009\"\n");
112 pr_warning("Can't load eeepc-wmi, use default acpi_osi " 112 pr_warn("Can't load eeepc-wmi, use default acpi_osi "
113 "(preferred) or eeepc-laptop"); 113 "(preferred) or eeepc-laptop\n");
114 return -EBUSY; 114 return -EBUSY;
115 } 115 }
116 return 0; 116 return 0;
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 493054c2dbe1..6b26666b37f2 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -56,6 +56,8 @@
56 * 56 *
57 */ 57 */
58 58
59#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
60
59#include <linux/module.h> 61#include <linux/module.h>
60#include <linux/kernel.h> 62#include <linux/kernel.h>
61#include <linux/init.h> 63#include <linux/init.h>
@@ -585,8 +587,7 @@ static struct platform_driver fujitsupf_driver = {
585static void dmi_check_cb_common(const struct dmi_system_id *id) 587static void dmi_check_cb_common(const struct dmi_system_id *id)
586{ 588{
587 acpi_handle handle; 589 acpi_handle handle;
588 printk(KERN_INFO "fujitsu-laptop: Identified laptop model '%s'.\n", 590 pr_info("Identified laptop model '%s'\n", id->ident);
589 id->ident);
590 if (use_alt_lcd_levels == -1) { 591 if (use_alt_lcd_levels == -1) {
591 if (ACPI_SUCCESS(acpi_get_handle(NULL, 592 if (ACPI_SUCCESS(acpi_get_handle(NULL,
592 "\\_SB.PCI0.LPCB.FJEX.SBL2", &handle))) 593 "\\_SB.PCI0.LPCB.FJEX.SBL2", &handle)))
@@ -691,11 +692,11 @@ static int acpi_fujitsu_add(struct acpi_device *device)
691 692
692 result = acpi_bus_update_power(fujitsu->acpi_handle, &state); 693 result = acpi_bus_update_power(fujitsu->acpi_handle, &state);
693 if (result) { 694 if (result) {
694 printk(KERN_ERR "Error reading power state\n"); 695 pr_err("Error reading power state\n");
695 goto err_unregister_input_dev; 696 goto err_unregister_input_dev;
696 } 697 }
697 698
698 printk(KERN_INFO "ACPI: %s [%s] (%s)\n", 699 pr_info("ACPI: %s [%s] (%s)\n",
699 acpi_device_name(device), acpi_device_bid(device), 700 acpi_device_name(device), acpi_device_bid(device),
700 !device->power.state ? "on" : "off"); 701 !device->power.state ? "on" : "off");
701 702
@@ -707,7 +708,7 @@ static int acpi_fujitsu_add(struct acpi_device *device)
707 if (ACPI_FAILURE 708 if (ACPI_FAILURE
708 (acpi_evaluate_object 709 (acpi_evaluate_object
709 (device->handle, METHOD_NAME__INI, NULL, NULL))) 710 (device->handle, METHOD_NAME__INI, NULL, NULL)))
710 printk(KERN_ERR "_INI Method failed\n"); 711 pr_err("_INI Method failed\n");
711 } 712 }
712 713
713 /* do config (detect defaults) */ 714 /* do config (detect defaults) */
@@ -827,7 +828,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
827 error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int), 828 error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int),
828 GFP_KERNEL); 829 GFP_KERNEL);
829 if (error) { 830 if (error) {
830 printk(KERN_ERR "kfifo_alloc failed\n"); 831 pr_err("kfifo_alloc failed\n");
831 goto err_stop; 832 goto err_stop;
832 } 833 }
833 834
@@ -859,13 +860,13 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
859 860
860 result = acpi_bus_update_power(fujitsu_hotkey->acpi_handle, &state); 861 result = acpi_bus_update_power(fujitsu_hotkey->acpi_handle, &state);
861 if (result) { 862 if (result) {
862 printk(KERN_ERR "Error reading power state\n"); 863 pr_err("Error reading power state\n");
863 goto err_unregister_input_dev; 864 goto err_unregister_input_dev;
864 } 865 }
865 866
866 printk(KERN_INFO "ACPI: %s [%s] (%s)\n", 867 pr_info("ACPI: %s [%s] (%s)\n",
867 acpi_device_name(device), acpi_device_bid(device), 868 acpi_device_name(device), acpi_device_bid(device),
868 !device->power.state ? "on" : "off"); 869 !device->power.state ? "on" : "off");
869 870
870 fujitsu_hotkey->dev = device; 871 fujitsu_hotkey->dev = device;
871 872
@@ -875,7 +876,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
875 if (ACPI_FAILURE 876 if (ACPI_FAILURE
876 (acpi_evaluate_object 877 (acpi_evaluate_object
877 (device->handle, METHOD_NAME__INI, NULL, NULL))) 878 (device->handle, METHOD_NAME__INI, NULL, NULL)))
878 printk(KERN_ERR "_INI Method failed\n"); 879 pr_err("_INI Method failed\n");
879 } 880 }
880 881
881 i = 0; 882 i = 0;
@@ -897,8 +898,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
897 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); 898 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
898 899
899 /* Suspect this is a keymap of the application panel, print it */ 900 /* Suspect this is a keymap of the application panel, print it */
900 printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n", 901 pr_info("BTNI: [0x%x]\n", call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0));
901 call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0));
902 902
903#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 903#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
904 if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { 904 if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) {
@@ -907,8 +907,8 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
907 if (result == 0) { 907 if (result == 0) {
908 fujitsu_hotkey->logolamp_registered = 1; 908 fujitsu_hotkey->logolamp_registered = 1;
909 } else { 909 } else {
910 printk(KERN_ERR "fujitsu-laptop: Could not register " 910 pr_err("Could not register LED handler for logo lamp, error %i\n",
911 "LED handler for logo lamp, error %i\n", result); 911 result);
912 } 912 }
913 } 913 }
914 914
@@ -919,8 +919,8 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
919 if (result == 0) { 919 if (result == 0) {
920 fujitsu_hotkey->kblamps_registered = 1; 920 fujitsu_hotkey->kblamps_registered = 1;
921 } else { 921 } else {
922 printk(KERN_ERR "fujitsu-laptop: Could not register " 922 pr_err("Could not register LED handler for keyboard lamps, error %i\n",
923 "LED handler for keyboard lamps, error %i\n", result); 923 result);
924 } 924 }
925 } 925 }
926#endif 926#endif
@@ -1169,8 +1169,7 @@ static int __init fujitsu_init(void)
1169 fujitsu->bl_device->props.power = 0; 1169 fujitsu->bl_device->props.power = 0;
1170 } 1170 }
1171 1171
1172 printk(KERN_INFO "fujitsu-laptop: driver " FUJITSU_DRIVER_VERSION 1172 pr_info("driver " FUJITSU_DRIVER_VERSION " successfully loaded\n");
1173 " successfully loaded.\n");
1174 1173
1175 return 0; 1174 return 0;
1176 1175
@@ -1216,7 +1215,7 @@ static void __exit fujitsu_cleanup(void)
1216 1215
1217 kfree(fujitsu); 1216 kfree(fujitsu);
1218 1217
1219 printk(KERN_INFO "fujitsu-laptop: driver unloaded.\n"); 1218 pr_info("driver unloaded\n");
1220} 1219}
1221 1220
1222module_init(fujitsu_init); 1221module_init(fujitsu_init);
diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c
index 067bf36d32f3..5a34973dc164 100644
--- a/drivers/platform/x86/hdaps.c
+++ b/drivers/platform/x86/hdaps.c
@@ -26,6 +26,8 @@
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
29#include <linux/delay.h> 31#include <linux/delay.h>
30#include <linux/platform_device.h> 32#include <linux/platform_device.h>
31#include <linux/input-polldev.h> 33#include <linux/input-polldev.h>
@@ -238,7 +240,7 @@ static int hdaps_device_init(void)
238 __check_latch(0x1611, 0x01)) 240 __check_latch(0x1611, 0x01))
239 goto out; 241 goto out;
240 242
241 printk(KERN_DEBUG "hdaps: initial latch check good (0x%02x).\n", 243 printk(KERN_DEBUG "hdaps: initial latch check good (0x%02x)\n",
242 __get_latch(0x1611)); 244 __get_latch(0x1611));
243 245
244 outb(0x17, 0x1610); 246 outb(0x17, 0x1610);
@@ -299,7 +301,7 @@ static int hdaps_probe(struct platform_device *dev)
299 if (ret) 301 if (ret)
300 return ret; 302 return ret;
301 303
302 printk(KERN_INFO "hdaps: device successfully initialized.\n"); 304 pr_info("device successfully initialized\n");
303 return 0; 305 return 0;
304} 306}
305 307
@@ -480,7 +482,7 @@ static struct attribute_group hdaps_attribute_group = {
480/* hdaps_dmi_match - found a match. return one, short-circuiting the hunt. */ 482/* hdaps_dmi_match - found a match. return one, short-circuiting the hunt. */
481static int __init hdaps_dmi_match(const struct dmi_system_id *id) 483static int __init hdaps_dmi_match(const struct dmi_system_id *id)
482{ 484{
483 printk(KERN_INFO "hdaps: %s detected.\n", id->ident); 485 pr_info("%s detected\n", id->ident);
484 return 1; 486 return 1;
485} 487}
486 488
@@ -488,8 +490,7 @@ static int __init hdaps_dmi_match(const struct dmi_system_id *id)
488static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id) 490static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id)
489{ 491{
490 hdaps_invert = (unsigned long)id->driver_data; 492 hdaps_invert = (unsigned long)id->driver_data;
491 printk(KERN_INFO "hdaps: inverting axis (%u) readings.\n", 493 pr_info("inverting axis (%u) readings\n", hdaps_invert);
492 hdaps_invert);
493 return hdaps_dmi_match(id); 494 return hdaps_dmi_match(id);
494} 495}
495 496
@@ -543,7 +544,7 @@ static int __init hdaps_init(void)
543 int ret; 544 int ret;
544 545
545 if (!dmi_check_system(hdaps_whitelist)) { 546 if (!dmi_check_system(hdaps_whitelist)) {
546 printk(KERN_WARNING "hdaps: supported laptop not found!\n"); 547 pr_warn("supported laptop not found!\n");
547 ret = -ENODEV; 548 ret = -ENODEV;
548 goto out; 549 goto out;
549 } 550 }
@@ -595,7 +596,7 @@ static int __init hdaps_init(void)
595 if (ret) 596 if (ret)
596 goto out_idev; 597 goto out_idev;
597 598
598 printk(KERN_INFO "hdaps: driver successfully loaded.\n"); 599 pr_info("driver successfully loaded\n");
599 return 0; 600 return 0;
600 601
601out_idev: 602out_idev:
@@ -609,7 +610,7 @@ out_driver:
609out_region: 610out_region:
610 release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); 611 release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
611out: 612out:
612 printk(KERN_WARNING "hdaps: driver init failed (ret=%d)!\n", ret); 613 pr_warn("driver init failed (ret=%d)!\n", ret);
613 return ret; 614 return ret;
614} 615}
615 616
@@ -622,7 +623,7 @@ static void __exit hdaps_exit(void)
622 platform_driver_unregister(&hdaps_driver); 623 platform_driver_unregister(&hdaps_driver);
623 release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); 624 release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
624 625
625 printk(KERN_INFO "hdaps: driver unloaded.\n"); 626 pr_info("driver unloaded\n");
626} 627}
627 628
628module_init(hdaps_init); 629module_init(hdaps_init);
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 1bc4a7539ba9..f94017bcdd6e 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -24,6 +24,8 @@
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */ 25 */
26 26
27#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28
27#include <linux/kernel.h> 29#include <linux/kernel.h>
28#include <linux/module.h> 30#include <linux/module.h>
29#include <linux/init.h> 31#include <linux/init.h>
@@ -54,9 +56,6 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
54#define HPWMI_HOTKEY_QUERY 0xc 56#define HPWMI_HOTKEY_QUERY 0xc
55#define HPWMI_WIRELESS2_QUERY 0x1b 57#define HPWMI_WIRELESS2_QUERY 0x1b
56 58
57#define PREFIX "HP WMI: "
58#define UNIMP "Unimplemented "
59
60enum hp_wmi_radio { 59enum hp_wmi_radio {
61 HPWMI_WIFI = 0, 60 HPWMI_WIFI = 0,
62 HPWMI_BLUETOOTH = 1, 61 HPWMI_BLUETOOTH = 1,
@@ -228,9 +227,8 @@ static int hp_wmi_perform_query(int query, int write, void *buffer,
228 227
229 if (bios_return->return_code) { 228 if (bios_return->return_code) {
230 if (bios_return->return_code != HPWMI_RET_UNKNOWN_CMDTYPE) 229 if (bios_return->return_code != HPWMI_RET_UNKNOWN_CMDTYPE)
231 printk(KERN_WARNING PREFIX "query 0x%x returned " 230 pr_warn("query 0x%x returned error 0x%x\n",
232 "error 0x%x\n", 231 query, bios_return->return_code);
233 query, bios_return->return_code);
234 kfree(obj); 232 kfree(obj);
235 return bios_return->return_code; 233 return bios_return->return_code;
236 } 234 }
@@ -384,8 +382,7 @@ static int hp_wmi_rfkill2_refresh(void)
384 382
385 if (num >= state.count || 383 if (num >= state.count ||
386 devstate->rfkill_id != rfkill2[i].id) { 384 devstate->rfkill_id != rfkill2[i].id) {
387 printk(KERN_WARNING PREFIX "power configuration of " 385 pr_warn("power configuration of the wireless devices unexpectedly changed\n");
388 "the wireless devices unexpectedly changed\n");
389 continue; 386 continue;
390 } 387 }
391 388
@@ -471,7 +468,7 @@ static void hp_wmi_notify(u32 value, void *context)
471 468
472 status = wmi_get_event_data(value, &response); 469 status = wmi_get_event_data(value, &response);
473 if (status != AE_OK) { 470 if (status != AE_OK) {
474 printk(KERN_INFO PREFIX "bad event status 0x%x\n", status); 471 pr_info("bad event status 0x%x\n", status);
475 return; 472 return;
476 } 473 }
477 474
@@ -480,8 +477,7 @@ static void hp_wmi_notify(u32 value, void *context)
480 if (!obj) 477 if (!obj)
481 return; 478 return;
482 if (obj->type != ACPI_TYPE_BUFFER) { 479 if (obj->type != ACPI_TYPE_BUFFER) {
483 printk(KERN_INFO "hp-wmi: Unknown response received %d\n", 480 pr_info("Unknown response received %d\n", obj->type);
484 obj->type);
485 kfree(obj); 481 kfree(obj);
486 return; 482 return;
487 } 483 }
@@ -498,8 +494,7 @@ static void hp_wmi_notify(u32 value, void *context)
498 event_id = *location; 494 event_id = *location;
499 event_data = *(location + 2); 495 event_data = *(location + 2);
500 } else { 496 } else {
501 printk(KERN_INFO "hp-wmi: Unknown buffer length %d\n", 497 pr_info("Unknown buffer length %d\n", obj->buffer.length);
502 obj->buffer.length);
503 kfree(obj); 498 kfree(obj);
504 return; 499 return;
505 } 500 }
@@ -527,8 +522,7 @@ static void hp_wmi_notify(u32 value, void *context)
527 522
528 if (!sparse_keymap_report_event(hp_wmi_input_dev, 523 if (!sparse_keymap_report_event(hp_wmi_input_dev,
529 key_code, 1, true)) 524 key_code, 1, true))
530 printk(KERN_INFO PREFIX "Unknown key code - 0x%x\n", 525 pr_info("Unknown key code - 0x%x\n", key_code);
531 key_code);
532 break; 526 break;
533 case HPWMI_WIRELESS: 527 case HPWMI_WIRELESS:
534 if (rfkill2_count) { 528 if (rfkill2_count) {
@@ -550,14 +544,12 @@ static void hp_wmi_notify(u32 value, void *context)
550 hp_wmi_get_hw_state(HPWMI_WWAN)); 544 hp_wmi_get_hw_state(HPWMI_WWAN));
551 break; 545 break;
552 case HPWMI_CPU_BATTERY_THROTTLE: 546 case HPWMI_CPU_BATTERY_THROTTLE:
553 printk(KERN_INFO PREFIX UNIMP "CPU throttle because of 3 Cell" 547 pr_info("Unimplemented CPU throttle because of 3 Cell battery event detected\n");
554 " battery event detected\n");
555 break; 548 break;
556 case HPWMI_LOCK_SWITCH: 549 case HPWMI_LOCK_SWITCH:
557 break; 550 break;
558 default: 551 default:
559 printk(KERN_INFO PREFIX "Unknown event_id - %d - 0x%x\n", 552 pr_info("Unknown event_id - %d - 0x%x\n", event_id, event_data);
560 event_id, event_data);
561 break; 553 break;
562 } 554 }
563} 555}
@@ -705,7 +697,7 @@ static int __devinit hp_wmi_rfkill2_setup(struct platform_device *device)
705 return err; 697 return err;
706 698
707 if (state.count > HPWMI_MAX_RFKILL2_DEVICES) { 699 if (state.count > HPWMI_MAX_RFKILL2_DEVICES) {
708 printk(KERN_WARNING PREFIX "unable to parse 0x1b query output\n"); 700 pr_warn("unable to parse 0x1b query output\n");
709 return -EINVAL; 701 return -EINVAL;
710 } 702 }
711 703
@@ -727,14 +719,14 @@ static int __devinit hp_wmi_rfkill2_setup(struct platform_device *device)
727 name = "hp-wwan"; 719 name = "hp-wwan";
728 break; 720 break;
729 default: 721 default:
730 printk(KERN_WARNING PREFIX "unknown device type 0x%x\n", 722 pr_warn("unknown device type 0x%x\n",
731 state.device[i].radio_type); 723 state.device[i].radio_type);
732 continue; 724 continue;
733 } 725 }
734 726
735 if (!state.device[i].vendor_id) { 727 if (!state.device[i].vendor_id) {
736 printk(KERN_WARNING PREFIX "zero device %d while %d " 728 pr_warn("zero device %d while %d reported\n",
737 "reported\n", i, state.count); 729 i, state.count);
738 continue; 730 continue;
739 } 731 }
740 732
@@ -755,8 +747,7 @@ static int __devinit hp_wmi_rfkill2_setup(struct platform_device *device)
755 IS_HWBLOCKED(state.device[i].power)); 747 IS_HWBLOCKED(state.device[i].power));
756 748
757 if (!(state.device[i].power & HPWMI_POWER_BIOS)) 749 if (!(state.device[i].power & HPWMI_POWER_BIOS))
758 printk(KERN_INFO PREFIX "device %s blocked by BIOS\n", 750 pr_info("device %s blocked by BIOS\n", name);
759 name);
760 751
761 err = rfkill_register(rfkill); 752 err = rfkill_register(rfkill);
762 if (err) { 753 if (err) {
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index b1396e5b2953..811d436cd677 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -22,6 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26
25#include <linux/kernel.h> 27#include <linux/kernel.h>
26#include <linux/delay.h> 28#include <linux/delay.h>
27#include <linux/module.h> 29#include <linux/module.h>
@@ -69,9 +71,10 @@ struct ibm_rtl_table {
69#define RTL_SIGNATURE 0x0000005f4c54525fULL 71#define RTL_SIGNATURE 0x0000005f4c54525fULL
70#define RTL_MASK 0x000000ffffffffffULL 72#define RTL_MASK 0x000000ffffffffffULL
71 73
72#define RTL_DEBUG(A, ...) do { \ 74#define RTL_DEBUG(fmt, ...) \
73 if (debug) \ 75do { \
74 pr_info("ibm-rtl: " A, ##__VA_ARGS__ ); \ 76 if (debug) \
77 pr_info(fmt, ##__VA_ARGS__); \
75} while (0) 78} while (0)
76 79
77static DEFINE_MUTEX(rtl_lock); 80static DEFINE_MUTEX(rtl_lock);
@@ -114,7 +117,7 @@ static int ibm_rtl_write(u8 value)
114 int ret = 0, count = 0; 117 int ret = 0, count = 0;
115 static u32 cmd_port_val; 118 static u32 cmd_port_val;
116 119
117 RTL_DEBUG("%s(%d)\n", __FUNCTION__, value); 120 RTL_DEBUG("%s(%d)\n", __func__, value);
118 121
119 value = value == 1 ? RTL_CMD_ENTER_PRTM : RTL_CMD_EXIT_PRTM; 122 value = value == 1 ? RTL_CMD_ENTER_PRTM : RTL_CMD_EXIT_PRTM;
120 123
@@ -144,8 +147,8 @@ static int ibm_rtl_write(u8 value)
144 while (ioread8(&rtl_table->command)) { 147 while (ioread8(&rtl_table->command)) {
145 msleep(10); 148 msleep(10);
146 if (count++ > 500) { 149 if (count++ > 500) {
147 pr_err("ibm-rtl: Hardware not responding to " 150 pr_err("Hardware not responding to "
148 "mode switch request\n"); 151 "mode switch request\n");
149 ret = -EIO; 152 ret = -EIO;
150 break; 153 break;
151 } 154 }
@@ -250,7 +253,7 @@ static int __init ibm_rtl_init(void) {
250 int ret = -ENODEV, i; 253 int ret = -ENODEV, i;
251 254
252 if (force) 255 if (force)
253 pr_warning("ibm-rtl: module loaded by force\n"); 256 pr_warn("module loaded by force\n");
254 /* first ensure that we are running on IBM HW */ 257 /* first ensure that we are running on IBM HW */
255 else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table)) 258 else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table))
256 return -ENODEV; 259 return -ENODEV;
@@ -288,19 +291,19 @@ static int __init ibm_rtl_init(void) {
288 if ((readq(&tmp->signature) & RTL_MASK) == RTL_SIGNATURE) { 291 if ((readq(&tmp->signature) & RTL_MASK) == RTL_SIGNATURE) {
289 phys_addr_t addr; 292 phys_addr_t addr;
290 unsigned int plen; 293 unsigned int plen;
291 RTL_DEBUG("found RTL_SIGNATURE at %#llx\n", (u64)tmp); 294 RTL_DEBUG("found RTL_SIGNATURE at %p\n", tmp);
292 rtl_table = tmp; 295 rtl_table = tmp;
293 /* The address, value, width and offset are platform 296 /* The address, value, width and offset are platform
294 * dependent and found in the ibm_rtl_table */ 297 * dependent and found in the ibm_rtl_table */
295 rtl_cmd_width = ioread8(&rtl_table->cmd_granularity); 298 rtl_cmd_width = ioread8(&rtl_table->cmd_granularity);
296 rtl_cmd_type = ioread8(&rtl_table->cmd_address_type); 299 rtl_cmd_type = ioread8(&rtl_table->cmd_address_type);
297 RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n", 300 RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n",
298 rtl_cmd_width, rtl_cmd_type); 301 rtl_cmd_width, rtl_cmd_type);
299 addr = ioread32(&rtl_table->cmd_port_address); 302 addr = ioread32(&rtl_table->cmd_port_address);
300 RTL_DEBUG("addr = %#llx\n", (unsigned long long)addr); 303 RTL_DEBUG("addr = %#llx\n", (unsigned long long)addr);
301 plen = rtl_cmd_width/sizeof(char); 304 plen = rtl_cmd_width/sizeof(char);
302 rtl_cmd_addr = rtl_port_map(addr, plen); 305 rtl_cmd_addr = rtl_port_map(addr, plen);
303 RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr); 306 RTL_DEBUG("rtl_cmd_addr = %p\n", rtl_cmd_addr);
304 if (!rtl_cmd_addr) { 307 if (!rtl_cmd_addr) {
305 ret = -ENOMEM; 308 ret = -ENOMEM;
306 break; 309 break;
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 21b101899bae..bfdda33feb26 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -20,6 +20,8 @@
20 * 02110-1301, USA. 20 * 02110-1301, USA.
21 */ 21 */
22 22
23#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24
23#include <linux/kernel.h> 25#include <linux/kernel.h>
24#include <linux/module.h> 26#include <linux/module.h>
25#include <linux/init.h> 27#include <linux/init.h>
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c
index eacd5da7dd24..809adea4965f 100644
--- a/drivers/platform/x86/intel_menlow.c
+++ b/drivers/platform/x86/intel_menlow.c
@@ -27,6 +27,8 @@
27 * to get/set bandwidth. 27 * to get/set bandwidth.
28 */ 28 */
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
30#include <linux/kernel.h> 32#include <linux/kernel.h>
31#include <linux/module.h> 33#include <linux/module.h>
32#include <linux/init.h> 34#include <linux/init.h>
@@ -135,8 +137,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
135 acpi_evaluate_integer(handle, MEMORY_SET_BANDWIDTH, &arg_list, 137 acpi_evaluate_integer(handle, MEMORY_SET_BANDWIDTH, &arg_list,
136 &temp); 138 &temp);
137 139
138 printk(KERN_INFO 140 pr_info("Bandwidth value was %ld: status is %d\n", state, status);
139 "Bandwidth value was %ld: status is %d\n", state, status);
140 if (ACPI_FAILURE(status)) 141 if (ACPI_FAILURE(status))
141 return -EFAULT; 142 return -EFAULT;
142 143
diff --git a/drivers/platform/x86/intel_mid_powerbtn.c b/drivers/platform/x86/intel_mid_powerbtn.c
index 213e79ba68d5..f1ae5078b7ec 100644
--- a/drivers/platform/x86/intel_mid_powerbtn.c
+++ b/drivers/platform/x86/intel_mid_powerbtn.c
@@ -23,58 +23,48 @@
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/input.h> 25#include <linux/input.h>
26
26#include <asm/intel_scu_ipc.h> 27#include <asm/intel_scu_ipc.h>
27 28
28#define DRIVER_NAME "msic_power_btn" 29#define DRIVER_NAME "msic_power_btn"
29 30
30#define MSIC_IRQ_STAT 0x02
31 #define MSIC_IRQ_PB (1 << 0)
32#define MSIC_PB_CONFIG 0x3e
33#define MSIC_PB_STATUS 0x3f 31#define MSIC_PB_STATUS 0x3f
34 #define MSIC_PB_LEVEL (1 << 3) /* 1 - release, 0 - press */ 32#define MSIC_PB_LEVEL (1 << 3) /* 1 - release, 0 - press */
35
36struct mfld_pb_priv {
37 struct input_dev *input;
38 unsigned int irq;
39};
40 33
41static irqreturn_t mfld_pb_isr(int irq, void *dev_id) 34static irqreturn_t mfld_pb_isr(int irq, void *dev_id)
42{ 35{
43 struct mfld_pb_priv *priv = dev_id; 36 struct input_dev *input = dev_id;
44 int ret; 37 int ret;
45 u8 pbstat; 38 u8 pbstat;
46 39
47 ret = intel_scu_ipc_ioread8(MSIC_PB_STATUS, &pbstat); 40 ret = intel_scu_ipc_ioread8(MSIC_PB_STATUS, &pbstat);
48 if (ret < 0) 41 if (ret < 0) {
49 return IRQ_HANDLED; 42 dev_err(input->dev.parent, "Read error %d while reading"
50 43 " MSIC_PB_STATUS\n", ret);
51 input_event(priv->input, EV_KEY, KEY_POWER, !(pbstat & MSIC_PB_LEVEL)); 44 } else {
52 input_sync(priv->input); 45 input_event(input, EV_KEY, KEY_POWER,
46 !(pbstat & MSIC_PB_LEVEL));
47 input_sync(input);
48 }
53 49
54 return IRQ_HANDLED; 50 return IRQ_HANDLED;
55} 51}
56 52
57static int __devinit mfld_pb_probe(struct platform_device *pdev) 53static int __devinit mfld_pb_probe(struct platform_device *pdev)
58{ 54{
59 struct mfld_pb_priv *priv;
60 struct input_dev *input; 55 struct input_dev *input;
61 int irq; 56 int irq = platform_get_irq(pdev, 0);
62 int error; 57 int error;
63 58
64 irq = platform_get_irq(pdev, 0);
65 if (irq < 0) 59 if (irq < 0)
66 return -EINVAL; 60 return -EINVAL;
67 61
68 priv = kzalloc(sizeof(struct mfld_pb_priv), GFP_KERNEL);
69 input = input_allocate_device(); 62 input = input_allocate_device();
70 if (!priv || !input) { 63 if (!input) {
71 error = -ENOMEM; 64 dev_err(&pdev->dev, "Input device allocation error\n");
72 goto err_free_mem; 65 return -ENOMEM;
73 } 66 }
74 67
75 priv->input = input;
76 priv->irq = irq;
77
78 input->name = pdev->name; 68 input->name = pdev->name;
79 input->phys = "power-button/input0"; 69 input->phys = "power-button/input0";
80 input->id.bustype = BUS_HOST; 70 input->id.bustype = BUS_HOST;
@@ -82,42 +72,40 @@ static int __devinit mfld_pb_probe(struct platform_device *pdev)
82 72
83 input_set_capability(input, EV_KEY, KEY_POWER); 73 input_set_capability(input, EV_KEY, KEY_POWER);
84 74
85 error = request_threaded_irq(priv->irq, NULL, mfld_pb_isr, 75 error = request_threaded_irq(irq, NULL, mfld_pb_isr, 0,
86 0, DRIVER_NAME, priv); 76 DRIVER_NAME, input);
87 if (error) { 77 if (error) {
88 dev_err(&pdev->dev, 78 dev_err(&pdev->dev, "Unable to request irq %d for mfld power"
89 "unable to request irq %d for mfld power button\n", 79 "button\n", irq);
90 irq); 80 goto err_free_input;
91 goto err_free_mem;
92 } 81 }
93 82
94 error = input_register_device(input); 83 error = input_register_device(input);
95 if (error) { 84 if (error) {
96 dev_err(&pdev->dev, 85 dev_err(&pdev->dev, "Unable to register input dev, error "
97 "unable to register input dev, error %d\n", error); 86 "%d\n", error);
98 goto err_free_irq; 87 goto err_free_irq;
99 } 88 }
100 89
101 platform_set_drvdata(pdev, priv); 90 platform_set_drvdata(pdev, input);
102 return 0; 91 return 0;
103 92
104err_free_irq: 93err_free_irq:
105 free_irq(priv->irq, priv); 94 free_irq(irq, input);
106err_free_mem: 95err_free_input:
107 input_free_device(input); 96 input_free_device(input);
108 kfree(priv);
109 return error; 97 return error;
110} 98}
111 99
112static int __devexit mfld_pb_remove(struct platform_device *pdev) 100static int __devexit mfld_pb_remove(struct platform_device *pdev)
113{ 101{
114 struct mfld_pb_priv *priv = platform_get_drvdata(pdev); 102 struct input_dev *input = platform_get_drvdata(pdev);
115 103 int irq = platform_get_irq(pdev, 0);
116 free_irq(priv->irq, priv);
117 input_unregister_device(priv->input);
118 kfree(priv);
119 104
105 free_irq(irq, input);
106 input_unregister_device(input);
120 platform_set_drvdata(pdev, NULL); 107 platform_set_drvdata(pdev, NULL);
108
121 return 0; 109 return 0;
122} 110}
123 111
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
index c2f4bd8013b5..3a578323122b 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -37,49 +37,50 @@
37#include <asm/intel_scu_ipc.h> 37#include <asm/intel_scu_ipc.h>
38 38
39/* Number of thermal sensors */ 39/* Number of thermal sensors */
40#define MSIC_THERMAL_SENSORS 4 40#define MSIC_THERMAL_SENSORS 4
41 41
42/* ADC1 - thermal registers */ 42/* ADC1 - thermal registers */
43#define MSIC_THERM_ADC1CNTL1 0x1C0 43#define MSIC_THERM_ADC1CNTL1 0x1C0
44#define MSIC_ADC_ENBL 0x10 44#define MSIC_ADC_ENBL 0x10
45#define MSIC_ADC_START 0x08 45#define MSIC_ADC_START 0x08
46 46
47#define MSIC_THERM_ADC1CNTL3 0x1C2 47#define MSIC_THERM_ADC1CNTL3 0x1C2
48#define MSIC_ADCTHERM_ENBL 0x04 48#define MSIC_ADCTHERM_ENBL 0x04
49#define MSIC_ADCRRDATA_ENBL 0x05 49#define MSIC_ADCRRDATA_ENBL 0x05
50#define MSIC_CHANL_MASK_VAL 0x0F 50#define MSIC_CHANL_MASK_VAL 0x0F
51 51
52#define MSIC_STOPBIT_MASK 16 52#define MSIC_STOPBIT_MASK 16
53#define MSIC_ADCTHERM_MASK 4 53#define MSIC_ADCTHERM_MASK 4
54#define ADC_CHANLS_MAX 15 /* Number of ADC channels */ 54/* Number of ADC channels */
55#define ADC_LOOP_MAX (ADC_CHANLS_MAX - MSIC_THERMAL_SENSORS) 55#define ADC_CHANLS_MAX 15
56#define ADC_LOOP_MAX (ADC_CHANLS_MAX - MSIC_THERMAL_SENSORS)
56 57
57/* ADC channel code values */ 58/* ADC channel code values */
58#define SKIN_SENSOR0_CODE 0x08 59#define SKIN_SENSOR0_CODE 0x08
59#define SKIN_SENSOR1_CODE 0x09 60#define SKIN_SENSOR1_CODE 0x09
60#define SYS_SENSOR_CODE 0x0A 61#define SYS_SENSOR_CODE 0x0A
61#define MSIC_DIE_SENSOR_CODE 0x03 62#define MSIC_DIE_SENSOR_CODE 0x03
62 63
63#define SKIN_THERM_SENSOR0 0 64#define SKIN_THERM_SENSOR0 0
64#define SKIN_THERM_SENSOR1 1 65#define SKIN_THERM_SENSOR1 1
65#define SYS_THERM_SENSOR2 2 66#define SYS_THERM_SENSOR2 2
66#define MSIC_DIE_THERM_SENSOR3 3 67#define MSIC_DIE_THERM_SENSOR3 3
67 68
68/* ADC code range */ 69/* ADC code range */
69#define ADC_MAX 977 70#define ADC_MAX 977
70#define ADC_MIN 162 71#define ADC_MIN 162
71#define ADC_VAL0C 887 72#define ADC_VAL0C 887
72#define ADC_VAL20C 720 73#define ADC_VAL20C 720
73#define ADC_VAL40C 508 74#define ADC_VAL40C 508
74#define ADC_VAL60C 315 75#define ADC_VAL60C 315
75 76
76/* ADC base addresses */ 77/* ADC base addresses */
77#define ADC_CHNL_START_ADDR 0x1C5 /* increments by 1 */ 78#define ADC_CHNL_START_ADDR 0x1C5 /* increments by 1 */
78#define ADC_DATA_START_ADDR 0x1D4 /* increments by 2 */ 79#define ADC_DATA_START_ADDR 0x1D4 /* increments by 2 */
79 80
80/* MSIC die attributes */ 81/* MSIC die attributes */
81#define MSIC_DIE_ADC_MIN 488 82#define MSIC_DIE_ADC_MIN 488
82#define MSIC_DIE_ADC_MAX 1004 83#define MSIC_DIE_ADC_MAX 1004
83 84
84/* This holds the address of the first free ADC channel, 85/* This holds the address of the first free ADC channel,
85 * among the 15 channels 86 * among the 15 channels
@@ -87,15 +88,15 @@
87static int channel_index; 88static int channel_index;
88 89
89struct platform_info { 90struct platform_info {
90 struct platform_device *pdev; 91 struct platform_device *pdev;
91 struct thermal_zone_device *tzd[MSIC_THERMAL_SENSORS]; 92 struct thermal_zone_device *tzd[MSIC_THERMAL_SENSORS];
92}; 93};
93 94
94struct thermal_device_info { 95struct thermal_device_info {
95 unsigned int chnl_addr; 96 unsigned int chnl_addr;
96 int direct; 97 int direct;
97 /* This holds the current temperature in millidegree celsius */ 98 /* This holds the current temperature in millidegree celsius */
98 long curr_temp; 99 long curr_temp;
99}; 100};
100 101
101/** 102/**
@@ -106,7 +107,7 @@ struct thermal_device_info {
106 */ 107 */
107static int to_msic_die_temp(uint16_t adc_val) 108static int to_msic_die_temp(uint16_t adc_val)
108{ 109{
109 return (368 * (adc_val) / 1000) - 220; 110 return (368 * (adc_val) / 1000) - 220;
110} 111}
111 112
112/** 113/**
@@ -118,7 +119,7 @@ static int to_msic_die_temp(uint16_t adc_val)
118 */ 119 */
119static int is_valid_adc(uint16_t adc_val, uint16_t min, uint16_t max) 120static int is_valid_adc(uint16_t adc_val, uint16_t min, uint16_t max)
120{ 121{
121 return (adc_val >= min) && (adc_val <= max); 122 return (adc_val >= min) && (adc_val <= max);
122} 123}
123 124
124/** 125/**
@@ -136,35 +137,35 @@ static int is_valid_adc(uint16_t adc_val, uint16_t min, uint16_t max)
136 */ 137 */
137static int adc_to_temp(int direct, uint16_t adc_val, unsigned long *tp) 138static int adc_to_temp(int direct, uint16_t adc_val, unsigned long *tp)
138{ 139{
139 int temp; 140 int temp;
140 141
141 /* Direct conversion for die temperature */ 142 /* Direct conversion for die temperature */
142 if (direct) { 143 if (direct) {
143 if (is_valid_adc(adc_val, MSIC_DIE_ADC_MIN, MSIC_DIE_ADC_MAX)) { 144 if (is_valid_adc(adc_val, MSIC_DIE_ADC_MIN, MSIC_DIE_ADC_MAX)) {
144 *tp = to_msic_die_temp(adc_val) * 1000; 145 *tp = to_msic_die_temp(adc_val) * 1000;
145 return 0; 146 return 0;
146 } 147 }
147 return -ERANGE; 148 return -ERANGE;
148 } 149 }
149 150
150 if (!is_valid_adc(adc_val, ADC_MIN, ADC_MAX)) 151 if (!is_valid_adc(adc_val, ADC_MIN, ADC_MAX))
151 return -ERANGE; 152 return -ERANGE;
152 153
153 /* Linear approximation for skin temperature */ 154 /* Linear approximation for skin temperature */
154 if (adc_val > ADC_VAL0C) 155 if (adc_val > ADC_VAL0C)
155 temp = 177 - (adc_val/5); 156 temp = 177 - (adc_val/5);
156 else if ((adc_val <= ADC_VAL0C) && (adc_val > ADC_VAL20C)) 157 else if ((adc_val <= ADC_VAL0C) && (adc_val > ADC_VAL20C))
157 temp = 111 - (adc_val/8); 158 temp = 111 - (adc_val/8);
158 else if ((adc_val <= ADC_VAL20C) && (adc_val > ADC_VAL40C)) 159 else if ((adc_val <= ADC_VAL20C) && (adc_val > ADC_VAL40C))
159 temp = 92 - (adc_val/10); 160 temp = 92 - (adc_val/10);
160 else if ((adc_val <= ADC_VAL40C) && (adc_val > ADC_VAL60C)) 161 else if ((adc_val <= ADC_VAL40C) && (adc_val > ADC_VAL60C))
161 temp = 91 - (adc_val/10); 162 temp = 91 - (adc_val/10);
162 else 163 else
163 temp = 112 - (adc_val/6); 164 temp = 112 - (adc_val/6);
164 165
165 /* Convert temperature in celsius to milli degree celsius */ 166 /* Convert temperature in celsius to milli degree celsius */
166 *tp = temp * 1000; 167 *tp = temp * 1000;
167 return 0; 168 return 0;
168} 169}
169 170
170/** 171/**
@@ -178,47 +179,47 @@ static int adc_to_temp(int direct, uint16_t adc_val, unsigned long *tp)
178 */ 179 */
179static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp) 180static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp)
180{ 181{
181 struct thermal_device_info *td_info = tzd->devdata; 182 struct thermal_device_info *td_info = tzd->devdata;
182 uint16_t adc_val, addr; 183 uint16_t adc_val, addr;
183 uint8_t data = 0; 184 uint8_t data = 0;
184 int ret; 185 int ret;
185 unsigned long curr_temp; 186 unsigned long curr_temp;
186 187
187 188
188 addr = td_info->chnl_addr; 189 addr = td_info->chnl_addr;
189 190
190 /* Enable the msic for conversion before reading */ 191 /* Enable the msic for conversion before reading */
191 ret = intel_scu_ipc_iowrite8(MSIC_THERM_ADC1CNTL3, MSIC_ADCRRDATA_ENBL); 192 ret = intel_scu_ipc_iowrite8(MSIC_THERM_ADC1CNTL3, MSIC_ADCRRDATA_ENBL);
192 if (ret) 193 if (ret)
193 return ret; 194 return ret;
194 195
195 /* Re-toggle the RRDATARD bit (temporary workaround) */ 196 /* Re-toggle the RRDATARD bit (temporary workaround) */
196 ret = intel_scu_ipc_iowrite8(MSIC_THERM_ADC1CNTL3, MSIC_ADCTHERM_ENBL); 197 ret = intel_scu_ipc_iowrite8(MSIC_THERM_ADC1CNTL3, MSIC_ADCTHERM_ENBL);
197 if (ret) 198 if (ret)
198 return ret; 199 return ret;
199 200
200 /* Read the higher bits of data */ 201 /* Read the higher bits of data */
201 ret = intel_scu_ipc_ioread8(addr, &data); 202 ret = intel_scu_ipc_ioread8(addr, &data);
202 if (ret) 203 if (ret)
203 return ret; 204 return ret;
204 205
205 /* Shift bits to accommodate the lower two data bits */ 206 /* Shift bits to accommodate the lower two data bits */
206 adc_val = (data << 2); 207 adc_val = (data << 2);
207 addr++; 208 addr++;
208 209
209 ret = intel_scu_ipc_ioread8(addr, &data);/* Read lower bits */ 210 ret = intel_scu_ipc_ioread8(addr, &data);/* Read lower bits */
210 if (ret) 211 if (ret)
211 return ret; 212 return ret;
212 213
213 /* Adding lower two bits to the higher bits */ 214 /* Adding lower two bits to the higher bits */
214 data &= 03; 215 data &= 03;
215 adc_val += data; 216 adc_val += data;
216 217
217 /* Convert ADC value to temperature */ 218 /* Convert ADC value to temperature */
218 ret = adc_to_temp(td_info->direct, adc_val, &curr_temp); 219 ret = adc_to_temp(td_info->direct, adc_val, &curr_temp);
219 if (ret == 0) 220 if (ret == 0)
220 *temp = td_info->curr_temp = curr_temp; 221 *temp = td_info->curr_temp = curr_temp;
221 return ret; 222 return ret;
222} 223}
223 224
224/** 225/**
@@ -231,22 +232,21 @@ static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp)
231 */ 232 */
232static int configure_adc(int val) 233static int configure_adc(int val)
233{ 234{
234 int ret; 235 int ret;
235 uint8_t data; 236 uint8_t data;
236 237
237 ret = intel_scu_ipc_ioread8(MSIC_THERM_ADC1CNTL1, &data); 238 ret = intel_scu_ipc_ioread8(MSIC_THERM_ADC1CNTL1, &data);
238 if (ret) 239 if (ret)
239 return ret; 240 return ret;
240 241
241 if (val) { 242 if (val) {
242 /* Enable and start the ADC */ 243 /* Enable and start the ADC */
243 data |= (MSIC_ADC_ENBL | MSIC_ADC_START); 244 data |= (MSIC_ADC_ENBL | MSIC_ADC_START);
244 } else { 245 } else {
245 /* Just stop the ADC */ 246 /* Just stop the ADC */
246 data &= (~MSIC_ADC_START); 247 data &= (~MSIC_ADC_START);
247 } 248 }
248 249 return intel_scu_ipc_iowrite8(MSIC_THERM_ADC1CNTL1, data);
249 return intel_scu_ipc_iowrite8(MSIC_THERM_ADC1CNTL1, data);
250} 250}
251 251
252/** 252/**
@@ -259,30 +259,30 @@ static int configure_adc(int val)
259 */ 259 */
260static int set_up_therm_channel(u16 base_addr) 260static int set_up_therm_channel(u16 base_addr)
261{ 261{
262 int ret; 262 int ret;
263 263
264 /* Enable all the sensor channels */ 264 /* Enable all the sensor channels */
265 ret = intel_scu_ipc_iowrite8(base_addr, SKIN_SENSOR0_CODE); 265 ret = intel_scu_ipc_iowrite8(base_addr, SKIN_SENSOR0_CODE);
266 if (ret) 266 if (ret)
267 return ret; 267 return ret;
268 268
269 ret = intel_scu_ipc_iowrite8(base_addr + 1, SKIN_SENSOR1_CODE); 269 ret = intel_scu_ipc_iowrite8(base_addr + 1, SKIN_SENSOR1_CODE);
270 if (ret) 270 if (ret)
271 return ret; 271 return ret;
272 272
273 ret = intel_scu_ipc_iowrite8(base_addr + 2, SYS_SENSOR_CODE); 273 ret = intel_scu_ipc_iowrite8(base_addr + 2, SYS_SENSOR_CODE);
274 if (ret) 274 if (ret)
275 return ret; 275 return ret;
276 276
277 /* Since this is the last channel, set the stop bit 277 /* Since this is the last channel, set the stop bit
278 to 1 by ORing the DIE_SENSOR_CODE with 0x10 */ 278 * to 1 by ORing the DIE_SENSOR_CODE with 0x10 */
279 ret = intel_scu_ipc_iowrite8(base_addr + 3, 279 ret = intel_scu_ipc_iowrite8(base_addr + 3,
280 (MSIC_DIE_SENSOR_CODE | 0x10)); 280 (MSIC_DIE_SENSOR_CODE | 0x10));
281 if (ret) 281 if (ret)
282 return ret; 282 return ret;
283 283
284 /* Enable ADC and start it */ 284 /* Enable ADC and start it */
285 return configure_adc(1); 285 return configure_adc(1);
286} 286}
287 287
288/** 288/**
@@ -293,13 +293,13 @@ static int set_up_therm_channel(u16 base_addr)
293 */ 293 */
294static int reset_stopbit(uint16_t addr) 294static int reset_stopbit(uint16_t addr)
295{ 295{
296 int ret; 296 int ret;
297 uint8_t data; 297 uint8_t data;
298 ret = intel_scu_ipc_ioread8(addr, &data); 298 ret = intel_scu_ipc_ioread8(addr, &data);
299 if (ret) 299 if (ret)
300 return ret; 300 return ret;
301 /* Set the stop bit to zero */ 301 /* Set the stop bit to zero */
302 return intel_scu_ipc_iowrite8(addr, (data & 0xEF)); 302 return intel_scu_ipc_iowrite8(addr, (data & 0xEF));
303} 303}
304 304
305/** 305/**
@@ -317,30 +317,30 @@ static int reset_stopbit(uint16_t addr)
317 */ 317 */
318static int find_free_channel(void) 318static int find_free_channel(void)
319{ 319{
320 int ret; 320 int ret;
321 int i; 321 int i;
322 uint8_t data; 322 uint8_t data;
323 323
324 /* check whether ADC is enabled */ 324 /* check whether ADC is enabled */
325 ret = intel_scu_ipc_ioread8(MSIC_THERM_ADC1CNTL1, &data); 325 ret = intel_scu_ipc_ioread8(MSIC_THERM_ADC1CNTL1, &data);
326 if (ret) 326 if (ret)
327 return ret; 327 return ret;
328 328
329 if ((data & MSIC_ADC_ENBL) == 0) 329 if ((data & MSIC_ADC_ENBL) == 0)
330 return 0; 330 return 0;
331 331
332 /* ADC is already enabled; Looking for an empty channel */ 332 /* ADC is already enabled; Looking for an empty channel */
333 for (i = 0; i < ADC_CHANLS_MAX; i++) { 333 for (i = 0; i < ADC_CHANLS_MAX; i++) {
334 ret = intel_scu_ipc_ioread8(ADC_CHNL_START_ADDR + i, &data); 334 ret = intel_scu_ipc_ioread8(ADC_CHNL_START_ADDR + i, &data);
335 if (ret) 335 if (ret)
336 return ret; 336 return ret;
337 337
338 if (data & MSIC_STOPBIT_MASK) { 338 if (data & MSIC_STOPBIT_MASK) {
339 ret = i; 339 ret = i;
340 break; 340 break;
341 } 341 }
342 } 342 }
343 return (ret > ADC_LOOP_MAX) ? (-EINVAL) : ret; 343 return (ret > ADC_LOOP_MAX) ? (-EINVAL) : ret;
344} 344}
345 345
346/** 346/**
@@ -351,48 +351,48 @@ static int find_free_channel(void)
351 */ 351 */
352static int mid_initialize_adc(struct device *dev) 352static int mid_initialize_adc(struct device *dev)
353{ 353{
354 u8 data; 354 u8 data;
355 u16 base_addr; 355 u16 base_addr;
356 int ret; 356 int ret;
357 357
358 /* 358 /*
359 * Ensure that adctherm is disabled before we 359 * Ensure that adctherm is disabled before we
360 * initialize the ADC 360 * initialize the ADC
361 */ 361 */
362 ret = intel_scu_ipc_ioread8(MSIC_THERM_ADC1CNTL3, &data); 362 ret = intel_scu_ipc_ioread8(MSIC_THERM_ADC1CNTL3, &data);
363 if (ret) 363 if (ret)
364 return ret; 364 return ret;
365 365
366 if (data & MSIC_ADCTHERM_MASK) 366 if (data & MSIC_ADCTHERM_MASK)
367 dev_warn(dev, "ADCTHERM already set"); 367 dev_warn(dev, "ADCTHERM already set");
368 368
369 /* Index of the first channel in which the stop bit is set */ 369 /* Index of the first channel in which the stop bit is set */
370 channel_index = find_free_channel(); 370 channel_index = find_free_channel();
371 if (channel_index < 0) { 371 if (channel_index < 0) {
372 dev_err(dev, "No free ADC channels"); 372 dev_err(dev, "No free ADC channels");
373 return channel_index; 373 return channel_index;
374 } 374 }
375 375
376 base_addr = ADC_CHNL_START_ADDR + channel_index; 376 base_addr = ADC_CHNL_START_ADDR + channel_index;
377 377
378 if (!(channel_index == 0 || channel_index == ADC_LOOP_MAX)) { 378 if (!(channel_index == 0 || channel_index == ADC_LOOP_MAX)) {
379 /* Reset stop bit for channels other than 0 and 12 */ 379 /* Reset stop bit for channels other than 0 and 12 */
380 ret = reset_stopbit(base_addr); 380 ret = reset_stopbit(base_addr);
381 if (ret) 381 if (ret)
382 return ret; 382 return ret;
383 383
384 /* Index of the first free channel */ 384 /* Index of the first free channel */
385 base_addr++; 385 base_addr++;
386 channel_index++; 386 channel_index++;
387 } 387 }
388 388
389 ret = set_up_therm_channel(base_addr); 389 ret = set_up_therm_channel(base_addr);
390 if (ret) { 390 if (ret) {
391 dev_err(dev, "unable to enable ADC"); 391 dev_err(dev, "unable to enable ADC");
392 return ret; 392 return ret;
393 } 393 }
394 dev_dbg(dev, "ADC initialization successful"); 394 dev_dbg(dev, "ADC initialization successful");
395 return ret; 395 return ret;
396} 396}
397 397
398/** 398/**
@@ -403,18 +403,18 @@ static int mid_initialize_adc(struct device *dev)
403 */ 403 */
404static struct thermal_device_info *initialize_sensor(int index) 404static struct thermal_device_info *initialize_sensor(int index)
405{ 405{
406 struct thermal_device_info *td_info = 406 struct thermal_device_info *td_info =
407 kzalloc(sizeof(struct thermal_device_info), GFP_KERNEL); 407 kzalloc(sizeof(struct thermal_device_info), GFP_KERNEL);
408 408
409 if (!td_info) 409 if (!td_info)
410 return NULL; 410 return NULL;
411 411
412 /* Set the base addr of the channel for this sensor */ 412 /* Set the base addr of the channel for this sensor */
413 td_info->chnl_addr = ADC_DATA_START_ADDR + 2 * (channel_index + index); 413 td_info->chnl_addr = ADC_DATA_START_ADDR + 2 * (channel_index + index);
414 /* Sensor 3 is direct conversion */ 414 /* Sensor 3 is direct conversion */
415 if (index == 3) 415 if (index == 3)
416 td_info->direct = 1; 416 td_info->direct = 1;
417 return td_info; 417 return td_info;
418} 418}
419 419
420/** 420/**
@@ -425,7 +425,7 @@ static struct thermal_device_info *initialize_sensor(int index)
425 */ 425 */
426static int mid_thermal_resume(struct platform_device *pdev) 426static int mid_thermal_resume(struct platform_device *pdev)
427{ 427{
428 return mid_initialize_adc(&pdev->dev); 428 return mid_initialize_adc(&pdev->dev);
429} 429}
430 430
431/** 431/**
@@ -437,12 +437,12 @@ static int mid_thermal_resume(struct platform_device *pdev)
437 */ 437 */
438static int mid_thermal_suspend(struct platform_device *pdev, pm_message_t mesg) 438static int mid_thermal_suspend(struct platform_device *pdev, pm_message_t mesg)
439{ 439{
440 /* 440 /*
441 * This just stops the ADC and does not disable it. 441 * This just stops the ADC and does not disable it.
442 * temporary workaround until we have a generic ADC driver. 442 * temporary workaround until we have a generic ADC driver.
443 * If 0 is passed, it disables the ADC. 443 * If 0 is passed, it disables the ADC.
444 */ 444 */
445 return configure_adc(0); 445 return configure_adc(0);
446} 446}
447 447
448/** 448/**
@@ -453,16 +453,15 @@ static int mid_thermal_suspend(struct platform_device *pdev, pm_message_t mesg)
453 */ 453 */
454static int read_curr_temp(struct thermal_zone_device *tzd, unsigned long *temp) 454static int read_curr_temp(struct thermal_zone_device *tzd, unsigned long *temp)
455{ 455{
456 WARN_ON(tzd == NULL); 456 WARN_ON(tzd == NULL);
457 return mid_read_temp(tzd, temp); 457 return mid_read_temp(tzd, temp);
458} 458}
459 459
460/* Can't be const */ 460/* Can't be const */
461static struct thermal_zone_device_ops tzd_ops = { 461static struct thermal_zone_device_ops tzd_ops = {
462 .get_temp = read_curr_temp, 462 .get_temp = read_curr_temp,
463}; 463};
464 464
465
466/** 465/**
467 * mid_thermal_probe - mfld thermal initialize 466 * mid_thermal_probe - mfld thermal initialize
468 * @pdev: platform device structure 467 * @pdev: platform device structure
@@ -472,46 +471,45 @@ static struct thermal_zone_device_ops tzd_ops = {
472 */ 471 */
473static int mid_thermal_probe(struct platform_device *pdev) 472static int mid_thermal_probe(struct platform_device *pdev)
474{ 473{
475 static char *name[MSIC_THERMAL_SENSORS] = { 474 static char *name[MSIC_THERMAL_SENSORS] = {
476 "skin0", "skin1", "sys", "msicdie" 475 "skin0", "skin1", "sys", "msicdie"
477 }; 476 };
478 477
479 int ret; 478 int ret;
480 int i; 479 int i;
481 struct platform_info *pinfo; 480 struct platform_info *pinfo;
482 481
483 pinfo = kzalloc(sizeof(struct platform_info), GFP_KERNEL); 482 pinfo = kzalloc(sizeof(struct platform_info), GFP_KERNEL);
484 if (!pinfo) 483 if (!pinfo)
485 return -ENOMEM; 484 return -ENOMEM;
486 485
487 /* Initializing the hardware */ 486 /* Initializing the hardware */
488 ret = mid_initialize_adc(&pdev->dev); 487 ret = mid_initialize_adc(&pdev->dev);
489 if (ret) { 488 if (ret) {
490 dev_err(&pdev->dev, "ADC init failed"); 489 dev_err(&pdev->dev, "ADC init failed");
491 kfree(pinfo); 490 kfree(pinfo);
492 return ret; 491 return ret;
493 } 492 }
494 493
495 /* Register each sensor with the generic thermal framework*/ 494 /* Register each sensor with the generic thermal framework*/
496 for (i = 0; i < MSIC_THERMAL_SENSORS; i++) { 495 for (i = 0; i < MSIC_THERMAL_SENSORS; i++) {
497 pinfo->tzd[i] = thermal_zone_device_register(name[i], 496 pinfo->tzd[i] = thermal_zone_device_register(name[i],
498 0, initialize_sensor(i), 497 0, initialize_sensor(i), &tzd_ops, 0, 0, 0, 0);
499 &tzd_ops, 0, 0, 0, 0); 498 if (IS_ERR(pinfo->tzd[i]))
500 if (IS_ERR(pinfo->tzd[i])) 499 goto reg_fail;
501 goto reg_fail; 500 }
502 } 501
503 502 pinfo->pdev = pdev;
504 pinfo->pdev = pdev; 503 platform_set_drvdata(pdev, pinfo);
505 platform_set_drvdata(pdev, pinfo); 504 return 0;
506 return 0;
507 505
508reg_fail: 506reg_fail:
509 ret = PTR_ERR(pinfo->tzd[i]); 507 ret = PTR_ERR(pinfo->tzd[i]);
510 while (--i >= 0) 508 while (--i >= 0)
511 thermal_zone_device_unregister(pinfo->tzd[i]); 509 thermal_zone_device_unregister(pinfo->tzd[i]);
512 configure_adc(0); 510 configure_adc(0);
513 kfree(pinfo); 511 kfree(pinfo);
514 return ret; 512 return ret;
515} 513}
516 514
517/** 515/**
@@ -523,49 +521,46 @@ reg_fail:
523 */ 521 */
524static int mid_thermal_remove(struct platform_device *pdev) 522static int mid_thermal_remove(struct platform_device *pdev)
525{ 523{
526 int i; 524 int i;
527 struct platform_info *pinfo = platform_get_drvdata(pdev); 525 struct platform_info *pinfo = platform_get_drvdata(pdev);
528 526
529 for (i = 0; i < MSIC_THERMAL_SENSORS; i++) 527 for (i = 0; i < MSIC_THERMAL_SENSORS; i++)
530 thermal_zone_device_unregister(pinfo->tzd[i]); 528 thermal_zone_device_unregister(pinfo->tzd[i]);
531 529
532 platform_set_drvdata(pdev, NULL); 530 kfree(pinfo);
531 platform_set_drvdata(pdev, NULL);
533 532
534 /* Stop the ADC */ 533 /* Stop the ADC */
535 return configure_adc(0); 534 return configure_adc(0);
536} 535}
537 536
538/*********************************************************************
539 * Driver initialisation and finalization
540 *********************************************************************/
541
542#define DRIVER_NAME "msic_sensor" 537#define DRIVER_NAME "msic_sensor"
543 538
544static const struct platform_device_id therm_id_table[] = { 539static const struct platform_device_id therm_id_table[] = {
545 { DRIVER_NAME, 1 }, 540 { DRIVER_NAME, 1 },
546 { } 541 { }
547}; 542};
548 543
549static struct platform_driver mid_thermal_driver = { 544static struct platform_driver mid_thermal_driver = {
550 .driver = { 545 .driver = {
551 .name = DRIVER_NAME, 546 .name = DRIVER_NAME,
552 .owner = THIS_MODULE, 547 .owner = THIS_MODULE,
553 }, 548 },
554 .probe = mid_thermal_probe, 549 .probe = mid_thermal_probe,
555 .suspend = mid_thermal_suspend, 550 .suspend = mid_thermal_suspend,
556 .resume = mid_thermal_resume, 551 .resume = mid_thermal_resume,
557 .remove = __devexit_p(mid_thermal_remove), 552 .remove = __devexit_p(mid_thermal_remove),
558 .id_table = therm_id_table, 553 .id_table = therm_id_table,
559}; 554};
560 555
561static int __init mid_thermal_module_init(void) 556static int __init mid_thermal_module_init(void)
562{ 557{
563 return platform_driver_register(&mid_thermal_driver); 558 return platform_driver_register(&mid_thermal_driver);
564} 559}
565 560
566static void __exit mid_thermal_module_exit(void) 561static void __exit mid_thermal_module_exit(void)
567{ 562{
568 platform_driver_unregister(&mid_thermal_driver); 563 platform_driver_unregister(&mid_thermal_driver);
569} 564}
570 565
571module_init(mid_thermal_module_init); 566module_init(mid_thermal_module_init);
diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c
new file mode 100644
index 000000000000..e936364a609d
--- /dev/null
+++ b/drivers/platform/x86/intel_oaktrail.c
@@ -0,0 +1,396 @@
1/*
2 * intel_oaktrail.c - Intel OakTrail Platform support.
3 *
4 * Copyright (C) 2010-2011 Intel Corporation
5 * Author: Yin Kangkai (kangkai.yin@intel.com)
6 *
7 * based on Compal driver, Copyright (C) 2008 Cezary Jackiewicz
8 * <cezary.jackiewicz (at) gmail.com>, based on MSI driver
9 * Copyright (C) 2006 Lennart Poettering <mzxreary (at) 0pointer (dot) de>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * 02110-1301, USA.
25 *
26 * This driver does below things:
27 * 1. registers itself in the Linux backlight control in
28 * /sys/class/backlight/intel_oaktrail/
29 *
30 * 2. registers in the rfkill subsystem here: /sys/class/rfkill/rfkillX/
31 * for these components: wifi, bluetooth, wwan (3g), gps
32 *
33 * This driver might work on other products based on Oaktrail. If you
34 * want to try it you can pass force=1 as argument to the module which
35 * will force it to load even when the DMI data doesn't identify the
36 * product as compatible.
37 */
38
39#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
40
41#include <linux/module.h>
42#include <linux/kernel.h>
43#include <linux/init.h>
44#include <linux/acpi.h>
45#include <linux/fb.h>
46#include <linux/mutex.h>
47#include <linux/err.h>
48#include <linux/i2c.h>
49#include <linux/backlight.h>
50#include <linux/platform_device.h>
51#include <linux/dmi.h>
52#include <linux/rfkill.h>
53#include <acpi/acpi_bus.h>
54#include <acpi/acpi_drivers.h>
55
56
57#define DRIVER_NAME "intel_oaktrail"
58#define DRIVER_VERSION "0.4ac1"
59
60/*
61 * This is the devices status address in EC space, and the control bits
62 * definition:
63 *
64 * (1 << 0): Camera enable/disable, RW.
65 * (1 << 1): Bluetooth enable/disable, RW.
66 * (1 << 2): GPS enable/disable, RW.
67 * (1 << 3): WiFi enable/disable, RW.
68 * (1 << 4): WWAN (3G) enable/disalbe, RW.
69 * (1 << 5): Touchscreen enable/disable, Read Only.
70 */
71#define OT_EC_DEVICE_STATE_ADDRESS 0xD6
72
73#define OT_EC_CAMERA_MASK (1 << 0)
74#define OT_EC_BT_MASK (1 << 1)
75#define OT_EC_GPS_MASK (1 << 2)
76#define OT_EC_WIFI_MASK (1 << 3)
77#define OT_EC_WWAN_MASK (1 << 4)
78#define OT_EC_TS_MASK (1 << 5)
79
80/*
81 * This is the address in EC space and commands used to control LCD backlight:
82 *
83 * Two steps needed to change the LCD backlight:
84 * 1. write the backlight percentage into OT_EC_BL_BRIGHTNESS_ADDRESS;
85 * 2. write OT_EC_BL_CONTROL_ON_DATA into OT_EC_BL_CONTROL_ADDRESS.
86 *
87 * To read the LCD back light, just read out the value from
88 * OT_EC_BL_BRIGHTNESS_ADDRESS.
89 *
90 * LCD backlight brightness range: 0 - 100 (OT_EC_BL_BRIGHTNESS_MAX)
91 */
92#define OT_EC_BL_BRIGHTNESS_ADDRESS 0x44
93#define OT_EC_BL_BRIGHTNESS_MAX 100
94#define OT_EC_BL_CONTROL_ADDRESS 0x3A
95#define OT_EC_BL_CONTROL_ON_DATA 0x1A
96
97
98static int force;
99module_param(force, bool, 0);
100MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
101
102static struct platform_device *oaktrail_device;
103static struct backlight_device *oaktrail_bl_device;
104static struct rfkill *bt_rfkill;
105static struct rfkill *gps_rfkill;
106static struct rfkill *wifi_rfkill;
107static struct rfkill *wwan_rfkill;
108
109
110/* rfkill */
111static int oaktrail_rfkill_set(void *data, bool blocked)
112{
113 u8 value;
114 u8 result;
115 unsigned long radio = (unsigned long) data;
116
117 ec_read(OT_EC_DEVICE_STATE_ADDRESS, &result);
118
119 if (!blocked)
120 value = (u8) (result | radio);
121 else
122 value = (u8) (result & ~radio);
123
124 ec_write(OT_EC_DEVICE_STATE_ADDRESS, value);
125
126 return 0;
127}
128
129static const struct rfkill_ops oaktrail_rfkill_ops = {
130 .set_block = oaktrail_rfkill_set,
131};
132
133static struct rfkill *oaktrail_rfkill_new(char *name, enum rfkill_type type,
134 unsigned long mask)
135{
136 struct rfkill *rfkill_dev;
137 u8 value;
138 int err;
139
140 rfkill_dev = rfkill_alloc(name, &oaktrail_device->dev, type,
141 &oaktrail_rfkill_ops, (void *)mask);
142 if (!rfkill_dev)
143 return ERR_PTR(-ENOMEM);
144
145 ec_read(OT_EC_DEVICE_STATE_ADDRESS, &value);
146 rfkill_init_sw_state(rfkill_dev, (value & mask) != 1);
147
148 err = rfkill_register(rfkill_dev);
149 if (err) {
150 rfkill_destroy(rfkill_dev);
151 return ERR_PTR(err);
152 }
153
154 return rfkill_dev;
155}
156
157static inline void __oaktrail_rfkill_cleanup(struct rfkill *rf)
158{
159 if (rf) {
160 rfkill_unregister(rf);
161 rfkill_destroy(rf);
162 }
163}
164
165static void oaktrail_rfkill_cleanup(void)
166{
167 __oaktrail_rfkill_cleanup(wifi_rfkill);
168 __oaktrail_rfkill_cleanup(bt_rfkill);
169 __oaktrail_rfkill_cleanup(gps_rfkill);
170 __oaktrail_rfkill_cleanup(wwan_rfkill);
171}
172
173static int oaktrail_rfkill_init(void)
174{
175 int ret;
176
177 wifi_rfkill = oaktrail_rfkill_new("oaktrail-wifi",
178 RFKILL_TYPE_WLAN,
179 OT_EC_WIFI_MASK);
180 if (IS_ERR(wifi_rfkill)) {
181 ret = PTR_ERR(wifi_rfkill);
182 wifi_rfkill = NULL;
183 goto cleanup;
184 }
185
186 bt_rfkill = oaktrail_rfkill_new("oaktrail-bluetooth",
187 RFKILL_TYPE_BLUETOOTH,
188 OT_EC_BT_MASK);
189 if (IS_ERR(bt_rfkill)) {
190 ret = PTR_ERR(bt_rfkill);
191 bt_rfkill = NULL;
192 goto cleanup;
193 }
194
195 gps_rfkill = oaktrail_rfkill_new("oaktrail-gps",
196 RFKILL_TYPE_GPS,
197 OT_EC_GPS_MASK);
198 if (IS_ERR(gps_rfkill)) {
199 ret = PTR_ERR(gps_rfkill);
200 gps_rfkill = NULL;
201 goto cleanup;
202 }
203
204 wwan_rfkill = oaktrail_rfkill_new("oaktrail-wwan",
205 RFKILL_TYPE_WWAN,
206 OT_EC_WWAN_MASK);
207 if (IS_ERR(wwan_rfkill)) {
208 ret = PTR_ERR(wwan_rfkill);
209 wwan_rfkill = NULL;
210 goto cleanup;
211 }
212
213 return 0;
214
215cleanup:
216 oaktrail_rfkill_cleanup();
217 return ret;
218}
219
220
221/* backlight */
222static int get_backlight_brightness(struct backlight_device *b)
223{
224 u8 value;
225 ec_read(OT_EC_BL_BRIGHTNESS_ADDRESS, &value);
226
227 return value;
228}
229
230static int set_backlight_brightness(struct backlight_device *b)
231{
232 u8 percent = (u8) b->props.brightness;
233 if (percent < 0 || percent > OT_EC_BL_BRIGHTNESS_MAX)
234 return -EINVAL;
235
236 ec_write(OT_EC_BL_BRIGHTNESS_ADDRESS, percent);
237 ec_write(OT_EC_BL_CONTROL_ADDRESS, OT_EC_BL_CONTROL_ON_DATA);
238
239 return 0;
240}
241
242static const struct backlight_ops oaktrail_bl_ops = {
243 .get_brightness = get_backlight_brightness,
244 .update_status = set_backlight_brightness,
245};
246
247static int oaktrail_backlight_init(void)
248{
249 struct backlight_device *bd;
250 struct backlight_properties props;
251
252 memset(&props, 0, sizeof(struct backlight_properties));
253 props.max_brightness = OT_EC_BL_BRIGHTNESS_MAX;
254 bd = backlight_device_register(DRIVER_NAME,
255 &oaktrail_device->dev, NULL,
256 &oaktrail_bl_ops,
257 &props);
258
259 if (IS_ERR(bd)) {
260 oaktrail_bl_device = NULL;
261 pr_warning("Unable to register backlight device\n");
262 return PTR_ERR(bd);
263 }
264
265 oaktrail_bl_device = bd;
266
267 bd->props.brightness = get_backlight_brightness(bd);
268 bd->props.power = FB_BLANK_UNBLANK;
269 backlight_update_status(bd);
270
271 return 0;
272}
273
274static void oaktrail_backlight_exit(void)
275{
276 if (oaktrail_bl_device)
277 backlight_device_unregister(oaktrail_bl_device);
278}
279
280static int __devinit oaktrail_probe(struct platform_device *pdev)
281{
282 return 0;
283}
284
285static int __devexit oaktrail_remove(struct platform_device *pdev)
286{
287 return 0;
288}
289
290static struct platform_driver oaktrail_driver = {
291 .driver = {
292 .name = DRIVER_NAME,
293 .owner = THIS_MODULE,
294 },
295 .probe = oaktrail_probe,
296 .remove = __devexit_p(oaktrail_remove)
297};
298
299static int dmi_check_cb(const struct dmi_system_id *id)
300{
301 pr_info("Identified model '%s'\n", id->ident);
302 return 0;
303}
304
305static struct dmi_system_id __initdata oaktrail_dmi_table[] = {
306 {
307 .ident = "OakTrail platform",
308 .matches = {
309 DMI_MATCH(DMI_PRODUCT_NAME, "OakTrail platform"),
310 },
311 .callback = dmi_check_cb
312 },
313 { }
314};
315
316static int __init oaktrail_init(void)
317{
318 int ret;
319
320 if (acpi_disabled) {
321 pr_err("ACPI needs to be enabled for this driver to work!\n");
322 return -ENODEV;
323 }
324
325 if (!force && !dmi_check_system(oaktrail_dmi_table)) {
326 pr_err("Platform not recognized (You could try the module's force-parameter)");
327 return -ENODEV;
328 }
329
330 ret = platform_driver_register(&oaktrail_driver);
331 if (ret) {
332 pr_warning("Unable to register platform driver\n");
333 goto err_driver_reg;
334 }
335
336 oaktrail_device = platform_device_alloc(DRIVER_NAME, -1);
337 if (!oaktrail_device) {
338 pr_warning("Unable to allocate platform device\n");
339 ret = -ENOMEM;
340 goto err_device_alloc;
341 }
342
343 ret = platform_device_add(oaktrail_device);
344 if (ret) {
345 pr_warning("Unable to add platform device\n");
346 goto err_device_add;
347 }
348
349 if (!acpi_video_backlight_support()) {
350 ret = oaktrail_backlight_init();
351 if (ret)
352 goto err_backlight;
353
354 } else
355 pr_info("Backlight controlled by ACPI video driver\n");
356
357 ret = oaktrail_rfkill_init();
358 if (ret) {
359 pr_warning("Setup rfkill failed\n");
360 goto err_rfkill;
361 }
362
363 pr_info("Driver "DRIVER_VERSION" successfully loaded\n");
364 return 0;
365
366err_rfkill:
367 oaktrail_backlight_exit();
368err_backlight:
369 platform_device_del(oaktrail_device);
370err_device_add:
371 platform_device_put(oaktrail_device);
372err_device_alloc:
373 platform_driver_unregister(&oaktrail_driver);
374err_driver_reg:
375
376 return ret;
377}
378
379static void __exit oaktrail_cleanup(void)
380{
381 oaktrail_backlight_exit();
382 oaktrail_rfkill_cleanup();
383 platform_device_unregister(oaktrail_device);
384 platform_driver_unregister(&oaktrail_driver);
385
386 pr_info("Driver unloaded\n");
387}
388
389module_init(oaktrail_init);
390module_exit(oaktrail_cleanup);
391
392MODULE_AUTHOR("Yin Kangkai (kangkai.yin@intel.com)");
393MODULE_DESCRIPTION("Intel Oaktrail Platform ACPI Extras");
394MODULE_VERSION(DRIVER_VERSION);
395MODULE_LICENSE("GPL");
396MODULE_ALIAS("dmi:*:svnIntelCorporation:pnOakTrailplatform:*");
diff --git a/drivers/platform/x86/intel_pmic_gpio.c b/drivers/platform/x86/intel_pmic_gpio.c
index 464bb3fc4d88..1686c1e07d5d 100644
--- a/drivers/platform/x86/intel_pmic_gpio.c
+++ b/drivers/platform/x86/intel_pmic_gpio.c
@@ -19,6 +19,8 @@
19 * Moorestown platform PMIC chip 19 * Moorestown platform PMIC chip
20 */ 20 */
21 21
22#define pr_fmt(fmt) "%s: " fmt, __func__
23
22#include <linux/module.h> 24#include <linux/module.h>
23#include <linux/kernel.h> 25#include <linux/kernel.h>
24#include <linux/interrupt.h> 26#include <linux/interrupt.h>
@@ -90,8 +92,7 @@ static void pmic_program_irqtype(int gpio, int type)
90static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 92static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
91{ 93{
92 if (offset > 8) { 94 if (offset > 8) {
93 printk(KERN_ERR 95 pr_err("only pin 0-7 support input\n");
94 "%s: only pin 0-7 support input\n", __func__);
95 return -1;/* we only have 8 GPIO can use as input */ 96 return -1;/* we only have 8 GPIO can use as input */
96 } 97 }
97 return intel_scu_ipc_update_register(GPIO0 + offset, 98 return intel_scu_ipc_update_register(GPIO0 + offset,
@@ -116,8 +117,7 @@ static int pmic_gpio_direction_output(struct gpio_chip *chip,
116 value ? 1 << (offset - 16) : 0, 117 value ? 1 << (offset - 16) : 0,
117 1 << (offset - 16)); 118 1 << (offset - 16));
118 else { 119 else {
119 printk(KERN_ERR 120 pr_err("invalid PMIC GPIO pin %d!\n", offset);
120 "%s: invalid PMIC GPIO pin %d!\n", __func__, offset);
121 WARN_ON(1); 121 WARN_ON(1);
122 } 122 }
123 123
@@ -260,7 +260,7 @@ static int __devinit platform_pmic_gpio_probe(struct platform_device *pdev)
260 /* setting up SRAM mapping for GPIOINT register */ 260 /* setting up SRAM mapping for GPIOINT register */
261 pg->gpiointr = ioremap_nocache(pdata->gpiointr, 8); 261 pg->gpiointr = ioremap_nocache(pdata->gpiointr, 8);
262 if (!pg->gpiointr) { 262 if (!pg->gpiointr) {
263 printk(KERN_ERR "%s: Can not map GPIOINT.\n", __func__); 263 pr_err("Can not map GPIOINT\n");
264 retval = -EINVAL; 264 retval = -EINVAL;
265 goto err2; 265 goto err2;
266 } 266 }
@@ -281,13 +281,13 @@ static int __devinit platform_pmic_gpio_probe(struct platform_device *pdev)
281 pg->chip.dev = dev; 281 pg->chip.dev = dev;
282 retval = gpiochip_add(&pg->chip); 282 retval = gpiochip_add(&pg->chip);
283 if (retval) { 283 if (retval) {
284 printk(KERN_ERR "%s: Can not add pmic gpio chip.\n", __func__); 284 pr_err("Can not add pmic gpio chip\n");
285 goto err; 285 goto err;
286 } 286 }
287 287
288 retval = request_irq(pg->irq, pmic_irq_handler, 0, "pmic", pg); 288 retval = request_irq(pg->irq, pmic_irq_handler, 0, "pmic", pg);
289 if (retval) { 289 if (retval) {
290 printk(KERN_WARNING "pmic: Interrupt request failed\n"); 290 pr_warn("Interrupt request failed\n");
291 goto err; 291 goto err;
292 } 292 }
293 293
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
index 23fb2afda00b..d7213e406867 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -447,7 +447,7 @@ static struct platform_device *msipf_device;
447 447
448static int dmi_check_cb(const struct dmi_system_id *id) 448static int dmi_check_cb(const struct dmi_system_id *id)
449{ 449{
450 pr_info("Identified laptop model '%s'.\n", id->ident); 450 pr_info("Identified laptop model '%s'\n", id->ident);
451 return 1; 451 return 1;
452} 452}
453 453
@@ -800,7 +800,7 @@ static void msi_laptop_input_destroy(void)
800 input_unregister_device(msi_laptop_input_dev); 800 input_unregister_device(msi_laptop_input_dev);
801} 801}
802 802
803static int load_scm_model_init(struct platform_device *sdev) 803static int __init load_scm_model_init(struct platform_device *sdev)
804{ 804{
805 u8 data; 805 u8 data;
806 int result; 806 int result;
@@ -875,8 +875,7 @@ static int __init msi_init(void)
875 /* Register backlight stuff */ 875 /* Register backlight stuff */
876 876
877 if (acpi_video_backlight_support()) { 877 if (acpi_video_backlight_support()) {
878 pr_info("Brightness ignored, must be controlled " 878 pr_info("Brightness ignored, must be controlled by ACPI video driver\n");
879 "by ACPI video driver\n");
880 } else { 879 } else {
881 struct backlight_properties props; 880 struct backlight_properties props;
882 memset(&props, 0, sizeof(struct backlight_properties)); 881 memset(&props, 0, sizeof(struct backlight_properties));
@@ -930,7 +929,7 @@ static int __init msi_init(void)
930 if (auto_brightness != 2) 929 if (auto_brightness != 2)
931 set_auto_brightness(auto_brightness); 930 set_auto_brightness(auto_brightness);
932 931
933 pr_info("driver "MSI_DRIVER_VERSION" successfully loaded.\n"); 932 pr_info("driver " MSI_DRIVER_VERSION " successfully loaded\n");
934 933
935 return 0; 934 return 0;
936 935
@@ -978,7 +977,7 @@ static void __exit msi_cleanup(void)
978 if (auto_brightness != 2) 977 if (auto_brightness != 2)
979 set_auto_brightness(1); 978 set_auto_brightness(1);
980 979
981 pr_info("driver unloaded.\n"); 980 pr_info("driver unloaded\n");
982} 981}
983 982
984module_init(msi_init); 983module_init(msi_init);
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index d5419c9ec07a..c832e3356cd6 100644
--- a/drivers/platform/x86/msi-wmi.c
+++ b/drivers/platform/x86/msi-wmi.c
@@ -20,6 +20,7 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23 24
24#include <linux/kernel.h> 25#include <linux/kernel.h>
25#include <linux/input.h> 26#include <linux/input.h>
@@ -36,13 +37,10 @@ MODULE_ALIAS("wmi:551A1F84-FBDD-4125-91DB-3EA8F44F1D45");
36MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2"); 37MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2");
37 38
38#define DRV_NAME "msi-wmi" 39#define DRV_NAME "msi-wmi"
39#define DRV_PFX DRV_NAME ": "
40 40
41#define MSIWMI_BIOS_GUID "551A1F84-FBDD-4125-91DB-3EA8F44F1D45" 41#define MSIWMI_BIOS_GUID "551A1F84-FBDD-4125-91DB-3EA8F44F1D45"
42#define MSIWMI_EVENT_GUID "B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2" 42#define MSIWMI_EVENT_GUID "B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2"
43 43
44#define dprintk(msg...) pr_debug(DRV_PFX msg)
45
46#define SCANCODE_BASE 0xD0 44#define SCANCODE_BASE 0xD0
47#define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE 45#define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE
48#define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1) 46#define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1)
@@ -78,7 +76,7 @@ static int msi_wmi_query_block(int instance, int *ret)
78 76
79 if (!obj || obj->type != ACPI_TYPE_INTEGER) { 77 if (!obj || obj->type != ACPI_TYPE_INTEGER) {
80 if (obj) { 78 if (obj) {
81 printk(KERN_ERR DRV_PFX "query block returned object " 79 pr_err("query block returned object "
82 "type: %d - buffer length:%d\n", obj->type, 80 "type: %d - buffer length:%d\n", obj->type,
83 obj->type == ACPI_TYPE_BUFFER ? 81 obj->type == ACPI_TYPE_BUFFER ?
84 obj->buffer.length : 0); 82 obj->buffer.length : 0);
@@ -97,8 +95,8 @@ static int msi_wmi_set_block(int instance, int value)
97 95
98 struct acpi_buffer input = { sizeof(int), &value }; 96 struct acpi_buffer input = { sizeof(int), &value };
99 97
100 dprintk("Going to set block of instance: %d - value: %d\n", 98 pr_debug("Going to set block of instance: %d - value: %d\n",
101 instance, value); 99 instance, value);
102 100
103 status = wmi_set_block(MSIWMI_BIOS_GUID, instance, &input); 101 status = wmi_set_block(MSIWMI_BIOS_GUID, instance, &input);
104 102
@@ -112,20 +110,19 @@ static int bl_get(struct backlight_device *bd)
112 /* Instance 1 is "get backlight", cmp with DSDT */ 110 /* Instance 1 is "get backlight", cmp with DSDT */
113 err = msi_wmi_query_block(1, &ret); 111 err = msi_wmi_query_block(1, &ret);
114 if (err) { 112 if (err) {
115 printk(KERN_ERR DRV_PFX "Could not query backlight: %d\n", err); 113 pr_err("Could not query backlight: %d\n", err);
116 return -EINVAL; 114 return -EINVAL;
117 } 115 }
118 dprintk("Get: Query block returned: %d\n", ret); 116 pr_debug("Get: Query block returned: %d\n", ret);
119 for (level = 0; level < ARRAY_SIZE(backlight_map); level++) { 117 for (level = 0; level < ARRAY_SIZE(backlight_map); level++) {
120 if (backlight_map[level] == ret) { 118 if (backlight_map[level] == ret) {
121 dprintk("Current backlight level: 0x%X - index: %d\n", 119 pr_debug("Current backlight level: 0x%X - index: %d\n",
122 backlight_map[level], level); 120 backlight_map[level], level);
123 break; 121 break;
124 } 122 }
125 } 123 }
126 if (level == ARRAY_SIZE(backlight_map)) { 124 if (level == ARRAY_SIZE(backlight_map)) {
127 printk(KERN_ERR DRV_PFX "get: Invalid brightness value: 0x%X\n", 125 pr_err("get: Invalid brightness value: 0x%X\n", ret);
128 ret);
129 return -EINVAL; 126 return -EINVAL;
130 } 127 }
131 return level; 128 return level;
@@ -156,7 +153,7 @@ static void msi_wmi_notify(u32 value, void *context)
156 153
157 status = wmi_get_event_data(value, &response); 154 status = wmi_get_event_data(value, &response);
158 if (status != AE_OK) { 155 if (status != AE_OK) {
159 printk(KERN_INFO DRV_PFX "bad event status 0x%x\n", status); 156 pr_info("bad event status 0x%x\n", status);
160 return; 157 return;
161 } 158 }
162 159
@@ -164,7 +161,7 @@ static void msi_wmi_notify(u32 value, void *context)
164 161
165 if (obj && obj->type == ACPI_TYPE_INTEGER) { 162 if (obj && obj->type == ACPI_TYPE_INTEGER) {
166 int eventcode = obj->integer.value; 163 int eventcode = obj->integer.value;
167 dprintk("Eventcode: 0x%x\n", eventcode); 164 pr_debug("Eventcode: 0x%x\n", eventcode);
168 key = sparse_keymap_entry_from_scancode(msi_wmi_input_dev, 165 key = sparse_keymap_entry_from_scancode(msi_wmi_input_dev,
169 eventcode); 166 eventcode);
170 if (key) { 167 if (key) {
@@ -175,8 +172,8 @@ static void msi_wmi_notify(u32 value, void *context)
175 /* Ignore event if the same event happened in a 50 ms 172 /* Ignore event if the same event happened in a 50 ms
176 timeframe -> Key press may result in 10-20 GPEs */ 173 timeframe -> Key press may result in 10-20 GPEs */
177 if (ktime_to_us(diff) < 1000 * 50) { 174 if (ktime_to_us(diff) < 1000 * 50) {
178 dprintk("Suppressed key event 0x%X - " 175 pr_debug("Suppressed key event 0x%X - "
179 "Last press was %lld us ago\n", 176 "Last press was %lld us ago\n",
180 key->code, ktime_to_us(diff)); 177 key->code, ktime_to_us(diff));
181 return; 178 return;
182 } 179 }
@@ -187,17 +184,16 @@ static void msi_wmi_notify(u32 value, void *context)
187 (!acpi_video_backlight_support() || 184 (!acpi_video_backlight_support() ||
188 (key->code != MSI_WMI_BRIGHTNESSUP && 185 (key->code != MSI_WMI_BRIGHTNESSUP &&
189 key->code != MSI_WMI_BRIGHTNESSDOWN))) { 186 key->code != MSI_WMI_BRIGHTNESSDOWN))) {
190 dprintk("Send key: 0x%X - " 187 pr_debug("Send key: 0x%X - "
191 "Input layer keycode: %d\n", key->code, 188 "Input layer keycode: %d\n",
192 key->keycode); 189 key->code, key->keycode);
193 sparse_keymap_report_entry(msi_wmi_input_dev, 190 sparse_keymap_report_entry(msi_wmi_input_dev,
194 key, 1, true); 191 key, 1, true);
195 } 192 }
196 } else 193 } else
197 printk(KERN_INFO "Unknown key pressed - %x\n", 194 pr_info("Unknown key pressed - %x\n", eventcode);
198 eventcode);
199 } else 195 } else
200 printk(KERN_INFO DRV_PFX "Unknown event received\n"); 196 pr_info("Unknown event received\n");
201 kfree(response.pointer); 197 kfree(response.pointer);
202} 198}
203 199
@@ -238,8 +234,7 @@ static int __init msi_wmi_init(void)
238 int err; 234 int err;
239 235
240 if (!wmi_has_guid(MSIWMI_EVENT_GUID)) { 236 if (!wmi_has_guid(MSIWMI_EVENT_GUID)) {
241 printk(KERN_ERR 237 pr_err("This machine doesn't have MSI-hotkeys through WMI\n");
242 "This machine doesn't have MSI-hotkeys through WMI\n");
243 return -ENODEV; 238 return -ENODEV;
244 } 239 }
245 err = wmi_install_notify_handler(MSIWMI_EVENT_GUID, 240 err = wmi_install_notify_handler(MSIWMI_EVENT_GUID,
@@ -270,7 +265,7 @@ static int __init msi_wmi_init(void)
270 265
271 backlight->props.brightness = err; 266 backlight->props.brightness = err;
272 } 267 }
273 dprintk("Event handler installed\n"); 268 pr_debug("Event handler installed\n");
274 269
275 return 0; 270 return 0;
276 271
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 6fe8cd6e23b5..bbd182e178cb 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -42,6 +42,8 @@
42 * 42 *
43 */ 43 */
44 44
45#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
46
45#include <linux/kernel.h> 47#include <linux/kernel.h>
46#include <linux/module.h> 48#include <linux/module.h>
47#include <linux/moduleparam.h> 49#include <linux/moduleparam.h>
@@ -70,10 +72,10 @@
70#include <linux/miscdevice.h> 72#include <linux/miscdevice.h>
71#endif 73#endif
72 74
73#define DRV_PFX "sony-laptop: " 75#define dprintk(fmt, ...) \
74#define dprintk(msg...) do { \ 76do { \
75 if (debug) \ 77 if (debug) \
76 pr_warn(DRV_PFX msg); \ 78 pr_warn(fmt, ##__VA_ARGS__); \
77} while (0) 79} while (0)
78 80
79#define SONY_LAPTOP_DRIVER_VERSION "0.6" 81#define SONY_LAPTOP_DRIVER_VERSION "0.6"
@@ -418,7 +420,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)
418 error = kfifo_alloc(&sony_laptop_input.fifo, 420 error = kfifo_alloc(&sony_laptop_input.fifo,
419 SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); 421 SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
420 if (error) { 422 if (error) {
421 pr_err(DRV_PFX "kfifo_alloc failed\n"); 423 pr_err("kfifo_alloc failed\n");
422 goto err_dec_users; 424 goto err_dec_users;
423 } 425 }
424 426
@@ -702,7 +704,7 @@ static int acpi_callgetfunc(acpi_handle handle, char *name, int *result)
702 return 0; 704 return 0;
703 } 705 }
704 706
705 pr_warn(DRV_PFX "acpi_callreadfunc failed\n"); 707 pr_warn("acpi_callreadfunc failed\n");
706 708
707 return -1; 709 return -1;
708} 710}
@@ -728,8 +730,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value,
728 if (status == AE_OK) { 730 if (status == AE_OK) {
729 if (result != NULL) { 731 if (result != NULL) {
730 if (out_obj.type != ACPI_TYPE_INTEGER) { 732 if (out_obj.type != ACPI_TYPE_INTEGER) {
731 pr_warn(DRV_PFX "acpi_evaluate_object bad " 733 pr_warn("acpi_evaluate_object bad return type\n");
732 "return type\n");
733 return -1; 734 return -1;
734 } 735 }
735 *result = out_obj.integer.value; 736 *result = out_obj.integer.value;
@@ -737,7 +738,7 @@ static int acpi_callsetfunc(acpi_handle handle, char *name, int value,
737 return 0; 738 return 0;
738 } 739 }
739 740
740 pr_warn(DRV_PFX "acpi_evaluate_object failed\n"); 741 pr_warn("acpi_evaluate_object failed\n");
741 742
742 return -1; 743 return -1;
743} 744}
@@ -961,7 +962,6 @@ static int sony_backlight_get_brightness(struct backlight_device *bd)
961static int sony_nc_get_brightness_ng(struct backlight_device *bd) 962static int sony_nc_get_brightness_ng(struct backlight_device *bd)
962{ 963{
963 int result; 964 int result;
964 int *handle = (int *)bl_get_data(bd);
965 struct sony_backlight_props *sdev = 965 struct sony_backlight_props *sdev =
966 (struct sony_backlight_props *)bl_get_data(bd); 966 (struct sony_backlight_props *)bl_get_data(bd);
967 967
@@ -973,7 +973,6 @@ static int sony_nc_get_brightness_ng(struct backlight_device *bd)
973static int sony_nc_update_status_ng(struct backlight_device *bd) 973static int sony_nc_update_status_ng(struct backlight_device *bd)
974{ 974{
975 int value, result; 975 int value, result;
976 int *handle = (int *)bl_get_data(bd);
977 struct sony_backlight_props *sdev = 976 struct sony_backlight_props *sdev =
978 (struct sony_backlight_props *)bl_get_data(bd); 977 (struct sony_backlight_props *)bl_get_data(bd);
979 978
@@ -1104,10 +1103,8 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)
1104 } 1103 }
1105 1104
1106 if (!key_event->data) 1105 if (!key_event->data)
1107 pr_info(DRV_PFX 1106 pr_info("Unknown event: 0x%x 0x%x\n",
1108 "Unknown event: 0x%x 0x%x\n", 1107 key_handle, ev);
1109 key_handle,
1110 ev);
1111 else 1108 else
1112 sony_laptop_report_input_event(ev); 1109 sony_laptop_report_input_event(ev);
1113 } 1110 }
@@ -1128,7 +1125,7 @@ static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
1128 struct acpi_device_info *info; 1125 struct acpi_device_info *info;
1129 1126
1130 if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) { 1127 if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) {
1131 pr_warn(DRV_PFX "method: name: %4.4s, args %X\n", 1128 pr_warn("method: name: %4.4s, args %X\n",
1132 (char *)&info->name, info->param_count); 1129 (char *)&info->name, info->param_count);
1133 1130
1134 kfree(info); 1131 kfree(info);
@@ -1169,7 +1166,7 @@ static int sony_nc_resume(struct acpi_device *device)
1169 ret = acpi_callsetfunc(sony_nc_acpi_handle, *item->acpiset, 1166 ret = acpi_callsetfunc(sony_nc_acpi_handle, *item->acpiset,
1170 item->value, NULL); 1167 item->value, NULL);
1171 if (ret < 0) { 1168 if (ret < 0) {
1172 pr_err(DRV_PFX "%s: %d\n", __func__, ret); 1169 pr_err("%s: %d\n", __func__, ret);
1173 break; 1170 break;
1174 } 1171 }
1175 } 1172 }
@@ -1336,12 +1333,12 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
1336 1333
1337 device_enum = (union acpi_object *) buffer.pointer; 1334 device_enum = (union acpi_object *) buffer.pointer;
1338 if (!device_enum) { 1335 if (!device_enum) {
1339 pr_err(DRV_PFX "No SN06 return object."); 1336 pr_err("No SN06 return object\n");
1340 goto out_no_enum; 1337 goto out_no_enum;
1341 } 1338 }
1342 if (device_enum->type != ACPI_TYPE_BUFFER) { 1339 if (device_enum->type != ACPI_TYPE_BUFFER) {
1343 pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n", 1340 pr_err("Invalid SN06 return object 0x%.2x\n",
1344 device_enum->type); 1341 device_enum->type);
1345 goto out_no_enum; 1342 goto out_no_enum;
1346 } 1343 }
1347 1344
@@ -1662,7 +1659,7 @@ static void sony_nc_backlight_setup(void)
1662 ops, &props); 1659 ops, &props);
1663 1660
1664 if (IS_ERR(sony_bl_props.dev)) { 1661 if (IS_ERR(sony_bl_props.dev)) {
1665 pr_warn(DRV_PFX "unable to register backlight device\n"); 1662 pr_warn("unable to register backlight device\n");
1666 sony_bl_props.dev = NULL; 1663 sony_bl_props.dev = NULL;
1667 } else 1664 } else
1668 sony_bl_props.dev->props.brightness = 1665 sony_bl_props.dev->props.brightness =
@@ -1682,8 +1679,7 @@ static int sony_nc_add(struct acpi_device *device)
1682 acpi_handle handle; 1679 acpi_handle handle;
1683 struct sony_nc_value *item; 1680 struct sony_nc_value *item;
1684 1681
1685 pr_info(DRV_PFX "%s v%s.\n", SONY_NC_DRIVER_NAME, 1682 pr_info("%s v%s\n", SONY_NC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION);
1686 SONY_LAPTOP_DRIVER_VERSION);
1687 1683
1688 sony_nc_acpi_device = device; 1684 sony_nc_acpi_device = device;
1689 strcpy(acpi_device_class(device), "sony/hotkey"); 1685 strcpy(acpi_device_class(device), "sony/hotkey");
@@ -1708,7 +1704,7 @@ static int sony_nc_add(struct acpi_device *device)
1708 sony_nc_acpi_handle, 1, sony_walk_callback, 1704 sony_nc_acpi_handle, 1, sony_walk_callback,
1709 NULL, NULL, NULL); 1705 NULL, NULL, NULL);
1710 if (ACPI_FAILURE(status)) { 1706 if (ACPI_FAILURE(status)) {
1711 pr_warn(DRV_PFX "unable to walk acpi resources\n"); 1707 pr_warn("unable to walk acpi resources\n");
1712 result = -ENODEV; 1708 result = -ENODEV;
1713 goto outpresent; 1709 goto outpresent;
1714 } 1710 }
@@ -1736,13 +1732,12 @@ static int sony_nc_add(struct acpi_device *device)
1736 /* setup input devices and helper fifo */ 1732 /* setup input devices and helper fifo */
1737 result = sony_laptop_setup_input(device); 1733 result = sony_laptop_setup_input(device);
1738 if (result) { 1734 if (result) {
1739 pr_err(DRV_PFX "Unable to create input devices.\n"); 1735 pr_err("Unable to create input devices\n");
1740 goto outkbdbacklight; 1736 goto outkbdbacklight;
1741 } 1737 }
1742 1738
1743 if (acpi_video_backlight_support()) { 1739 if (acpi_video_backlight_support()) {
1744 pr_info(DRV_PFX "brightness ignored, must be " 1740 pr_info("brightness ignored, must be controlled by ACPI video driver\n");
1745 "controlled by ACPI video driver\n");
1746 } else { 1741 } else {
1747 sony_nc_backlight_setup(); 1742 sony_nc_backlight_setup();
1748 } 1743 }
@@ -2265,9 +2260,9 @@ out:
2265 if (pcidev) 2260 if (pcidev)
2266 pci_dev_put(pcidev); 2261 pci_dev_put(pcidev);
2267 2262
2268 pr_info(DRV_PFX "detected Type%d model\n", 2263 pr_info("detected Type%d model\n",
2269 dev->model == SONYPI_DEVICE_TYPE1 ? 1 : 2264 dev->model == SONYPI_DEVICE_TYPE1 ? 1 :
2270 dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3); 2265 dev->model == SONYPI_DEVICE_TYPE2 ? 2 : 3);
2271} 2266}
2272 2267
2273/* camera tests and poweron/poweroff */ 2268/* camera tests and poweron/poweroff */
@@ -2313,7 +2308,7 @@ static int __sony_pic_camera_ready(void)
2313static int __sony_pic_camera_off(void) 2308static int __sony_pic_camera_off(void)
2314{ 2309{
2315 if (!camera) { 2310 if (!camera) {
2316 pr_warn(DRV_PFX "camera control not enabled\n"); 2311 pr_warn("camera control not enabled\n");
2317 return -ENODEV; 2312 return -ENODEV;
2318 } 2313 }
2319 2314
@@ -2333,7 +2328,7 @@ static int __sony_pic_camera_on(void)
2333 int i, j, x; 2328 int i, j, x;
2334 2329
2335 if (!camera) { 2330 if (!camera) {
2336 pr_warn(DRV_PFX "camera control not enabled\n"); 2331 pr_warn("camera control not enabled\n");
2337 return -ENODEV; 2332 return -ENODEV;
2338 } 2333 }
2339 2334
@@ -2356,7 +2351,7 @@ static int __sony_pic_camera_on(void)
2356 } 2351 }
2357 2352
2358 if (j == 0) { 2353 if (j == 0) {
2359 pr_warn(DRV_PFX "failed to power on camera\n"); 2354 pr_warn("failed to power on camera\n");
2360 return -ENODEV; 2355 return -ENODEV;
2361 } 2356 }
2362 2357
@@ -2412,8 +2407,7 @@ int sony_pic_camera_command(int command, u8 value)
2412 ITERATIONS_SHORT); 2407 ITERATIONS_SHORT);
2413 break; 2408 break;
2414 default: 2409 default:
2415 pr_err(DRV_PFX "sony_pic_camera_command invalid: %d\n", 2410 pr_err("sony_pic_camera_command invalid: %d\n", command);
2416 command);
2417 break; 2411 break;
2418 } 2412 }
2419 mutex_unlock(&spic_dev.lock); 2413 mutex_unlock(&spic_dev.lock);
@@ -2819,7 +2813,7 @@ static int sonypi_compat_init(void)
2819 error = 2813 error =
2820 kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); 2814 kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
2821 if (error) { 2815 if (error) {
2822 pr_err(DRV_PFX "kfifo_alloc failed\n"); 2816 pr_err("kfifo_alloc failed\n");
2823 return error; 2817 return error;
2824 } 2818 }
2825 2819
@@ -2829,12 +2823,12 @@ static int sonypi_compat_init(void)
2829 sonypi_misc_device.minor = minor; 2823 sonypi_misc_device.minor = minor;
2830 error = misc_register(&sonypi_misc_device); 2824 error = misc_register(&sonypi_misc_device);
2831 if (error) { 2825 if (error) {
2832 pr_err(DRV_PFX "misc_register failed\n"); 2826 pr_err("misc_register failed\n");
2833 goto err_free_kfifo; 2827 goto err_free_kfifo;
2834 } 2828 }
2835 if (minor == -1) 2829 if (minor == -1)
2836 pr_info(DRV_PFX "device allocated minor is %d\n", 2830 pr_info("device allocated minor is %d\n",
2837 sonypi_misc_device.minor); 2831 sonypi_misc_device.minor);
2838 2832
2839 return 0; 2833 return 0;
2840 2834
@@ -2893,8 +2887,8 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2893 } 2887 }
2894 for (i = 0; i < p->interrupt_count; i++) { 2888 for (i = 0; i < p->interrupt_count; i++) {
2895 if (!p->interrupts[i]) { 2889 if (!p->interrupts[i]) {
2896 pr_warn(DRV_PFX "Invalid IRQ %d\n", 2890 pr_warn("Invalid IRQ %d\n",
2897 p->interrupts[i]); 2891 p->interrupts[i]);
2898 continue; 2892 continue;
2899 } 2893 }
2900 interrupt = kzalloc(sizeof(*interrupt), 2894 interrupt = kzalloc(sizeof(*interrupt),
@@ -2932,14 +2926,14 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2932 ioport->io2.address_length); 2926 ioport->io2.address_length);
2933 } 2927 }
2934 else { 2928 else {
2935 pr_err(DRV_PFX "Unknown SPIC Type, more than 2 IO Ports\n"); 2929 pr_err("Unknown SPIC Type, more than 2 IO Ports\n");
2936 return AE_ERROR; 2930 return AE_ERROR;
2937 } 2931 }
2938 return AE_OK; 2932 return AE_OK;
2939 } 2933 }
2940 default: 2934 default:
2941 dprintk("Resource %d isn't an IRQ nor an IO port\n", 2935 dprintk("Resource %d isn't an IRQ nor an IO port\n",
2942 resource->type); 2936 resource->type);
2943 2937
2944 case ACPI_RESOURCE_TYPE_END_TAG: 2938 case ACPI_RESOURCE_TYPE_END_TAG:
2945 return AE_OK; 2939 return AE_OK;
@@ -2960,7 +2954,7 @@ static int sony_pic_possible_resources(struct acpi_device *device)
2960 dprintk("Evaluating _STA\n"); 2954 dprintk("Evaluating _STA\n");
2961 result = acpi_bus_get_status(device); 2955 result = acpi_bus_get_status(device);
2962 if (result) { 2956 if (result) {
2963 pr_warn(DRV_PFX "Unable to read status\n"); 2957 pr_warn("Unable to read status\n");
2964 goto end; 2958 goto end;
2965 } 2959 }
2966 2960
@@ -2976,8 +2970,7 @@ static int sony_pic_possible_resources(struct acpi_device *device)
2976 status = acpi_walk_resources(device->handle, METHOD_NAME__PRS, 2970 status = acpi_walk_resources(device->handle, METHOD_NAME__PRS,
2977 sony_pic_read_possible_resource, &spic_dev); 2971 sony_pic_read_possible_resource, &spic_dev);
2978 if (ACPI_FAILURE(status)) { 2972 if (ACPI_FAILURE(status)) {
2979 pr_warn(DRV_PFX "Failure evaluating %s\n", 2973 pr_warn("Failure evaluating %s\n", METHOD_NAME__PRS);
2980 METHOD_NAME__PRS);
2981 result = -ENODEV; 2974 result = -ENODEV;
2982 } 2975 }
2983end: 2976end:
@@ -3090,7 +3083,7 @@ static int sony_pic_enable(struct acpi_device *device,
3090 3083
3091 /* check for total failure */ 3084 /* check for total failure */
3092 if (ACPI_FAILURE(status)) { 3085 if (ACPI_FAILURE(status)) {
3093 pr_err(DRV_PFX "Error evaluating _SRS\n"); 3086 pr_err("Error evaluating _SRS\n");
3094 result = -ENODEV; 3087 result = -ENODEV;
3095 goto end; 3088 goto end;
3096 } 3089 }
@@ -3182,7 +3175,7 @@ static int sony_pic_remove(struct acpi_device *device, int type)
3182 struct sony_pic_irq *irq, *tmp_irq; 3175 struct sony_pic_irq *irq, *tmp_irq;
3183 3176
3184 if (sony_pic_disable(device)) { 3177 if (sony_pic_disable(device)) {
3185 pr_err(DRV_PFX "Couldn't disable device.\n"); 3178 pr_err("Couldn't disable device\n");
3186 return -ENXIO; 3179 return -ENXIO;
3187 } 3180 }
3188 3181
@@ -3222,8 +3215,7 @@ static int sony_pic_add(struct acpi_device *device)
3222 struct sony_pic_ioport *io, *tmp_io; 3215 struct sony_pic_ioport *io, *tmp_io;
3223 struct sony_pic_irq *irq, *tmp_irq; 3216 struct sony_pic_irq *irq, *tmp_irq;
3224 3217
3225 pr_info(DRV_PFX "%s v%s.\n", SONY_PIC_DRIVER_NAME, 3218 pr_info("%s v%s\n", SONY_PIC_DRIVER_NAME, SONY_LAPTOP_DRIVER_VERSION);
3226 SONY_LAPTOP_DRIVER_VERSION);
3227 3219
3228 spic_dev.acpi_dev = device; 3220 spic_dev.acpi_dev = device;
3229 strcpy(acpi_device_class(device), "sony/hotkey"); 3221 strcpy(acpi_device_class(device), "sony/hotkey");
@@ -3233,14 +3225,14 @@ static int sony_pic_add(struct acpi_device *device)
3233 /* read _PRS resources */ 3225 /* read _PRS resources */
3234 result = sony_pic_possible_resources(device); 3226 result = sony_pic_possible_resources(device);
3235 if (result) { 3227 if (result) {
3236 pr_err(DRV_PFX "Unable to read possible resources.\n"); 3228 pr_err("Unable to read possible resources\n");
3237 goto err_free_resources; 3229 goto err_free_resources;
3238 } 3230 }
3239 3231
3240 /* setup input devices and helper fifo */ 3232 /* setup input devices and helper fifo */
3241 result = sony_laptop_setup_input(device); 3233 result = sony_laptop_setup_input(device);
3242 if (result) { 3234 if (result) {
3243 pr_err(DRV_PFX "Unable to create input devices.\n"); 3235 pr_err("Unable to create input devices\n");
3244 goto err_free_resources; 3236 goto err_free_resources;
3245 } 3237 }
3246 3238
@@ -3281,7 +3273,7 @@ static int sony_pic_add(struct acpi_device *device)
3281 } 3273 }
3282 } 3274 }
3283 if (!spic_dev.cur_ioport) { 3275 if (!spic_dev.cur_ioport) {
3284 pr_err(DRV_PFX "Failed to request_region.\n"); 3276 pr_err("Failed to request_region\n");
3285 result = -ENODEV; 3277 result = -ENODEV;
3286 goto err_remove_compat; 3278 goto err_remove_compat;
3287 } 3279 }
@@ -3301,7 +3293,7 @@ static int sony_pic_add(struct acpi_device *device)
3301 } 3293 }
3302 } 3294 }
3303 if (!spic_dev.cur_irq) { 3295 if (!spic_dev.cur_irq) {
3304 pr_err(DRV_PFX "Failed to request_irq.\n"); 3296 pr_err("Failed to request_irq\n");
3305 result = -ENODEV; 3297 result = -ENODEV;
3306 goto err_release_region; 3298 goto err_release_region;
3307 } 3299 }
@@ -3309,7 +3301,7 @@ static int sony_pic_add(struct acpi_device *device)
3309 /* set resource status _SRS */ 3301 /* set resource status _SRS */
3310 result = sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq); 3302 result = sony_pic_enable(device, spic_dev.cur_ioport, spic_dev.cur_irq);
3311 if (result) { 3303 if (result) {
3312 pr_err(DRV_PFX "Couldn't enable device.\n"); 3304 pr_err("Couldn't enable device\n");
3313 goto err_free_irq; 3305 goto err_free_irq;
3314 } 3306 }
3315 3307
@@ -3418,7 +3410,7 @@ static int __init sony_laptop_init(void)
3418 if (!no_spic && dmi_check_system(sonypi_dmi_table)) { 3410 if (!no_spic && dmi_check_system(sonypi_dmi_table)) {
3419 result = acpi_bus_register_driver(&sony_pic_driver); 3411 result = acpi_bus_register_driver(&sony_pic_driver);
3420 if (result) { 3412 if (result) {
3421 pr_err(DRV_PFX "Unable to register SPIC driver."); 3413 pr_err("Unable to register SPIC driver\n");
3422 goto out; 3414 goto out;
3423 } 3415 }
3424 spic_drv_registered = 1; 3416 spic_drv_registered = 1;
@@ -3426,7 +3418,7 @@ static int __init sony_laptop_init(void)
3426 3418
3427 result = acpi_bus_register_driver(&sony_nc_driver); 3419 result = acpi_bus_register_driver(&sony_nc_driver);
3428 if (result) { 3420 if (result) {
3429 pr_err(DRV_PFX "Unable to register SNC driver."); 3421 pr_err("Unable to register SNC driver\n");
3430 goto out_unregister_pic; 3422 goto out_unregister_pic;
3431 } 3423 }
3432 3424
diff --git a/drivers/platform/x86/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c
index 865ef78d6f1a..e24f5ae475af 100644
--- a/drivers/platform/x86/tc1100-wmi.c
+++ b/drivers/platform/x86/tc1100-wmi.c
@@ -25,6 +25,8 @@
25 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 */ 26 */
27 27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
28#include <linux/kernel.h> 30#include <linux/kernel.h>
29#include <linux/module.h> 31#include <linux/module.h>
30#include <linux/slab.h> 32#include <linux/slab.h>
@@ -40,9 +42,6 @@
40#define TC1100_INSTANCE_WIRELESS 1 42#define TC1100_INSTANCE_WIRELESS 1
41#define TC1100_INSTANCE_JOGDIAL 2 43#define TC1100_INSTANCE_JOGDIAL 2
42 44
43#define TC1100_LOGPREFIX "tc1100-wmi: "
44#define TC1100_INFO KERN_INFO TC1100_LOGPREFIX
45
46MODULE_AUTHOR("Jamey Hicks, Carlos Corbacho"); 45MODULE_AUTHOR("Jamey Hicks, Carlos Corbacho");
47MODULE_DESCRIPTION("HP Compaq TC1100 Tablet WMI Extras"); 46MODULE_DESCRIPTION("HP Compaq TC1100 Tablet WMI Extras");
48MODULE_LICENSE("GPL"); 47MODULE_LICENSE("GPL");
@@ -264,7 +263,7 @@ static int __init tc1100_init(void)
264 if (error) 263 if (error)
265 goto err_device_del; 264 goto err_device_del;
266 265
267 printk(TC1100_INFO "HP Compaq TC1100 Tablet WMI Extras loaded\n"); 266 pr_info("HP Compaq TC1100 Tablet WMI Extras loaded\n");
268 return 0; 267 return 0;
269 268
270 err_device_del: 269 err_device_del:
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 {
diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c
index 1d07d6d09f27..4c20447ddbb7 100644
--- a/drivers/platform/x86/topstar-laptop.c
+++ b/drivers/platform/x86/topstar-laptop.c
@@ -194,7 +194,7 @@ static int __init topstar_laptop_init(void)
194 if (ret < 0) 194 if (ret < 0)
195 return ret; 195 return ret;
196 196
197 printk(KERN_INFO "Topstar Laptop ACPI extras driver loaded\n"); 197 pr_info("ACPI extras driver loaded\n");
198 198
199 return 0; 199 return 0;
200} 200}
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 63f42a22e102..cb009b2629ee 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -35,6 +35,8 @@
35 * 35 *
36 */ 36 */
37 37
38#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
39
38#define TOSHIBA_ACPI_VERSION "0.19" 40#define TOSHIBA_ACPI_VERSION "0.19"
39#define PROC_INTERFACE_VERSION 1 41#define PROC_INTERFACE_VERSION 1
40 42
@@ -60,11 +62,6 @@ MODULE_AUTHOR("John Belmonte");
60MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver"); 62MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver");
61MODULE_LICENSE("GPL"); 63MODULE_LICENSE("GPL");
62 64
63#define MY_LOGPREFIX "toshiba_acpi: "
64#define MY_ERR KERN_ERR MY_LOGPREFIX
65#define MY_NOTICE KERN_NOTICE MY_LOGPREFIX
66#define MY_INFO KERN_INFO MY_LOGPREFIX
67
68/* Toshiba ACPI method paths */ 65/* Toshiba ACPI method paths */
69#define METHOD_LCD_BRIGHTNESS "\\_SB_.PCI0.VGA_.LCD_._BCM" 66#define METHOD_LCD_BRIGHTNESS "\\_SB_.PCI0.VGA_.LCD_._BCM"
70#define TOSH_INTERFACE_1 "\\_SB_.VALD" 67#define TOSH_INTERFACE_1 "\\_SB_.VALD"
@@ -301,7 +298,7 @@ static int toshiba_illumination_available(void)
301 in[0] = 0xf100; 298 in[0] = 0xf100;
302 status = hci_raw(in, out); 299 status = hci_raw(in, out);
303 if (ACPI_FAILURE(status)) { 300 if (ACPI_FAILURE(status)) {
304 printk(MY_INFO "Illumination device not available\n"); 301 pr_info("Illumination device not available\n");
305 return 0; 302 return 0;
306 } 303 }
307 in[0] = 0xf400; 304 in[0] = 0xf400;
@@ -320,7 +317,7 @@ static void toshiba_illumination_set(struct led_classdev *cdev,
320 in[0] = 0xf100; 317 in[0] = 0xf100;
321 status = hci_raw(in, out); 318 status = hci_raw(in, out);
322 if (ACPI_FAILURE(status)) { 319 if (ACPI_FAILURE(status)) {
323 printk(MY_INFO "Illumination device not available\n"); 320 pr_info("Illumination device not available\n");
324 return; 321 return;
325 } 322 }
326 323
@@ -331,7 +328,7 @@ static void toshiba_illumination_set(struct led_classdev *cdev,
331 in[2] = 1; 328 in[2] = 1;
332 status = hci_raw(in, out); 329 status = hci_raw(in, out);
333 if (ACPI_FAILURE(status)) { 330 if (ACPI_FAILURE(status)) {
334 printk(MY_INFO "ACPI call for illumination failed.\n"); 331 pr_info("ACPI call for illumination failed\n");
335 return; 332 return;
336 } 333 }
337 } else { 334 } else {
@@ -341,7 +338,7 @@ static void toshiba_illumination_set(struct led_classdev *cdev,
341 in[2] = 0; 338 in[2] = 0;
342 status = hci_raw(in, out); 339 status = hci_raw(in, out);
343 if (ACPI_FAILURE(status)) { 340 if (ACPI_FAILURE(status)) {
344 printk(MY_INFO "ACPI call for illumination failed.\n"); 341 pr_info("ACPI call for illumination failed.\n");
345 return; 342 return;
346 } 343 }
347 } 344 }
@@ -364,7 +361,7 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)
364 in[0] = 0xf100; 361 in[0] = 0xf100;
365 status = hci_raw(in, out); 362 status = hci_raw(in, out);
366 if (ACPI_FAILURE(status)) { 363 if (ACPI_FAILURE(status)) {
367 printk(MY_INFO "Illumination device not available\n"); 364 pr_info("Illumination device not available\n");
368 return LED_OFF; 365 return LED_OFF;
369 } 366 }
370 367
@@ -373,7 +370,7 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)
373 in[1] = 0x14e; 370 in[1] = 0x14e;
374 status = hci_raw(in, out); 371 status = hci_raw(in, out);
375 if (ACPI_FAILURE(status)) { 372 if (ACPI_FAILURE(status)) {
376 printk(MY_INFO "ACPI call for illumination failed.\n"); 373 pr_info("ACPI call for illumination failed.\n");
377 return LED_OFF; 374 return LED_OFF;
378 } 375 }
379 376
@@ -517,7 +514,7 @@ static int lcd_proc_show(struct seq_file *m, void *v)
517 seq_printf(m, "brightness_levels: %d\n", 514 seq_printf(m, "brightness_levels: %d\n",
518 HCI_LCD_BRIGHTNESS_LEVELS); 515 HCI_LCD_BRIGHTNESS_LEVELS);
519 } else { 516 } else {
520 printk(MY_ERR "Error reading LCD brightness\n"); 517 pr_err("Error reading LCD brightness\n");
521 } 518 }
522 519
523 return 0; 520 return 0;
@@ -592,7 +589,7 @@ static int video_proc_show(struct seq_file *m, void *v)
592 seq_printf(m, "crt_out: %d\n", is_crt); 589 seq_printf(m, "crt_out: %d\n", is_crt);
593 seq_printf(m, "tv_out: %d\n", is_tv); 590 seq_printf(m, "tv_out: %d\n", is_tv);
594 } else { 591 } else {
595 printk(MY_ERR "Error reading video out status\n"); 592 pr_err("Error reading video out status\n");
596 } 593 }
597 594
598 return 0; 595 return 0;
@@ -686,7 +683,7 @@ static int fan_proc_show(struct seq_file *m, void *v)
686 seq_printf(m, "running: %d\n", (value > 0)); 683 seq_printf(m, "running: %d\n", (value > 0));
687 seq_printf(m, "force_on: %d\n", force_fan); 684 seq_printf(m, "force_on: %d\n", force_fan);
688 } else { 685 } else {
689 printk(MY_ERR "Error reading fan status\n"); 686 pr_err("Error reading fan status\n");
690 } 687 }
691 688
692 return 0; 689 return 0;
@@ -750,9 +747,9 @@ static int keys_proc_show(struct seq_file *m, void *v)
750 * some machines where system events sporadically 747 * some machines where system events sporadically
751 * become disabled. */ 748 * become disabled. */
752 hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result); 749 hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result);
753 printk(MY_NOTICE "Re-enabled hotkeys\n"); 750 pr_notice("Re-enabled hotkeys\n");
754 } else { 751 } else {
755 printk(MY_ERR "Error reading hotkey status\n"); 752 pr_err("Error reading hotkey status\n");
756 goto end; 753 goto end;
757 } 754 }
758 } 755 }
@@ -863,7 +860,7 @@ static void toshiba_acpi_notify(acpi_handle handle, u32 event, void *context)
863 860
864 if (!sparse_keymap_report_event(toshiba_acpi.hotkey_dev, 861 if (!sparse_keymap_report_event(toshiba_acpi.hotkey_dev,
865 value, 1, true)) { 862 value, 1, true)) {
866 printk(MY_INFO "Unknown key %x\n", 863 pr_info("Unknown key %x\n",
867 value); 864 value);
868 } 865 }
869 } else if (hci_result == HCI_NOT_SUPPORTED) { 866 } else if (hci_result == HCI_NOT_SUPPORTED) {
@@ -871,7 +868,7 @@ static void toshiba_acpi_notify(acpi_handle handle, u32 event, void *context)
871 * some machines where system events sporadically 868 * some machines where system events sporadically
872 * become disabled. */ 869 * become disabled. */
873 hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result); 870 hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result);
874 printk(MY_NOTICE "Re-enabled hotkeys\n"); 871 pr_notice("Re-enabled hotkeys\n");
875 } 872 }
876 } while (hci_result != HCI_EMPTY); 873 } while (hci_result != HCI_EMPTY);
877} 874}
@@ -883,13 +880,13 @@ static int __init toshiba_acpi_setup_keyboard(char *device)
883 880
884 status = acpi_get_handle(NULL, device, &toshiba_acpi.handle); 881 status = acpi_get_handle(NULL, device, &toshiba_acpi.handle);
885 if (ACPI_FAILURE(status)) { 882 if (ACPI_FAILURE(status)) {
886 printk(MY_INFO "Unable to get notification device\n"); 883 pr_info("Unable to get notification device\n");
887 return -ENODEV; 884 return -ENODEV;
888 } 885 }
889 886
890 toshiba_acpi.hotkey_dev = input_allocate_device(); 887 toshiba_acpi.hotkey_dev = input_allocate_device();
891 if (!toshiba_acpi.hotkey_dev) { 888 if (!toshiba_acpi.hotkey_dev) {
892 printk(MY_INFO "Unable to register input device\n"); 889 pr_info("Unable to register input device\n");
893 return -ENOMEM; 890 return -ENOMEM;
894 } 891 }
895 892
@@ -905,21 +902,21 @@ static int __init toshiba_acpi_setup_keyboard(char *device)
905 status = acpi_install_notify_handler(toshiba_acpi.handle, 902 status = acpi_install_notify_handler(toshiba_acpi.handle,
906 ACPI_DEVICE_NOTIFY, toshiba_acpi_notify, NULL); 903 ACPI_DEVICE_NOTIFY, toshiba_acpi_notify, NULL);
907 if (ACPI_FAILURE(status)) { 904 if (ACPI_FAILURE(status)) {
908 printk(MY_INFO "Unable to install hotkey notification\n"); 905 pr_info("Unable to install hotkey notification\n");
909 error = -ENODEV; 906 error = -ENODEV;
910 goto err_free_keymap; 907 goto err_free_keymap;
911 } 908 }
912 909
913 status = acpi_evaluate_object(toshiba_acpi.handle, "ENAB", NULL, NULL); 910 status = acpi_evaluate_object(toshiba_acpi.handle, "ENAB", NULL, NULL);
914 if (ACPI_FAILURE(status)) { 911 if (ACPI_FAILURE(status)) {
915 printk(MY_INFO "Unable to enable hotkeys\n"); 912 pr_info("Unable to enable hotkeys\n");
916 error = -ENODEV; 913 error = -ENODEV;
917 goto err_remove_notify; 914 goto err_remove_notify;
918 } 915 }
919 916
920 error = input_register_device(toshiba_acpi.hotkey_dev); 917 error = input_register_device(toshiba_acpi.hotkey_dev);
921 if (error) { 918 if (error) {
922 printk(MY_INFO "Unable to register input device\n"); 919 pr_info("Unable to register input device\n");
923 goto err_remove_notify; 920 goto err_remove_notify;
924 } 921 }
925 922
@@ -980,17 +977,17 @@ static int __init toshiba_acpi_init(void)
980 if (is_valid_acpi_path(TOSH_INTERFACE_1 GHCI_METHOD)) { 977 if (is_valid_acpi_path(TOSH_INTERFACE_1 GHCI_METHOD)) {
981 method_hci = TOSH_INTERFACE_1 GHCI_METHOD; 978 method_hci = TOSH_INTERFACE_1 GHCI_METHOD;
982 if (toshiba_acpi_setup_keyboard(TOSH_INTERFACE_1)) 979 if (toshiba_acpi_setup_keyboard(TOSH_INTERFACE_1))
983 printk(MY_INFO "Unable to activate hotkeys\n"); 980 pr_info("Unable to activate hotkeys\n");
984 } else if (is_valid_acpi_path(TOSH_INTERFACE_2 GHCI_METHOD)) { 981 } else if (is_valid_acpi_path(TOSH_INTERFACE_2 GHCI_METHOD)) {
985 method_hci = TOSH_INTERFACE_2 GHCI_METHOD; 982 method_hci = TOSH_INTERFACE_2 GHCI_METHOD;
986 if (toshiba_acpi_setup_keyboard(TOSH_INTERFACE_2)) 983 if (toshiba_acpi_setup_keyboard(TOSH_INTERFACE_2))
987 printk(MY_INFO "Unable to activate hotkeys\n"); 984 pr_info("Unable to activate hotkeys\n");
988 } else 985 } else
989 return -ENODEV; 986 return -ENODEV;
990 987
991 printk(MY_INFO "Toshiba Laptop ACPI Extras version %s\n", 988 pr_info("Toshiba Laptop ACPI Extras version %s\n",
992 TOSHIBA_ACPI_VERSION); 989 TOSHIBA_ACPI_VERSION);
993 printk(MY_INFO " HCI method: %s\n", method_hci); 990 pr_info(" HCI method: %s\n", method_hci);
994 991
995 mutex_init(&toshiba_acpi.mutex); 992 mutex_init(&toshiba_acpi.mutex);
996 993
@@ -998,7 +995,7 @@ static int __init toshiba_acpi_init(void)
998 -1, NULL, 0); 995 -1, NULL, 0);
999 if (IS_ERR(toshiba_acpi.p_dev)) { 996 if (IS_ERR(toshiba_acpi.p_dev)) {
1000 ret = PTR_ERR(toshiba_acpi.p_dev); 997 ret = PTR_ERR(toshiba_acpi.p_dev);
1001 printk(MY_ERR "unable to register platform device\n"); 998 pr_err("unable to register platform device\n");
1002 toshiba_acpi.p_dev = NULL; 999 toshiba_acpi.p_dev = NULL;
1003 toshiba_acpi_exit(); 1000 toshiba_acpi_exit();
1004 return ret; 1001 return ret;
@@ -1028,7 +1025,7 @@ static int __init toshiba_acpi_init(void)
1028 if (IS_ERR(toshiba_backlight_device)) { 1025 if (IS_ERR(toshiba_backlight_device)) {
1029 ret = PTR_ERR(toshiba_backlight_device); 1026 ret = PTR_ERR(toshiba_backlight_device);
1030 1027
1031 printk(KERN_ERR "Could not register toshiba backlight device\n"); 1028 pr_err("Could not register toshiba backlight device\n");
1032 toshiba_backlight_device = NULL; 1029 toshiba_backlight_device = NULL;
1033 toshiba_acpi_exit(); 1030 toshiba_acpi_exit();
1034 return ret; 1031 return ret;
@@ -1042,14 +1039,14 @@ static int __init toshiba_acpi_init(void)
1042 &toshiba_rfk_ops, 1039 &toshiba_rfk_ops,
1043 &toshiba_acpi); 1040 &toshiba_acpi);
1044 if (!toshiba_acpi.bt_rfk) { 1041 if (!toshiba_acpi.bt_rfk) {
1045 printk(MY_ERR "unable to allocate rfkill device\n"); 1042 pr_err("unable to allocate rfkill device\n");
1046 toshiba_acpi_exit(); 1043 toshiba_acpi_exit();
1047 return -ENOMEM; 1044 return -ENOMEM;
1048 } 1045 }
1049 1046
1050 ret = rfkill_register(toshiba_acpi.bt_rfk); 1047 ret = rfkill_register(toshiba_acpi.bt_rfk);
1051 if (ret) { 1048 if (ret) {
1052 printk(MY_ERR "unable to register rfkill device\n"); 1049 pr_err("unable to register rfkill device\n");
1053 rfkill_destroy(toshiba_acpi.bt_rfk); 1050 rfkill_destroy(toshiba_acpi.bt_rfk);
1054 toshiba_acpi_exit(); 1051 toshiba_acpi_exit();
1055 return ret; 1052 return ret;
diff --git a/drivers/platform/x86/toshiba_bluetooth.c b/drivers/platform/x86/toshiba_bluetooth.c
index 944068611919..5fb7186694df 100644
--- a/drivers/platform/x86/toshiba_bluetooth.c
+++ b/drivers/platform/x86/toshiba_bluetooth.c
@@ -17,6 +17,8 @@
17 * delivered. 17 * delivered.
18 */ 18 */
19 19
20#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
21
20#include <linux/kernel.h> 22#include <linux/kernel.h>
21#include <linux/module.h> 23#include <linux/module.h>
22#include <linux/init.h> 24#include <linux/init.h>
@@ -70,14 +72,13 @@ static int toshiba_bluetooth_enable(acpi_handle handle)
70 if (!(result & 0x01)) 72 if (!(result & 0x01))
71 return 0; 73 return 0;
72 74
73 printk(KERN_INFO "toshiba_bluetooth: Re-enabling Toshiba Bluetooth\n"); 75 pr_info("Re-enabling Toshiba Bluetooth\n");
74 res1 = acpi_evaluate_object(handle, "AUSB", NULL, NULL); 76 res1 = acpi_evaluate_object(handle, "AUSB", NULL, NULL);
75 res2 = acpi_evaluate_object(handle, "BTPO", NULL, NULL); 77 res2 = acpi_evaluate_object(handle, "BTPO", NULL, NULL);
76 if (!ACPI_FAILURE(res1) || !ACPI_FAILURE(res2)) 78 if (!ACPI_FAILURE(res1) || !ACPI_FAILURE(res2))
77 return 0; 79 return 0;
78 80
79 printk(KERN_WARNING "toshiba_bluetooth: Failed to re-enable " 81 pr_warn("Failed to re-enable Toshiba Bluetooth\n");
80 "Toshiba Bluetooth\n");
81 82
82 return -ENODEV; 83 return -ENODEV;
83} 84}
@@ -107,8 +108,8 @@ static int toshiba_bt_rfkill_add(struct acpi_device *device)
107 &bt_present); 108 &bt_present);
108 109
109 if (!ACPI_FAILURE(status) && bt_present) { 110 if (!ACPI_FAILURE(status) && bt_present) {
110 printk(KERN_INFO "Detected Toshiba ACPI Bluetooth device - " 111 pr_info("Detected Toshiba ACPI Bluetooth device - "
111 "installing RFKill handler\n"); 112 "installing RFKill handler\n");
112 result = toshiba_bluetooth_enable(device->handle); 113 result = toshiba_bluetooth_enable(device->handle);
113 } 114 }
114 115
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 05cc79672a8b..f23d5a84e7b1 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -486,16 +486,16 @@ static void wmi_dump_wdg(const struct guid_block *g)
486 pr_info("\tnotify_id: %02X\n", g->notify_id); 486 pr_info("\tnotify_id: %02X\n", g->notify_id);
487 pr_info("\treserved: %02X\n", g->reserved); 487 pr_info("\treserved: %02X\n", g->reserved);
488 pr_info("\tinstance_count: %d\n", g->instance_count); 488 pr_info("\tinstance_count: %d\n", g->instance_count);
489 pr_info("\tflags: %#x ", g->flags); 489 pr_info("\tflags: %#x", g->flags);
490 if (g->flags) { 490 if (g->flags) {
491 if (g->flags & ACPI_WMI_EXPENSIVE) 491 if (g->flags & ACPI_WMI_EXPENSIVE)
492 pr_cont("ACPI_WMI_EXPENSIVE "); 492 pr_cont(" ACPI_WMI_EXPENSIVE");
493 if (g->flags & ACPI_WMI_METHOD) 493 if (g->flags & ACPI_WMI_METHOD)
494 pr_cont("ACPI_WMI_METHOD "); 494 pr_cont(" ACPI_WMI_METHOD");
495 if (g->flags & ACPI_WMI_STRING) 495 if (g->flags & ACPI_WMI_STRING)
496 pr_cont("ACPI_WMI_STRING "); 496 pr_cont(" ACPI_WMI_STRING");
497 if (g->flags & ACPI_WMI_EVENT) 497 if (g->flags & ACPI_WMI_EVENT)
498 pr_cont("ACPI_WMI_EVENT "); 498 pr_cont(" ACPI_WMI_EVENT");
499 } 499 }
500 pr_cont("\n"); 500 pr_cont("\n");
501 501
diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c
index c1372ed9d2e9..fad153dc0355 100644
--- a/drivers/platform/x86/xo15-ebook.c
+++ b/drivers/platform/x86/xo15-ebook.c
@@ -11,6 +11,8 @@
11 * your option) any later version. 11 * your option) any later version.
12 */ 12 */
13 13
14#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15
14#include <linux/kernel.h> 16#include <linux/kernel.h>
15#include <linux/module.h> 17#include <linux/module.h>
16#include <linux/init.h> 18#include <linux/init.h>
@@ -20,7 +22,6 @@
20#include <acpi/acpi_drivers.h> 22#include <acpi/acpi_drivers.h>
21 23
22#define MODULE_NAME "xo15-ebook" 24#define MODULE_NAME "xo15-ebook"
23#define PREFIX MODULE_NAME ": "
24 25
25#define XO15_EBOOK_CLASS MODULE_NAME 26#define XO15_EBOOK_CLASS MODULE_NAME
26#define XO15_EBOOK_TYPE_UNKNOWN 0x00 27#define XO15_EBOOK_TYPE_UNKNOWN 0x00
@@ -105,7 +106,7 @@ static int ebook_switch_add(struct acpi_device *device)
105 class = acpi_device_class(device); 106 class = acpi_device_class(device);
106 107
107 if (strcmp(hid, XO15_EBOOK_HID)) { 108 if (strcmp(hid, XO15_EBOOK_HID)) {
108 printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", hid); 109 pr_err("Unsupported hid [%s]\n", hid);
109 error = -ENODEV; 110 error = -ENODEV;
110 goto err_free_input; 111 goto err_free_input;
111 } 112 }