-----Original Message----- From: hinko.kocevar@xxxxxxxxxxxx [mailto:hinko.kocevar@xxxxxxxxxxxx] Sent: Tuesday, July 17, 2007 8:07 PM To: rajendra.stalekar@xxxxxxxxx Cc: 'Erik Mouw'; kernelnewbies@xxxxxxxxxxxx Subject: Re: Doubt on Interrupt sharing Rajendra Stalekar wrote: > > Rajendra :- How can that be done? Is it not a physical interrupt line(wire), > how can that line go to multiple devices. That is the job of interrupt controller in the hardware- it multiplexes the interrupt sources and presents them on the single interrupt number IRQ number shown in /proc/interrupts. The way it is implemented in the hardware differs for each architecture. When dealing with the shared interrupts, the interrupt handler for each device driver needs to know what hardware device caused the interrupt by means of dev_id argument which must be unique for every device that claims the same interrupt line (IRQ number) - hence every shared interrupt handler checks if the interrupt was caused by the device it supports and handles the interrupt only if it is from its device - otherwise the interrupt handler should return IRQ_NONE and possibly let another (correct) device driver handle the interrupt and return IRQ_HANDLED. Rajendra :- Thanks a lot for explanation, however what I still haven't got is, if the interrupt line needs to be shared, since it's a hardware stuff, shouldn't the same interrupt line have 2 wires going from the same line, one for one device and the other for the 2nd device. How , otherwise how will it share the interrupt line? I am aware of the other things, that u have mentioned here. > >> I can understand during driver initialization it's not a good idea to >> install the handler because we don't know whether we are going to use the >> device. >> >> But if we install the handler when the device is opened how can we share > the >> interrupt line because it is now dedicated for it. If I understand the question correctly - this is done when registering the interrupt handler. If shared interrupt line is used, every interrupt handler that claims the same IRQ number must use SA_SHIRQ in the flags argument. That being said it doesn't really matter which driver claims the shared line first as long as all of them are using SA_SHIRQ in their flags. Correct me if I'm wrong... best regards, hinko -- ČETRTA POT, d.o.o., Kranj Planina 3 4000 Kranj Slovenia, Europe Tel. +386 (0) 4 280 66 03 E-mail: hinko.kocevar@xxxxxxxxxxxx Http: www.cetrtapot.si -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ