Arjan,
Please look in line
Regards,
Rajaram.
Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
>
> Now my questions.
>
> Suppose two devices A ( IRQ1 ) and B ( IRQ2 ) share the same
> handler handler1.
> Then according to the above description, handler1
> distinguishes between the devices by the dev_id passed to it.
> And also it is the same dev_id that was passed to
> request_irq() when the handler was registered.
>
> 1. But handler1 would have been registered by calling
> request_irq() with dev_id as NULL ( because NULL would be
> passed if the line is not shared with another handler ). So
> how handler1 will differentiate between the devices if NULL
> was passed to it ?
don't do that.
Usually what you pass is actually the device structure for your device,
not null. And you can use that to find the io addresses etc etc of the
exact device in question<Raja> So we should not pass NULL even if the handler does not share the IRQ with any other handler ? <Raja>
>
> Or is it like handler1 should be registered twice ( one for
> each device ) with the corresponding dev_id in each call to
> request_irq() , and the kernel will call the handler with the
> correct dev_id ?
yes you need to register twice
>
> 2. Also as the dev_id is passed to the interrupt handler when
> it is invoked , why should the kernel call all handlers on a
> particular IRQ ? Rather, it can call the handler which has
> registered for that device ?
you don't know which device generated the irq!
All the kernel knows is that "irq 11 triggered". Not which of the two
devices on irq 11 did that.
><Raja> My question is if the kernel is going to call the handler with the correct dev_id parameter, then why should the handler again check if its device caused the IRQ ? It has the dev_id of the device. So it knows the device which caused the IRQ. right ?Or is it like, the kernel will call a handler with the dev_id passed to it during registration, and not with the dev_id of the device which actually caused the IRQ ? <Raja>
Yahoo! Photos
Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.