Add patches accepted for 2.6.26-rc1
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / releases / upstream / 2.6.26-rc1 / 0003-ACPI-thinkpad-acpi-warn-once-about-weird-hotkey-ma.patch
blobfe52f1d7c4663c9de1e8da444b78f0a9581dbaf4
1 From 92889022250d736e135ca92fbffd1ab0ea4780d1 Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Sat, 26 Apr 2008 01:02:18 -0300
4 Subject: ACPI: thinkpad-acpi: warn once about weird hotkey masks
6 thinkpad-acpi knows for a while now how to best program the hotkeys by
7 default, and always enable them by default. Unfortunately, this
8 information has not filtered down everywhere it needs to, yet. Notably,
9 old ibm-acpi documentation and most "thinkpad setup guides" will have wrong
10 information on this area.
12 Warn the local admin once whenever any of the following patterns are met:
14 1. Attempts to set hotkey mask to 0xffff (artifact from docs and config
15 for the old ibm-acpi driver and behaviour). This mask makes no
16 real-world sense;
18 2. Attempts to set hotkey mask to 0xffffffff, which means the user is
19 trying to just have "everything work" without even reading the
20 documentation, or that we need to get a bug report, because there
21 is a new thinkpad out there with new exciting hot keys :-)
23 3. Attempts to set hotkey mask to 0xffffff, which is almost never the
24 correct way to set up volume and brightness event reporting (and with
25 the current state-of-the-art, it is known to never be right way to do
26 it).
28 The driver will perform any and all requested operations, though,
29 regardless of any warnings. I hope these warnings can be removed one or
30 two years from now.
32 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
33 Signed-off-by: Len Brown <len.brown@intel.com>
34 ---
35 drivers/misc/thinkpad_acpi.c | 17 +++++++++++++++++
36 1 files changed, 17 insertions(+), 0 deletions(-)
38 diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
39 index 2c85a2e..cd263c5 100644
40 --- a/drivers/misc/thinkpad_acpi.c
41 +++ b/drivers/misc/thinkpad_acpi.c
42 @@ -237,6 +237,10 @@ static struct {
43 u32 hotkey_poll_active:1;
44 } tp_features;
46 +static struct {
47 + u16 hotkey_mask_ff:1;
48 +} tp_warned;
50 struct thinkpad_id_data {
51 unsigned int vendor; /* ThinkPad vendor:
52 * PCI_VENDOR_ID_IBM/PCI_VENDOR_ID_LENOVO */
53 @@ -1182,6 +1186,19 @@ static int hotkey_mask_set(u32 mask)
54 int rc = 0;
56 if (tp_features.hotkey_mask) {
57 + if (!tp_warned.hotkey_mask_ff &&
58 + (mask == 0xffff || mask == 0xffffff ||
59 + mask == 0xffffffff)) {
60 + tp_warned.hotkey_mask_ff = 1;
61 + printk(TPACPI_NOTICE
62 + "setting the hotkey mask to 0x%08x is likely "
63 + "not the best way to go about it\n", mask);
64 + printk(TPACPI_NOTICE
65 + "please consider using the driver defaults, "
66 + "and refer to up-to-date thinkpad-acpi "
67 + "documentation\n");
68 + }
70 HOTKEY_CONFIG_CRITICAL_START
71 for (i = 0; i < 32; i++) {
72 u32 m = 1 << i;
73 --
74 1.5.4.4