diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 18:39:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 18:39:36 -0400 |
commit | 0dd52d0df02733dfc2d5f3824e41b96492305384 (patch) | |
tree | 4cfd84b7a66d71d83c624275d889136fb23a33c9 /drivers/input/serio/libps2.c | |
parent | c37efa932598de5e30330a1414e34d9e082e0d9e (diff) | |
parent | fde1132374c9ba7da98a73b9a3c150dca6cf8502 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: add driver for Atmel AT42QT2160 Sensor Chip
Input: max7359 - use threaded IRQs
Input: add driver for Maxim MAX7359 key switch controller
Input: add driver for ADP5588 QWERTY I2C Keypad
Input: add touchscreen driver for MELFAS MCS-5000 controller
Input: add driver for OpenCores Keyboard Controller
Input: dm355evm_keys - remove dm355evm_keys_hardirq
Input: synaptics_i2c - switch to using __cancel_delayed_work()
Input: ad7879 - add support for AD7889
Input: atkbd - rely on input core to restore state on resume
Input: add generic suspend and resume for input devices
Input: libps2 - additional locking for i8042 ports
Diffstat (limited to 'drivers/input/serio/libps2.c')
-rw-r--r-- | drivers/input/serio/libps2.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c index 3a95b508bf27..769ba65a585a 100644 --- a/drivers/input/serio/libps2.c +++ b/drivers/input/serio/libps2.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/input.h> | 18 | #include <linux/input.h> |
19 | #include <linux/serio.h> | 19 | #include <linux/serio.h> |
20 | #include <linux/i8042.h> | ||
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/libps2.h> | 22 | #include <linux/libps2.h> |
22 | 23 | ||
@@ -54,6 +55,24 @@ int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout) | |||
54 | } | 55 | } |
55 | EXPORT_SYMBOL(ps2_sendbyte); | 56 | EXPORT_SYMBOL(ps2_sendbyte); |
56 | 57 | ||
58 | void ps2_begin_command(struct ps2dev *ps2dev) | ||
59 | { | ||
60 | mutex_lock(&ps2dev->cmd_mutex); | ||
61 | |||
62 | if (i8042_check_port_owner(ps2dev->serio)) | ||
63 | i8042_lock_chip(); | ||
64 | } | ||
65 | EXPORT_SYMBOL(ps2_begin_command); | ||
66 | |||
67 | void ps2_end_command(struct ps2dev *ps2dev) | ||
68 | { | ||
69 | if (i8042_check_port_owner(ps2dev->serio)) | ||
70 | i8042_unlock_chip(); | ||
71 | |||
72 | mutex_unlock(&ps2dev->cmd_mutex); | ||
73 | } | ||
74 | EXPORT_SYMBOL(ps2_end_command); | ||
75 | |||
57 | /* | 76 | /* |
58 | * ps2_drain() waits for device to transmit requested number of bytes | 77 | * ps2_drain() waits for device to transmit requested number of bytes |
59 | * and discards them. | 78 | * and discards them. |
@@ -66,7 +85,7 @@ void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout) | |||
66 | maxbytes = sizeof(ps2dev->cmdbuf); | 85 | maxbytes = sizeof(ps2dev->cmdbuf); |
67 | } | 86 | } |
68 | 87 | ||
69 | mutex_lock(&ps2dev->cmd_mutex); | 88 | ps2_begin_command(ps2dev); |
70 | 89 | ||
71 | serio_pause_rx(ps2dev->serio); | 90 | serio_pause_rx(ps2dev->serio); |
72 | ps2dev->flags = PS2_FLAG_CMD; | 91 | ps2dev->flags = PS2_FLAG_CMD; |
@@ -76,7 +95,8 @@ void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout) | |||
76 | wait_event_timeout(ps2dev->wait, | 95 | wait_event_timeout(ps2dev->wait, |
77 | !(ps2dev->flags & PS2_FLAG_CMD), | 96 | !(ps2dev->flags & PS2_FLAG_CMD), |
78 | msecs_to_jiffies(timeout)); | 97 | msecs_to_jiffies(timeout)); |
79 | mutex_unlock(&ps2dev->cmd_mutex); | 98 | |
99 | ps2_end_command(ps2dev); | ||
80 | } | 100 | } |
81 | EXPORT_SYMBOL(ps2_drain); | 101 | EXPORT_SYMBOL(ps2_drain); |
82 | 102 | ||
@@ -237,9 +257,9 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) | |||
237 | { | 257 | { |
238 | int rc; | 258 | int rc; |
239 | 259 | ||
240 | mutex_lock(&ps2dev->cmd_mutex); | 260 | ps2_begin_command(ps2dev); |
241 | rc = __ps2_command(ps2dev, param, command); | 261 | rc = __ps2_command(ps2dev, param, command); |
242 | mutex_unlock(&ps2dev->cmd_mutex); | 262 | ps2_end_command(ps2dev); |
243 | 263 | ||
244 | return rc; | 264 | return rc; |
245 | } | 265 | } |