]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
genirq: Move IRQ_DISABLED to core
authorThomas Gleixner <tglx@linutronix.de>
Mon, 7 Feb 2011 21:11:30 +0000 (22:11 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 19 Feb 2011 11:58:17 +0000 (12:58 +0100)
Keep status in sync until all abusers are fixed.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/irq.h
kernel/irq/chip.c
kernel/irq/compat.h
kernel/irq/internals.h
kernel/irq/irqdesc.c
kernel/irq/manage.c
kernel/irq/migration.c
kernel/irq/settings.h
kernel/irq/spurious.c

index c38dbd506656f546a7172700315a20b5c337371b..32efca71ce8881d26de0ab817acfc9d25e487ef0 100644 (file)
@@ -55,9 +55,9 @@ typedef       void (*irq_flow_handler_t)(unsigned int irq,
 #define IRQ_INPROGRESS         0x00000100      /* DEPRECATED */
 #define IRQ_REPLAY             0x00000200      /* DEPRECATED */
 #define IRQ_WAITING            0x00000400      /* DEPRECATED */
+#define IRQ_DISABLED           0x00000800      /* DEPRECATED */
 #endif
 
-#define IRQ_DISABLED           0x00000800      /* IRQ disabled - do not enter! */
 #define IRQ_PENDING            0x00001000      /* IRQ pending - replay on enable */
 
 #define IRQ_LEVEL              0x00004000      /* IRQ level triggered */
@@ -231,7 +231,7 @@ struct irq_chip {
 # define ARCH_IRQ_INIT_FLAGS   0
 #endif
 
-#define IRQ_DEFAULT_INIT_FLAGS (IRQ_DISABLED | ARCH_IRQ_INIT_FLAGS)
+#define IRQ_DEFAULT_INIT_FLAGS ARCH_IRQ_INIT_FLAGS
 
 struct irqaction;
 extern int setup_irq(unsigned int irq, struct irqaction *new);
index 59ae14527ecda277a884ee6ef66f9d4beb5bea49..527df7ab1b054b429763e9438b8078c146575431 100644 (file)
@@ -164,9 +164,21 @@ struct irq_data *irq_get_irq_data(unsigned int irq)
 }
 EXPORT_SYMBOL_GPL(irq_get_irq_data);
 
+static void irq_state_clr_disabled(struct irq_desc *desc)
+{
+       desc->istate &= ~IRQS_DISABLED;
+       irq_compat_clr_disabled(desc);
+}
+
+static void irq_state_set_disabled(struct irq_desc *desc)
+{
+       desc->istate |= IRQS_DISABLED;
+       irq_compat_set_disabled(desc);
+}
+
 int irq_startup(struct irq_desc *desc)
 {
-       desc->status &= ~IRQ_DISABLED;
+       irq_state_clr_disabled(desc);
        desc->depth = 0;
 
        if (desc->irq_data.chip->irq_startup) {
@@ -181,7 +193,7 @@ int irq_startup(struct irq_desc *desc)
 
 void irq_shutdown(struct irq_desc *desc)
 {
-       desc->status |= IRQ_DISABLED;
+       irq_state_set_disabled(desc);
        desc->depth = 1;
        if (desc->irq_data.chip->irq_shutdown)
                desc->irq_data.chip->irq_shutdown(&desc->irq_data);
@@ -194,7 +206,7 @@ void irq_shutdown(struct irq_desc *desc)
 
 void irq_enable(struct irq_desc *desc)
 {
-       desc->status &= ~IRQ_DISABLED;
+       irq_state_clr_disabled(desc);
        if (desc->irq_data.chip->irq_enable)
                desc->irq_data.chip->irq_enable(&desc->irq_data);
        else
@@ -204,7 +216,7 @@ void irq_enable(struct irq_desc *desc)
 
 void irq_disable(struct irq_desc *desc)
 {
-       desc->status |= IRQ_DISABLED;
+       irq_state_set_disabled(desc);
        if (desc->irq_data.chip->irq_disable) {
                desc->irq_data.chip->irq_disable(&desc->irq_data);
                desc->status |= IRQ_MASKED;
@@ -380,7 +392,7 @@ void handle_nested_irq(unsigned int irq)
        kstat_incr_irqs_this_cpu(irq, desc);
 
        action = desc->action;
-       if (unlikely(!action || (desc->status & IRQ_DISABLED)))
+       if (unlikely(!action || (desc->istate & IRQS_DISABLED)))
                goto out_unlock;
 
        irq_compat_set_progress(desc);
@@ -431,7 +443,7 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
        desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
        kstat_incr_irqs_this_cpu(irq, desc);
 
-       if (unlikely(!desc->action || (desc->status & IRQ_DISABLED)))
+       if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED)))
                goto out_unlock;
 
        handle_irq_event(desc);
@@ -467,12 +479,12 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
         * If its disabled or no action available
         * keep it masked and get out of here
         */
-       if (unlikely(!desc->action || (desc->status & IRQ_DISABLED)))
+       if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED)))
                goto out_unlock;
 
        handle_irq_event(desc);
 
-       if (!(desc->status & IRQ_DISABLED) && !(desc->istate & IRQS_ONESHOT))
+       if (!(desc->istate & (IRQS_DISABLED | IRQS_ONESHOT)))
                unmask_irq(desc);
 out_unlock:
        raw_spin_unlock(&desc->lock);
@@ -505,7 +517,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
         * If its disabled or no action available
         * then mask it and get out of here:
         */
-       if (unlikely(!desc->action || (desc->status & IRQ_DISABLED))) {
+       if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) {
                desc->status |= IRQ_PENDING;
                mask_irq(desc);
                goto out;
@@ -543,8 +555,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
         * we shouldn't process the IRQ. Mark it pending, handle
         * the necessary masking and go out
         */
-       if (unlikely((desc->istate & (IRQS_INPROGRESS) ||
-                     (desc->status & IRQ_DISABLED) || !desc->action))) {
+       if (unlikely((desc->istate & (IRQS_DISABLED | IRQS_INPROGRESS) ||
+                     !desc->action))) {
                if (!irq_check_poll(desc)) {
                        desc->status |= IRQ_PENDING;
                        mask_ack_irq(desc);
@@ -567,15 +579,16 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
                 * one, we could have masked the irq.
                 * Renable it, if it was not disabled in meantime.
                 */
-               if (unlikely((desc->status &
-                              (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) ==
-                             (IRQ_PENDING | IRQ_MASKED))) {
-                       unmask_irq(desc);
+               if (unlikely(desc->status & IRQ_PENDING)) {
+                       if (!(desc->istate & IRQS_DISABLED) &&
+                           (desc->status & IRQ_MASKED))
+                               unmask_irq(desc);
                }
 
                handle_irq_event(desc);
 
-       } while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING);
+       } while ((desc->status & IRQ_PENDING) &&
+                !(desc->istate & IRQS_DISABLED));
 
 out_unlock:
        raw_spin_unlock(&desc->lock);
@@ -639,7 +652,8 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
        if (handle == handle_bad_irq) {
                if (desc->irq_data.chip != &no_irq_chip)
                        mask_ack_irq(desc);
-               desc->status |= IRQ_DISABLED;
+               irq_compat_set_disabled(desc);
+               desc->istate |= IRQS_DISABLED;
                desc->depth = 1;
        }
        desc->handle_irq = handle;
index aac6e400e608abc67958a06a0406a4fc35359e35..bc0c2a501e822be6d12070e71462ccc2887fe246 100644 (file)
@@ -11,7 +11,19 @@ static inline void irq_compat_clr_progress(struct irq_desc *desc)
 {
        desc->status &= ~IRQ_INPROGRESS;
 }
+static inline void irq_compat_set_disabled(struct irq_desc *desc)
+{
+       desc->status |= IRQ_DISABLED;
+}
+
+static inline void irq_compat_clr_disabled(struct irq_desc *desc)
+{
+       desc->status &= ~IRQ_DISABLED;
+}
 #else
 static inline void irq_compat_set_progress(struct irq_desc *desc) { }
 static inline void irq_compat_clr_progress(struct irq_desc *desc) { }
+static inline void irq_compat_set_disabled(struct irq_desc *desc) { }
+static inline void irq_compat_clr_disabled(struct irq_desc *desc) { }
 #endif
+
index 54037533af7afb051478e6afb8af1563df18c2c0..919d2dd0bb33a8f02a27e6e005e2c55137cad42d 100644 (file)
@@ -45,6 +45,7 @@ enum {
  * IRQS_ONESHOT                        - irq is not unmasked in primary handler
  * IRQS_REPLAY                 - irq is replayed
  * IRQS_WAITING                        - irq is waiting
+ * IRQS_DISABLED               - irq is disabled
  */
 enum {
        IRQS_AUTODETECT         = 0x00000001,
@@ -54,6 +55,7 @@ enum {
        IRQS_ONESHOT            = 0x00000020,
        IRQS_REPLAY             = 0x00000040,
        IRQS_WAITING            = 0x00000080,
+       IRQS_DISABLED           = 0x00000100,
 };
 
 #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
@@ -137,7 +139,6 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
                print_symbol("%s\n", (unsigned long)desc->action->handler);
        }
 
-       P(IRQ_DISABLED);
        P(IRQ_PENDING);
        P(IRQ_LEVEL);
        P(IRQ_MASKED);
@@ -152,6 +153,7 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
        PS(IRQS_INPROGRESS);
        PS(IRQS_REPLAY);
        PS(IRQS_WAITING);
+       PS(IRQS_DISABLED);
 }
 
 #undef P
index 8b87f2ce0203a74dcafb60acc64689aac9b1bebd..78866d050bc9ae55793ba5baf77b7c0459a4d025 100644 (file)
@@ -80,6 +80,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node)
        desc->irq_data.handler_data = NULL;
        desc->irq_data.msi_desc = NULL;
        desc->status = _IRQ_DEFAULT_INIT_FLAGS;
+       desc->istate = IRQS_DISABLED;
        desc->handle_irq = handle_bad_irq;
        desc->depth = 1;
        desc->irq_count = 0;
@@ -247,6 +248,7 @@ int __init early_irq_init(void)
 struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
        [0 ... NR_IRQS-1] = {
                .status         = _IRQ_DEFAULT_INIT_FLAGS,
+               .istate         = IRQS_DISABLED,
                .handle_irq     = handle_bad_irq,
                .depth          = 1,
                .lock           = __RAW_SPIN_LOCK_UNLOCKED(irq_desc->lock),
index 7971df53d6a91838b95fb992155771d212bd8dfa..77ff275b54cf6a264e896282afdcd75de467c778 100644 (file)
@@ -646,7 +646,7 @@ again:
                goto again;
        }
 
-       if (!(desc->status & IRQ_DISABLED) && (desc->status & IRQ_MASKED)) {
+       if (!(desc->istate & IRQS_DISABLED) && (desc->status & IRQ_MASKED)) {
                desc->status &= ~IRQ_MASKED;
                desc->irq_data.chip->irq_unmask(&desc->irq_data);
        }
@@ -709,7 +709,7 @@ static int irq_thread(void *data)
                atomic_inc(&desc->threads_active);
 
                raw_spin_lock_irq(&desc->lock);
-               if (unlikely(desc->status & IRQ_DISABLED)) {
+               if (unlikely(desc->istate & IRQS_DISABLED)) {
                        /*
                         * CHECKME: We might need a dedicated
                         * IRQ_THREAD_PENDING flag here, which
index 441fd629ff04b41db0bb044f06163f5dd8c08c58..8c68cb8555a762bcf35dc156b11df8088b8cdbae 100644 (file)
@@ -61,7 +61,7 @@ void move_native_irq(int irq)
        if (likely(!(desc->status & IRQ_MOVE_PENDING)))
                return;
 
-       if (unlikely(desc->status & IRQ_DISABLED))
+       if (unlikely(desc->istate & IRQS_DISABLED))
                return;
 
        /*
index 2e7d08fff0ce818f9ef041d1148baa32b82bd543..5e3411c7c62b29d9b2c28a80cf56f6fb76039326 100644 (file)
@@ -12,3 +12,5 @@ enum {
 #define IRQ_REPLAY             GOT_YOU_MORON
 #undef IRQ_WAITING
 #define IRQ_WAITING            GOT_YOU_MORON
+#undef IRQ_DISABLED
+#define IRQ_DISABLED           GOT_YOU_MORON
index 51504837d8ccea4426ce2462e971f2be8a97f32f..367614f858ffc5fcfe2a7f52d6c7aa9d2d624a07 100644 (file)
@@ -50,7 +50,7 @@ bool irq_wait_for_poll(struct irq_desc *desc)
                raw_spin_lock(&desc->lock);
        } while (desc->istate & IRQS_INPROGRESS);
        /* Might have been disabled in meantime */
-       return !(desc->status & IRQ_DISABLED) && desc->action;
+       return !(desc->istate & IRQS_DISABLED) && desc->action;
 #else
        return false;
 #endif
@@ -75,7 +75,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
         * Do not poll disabled interrupts unless the spurious
         * disabled poller asks explicitely.
         */
-       if ((desc->status & IRQ_DISABLED) && !force)
+       if ((desc->istate & IRQS_DISABLED) && !force)
                goto out;
 
        /*