Re: About Interrupts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2005-03-09 at 09:35 +0100, Erik Mouw wrote:
> On Wed, Mar 09, 2005 at 10:22:55AM +0530, Mandeep Sandhu wrote:
> > On Tue, 2005-03-08 at 11:48 +0100, Erik Mouw wrote:
> > > Each driver must request_irq() and free_irq() its own interrupt. IOW:
> > > if the serial driver is unloaded, the interrupt is free. Besides,
> > > you're supposed to call free_irq() with a pointer to your own device
> > > structure, not a NULL pointer.
> > I think NULL can be passed on to free_irq...if the irq line is not
> > shared. dev_id would be usefull only in case of shared interrupts (like
> > those of PCI devices maybe...). correct me if i'm wrong.
> 
> Yes, you're right, dev_id is not required in the case of a non-shared
> IRQ (but it certainly doesn't hurt).
> 
yeah OK. I was going through free_irq under ../arch/i386/kernel/irq.c
(kernel 2.4.20) to confirm what I said. but the following lines have me
confused...! :P

...
...
         for (;;) {
                 struct irqaction * action = *p;
                 if (action) {
                         struct irqaction **pp = p;
                         p = &action->next;
                         if (action->dev_id != dev_id) <<<<<*************** (1)
                                 continue;
 
                         /* Found it - now remove it from the list of entries */
                         *pp = action->next;
                         if (!desc->action) {
                                 desc->status |= IRQ_DISABLED;
....
....

In case I pass NULL as the dev_id for a non-shared interrupt (in request_irq)
will free_irq be able to free it.

Will the condition  if(action->dev_id != dev_id) indicated by (1) be FALSE
if both dev_id's are NULL??? just got a little confused by the NULL comparison
thing!

thanks,
-mandeep
> 
> Erik
> 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux