On Sun, Sep 12, 2010 at 02:45:15PM +0200, Carlo Caione wrote:
> 
> Let's assume that I have registered two handlers on a shared IRQ.
> 
> request_irq(irqn, handler1, IRQF_SHARED, "first", dev1);
> request_irq(irqn, handler2, IRQF_SHARED, "second", dev2);
> 
> using two different dev1 and dev2 device structures.
> 
> When the interrupt is raised what is passed to handler1() and handler2() as 
> second
> argument? dev1 is passed to handler1() and dev2 to handler2() or both receive 
> the
> same value as pointer?

Your handler1 will be called with dev1 as the second argument, and your
handler2 will be called with dev2 as the second argument (but both will
be called with the asserted IRQ as their first argument).

> If each one receives the pointer to device structure indicated in 
> request_irq() 
> how this can help to differentiate between multiple device?

The provided dev pointer to request_irq() is not itself useful to the
core IRQ code, it doesn't do anything but store it away for use when
calling your handler function.

That being said, the IRQ-core core does need some way to differentiate
between handlers for shared IRQs.  This is necessary so that you can
selectively uninstall handlers.  This is also why the free_irq() takes
not only the IRQ#, but the dev_id (your dev1 or dev2) you registered
with.

Hopefully that answers your question. :)

-- 
                                        -joshc

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to