genirq: Add chip flag for restricting cpu_on/offline calls
authorThomas Gleixner <tglx@linutronix.de>
Sun, 27 Mar 2011 14:05:36 +0000 (16:05 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Sun, 27 Mar 2011 15:45:58 +0000 (17:45 +0200)
Add a flag which indicates that the on/offline callback should only be
called on enabled interrupts.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/irq.h
kernel/irq/chip.c

index c2a0c192969084f17937996e201fb74121331b4b..76e948fa88f83cf77f7c505916639cf0cd25a63e 100644 (file)
@@ -348,11 +348,14 @@ struct irq_chip {
  * IRQCHIP_SET_TYPE_MASKED:    Mask before calling chip.irq_set_type()
  * IRQCHIP_EOI_IF_HANDLED:     Only issue irq_eoi() when irq was handled
  * IRQCHIP_MASK_ON_SUSPEND:    Mask non wake irqs in the suspend path
+ * IRQCHIP_ONOFFLINE_ENABLED:  Only call irq_on/off_line callbacks
+ *                             when irq enabled
  */
 enum {
        IRQCHIP_SET_TYPE_MASKED         = (1 <<  0),
        IRQCHIP_EOI_IF_HANDLED          = (1 <<  1),
        IRQCHIP_MASK_ON_SUSPEND         = (1 <<  2),
+       IRQCHIP_ONOFFLINE_ENABLED       = (1 <<  3),
 };
 
 /* This include will go away once we isolated irq_desc usage to core code */
index 44b16a1ecd9a0c7dac44ef05b29a944d05338d3d..9283d3300ea98b3ed4dacbece1bc0c67151882d0 100644 (file)
@@ -718,8 +718,9 @@ void irq_cpu_online(void)
                raw_spin_lock_irqsave(&desc->lock, flags);
 
                chip = irq_data_get_irq_chip(&desc->irq_data);
-
-               if (chip && chip->irq_cpu_online)
+               if (chip && chip->irq_cpu_online &&
+                   (!(chip->flags & IRQCHIP_ONOFFLINE_ENABLED) ||
+                    !(desc->istate & IRQS_DISABLED)))
                        chip->irq_cpu_online(&desc->irq_data);
 
                raw_spin_unlock_irqrestore(&desc->lock, flags);
@@ -747,8 +748,9 @@ void irq_cpu_offline(void)
                raw_spin_lock_irqsave(&desc->lock, flags);
 
                chip = irq_data_get_irq_chip(&desc->irq_data);
-
-               if (chip && chip->irq_cpu_offline)
+               if (chip && chip->irq_cpu_offline &&
+                   (!(chip->flags & IRQCHIP_ONOFFLINE_ENABLED) ||
+                    !(desc->istate & IRQS_DISABLED)))
                        chip->irq_cpu_offline(&desc->irq_data);
 
                raw_spin_unlock_irqrestore(&desc->lock, flags);