aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/laptops/thinkpad-acpi.txt2
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c40
2 files changed, 42 insertions, 0 deletions
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt
index f6e6bc66eed3..e8f52fbadfe0 100644
--- a/Documentation/laptops/thinkpad-acpi.txt
+++ b/Documentation/laptops/thinkpad-acpi.txt
@@ -1484,6 +1484,8 @@ will enable all debugging output classes. It takes a bitmask, so
1484to enable more than one output class, just add their values. 1484to enable more than one output class, just add their values.
1485 1485
1486 Debug bitmask Description 1486 Debug bitmask Description
1487 0x8000 Disclose PID of userspace programs
1488 accessing some functions of the driver
1487 0x0001 Initialization and probing 1489 0x0001 Initialization and probing
1488 0x0002 Removal 1490 0x0002 Removal
1489 1491
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 6331b88d77d9..852be7c1a172 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -54,6 +54,7 @@
54#include <linux/string.h> 54#include <linux/string.h>
55#include <linux/list.h> 55#include <linux/list.h>
56#include <linux/mutex.h> 56#include <linux/mutex.h>
57#include <linux/sched.h>
57#include <linux/kthread.h> 58#include <linux/kthread.h>
58#include <linux/freezer.h> 59#include <linux/freezer.h>
59#include <linux/delay.h> 60#include <linux/delay.h>
@@ -185,6 +186,7 @@ enum {
185 186
186/* Debugging printk groups */ 187/* Debugging printk groups */
187#define TPACPI_DBG_ALL 0xffff 188#define TPACPI_DBG_ALL 0xffff
189#define TPACPI_DBG_DISCLOSETASK 0x8000
188#define TPACPI_DBG_INIT 0x0001 190#define TPACPI_DBG_INIT 0x0001
189#define TPACPI_DBG_EXIT 0x0002 191#define TPACPI_DBG_EXIT 0x0002
190 192
@@ -335,6 +337,21 @@ static const char *str_supported(int is_supported);
335 do { } while (0) 337 do { } while (0)
336#endif 338#endif
337 339
340static void tpacpi_log_usertask(const char * const what)
341{
342 printk(TPACPI_DEBUG "%s: access by process with PID %d\n",
343 what, task_tgid_vnr(current));
344}
345
346#define tpacpi_disclose_usertask(what, format, arg...) \
347 do { \
348 if (unlikely( \
349 (dbg_level & TPACPI_DBG_DISCLOSETASK) && \
350 (tpacpi_lifecycle == TPACPI_LIFE_RUNNING))) { \
351 printk(TPACPI_DEBUG "%s: PID %d: " format, \
352 what, task_tgid_vnr(current), ## arg); \
353 } \
354 } while (0)
338 355
339/**************************************************************************** 356/****************************************************************************
340 **************************************************************************** 357 ****************************************************************************
@@ -1030,6 +1047,21 @@ static int __init tpacpi_new_rfkill(const unsigned int id,
1030 return 0; 1047 return 0;
1031} 1048}
1032 1049
1050static void printk_deprecated_attribute(const char * const what,
1051 const char * const details)
1052{
1053 tpacpi_log_usertask("deprecated sysfs attribute");
1054 printk(TPACPI_WARN "WARNING: sysfs attribute %s is deprecated and "
1055 "will be removed. %s\n",
1056 what, details);
1057}
1058
1059static void printk_deprecated_rfkill_attribute(const char * const what)
1060{
1061 printk_deprecated_attribute(what,
1062 "Please switch to generic rfkill before year 2010");
1063}
1064
1033/************************************************************************* 1065/*************************************************************************
1034 * thinkpad-acpi driver attributes 1066 * thinkpad-acpi driver attributes
1035 */ 1067 */
@@ -3070,6 +3102,8 @@ static ssize_t bluetooth_enable_show(struct device *dev,
3070{ 3102{
3071 int status; 3103 int status;
3072 3104
3105 printk_deprecated_rfkill_attribute("bluetooth_enable");
3106
3073 status = bluetooth_get_radiosw(); 3107 status = bluetooth_get_radiosw();
3074 if (status < 0) 3108 if (status < 0)
3075 return status; 3109 return status;
@@ -3085,6 +3119,8 @@ static ssize_t bluetooth_enable_store(struct device *dev,
3085 unsigned long t; 3119 unsigned long t;
3086 int res; 3120 int res;
3087 3121
3122 printk_deprecated_rfkill_attribute("bluetooth_enable");
3123
3088 if (parse_strtoul(buf, 1, &t)) 3124 if (parse_strtoul(buf, 1, &t))
3089 return -EINVAL; 3125 return -EINVAL;
3090 3126
@@ -3347,6 +3383,8 @@ static ssize_t wan_enable_show(struct device *dev,
3347{ 3383{
3348 int status; 3384 int status;
3349 3385
3386 printk_deprecated_rfkill_attribute("wwan_enable");
3387
3350 status = wan_get_radiosw(); 3388 status = wan_get_radiosw();
3351 if (status < 0) 3389 if (status < 0)
3352 return status; 3390 return status;
@@ -3362,6 +3400,8 @@ static ssize_t wan_enable_store(struct device *dev,
3362 unsigned long t; 3400 unsigned long t;
3363 int res; 3401 int res;
3364 3402
3403 printk_deprecated_rfkill_attribute("wwan_enable");
3404
3365 if (parse_strtoul(buf, 1, &t)) 3405 if (parse_strtoul(buf, 1, &t))
3366 return -EINVAL; 3406 return -EINVAL;
3367 3407