aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-clevo-mail.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-09-16 04:06:43 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-09-18 02:23:45 -0400
commit181d683d752c432635eda0f182ee71548c1f1820 (patch)
tree1fa397811ea6bcc73001fe1ab5b53525f2b88f74 /drivers/leds/leds-clevo-mail.c
parent0cb583fd2862f19ea88b02eb307d11c09e51e2f8 (diff)
Input: libps2 - additional locking for i8042 ports
The serio ports on i8042 are not completely isolated; while we provide enough locking to ensure proper serialization when accessing control and data registers AUX and KBD ports can still have an effect on each other on PS/2 protocol level. The most prominent effect is that issuing a command for the device connected to one port may cause abort of the command currently executing by the device connected to another port. Since i8042 nor serio subsystem are not aware of the details of the PS/2 protocol (length of the commands and their replies and so on) the locking should be done on libps2 level by adding special handling when we see that we are dealing with serio port on i8042. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/leds/leds-clevo-mail.c')
-rw-r--r--drivers/leds/leds-clevo-mail.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c
index 1813c84ea5fc..f2242db54016 100644
--- a/drivers/leds/leds-clevo-mail.c
+++ b/drivers/leds/leds-clevo-mail.c
@@ -93,6 +93,8 @@ static struct dmi_system_id __initdata mail_led_whitelist[] = {
93static void clevo_mail_led_set(struct led_classdev *led_cdev, 93static void clevo_mail_led_set(struct led_classdev *led_cdev,
94 enum led_brightness value) 94 enum led_brightness value)
95{ 95{
96 i8042_lock_chip();
97
96 if (value == LED_OFF) 98 if (value == LED_OFF)
97 i8042_command(NULL, CLEVO_MAIL_LED_OFF); 99 i8042_command(NULL, CLEVO_MAIL_LED_OFF);
98 else if (value <= LED_HALF) 100 else if (value <= LED_HALF)
@@ -100,6 +102,8 @@ static void clevo_mail_led_set(struct led_classdev *led_cdev,
100 else 102 else
101 i8042_command(NULL, CLEVO_MAIL_LED_BLINK_1HZ); 103 i8042_command(NULL, CLEVO_MAIL_LED_BLINK_1HZ);
102 104
105 i8042_unlock_chip();
106
103} 107}
104 108
105static int clevo_mail_led_blink(struct led_classdev *led_cdev, 109static int clevo_mail_led_blink(struct led_classdev *led_cdev,
@@ -108,6 +112,8 @@ static int clevo_mail_led_blink(struct led_classdev *led_cdev,
108{ 112{
109 int status = -EINVAL; 113 int status = -EINVAL;
110 114
115 i8042_lock_chip();
116
111 if (*delay_on == 0 /* ms */ && *delay_off == 0 /* ms */) { 117 if (*delay_on == 0 /* ms */ && *delay_off == 0 /* ms */) {
112 /* Special case: the leds subsystem requested us to 118 /* Special case: the leds subsystem requested us to
113 * chose one user friendly blinking of the LED, and 119 * chose one user friendly blinking of the LED, and
@@ -135,6 +141,8 @@ static int clevo_mail_led_blink(struct led_classdev *led_cdev,
135 *delay_on, *delay_off); 141 *delay_on, *delay_off);
136 } 142 }
137 143
144 i8042_unlock_chip();
145
138 return status; 146 return status;
139} 147}
140 148