aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2010-02-25 19:29:00 -0500
committerHenrique de Moraes Holschuh <hmh@hmh.eng.br>2010-02-25 19:37:23 -0500
commit7f0cf712a74fcc3ad21f0bde95bd32c2f2cc3888 (patch)
tree27ff0f6a3fcb501cff825a967d9fb7592dc81d47 /drivers/platform/x86
parentb589ea4c44170d3f7a845684e2d1b3b9571663af (diff)
thinkpad-acpi: make driver events work in NVRAM poll mode
Thadeu Lima de Souza Cascardo reports this: Brightness notification does not work until the user writes to hotkey_mask attribute. That's because the polling thread will only run if hotkey_user_mask is set and someone is reading the input device or if hotkey_driver_mask is set. In this second case, this condition is not tested after the mask is changed, because the brightness and volume drivers are started after the hotkey drivers. Fix tpacpi_hotkey_driver_mask_set() to call hotkey_poll_setup(), so that the poller kthread will be started when needed. Reported-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Tested-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: stable@kernel.org
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 933bcc477f4a..5f450831e5f0 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -2082,6 +2082,7 @@ static struct attribute_set *hotkey_dev_attributes;
2082 2082
2083static void tpacpi_driver_event(const unsigned int hkey_event); 2083static void tpacpi_driver_event(const unsigned int hkey_event);
2084static void hotkey_driver_event(const unsigned int scancode); 2084static void hotkey_driver_event(const unsigned int scancode);
2085static void hotkey_poll_setup(const bool may_warn);
2085 2086
2086/* HKEY.MHKG() return bits */ 2087/* HKEY.MHKG() return bits */
2087#define TP_HOTKEY_TABLET_MASK (1 << 3) 2088#define TP_HOTKEY_TABLET_MASK (1 << 3)
@@ -2264,6 +2265,8 @@ static int tpacpi_hotkey_driver_mask_set(const u32 mask)
2264 2265
2265 rc = hotkey_mask_set((hotkey_acpi_mask | hotkey_driver_mask) & 2266 rc = hotkey_mask_set((hotkey_acpi_mask | hotkey_driver_mask) &
2266 ~hotkey_source_mask); 2267 ~hotkey_source_mask);
2268 hotkey_poll_setup(true);
2269
2267 mutex_unlock(&hotkey_mutex); 2270 mutex_unlock(&hotkey_mutex);
2268 2271
2269 return rc; 2272 return rc;
@@ -2548,7 +2551,7 @@ static void hotkey_poll_stop_sync(void)
2548} 2551}
2549 2552
2550/* call with hotkey_mutex held */ 2553/* call with hotkey_mutex held */
2551static void hotkey_poll_setup(bool may_warn) 2554static void hotkey_poll_setup(const bool may_warn)
2552{ 2555{
2553 const u32 poll_driver_mask = hotkey_driver_mask & hotkey_source_mask; 2556 const u32 poll_driver_mask = hotkey_driver_mask & hotkey_source_mask;
2554 const u32 poll_user_mask = hotkey_user_mask & hotkey_source_mask; 2557 const u32 poll_user_mask = hotkey_user_mask & hotkey_source_mask;
@@ -2579,7 +2582,7 @@ static void hotkey_poll_setup(bool may_warn)
2579 } 2582 }
2580} 2583}
2581 2584
2582static void hotkey_poll_setup_safe(bool may_warn) 2585static void hotkey_poll_setup_safe(const bool may_warn)
2583{ 2586{
2584 mutex_lock(&hotkey_mutex); 2587 mutex_lock(&hotkey_mutex);
2585 hotkey_poll_setup(may_warn); 2588 hotkey_poll_setup(may_warn);
@@ -2597,7 +2600,11 @@ static void hotkey_poll_set_freq(unsigned int freq)
2597 2600
2598#else /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 2601#else /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */
2599 2602
2600static void hotkey_poll_setup_safe(bool __unused) 2603static void hotkey_poll_setup(const bool __unused)
2604{
2605}
2606
2607static void hotkey_poll_setup_safe(const bool __unused)
2601{ 2608{
2602} 2609}
2603 2610