aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2009-04-04 00:25:47 -0400
committerLen Brown <len.brown@intel.com>2009-04-04 03:14:52 -0400
commit73a94d86a8625371f76de0ee12dc5bacd3ed42c0 (patch)
treedb8def5a298edf3b70efefb4fd255da87ca0d2fd /drivers
parent7ff8d62f7f055aaffbeb493863136c1b876bbe2e (diff)
thinkpad-acpi: add new debug helpers and warn of deprecated atts
Add a debug helper that discloses the TGID of the userspace task attempting to access the driver. This is highly useful when dealing with bug reports, since often the user has no idea that some userspace application is accessing thinkpad-acpi... Also add a helper to log warnings about sysfs attributes that are deprecated. Use the new helpers to issue deprecation warnings for bluetooth_enable and wwan_enabled, that have been deprecated for a while, now. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c40
1 files changed, 40 insertions, 0 deletions
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