powerpc: Add virq_is_host to reduce virq_to_host usage
authorMilton Miller <miltonm@bga.com>
Tue, 10 May 2011 19:30:36 +0000 (19:30 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 19 May 2011 05:31:59 +0000 (15:31 +1000)
Some irq_host implementations are using virq_to_host to check if
they are the irq_host for a virtual irq.  To allow us to make space
versus time tradeoffs, replace this usage with an assertive
virq_is_host that confirms or denies the irq is associated with the
given irq_host.

Signed-off-by: Milton Miller <miltonm@bga.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/irq.h
arch/powerpc/kernel/irq.c
arch/powerpc/sysdev/xics/xics-common.c

index 6f4a3efb59a9355ccbdd210af2e6b3a05ddb6181..a65d1702643b61b184196f6ddad82f66e1f88627 100644 (file)
@@ -128,6 +128,7 @@ struct irq_host {
 struct irq_data;
 extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d);
 extern irq_hw_number_t virq_to_hw(unsigned int virq);
+extern bool virq_is_host(unsigned int virq, struct irq_host *host);
 extern struct irq_host *virq_to_host(unsigned int virq);
 
 /**
index 0715a09a4101187e4b84974e2ec089a56f8c4906..73cf29078fef5f05ddadbae285d5cbaf83795e60 100644 (file)
@@ -510,6 +510,12 @@ irq_hw_number_t virq_to_hw(unsigned int virq)
 }
 EXPORT_SYMBOL_GPL(virq_to_hw);
 
+bool virq_is_host(unsigned int virq, struct irq_host *host)
+{
+       return irq_map[virq].host == host;
+}
+EXPORT_SYMBOL_GPL(virq_is_host);
+
 struct irq_host *virq_to_host(unsigned int virq)
 {
        return irq_map[virq].host;
index 43b2a791e204009d51ef193936d5cf0f2e6082e8..445c5a01b766a3b5e17749adc50eecb578f2f2e8 100644 (file)
@@ -213,7 +213,7 @@ void xics_migrate_irqs_away(void)
                /* We can't set affinity on ISA interrupts */
                if (virq < NUM_ISA_INTERRUPTS)
                        continue;
-               if (virq_to_host(virq) != xics_host)
+               if (!virq_is_host(virq, xics_host))
                        continue;
                irq = (unsigned int)virq_to_hw(virq);
                /* We need to get IPIs still. */