powerpc/mpic: Cleanup mpic_find() implementation
authorTony Breeds <tony@bakeyournoodle.com>
Tue, 7 Apr 2009 18:26:54 +0000 (18:26 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 21 May 2009 05:42:56 +0000 (15:42 +1000)
mpic_find() was overloaded to do two things, finding the mpic instance
for a given interrupt and returning if it's an IPI. Instead we introduce
mpic_is_ipi() and simplify mpic_find() to just return the mpic instance

Also silences the warning:
arch/powerpc/sysdev/mpic.c: In function 'mpic_irq_set_priority':
arch/powerpc/sysdev/mpic.c:1382: warning: 'is_ipi' may be used uninitialized in this function

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Acked-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/sysdev/mpic.c

index 0efc12d..bbee441 100644 (file)
@@ -613,23 +613,23 @@ static int irq_choose_cpu(unsigned int virt_irq)
 #define mpic_irq_to_hw(virq)   ((unsigned int)irq_map[virq].hwirq)
 
 /* Find an mpic associated with a given linux interrupt */
-static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi)
+static struct mpic *mpic_find(unsigned int irq)
 {
-       unsigned int src = mpic_irq_to_hw(irq);
-       struct mpic *mpic;
-
        if (irq < NUM_ISA_INTERRUPTS)
                return NULL;
 
-       mpic = irq_desc[irq].chip_data;
+       return irq_desc[irq].chip_data;
+}
 
-       if (is_ipi)
-               *is_ipi = (src >= mpic->ipi_vecs[0] &&
-                          src <= mpic->ipi_vecs[3]);
+/* Determine if the linux irq is an IPI */
+static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int irq)
+{
+       unsigned int src = mpic_irq_to_hw(irq);
 
-       return mpic;
+       return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]);
 }
 
+
 /* Convert a cpu mask from logical to physical cpu numbers. */
 static inline u32 mpic_physmask(u32 cpumask)
 {
@@ -1381,8 +1381,7 @@ void __init mpic_set_serial_int(struct mpic *mpic, int enable)
 
 void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
 {
-       unsigned int is_ipi;
-       struct mpic *mpic = mpic_find(irq, &is_ipi);
+       struct mpic *mpic = mpic_find(irq);
        unsigned int src = mpic_irq_to_hw(irq);
        unsigned long flags;
        u32 reg;
@@ -1391,7 +1390,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
                return;
 
        spin_lock_irqsave(&mpic_lock, flags);
-       if (is_ipi) {
+       if (mpic_is_ipi(mpic, irq)) {
                reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) &
                        ~MPIC_VECPRI_PRIORITY_MASK;
                mpic_ipi_write(src - mpic->ipi_vecs[0],