Alrighty then, the patch below uses spinlocks instead of cli() and
friends -- to conform to the new irq locking mechanism -- and some minor
module changes while we're at it.
--- linux-2.5.30/drivers/char/toshiba.c 2002-08-01 17:16:39.000000000 -0400
+++ linux-bleed/drivers/char/toshiba.c 2002-08-02 18:43:53.000000000 -0400
@@ -82,7 +82,13 @@
static int tosh_fn = 0;
+extern spinlock_t tosh_lock;
+
MODULE_PARM(tosh_fn, "i");
+MODULE_PARM_DESC(tosh_fn, "User specified Fn key detection port");
+MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
+MODULE_DESCRIPTION("Toshiba laptop SMM driver");
+MODULE_SUPPORTED_DEVICE("toshiba");
MODULE_LICENSE("GPL");
@@ -114,11 +120,10 @@
if (tosh_fn!=0) {
scan = inb(tosh_fn);
} else {
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0x8e, 0xe4);
scan = inb(0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
}
return (int) scan;
@@ -141,35 +146,32 @@
if (tosh_id==0xfccb) {
if (eax==0xfe00) {
/* fan status */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xbe, 0xe4);
al = inb(0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = (unsigned int) (al & 0x01);
}
if ((eax==0xff00) && (ecx==0x0000)) {
/* fan off */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xbe, 0xe4);
al = inb(0xe5);
outb(0xbe, 0xe4);
outb (al | 0x01, 0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = 0x00;
}
if ((eax==0xff00) && (ecx==0x0001)) {
/* fan on */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xbe, 0xe4);
al = inb(0xe5);
outb(0xbe, 0xe4);
outb(al & 0xfe, 0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = 0x01;
}
@@ -180,33 +182,30 @@
if (tosh_id==0xfccc) {
if (eax==0xfe00) {
/* fan status */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xe0, 0xe4);
al = inb(0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = al & 0x01;
}
if ((eax==0xff00) && (ecx==0x0000)) {
/* fan off */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xe0, 0xe4);
al = inb(0xe5);
outw(0xe0 | ((al & 0xfe) << 8), 0xe4);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = 0x00;
}
if ((eax==0xff00) && (ecx==0x0001)) {
/* fan on */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xe0, 0xe4);
al = inb(0xe5);
outw(0xe0 | ((al | 0x01) << 8), 0xe4);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = 0x01;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/