Re: [tip:irq/genirq] genirq: do not execute DEBUG_SHIRQ when irq setup failed

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

 



On Thu, 2009-04-02 at 14:03 +0000, Luis Henriques wrote:
> Commit-ID:  ba71604fad348656071a2a76eef9a67dab85a773
> Gitweb:     http://git.kernel.org/tip/ba71604fad348656071a2a76eef9a67dab85a773
> Author:     Luis Henriques <henrix@xxxxxxx>
> AuthorDate: Wed, 1 Apr 2009 18:06:35 +0100
> Committer:  Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> CommitDate: Thu, 2 Apr 2009 16:02:39 +0200
> 
> genirq: do not execute DEBUG_SHIRQ when irq setup failed
> 
> When requesting an IRQ, the DEBUG_SHIRQ code executes a fake IRQ just to make
> sure the driver is ready to receive an IRQ immediately.  The problem was that
> this fake IRQ was being executed even if interrupt line failed to be allocated
> by __setup_irq.
> 
> Signed-off-by: Luis Henriques <henrix@xxxxxxx>
> LKML-Reference: <20090401170635.GA4392@xxxxxxxxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> 
> 
> ---
>  kernel/irq/manage.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 1516ab7..beeb7d1 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -768,7 +768,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
>  		kfree(action);
>  
>  #ifdef CONFIG_DEBUG_SHIRQ
> -	if (irqflags & IRQF_SHARED) {
> +	if (!retval & (irqflags & IRQF_SHARED)) {
>  		/*
>  		 * It's a shared IRQ -- the driver ought to be prepared for it
>  		 * to happen immediately, so let's make sure....

What is this ?

There is no retval:

http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-tip.git;a=blob;f=kernel/irq/manage.c;h=a3eb7baf1e46f2c735edb4cc44e0386cfbc4989e;hb=HEAD

*/
696 static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
697 {
698         struct irq_desc *desc = irq_to_desc(irq);
699         struct irqaction *action, **action_ptr;
700         struct task_struct *irqthread;
701         unsigned long flags;
702 
703         WARN(in_interrupt(), "Trying to free IRQ %
d from IRQ context!\n", irq);
704 
705         if (!desc)
706                 return NULL;
707 
708         spin_lock_irqsave(&desc->lock, flags);
709 
710         /*
711
         * There can be multiple actions per IRQ descriptor, find the right
712          * one based on the dev_id:
713          */
714         action_ptr = &desc->action;
715         for (;;) {
716                 action = *action_ptr;
717 
718                 if (!action) {
719                         WARN(1, "Trying to free already-free IRQ %d
\n", irq);
720                         spin_unlock_irqrestore(&desc->lock, flags);
721 
722                         return NULL;
723                 }
724 
725                 if (action->dev_id == dev_id)
726                         break;
727                 action_ptr = &action->next;
728         }
729 
730         /* Found it - now remove it from the list of entries: */
731         *action_ptr = action->next;
732 
733         /* Currently used only by UML, might disappear one day: */
734 #ifdef CONFIG_IRQ_RELEASE_METHOD
735         if (desc->chip->release)
736                 desc->chip->release(irq, dev_id);
737 #endif
738 
739         /* If this was the last handler, shut down the IRQ line: */
740         if (!desc->action) {
741                 desc->status |= IRQ_DISABLED;
742                 if (desc->chip->shutdown)
743                         desc->chip->shutdown(irq);
744                 else
745                         desc->chip->disable(irq);
746         }
747 
748         irqthread = action->thread;
749         action->thread = NULL;
750 
751         spin_unlock_irqrestore(&desc->lock, flags);
752 
753         unregister_handler_proc(irq, action);
754 
755         /* Make sure it's not being used on another CPU: */
756         synchronize_irq(irq);
757 
758         if (irqthread) {
759                 if (!test_bit(IRQTF_DIED, &action->thread_flags))
760                         kthread_stop(irqthread);
761                 put_task_struct(irqthread);
762         }
763 
764 #ifdef CONFIG_DEBUG_SHIRQ
765         /*
766
         * It's a shared IRQ -- the driver ought to be prepared for an IRQ
767
         * event to happen even now it's being freed, so let's make sure that
768          * is so by doing an extra call to the handler ....
769          *
770
         * ( We do this after actually deregistering it, to make sure that a
771          *   'real' IRQ doesn't run in * parallel with our fake. )
772          */
773         if (action->flags & IRQF_SHARED) {
774                 local_irq_save(flags);
775                 action->handler(irq, dev_id);
776                 local_irq_restore(flags);
777         }
778 #endif
779         return action;
780 }


--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux