Skip to contentSkip to conversation

2.5.34 IRQ Patch

PATCH In review James Blackwell 2 participants 3 messages Sep 9, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.34 IRQ Patch

Somewhere around 2.5.31 the method for setting and clearing interrupts changed:

From- To-
save_flags(flags); local_irq_save(flags);
cli();

restore_flags(flags); local_irq_restore(flags);

Though bordering on trivial, including toshiba support with stock 2.5.34 fails to compile, which this patch seems to fix. This patch fixes this issue and has worked reliably for me under 2.5.31, though it is untested on 2.5.32 and 2.5.33 because I didn't manage to get those to work.

A note to those that are a bit rough on kernel patch newbies.... submitting a kernel patch for the very first time is a rather intimidating experience so please don't chew my head off unless its absolutely necessary.

See my point? I was so worried that Cristoph Hellwig is going to come to my house and eat me I forgot to include the patch itself. :)

drivers/char/toshiba.c +14 -21
diff -ur linux-2.5.34/drivers/char/toshiba.c linux-2.5.34.new/drivers/char/toshiba.c
@@ -114,11 +114,10 @@
 	if (tosh_fn!=0) {
 		scan = inb(tosh_fn);
 	} else {
-		save_flags(flags);
-		cli();
+		local_irq_save(flags);
 		outb(0x8e, 0xe4);
 		scan = inb(0xe5);
-		restore_flags(flags);
+		local_irq_restore(flags);
 	}
 
         return (int) scan;
@@ -141,35 +140,32 @@
 	if (tosh_id==0xfccb) {
 		if (eax==0xfe00) {
 			/* fan status */
-			save_flags(flags);
-			cli();
+			local_irq_save(flags);
 			outb(0xbe, 0xe4);
 			al = inb(0xe5);
-			restore_flags(flags);
+			local_irq_restore(flags);
 			regs->eax = 0x00;
 			regs->ecx = (unsigned int) (al & 0x01);
 		}
 		if ((eax==0xff00) && (ecx==0x0000)) {
 			/* fan off */
-			save_flags(flags);
-			cli();
+			local_irq_save(flags);
 			outb(0xbe, 0xe4);
 			al = inb(0xe5);
 			outb(0xbe, 0xe4);
 			outb (al | 0x01, 0xe5);
-			restore_flags(flags);
+			local_irq_restore(flags);
 			regs->eax = 0x00;
 			regs->ecx = 0x00;
 		}
 		if ((eax==0xff00) && (ecx==0x0001)) {
 			/* fan on */
-			save_flags(flags);
-			cli();
+			local_irq_save(flags);
 			outb(0xbe, 0xe4);
 			al = inb(0xe5);
 			outb(0xbe, 0xe4);
 			outb(al & 0xfe, 0xe5);
-			restore_flags(flags);
+			local_irq_restore(flags);
 			regs->eax = 0x00;
 			regs->ecx = 0x01;
 		}
@@ -180,33 +176,30 @@
 	if (tosh_id==0xfccc) {
 		if (eax==0xfe00) {
 			/* fan status */
-			save_flags(flags);
-			cli();
+			local_irq_save(flags);
 			outb(0xe0, 0xe4);
 			al = inb(0xe5);
-			restore_flags(flags);
+			local_irq_restore(flags);
 			regs->eax = 0x00;
 			regs->ecx = al & 0x01;
 		}
 		if ((eax==0xff00) && (ecx==0x0000)) {
 			/* fan off */
-			save_flags(flags);
-			cli();
+			local_irq_save(flags);
 			outb(0xe0, 0xe4);
 			al = inb(0xe5);
 			outw(0xe0 | ((al & 0xfe) << 8), 0xe4);
-			restore_flags(flags);
+			local_irq_restore(flags);
 			regs->eax = 0x00;
 			regs->ecx = 0x00;
 		}
 		if ((eax==0xff00) && (ecx==0x0001)) {
 			/* fan on */
-			save_flags(flags);
-			cli();
+			local_irq_save(flags);
 			outb(0xe0, 0xe4);
 			al = inb(0xe5);
 			outw(0xe0 | ((al | 0x01) << 8), 0xe4);
-			restore_flags(flags);
+			local_irq_restore(flags);
 			regs->eax = 0x00;
 			regs->ecx = 0x01;
 		}
Signature · 2 lines
GnuPG fingerprint AAE4 8C76 58DA 5902 761D  247A 8A55 DA73 0635 7400
James Blackwell  --  Director http://www.linuxguru.net
#1 lore raw
Quoted 3 lines · James Blackwell

A note to those that are a bit rough on kernel patch newbies.... submitting a kernel patch for the very first time is a rather intimidating experience so please don't chew my head off unless its absolutely necessary.

I didn't look at this particular case, but the fixes are generally not as simple as just replacing them mechanically. You need to ensure that things are still properly locked wrt the interrupt handler since the semantics have changed. See the discussion in the mail archives

regards
john

Signature · 3 lines
"This *is* Usenet, after all, where virtually every conversation that goes on
is fairly ludicrous in the first place."
	- Godwin's Law FAQ
#2 lore raw
Quoted 10 lines · you
Quoted 3 lines · James Blackwell

A note to those that are a bit rough on kernel patch newbies.... submitting a kernel patch for the very first time is a rather intimidating experience so please don't chew my head off unless its absolutely necessary.

I didn't look at this particular case, but the fixes are generally not as simple as just replacing them mechanically. You need to ensure that things are still properly locked wrt the interrupt handler since the semantics have changed. See the discussion in the mail archives

Do you mean in reference to smp? The reason I ask is that the Toshiba module is used to control things such as lcd brightness and cpu speed on toshiba laptops and I'm not aware of any smp laptops.

Or did you mean in reference to the recent preemptible stuff?

Signature · 2 lines
GnuPG fingerprint AAE4 8C76 58DA 5902 761D  247A 8A55 DA73 0635 7400
James Blackwell  --  Director http://www.linuxguru.net