and changed files
[powerpc.git] / kernel / irq / autoprobe.c
index d1f1e6f..533068c 100644 (file)
@@ -11,6 +11,8 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 
+#include "internals.h"
+
 /*
  * Autodetection depends on the fact that any interrupt that
  * comes in on to an unassigned handler will get stuck with
@@ -27,8 +29,8 @@ static DEFINE_MUTEX(probing_active);
  */
 unsigned long probe_irq_on(void)
 {
-       unsigned long val;
-       irq_desc_t *desc;
+       struct irq_desc *desc;
+       unsigned long mask;
        unsigned int i;
 
        mutex_lock(&probing_active);
@@ -40,8 +42,21 @@ unsigned long probe_irq_on(void)
                desc = irq_desc + i;
 
                spin_lock_irq(&desc->lock);
-               if (!irq_desc[i].action)
-                       irq_desc[i].chip->startup(i);
+               if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
+                       /*
+                        * An old-style architecture might still have
+                        * the handle_bad_irq handler there:
+                        */
+                       compat_irq_chip_set_default_handler(desc);
+
+                       /*
+                        * Some chips need to know about probing in
+                        * progress:
+                        */
+                       if (desc->chip->set_type)
+                               desc->chip->set_type(i, IRQ_TYPE_PROBE);
+                       desc->chip->startup(i);
+               }
                spin_unlock_irq(&desc->lock);
        }
 
@@ -57,7 +72,7 @@ unsigned long probe_irq_on(void)
                desc = irq_desc + i;
 
                spin_lock_irq(&desc->lock);
-               if (!desc->action) {
+               if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
                        desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
                        if (desc->chip->startup(i))
                                desc->status |= IRQ_PENDING;
@@ -73,11 +88,11 @@ unsigned long probe_irq_on(void)
        /*
         * Now filter out any obviously spurious interrupts
         */
-       val = 0;
+       mask = 0;
        for (i = 0; i < NR_IRQS; i++) {
-               irq_desc_t *desc = irq_desc + i;
                unsigned int status;
 
+               desc = irq_desc + i;
                spin_lock_irq(&desc->lock);
                status = desc->status;
 
@@ -88,14 +103,13 @@ unsigned long probe_irq_on(void)
                                desc->chip->shutdown(i);
                        } else
                                if (i < 32)
-                                       val |= 1 << i;
+                                       mask |= 1 << i;
                }
                spin_unlock_irq(&desc->lock);
        }
 
-       return val;
+       return mask;
 }
-
 EXPORT_SYMBOL(probe_irq_on);
 
 /**
@@ -117,7 +131,7 @@ unsigned int probe_irq_mask(unsigned long val)
 
        mask = 0;
        for (i = 0; i < NR_IRQS; i++) {
-               irq_desc_t *desc = irq_desc + i;
+               struct irq_desc *desc = irq_desc + i;
                unsigned int status;
 
                spin_lock_irq(&desc->lock);
@@ -160,7 +174,7 @@ int probe_irq_off(unsigned long val)
        int i, irq_found = 0, nr_irqs = 0;
 
        for (i = 0; i < NR_IRQS; i++) {
-               irq_desc_t *desc = irq_desc + i;
+               struct irq_desc *desc = irq_desc + i;
                unsigned int status;
 
                spin_lock_irq(&desc->lock);
@@ -184,6 +198,5 @@ int probe_irq_off(unsigned long val)
 
        return irq_found;
 }
-
 EXPORT_SYMBOL(probe_irq_off);