lkml.org 
[lkml]   [2000]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH 2.4.0.10.3: pc_keyb and q40_keyb cleanup
Changes:
* both: we know we are in an interrupt, so
s/spin_lock_irqsave/spin_lock/
* both: kbd_controller_lock is local to the module, mark it 'static'
* pc_keyb: move the printk out of the loop

--
Jeff Garzik | The difference between laziness and
Building 1024 | prioritization is the end result.
MandrakeSoft |diff -urN vanilla/linux-2.4.0-test10-pre3/drivers/char/pc_keyb.c linux_2_3/drivers/char/pc_keyb.c
--- vanilla/linux-2.4.0-test10-pre3/drivers/char/pc_keyb.c Mon Aug 28 15:06:33 2000
+++ linux_2_3/drivers/char/pc_keyb.c Sun Oct 15 12:15:36 2000
@@ -65,7 +65,7 @@
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 */
@@ -448,7 +448,7 @@
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 @@
}

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 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(&kbd_controller_lock);
handle_kbd_event();
- spin_unlock_irqrestore(&kbd_controller_lock, flags);
+ spin_unlock(&kbd_controller_lock);
}

/*
diff -urN vanilla/linux-2.4.0-test10-pre3/drivers/char/q40_keyb.c linux_2_3/drivers/char/q40_keyb.c
--- vanilla/linux-2.4.0-test10-pre3/drivers/char/q40_keyb.c Wed Sep 8 14:51:22 1999
+++ linux_2_3/drivers/char/q40_keyb.c Sun Oct 15 12:15:36 2000
@@ -94,7 +94,7 @@
};


-spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED;


/*
@@ -340,11 +340,10 @@

static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
- unsigned long flags;
unsigned char status;

disable_keyboard();
- spin_lock_irqsave(&kbd_controller_lock, flags);
+ spin_lock(&kbd_controller_lock);
kbd_pt_regs = regs;

status = IRQ_KEYB_MASK & master_inb(INTERRUPT_REG);
@@ -386,7 +385,7 @@
keyup=1;
}
exit:
- spin_unlock_irqrestore(&kbd_controller_lock, flags);
+ spin_unlock(&kbd_controller_lock);
master_outb(-1,KEYBOARD_UNLOCK_REG); /* keyb ints reenabled herewith */
enable_keyboard();
}
\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.177 / U:15.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site