|
|
Subscribe / Log in / New account

device driver irq routine change in 2.5.x

From:  Linus Torvalds <torvalds@transmeta.com>
To:  kernel-janitor-discuss@lists.sourceforge.net
Subject:  Heads-up: device driver irq routine change in 2.5.x
Date:  Sun, 20 Apr 2003 15:28:54 -0700 (PDT)


I've added a "irq status" return value to irq handlers, so that the irq 
layer in the kernel can automatically notice when some interrupt line is 
"screaming" and has irq handlers attached, but none of the handlers can do 
anything about it. This can happen with shared PCI irq lines, when an 
interrupt gets mis-allocated or when the driver just incorrectly enabled 
the interrupt before it attached the proper handler - and somebody else is 
already attached to it.

The reason I'm mentioning it here is that the change results in most 
device drivers having to change a

	void my_irq_handler(...)
	{
		..
		if (!(status & MY_IRQFLAG))
			return;
		...
	}

to a

	irqreturn_t my_irq_handler(...)
	{
		..
		if (!(status & MY_IRQFLAG)
			return IRQ_NONE;
		...
		return IRQ_HANDLED;
	}

instead.

(the "IRQ_NONE" return is optional, but preferred: if the handler
literally does nothing, and thinks that the interrupt was for somebody
else, it should preferably return IRQ_NONE to tell the irq layer about it.
HOWEVER - returning IRQ_NONE when you _should_ return IRQ_HANDLED is a
real bug, so it's safer to return IRQ_HANDLED if you're not sure about
it).

It's fairly boring and largely repetitive work, and I only did it for the 
drivers I use myself. The good news is that the compiler will warn about 
missing conversions, and the conversion is usually pretty easy and 
straightforward. Any takers? The code is in the current BK archives, and 
should show up in the normal daily snapshots for non-BK users.

		Linus



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Kernel-janitor-discuss mailing list
Kernel-janitor-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kernel-janitor-discuss


Copyright © 2003, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds