aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic.c
diff options
context:
space:
mode:
authorTony Breeds <tony@bakeyournoodle.com>2009-04-07 14:26:54 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-05-21 01:42:56 -0400
commitd69a78d7daada190b42269a73daabe32a5e138a6 (patch)
tree6b5f61193e75734076e12b2e2ffdc68336ebef08 /arch/powerpc/sysdev/mpic.c
parent805e324b7fbddf9f420f0ea09eb61c21777b0526 (diff)
powerpc/mpic: Cleanup mpic_find() implementation
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>
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r--arch/powerpc/sysdev/mpic.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 0efc12d1a3d7..bbee441ae867 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -613,23 +613,23 @@ static int irq_choose_cpu(unsigned int virt_irq)
613#define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq) 613#define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq)
614 614
615/* Find an mpic associated with a given linux interrupt */ 615/* Find an mpic associated with a given linux interrupt */
616static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi) 616static struct mpic *mpic_find(unsigned int irq)
617{ 617{
618 unsigned int src = mpic_irq_to_hw(irq);
619 struct mpic *mpic;
620
621 if (irq < NUM_ISA_INTERRUPTS) 618 if (irq < NUM_ISA_INTERRUPTS)
622 return NULL; 619 return NULL;
623 620
624 mpic = irq_desc[irq].chip_data; 621 return irq_desc[irq].chip_data;
622}
625 623
626 if (is_ipi) 624/* Determine if the linux irq is an IPI */
627 *is_ipi = (src >= mpic->ipi_vecs[0] && 625static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int irq)
628 src <= mpic->ipi_vecs[3]); 626{
627 unsigned int src = mpic_irq_to_hw(irq);
629 628
630 return mpic; 629 return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]);
631} 630}
632 631
632
633/* Convert a cpu mask from logical to physical cpu numbers. */ 633/* Convert a cpu mask from logical to physical cpu numbers. */
634static inline u32 mpic_physmask(u32 cpumask) 634static inline u32 mpic_physmask(u32 cpumask)
635{ 635{
@@ -1381,8 +1381,7 @@ void __init mpic_set_serial_int(struct mpic *mpic, int enable)
1381 1381
1382void mpic_irq_set_priority(unsigned int irq, unsigned int pri) 1382void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1383{ 1383{
1384 unsigned int is_ipi; 1384 struct mpic *mpic = mpic_find(irq);
1385 struct mpic *mpic = mpic_find(irq, &is_ipi);
1386 unsigned int src = mpic_irq_to_hw(irq); 1385 unsigned int src = mpic_irq_to_hw(irq);
1387 unsigned long flags; 1386 unsigned long flags;
1388 u32 reg; 1387 u32 reg;
@@ -1391,7 +1390,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1391 return; 1390 return;
1392 1391
1393 spin_lock_irqsave(&mpic_lock, flags); 1392 spin_lock_irqsave(&mpic_lock, flags);
1394 if (is_ipi) { 1393 if (mpic_is_ipi(mpic, irq)) {
1395 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) & 1394 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) &
1396 ~MPIC_VECPRI_PRIORITY_MASK; 1395 ~MPIC_VECPRI_PRIORITY_MASK;
1397 mpic_ipi_write(src - mpic->ipi_vecs[0], 1396 mpic_ipi_write(src - mpic->ipi_vecs[0],