1 From 406e988bef742aa74cdc1f5fafc812ecebf7c02b Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Tue, 14 Apr 2009 02:44:10 +0000
4 Subject: thinkpad-acpi: silence hotkey enable warning for module parameter
6 Avoid the WARN() when the procfs handler for hotkey enable is used by
7 a module parameter. Instead, urge the user to stop doing that.
9 Reported-by: Niel Lambrechts <niel.lambrechts@gmail.com>
10 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
11 Signed-off-by: Len Brown <len.brown@intel.com>
13 drivers/platform/x86/thinkpad_acpi.c | 18 ++++++++++++------
14 1 files changed, 12 insertions(+), 6 deletions(-)
16 diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
17 index a40b075..a186c5b 100644
18 --- a/drivers/platform/x86/thinkpad_acpi.c
19 +++ b/drivers/platform/x86/thinkpad_acpi.c
20 @@ -2946,12 +2946,18 @@ static int hotkey_read(char *p)
24 -static void hotkey_enabledisable_warn(void)
25 +static void hotkey_enabledisable_warn(bool enable)
27 tpacpi_log_usertask("procfs hotkey enable/disable");
29 - "hotkey enable/disable functionality has been "
30 - "removed from the driver. Hotkeys are always enabled.\n");
31 + if (!WARN((tpacpi_lifecycle == TPACPI_LIFE_RUNNING || !enable),
33 + "hotkey enable/disable functionality has been "
34 + "removed from the driver. Hotkeys are always "
37 + "Please remove the hotkey=enable module "
38 + "parameter, it is deprecated. Hotkeys are always "
42 static int hotkey_write(char *buf)
43 @@ -2971,9 +2977,9 @@ static int hotkey_write(char *buf)
45 while ((cmd = next_cmd(&buf))) {
46 if (strlencmp(cmd, "enable") == 0) {
47 - hotkey_enabledisable_warn();
48 + hotkey_enabledisable_warn(1);
49 } else if (strlencmp(cmd, "disable") == 0) {
50 - hotkey_enabledisable_warn();
51 + hotkey_enabledisable_warn(0);
53 } else if (strlencmp(cmd, "reset") == 0) {
54 mask = hotkey_orig_mask;