Skip to content

Commit

Permalink
Input: i8042 - restore control register when enabling port fails
Browse files Browse the repository at this point in the history
When enabling interrupts for a port fails, the interrupt enable and
port enable bits remain set in i8042_ctr. Later writes of i8042_ctr
to the hardware could accidentally retry enabling interrupts. Clear
the bits on failure.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Markus Armbruster authored and Dmitry Torokhov committed Jul 18, 2007
1 parent 20b3cdd commit 018db6b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/input/serio/i8042.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ static int i8042_enable_kbd_port(void)
i8042_ctr |= I8042_CTR_KBDINT;

if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
i8042_ctr &= ~I8042_CTR_KBDINT;
i8042_ctr |= I8042_CTR_KBDDIS;
printk(KERN_ERR "i8042.c: Failed to enable KBD port.\n");
return -EIO;
}
Expand All @@ -402,6 +404,8 @@ static int i8042_enable_aux_port(void)
i8042_ctr |= I8042_CTR_AUXINT;

if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
i8042_ctr &= ~I8042_CTR_AUXINT;
i8042_ctr |= I8042_CTR_AUXDIS;
printk(KERN_ERR "i8042.c: Failed to enable AUX port.\n");
return -EIO;
}
Expand Down

0 comments on commit 018db6b

Please sign in to comment.