aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/thinkpad_acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/thinkpad_acpi.c')
-rw-r--r--drivers/misc/thinkpad_acpi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 8aa0f9694b87..0ced9d65c6be 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -519,6 +519,7 @@ static char *next_cmd(char **cmds)
519static struct platform_device *tpacpi_pdev; 519static struct platform_device *tpacpi_pdev;
520static struct class_device *tpacpi_hwmon; 520static struct class_device *tpacpi_hwmon;
521static struct input_dev *tpacpi_inputdev; 521static struct input_dev *tpacpi_inputdev;
522static struct mutex tpacpi_inputdev_send_mutex;
522 523
523 524
524static int tpacpi_resume_handler(struct platform_device *pdev) 525static int tpacpi_resume_handler(struct platform_device *pdev)
@@ -1131,6 +1132,8 @@ static void tpacpi_input_send_key(unsigned int scancode,
1131 unsigned int keycode) 1132 unsigned int keycode)
1132{ 1133{
1133 if (keycode != KEY_RESERVED) { 1134 if (keycode != KEY_RESERVED) {
1135 mutex_lock(&tpacpi_inputdev_send_mutex);
1136
1134 input_report_key(tpacpi_inputdev, keycode, 1); 1137 input_report_key(tpacpi_inputdev, keycode, 1);
1135 if (keycode == KEY_UNKNOWN) 1138 if (keycode == KEY_UNKNOWN)
1136 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, 1139 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
@@ -1142,6 +1145,8 @@ static void tpacpi_input_send_key(unsigned int scancode,
1142 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, 1145 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
1143 scancode); 1146 scancode);
1144 input_sync(tpacpi_inputdev); 1147 input_sync(tpacpi_inputdev);
1148
1149 mutex_unlock(&tpacpi_inputdev_send_mutex);
1145 } 1150 }
1146} 1151}
1147 1152
@@ -1149,11 +1154,15 @@ static void tpacpi_input_send_radiosw(void)
1149{ 1154{
1150 int wlsw; 1155 int wlsw;
1151 1156
1157 mutex_lock(&tpacpi_inputdev_send_mutex);
1158
1152 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { 1159 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
1153 input_report_switch(tpacpi_inputdev, 1160 input_report_switch(tpacpi_inputdev,
1154 SW_RADIO, !!wlsw); 1161 SW_RADIO, !!wlsw);
1155 input_sync(tpacpi_inputdev); 1162 input_sync(tpacpi_inputdev);
1156 } 1163 }
1164
1165 mutex_unlock(&tpacpi_inputdev_send_mutex);
1157} 1166}
1158 1167
1159static void hotkey_notify(struct ibm_struct *ibm, u32 event) 1168static void hotkey_notify(struct ibm_struct *ibm, u32 event)
@@ -4737,6 +4746,7 @@ static int __init thinkpad_acpi_module_init(void)
4737 thinkpad_acpi_module_exit(); 4746 thinkpad_acpi_module_exit();
4738 return ret; 4747 return ret;
4739 } 4748 }
4749 mutex_init(&tpacpi_inputdev_send_mutex);
4740 tpacpi_inputdev = input_allocate_device(); 4750 tpacpi_inputdev = input_allocate_device();
4741 if (!tpacpi_inputdev) { 4751 if (!tpacpi_inputdev) {
4742 printk(IBM_ERR "unable to allocate input device\n"); 4752 printk(IBM_ERR "unable to allocate input device\n");