-----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:- Hinko, I think I got it , the interrupt lines can be shared because they are on a bus, so the interrupt line is connected to the various devices and they can share them. Sorry for all those(Hinko, Erik,Rajat) whom I bothered with such fundamental question. > >> 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