summaryrefslogtreecommitdiffstats
path: root/drivers/char/pc_keyb.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-11-23 02:00:47 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-11-23 02:00:47 +0000
commit06615f62b17d7de6e12d2f5ec6b88cf30af08413 (patch)
tree8766f208847d4876a6db619aebbf54d53b76eb44 /drivers/char/pc_keyb.c
parentfa9bdb574f4febb751848a685d9a9017e04e1d53 (diff)
Merge with Linux 2.4.0-test10.
Diffstat (limited to 'drivers/char/pc_keyb.c')
-rw-r--r--drivers/char/pc_keyb.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/char/pc_keyb.c b/drivers/char/pc_keyb.c
index d9276b753..4a7758325 100644
--- a/drivers/char/pc_keyb.c
+++ b/drivers/char/pc_keyb.c
@@ -65,13 +65,13 @@ static void aux_write_ack(int val);
static void __aux_write_ack(int val);
#endif
-spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED;
static unsigned char handle_kbd_event(void);
/* used only by send_data - set by keyboard_interrupt */
-static volatile unsigned char reply_expected = 0;
-static volatile unsigned char acknowledge = 0;
-static volatile unsigned char resend = 0;
+static volatile unsigned char reply_expected;
+static volatile unsigned char acknowledge;
+static volatile unsigned char resend;
#if defined CONFIG_PSMOUSE
@@ -84,9 +84,9 @@ static int __init psaux_init(void);
#define AUX_RECONNECT 170 /* scancode when ps2 device is plugged (back) in */
static struct aux_queue *queue; /* Mouse data buffer. */
-static int aux_count = 0;
+static int aux_count;
/* used when we send commands to the mouse that expect an ACK. */
-static unsigned char mouse_reply_expected = 0;
+static unsigned char mouse_reply_expected;
#define AUX_INTS_OFF (KBD_MODE_KCC | KBD_MODE_DISABLE_MOUSE | KBD_MODE_SYS | KBD_MODE_KBD_INT)
#define AUX_INTS_ON (KBD_MODE_KCC | KBD_MODE_SYS | KBD_MODE_MOUSE_INT | KBD_MODE_KBD_INT)
@@ -291,7 +291,7 @@ static int do_acknowledge(unsigned char scancode)
int pckbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode)
{
- static int prev_scancode = 0;
+ static int prev_scancode;
/* special prefix scancodes.. */
if (scancode == 0xe0 || scancode == 0xe1) {
@@ -448,7 +448,7 @@ static unsigned char handle_kbd_event(void)
unsigned char status = kbd_read_status();
unsigned int work = 10000;
- while (status & KBD_STAT_OBF) {
+ while ((--work > 0) && (status & KBD_STAT_OBF)) {
unsigned char scancode;
scancode = kbd_read_input();
@@ -467,13 +467,10 @@ static unsigned char handle_kbd_event(void)
}
status = kbd_read_status();
-
- if (!--work) {
- printk(KERN_ERR "pc_keyb: controller jammed (0x%02X).\n",
- status);
- break;
- }
}
+
+ if (!work)
+ printk(KERN_ERR "pc_keyb: controller jammed (0x%02X).\n", status);
return status;
}
@@ -481,14 +478,13 @@ static unsigned char handle_kbd_event(void)
static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
- unsigned long flags;
-
#ifdef CONFIG_VT
kbd_pt_regs = regs;
#endif
- spin_lock_irqsave(&kbd_controller_lock, flags);
+
+ spin_lock_irq(&kbd_controller_lock);
handle_kbd_event();
- spin_unlock_irqrestore(&kbd_controller_lock, flags);
+ spin_unlock_irq(&kbd_controller_lock);
}
/*