[POWERPC] Provide a default irq_host match, which matches on an exact of_node
[powerpc.git] / arch / powerpc / kernel / irq.c
index 24bea97..d5c7e4c 100644 (file)
@@ -272,7 +272,7 @@ void do_IRQ(struct pt_regs *regs)
        struct thread_info *curtp, *irqtp;
 #endif
 
-        irq_enter();
+       irq_enter();
 
 #ifdef CONFIG_DEBUG_STACKOVERFLOW
        /* Debugging check for stack overflow: is there less than 2KB free? */
@@ -321,7 +321,7 @@ void do_IRQ(struct pt_regs *regs)
                /* That's not SMP safe ... but who cares ? */
                ppc_spurious_interrupts++;
 
-        irq_exit();
+       irq_exit();
        set_irq_regs(old_regs);
 
 #ifdef CONFIG_PPC_ISERIES
@@ -418,10 +418,16 @@ irq_hw_number_t virq_to_hw(unsigned int virq)
 }
 EXPORT_SYMBOL_GPL(virq_to_hw);
 
-__init_refok struct irq_host *irq_alloc_host(unsigned int revmap_type,
-                                               unsigned int revmap_arg,
-                                               struct irq_host_ops *ops,
-                                               irq_hw_number_t inval_irq)
+static int default_irq_host_match(struct irq_host *h, struct device_node *np)
+{
+       return h->of_node != NULL && h->of_node == np;
+}
+
+__init_refok struct irq_host *irq_alloc_host(struct device_node *of_node,
+                               unsigned int revmap_type,
+                               unsigned int revmap_arg,
+                               struct irq_host_ops *ops,
+                               irq_hw_number_t inval_irq)
 {
        struct irq_host *host;
        unsigned int size = sizeof(struct irq_host);
@@ -446,6 +452,10 @@ __init_refok struct irq_host *irq_alloc_host(unsigned int revmap_type,
        host->revmap_type = revmap_type;
        host->inval_irq = inval_irq;
        host->ops = ops;
+       host->of_node = of_node;
+
+       if (host->ops->match == NULL)
+               host->ops->match = default_irq_host_match;
 
        spin_lock_irqsave(&irq_big_lock, flags);
 
@@ -521,7 +531,7 @@ struct irq_host *irq_find_host(struct device_node *node)
         */
        spin_lock_irqsave(&irq_big_lock, flags);
        list_for_each_entry(h, &irq_hosts, link)
-               if (h->ops->match == NULL || h->ops->match(h, node)) {
+               if (h->ops->match(h, node)) {
                        found = h;
                        break;
                }