Commit 0215b4aa authored by Paul Gortmaker's avatar Paul Gortmaker Committed by Benjamin Herrenschmidt

powerpc: Fix build failure in sysdev/mpic.c for MPIC_WEIRD=y

Commit 446f6d06 ("powerpc/mpic: Properly
set default triggers") breaks the mpc7447_hpc_defconfig as follows:

  CC      arch/powerpc/sysdev/mpic.o
arch/powerpc/sysdev/mpic.c: In function 'mpic_set_irq_type':
arch/powerpc/sysdev/mpic.c:886:9: error: case label does not reduce to an integer constant
arch/powerpc/sysdev/mpic.c:890:9: error: case label does not reduce to an integer constant
arch/powerpc/sysdev/mpic.c:894:9: error: case label does not reduce to an integer constant
arch/powerpc/sysdev/mpic.c:898:9: error: case label does not reduce to an integer constant

Looking at the cpp output (gcc 4.7.3), I see:

   case mpic->hw_set[MPIC_IDX_VECPRI_SENSE_EDGE] |
        mpic->hw_set[MPIC_IDX_VECPRI_POLARITY_POSITIVE]:

The pointer into an array appears because CONFIG_MPIC_WEIRD=y is set
for this platform, thus enabling the following:

  -------------------
  #ifdef CONFIG_MPIC_WEIRD
  static u32 mpic_infos[][MPIC_IDX_END] = {
        [0] = { /* Original OpenPIC compatible MPIC */

  [...]

  #define MPIC_INFO(name) mpic->hw_set[MPIC_IDX_##name]

  #else /* CONFIG_MPIC_WEIRD */

  #define MPIC_INFO(name) MPIC_##name

  #endif /* CONFIG_MPIC_WEIRD */
  -------------------

Here we convert the case section to if/else if, and also add
the equivalent of a default case to warn about unknown types.
Boot tested on sbc8548, build tested on all defconfigs.
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent b28a960c
...@@ -886,25 +886,25 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type) ...@@ -886,25 +886,25 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
/* Default: read HW settings */ /* Default: read HW settings */
if (flow_type == IRQ_TYPE_DEFAULT) { if (flow_type == IRQ_TYPE_DEFAULT) {
switch(vold & (MPIC_INFO(VECPRI_POLARITY_MASK) | int vold_ps;
MPIC_INFO(VECPRI_SENSE_MASK))) {
case MPIC_INFO(VECPRI_SENSE_EDGE) | vold_ps = vold & (MPIC_INFO(VECPRI_POLARITY_MASK) |
MPIC_INFO(VECPRI_POLARITY_POSITIVE): MPIC_INFO(VECPRI_SENSE_MASK));
flow_type = IRQ_TYPE_EDGE_RISING;
break; if (vold_ps == (MPIC_INFO(VECPRI_SENSE_EDGE) |
case MPIC_INFO(VECPRI_SENSE_EDGE) | MPIC_INFO(VECPRI_POLARITY_POSITIVE)))
MPIC_INFO(VECPRI_POLARITY_NEGATIVE): flow_type = IRQ_TYPE_EDGE_RISING;
flow_type = IRQ_TYPE_EDGE_FALLING; else if (vold_ps == (MPIC_INFO(VECPRI_SENSE_EDGE) |
break; MPIC_INFO(VECPRI_POLARITY_NEGATIVE)))
case MPIC_INFO(VECPRI_SENSE_LEVEL) | flow_type = IRQ_TYPE_EDGE_FALLING;
MPIC_INFO(VECPRI_POLARITY_POSITIVE): else if (vold_ps == (MPIC_INFO(VECPRI_SENSE_LEVEL) |
flow_type = IRQ_TYPE_LEVEL_HIGH; MPIC_INFO(VECPRI_POLARITY_POSITIVE)))
break; flow_type = IRQ_TYPE_LEVEL_HIGH;
case MPIC_INFO(VECPRI_SENSE_LEVEL) | else if (vold_ps == (MPIC_INFO(VECPRI_SENSE_LEVEL) |
MPIC_INFO(VECPRI_POLARITY_NEGATIVE): MPIC_INFO(VECPRI_POLARITY_NEGATIVE)))
flow_type = IRQ_TYPE_LEVEL_LOW; flow_type = IRQ_TYPE_LEVEL_LOW;
break; else
} WARN_ONCE(1, "mpic: unknown IRQ type %d\n", vold);
} }
/* Apply to irq desc */ /* Apply to irq desc */
......
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