Commit d9d1063d authored by Johannes Berg's avatar Johannes Berg Committed by Paul Mackerras

[POWERPC] mpic: Make sparse happy

I was running sparse on something else and noticed sparse warnings
and especially the bogus code that is fixed by the first hunk of
this patch, so I fixed them all while at it.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Milton Miller <miltonm@bga.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 4217c7b5
...@@ -175,13 +175,16 @@ static inline void _mpic_write(enum mpic_reg_type type, ...@@ -175,13 +175,16 @@ static inline void _mpic_write(enum mpic_reg_type type,
switch(type) { switch(type) {
#ifdef CONFIG_PPC_DCR #ifdef CONFIG_PPC_DCR
case mpic_access_dcr: case mpic_access_dcr:
return dcr_write(rb->dhost, reg, value); dcr_write(rb->dhost, reg, value);
break;
#endif #endif
case mpic_access_mmio_be: case mpic_access_mmio_be:
return out_be32(rb->base + (reg >> 2), value); out_be32(rb->base + (reg >> 2), value);
break;
case mpic_access_mmio_le: case mpic_access_mmio_le:
default: default:
return out_le32(rb->base + (reg >> 2), value); out_le32(rb->base + (reg >> 2), value);
break;
} }
} }
...@@ -1000,7 +1003,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, ...@@ -1000,7 +1003,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
const char *name) const char *name)
{ {
struct mpic *mpic; struct mpic *mpic;
u32 reg; u32 greg_feature;
const char *vers; const char *vers;
int i; int i;
int intvec_top; int intvec_top;
...@@ -1064,7 +1067,8 @@ struct mpic * __init mpic_alloc(struct device_node *node, ...@@ -1064,7 +1067,8 @@ struct mpic * __init mpic_alloc(struct device_node *node,
/* Look for protected sources */ /* Look for protected sources */
if (node) { if (node) {
unsigned int psize, bits, mapsize; int psize;
unsigned int bits, mapsize;
const u32 *psrc = const u32 *psrc =
of_get_property(node, "protected-sources", &psize); of_get_property(node, "protected-sources", &psize);
if (psrc) { if (psrc) {
...@@ -1107,8 +1111,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, ...@@ -1107,8 +1111,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
* in, try to obtain one * in, try to obtain one
*/ */
if (paddr == 0 && !(mpic->flags & MPIC_USES_DCR)) { if (paddr == 0 && !(mpic->flags & MPIC_USES_DCR)) {
const u32 *reg; const u32 *reg = of_get_property(node, "reg", NULL);
reg = of_get_property(node, "reg", NULL);
BUG_ON(reg == NULL); BUG_ON(reg == NULL);
paddr = of_translate_address(node, reg); paddr = of_translate_address(node, reg);
BUG_ON(paddr == OF_BAD_ADDR); BUG_ON(paddr == OF_BAD_ADDR);
...@@ -1137,11 +1140,12 @@ struct mpic * __init mpic_alloc(struct device_node *node, ...@@ -1137,11 +1140,12 @@ struct mpic * __init mpic_alloc(struct device_node *node,
* MPICs, num sources as well. On ISU MPICs, sources are counted * MPICs, num sources as well. On ISU MPICs, sources are counted
* as ISUs are added * as ISUs are added
*/ */
reg = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0)); greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0));
mpic->num_cpus = ((reg & MPIC_GREG_FEATURE_LAST_CPU_MASK) mpic->num_cpus = ((greg_feature & MPIC_GREG_FEATURE_LAST_CPU_MASK)
>> MPIC_GREG_FEATURE_LAST_CPU_SHIFT) + 1; >> MPIC_GREG_FEATURE_LAST_CPU_SHIFT) + 1;
if (isu_size == 0) if (isu_size == 0)
mpic->num_sources = ((reg & MPIC_GREG_FEATURE_LAST_SRC_MASK) mpic->num_sources =
((greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
>> MPIC_GREG_FEATURE_LAST_SRC_SHIFT) + 1; >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT) + 1;
/* Map the per-CPU registers */ /* Map the per-CPU registers */
...@@ -1161,7 +1165,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, ...@@ -1161,7 +1165,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
mpic->isu_mask = (1 << mpic->isu_shift) - 1; mpic->isu_mask = (1 << mpic->isu_shift) - 1;
/* Display version */ /* Display version */
switch (reg & MPIC_GREG_FEATURE_VERSION_MASK) { switch (greg_feature & MPIC_GREG_FEATURE_VERSION_MASK) {
case 1: case 1:
vers = "1.0"; vers = "1.0";
break; break;
...@@ -1321,7 +1325,7 @@ void __init mpic_set_serial_int(struct mpic *mpic, int enable) ...@@ -1321,7 +1325,7 @@ void __init mpic_set_serial_int(struct mpic *mpic, int enable)
void mpic_irq_set_priority(unsigned int irq, unsigned int pri) void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
{ {
int is_ipi; unsigned int is_ipi;
struct mpic *mpic = mpic_find(irq, &is_ipi); struct mpic *mpic = mpic_find(irq, &is_ipi);
unsigned int src = mpic_irq_to_hw(irq); unsigned int src = mpic_irq_to_hw(irq);
unsigned long flags; unsigned long flags;
...@@ -1344,7 +1348,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri) ...@@ -1344,7 +1348,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
unsigned int mpic_irq_get_priority(unsigned int irq) unsigned int mpic_irq_get_priority(unsigned int irq)
{ {
int is_ipi; unsigned int is_ipi;
struct mpic *mpic = mpic_find(irq, &is_ipi); struct mpic *mpic = mpic_find(irq, &is_ipi);
unsigned int src = mpic_irq_to_hw(irq); unsigned int src = mpic_irq_to_hw(irq);
unsigned long flags; unsigned long flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment