All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <luis.henriques@canonical.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Scott Wood <scottwood@freescale.com>,
	Wang Dongsheng <dongsheng.wang@freescale.com>,
	Jia Hongtao <hongtao.jia@freescale.com>,
	Alexander Gordeev <agordeev@redhat.com>
Cc: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] powerpc/mpic: Fix build errors for CONFIG_MPIC_WEIRD
Date: Mon, 20 Jan 2014 19:42:16 +0000	[thread overview]
Message-ID: <20140120194212.GA5684@hercules> (raw)

When CONFIG_MPIC_WEIRD is defined, the following build error occurs:

arch/powerpc/sysdev/mpic.c: In function 'mpic_set_irq_type':
arch/powerpc/sysdev/mpic.c:892:9: error: case label does not reduce to an integer constant
         MPIC_INFO(VECPRI_POLARITY_POSITIVE):
         ^
arch/powerpc/sysdev/mpic.c:896:9: error: case label does not reduce to an integer constant
         MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
         ^
arch/powerpc/sysdev/mpic.c:900:9: error: case label does not reduce to an integer constant
         MPIC_INFO(VECPRI_POLARITY_POSITIVE):
         ^
arch/powerpc/sysdev/mpic.c:904:9: error: case label does not reduce to an integer constant
         MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
         ^

This is because the case labels are built by accessing mpic->hw_set, and not an
integer constant.

Fixes: 446f6d06fab0 ("powerpc/mpic: Properly set default triggers")
Cc: <stable@vger.kernel.org> (3.4+)
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/sysdev/mpic.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 0e166ed..e7bf1a2 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -886,25 +886,21 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
 
 	/* Default: read HW settings */
 	if (flow_type == IRQ_TYPE_DEFAULT) {
-		switch(vold & (MPIC_INFO(VECPRI_POLARITY_MASK) |
-			       MPIC_INFO(VECPRI_SENSE_MASK))) {
-			case MPIC_INFO(VECPRI_SENSE_EDGE) |
-			     MPIC_INFO(VECPRI_POLARITY_POSITIVE):
-				flow_type = IRQ_TYPE_EDGE_RISING;
-				break;
-			case MPIC_INFO(VECPRI_SENSE_EDGE) |
-			     MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
-				flow_type = IRQ_TYPE_EDGE_FALLING;
-				break;
-			case MPIC_INFO(VECPRI_SENSE_LEVEL) |
-			     MPIC_INFO(VECPRI_POLARITY_POSITIVE):
-				flow_type = IRQ_TYPE_LEVEL_HIGH;
-				break;
-			case MPIC_INFO(VECPRI_SENSE_LEVEL) |
-			     MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
-				flow_type = IRQ_TYPE_LEVEL_LOW;
-				break;
-		}
+		unsigned int info;
+		info = vold & (MPIC_INFO(VECPRI_POLARITY_MASK) |
+			       MPIC_INFO(VECPRI_SENSE_MASK));
+		if (info == (MPIC_INFO(VECPRI_SENSE_EDGE) |
+			     MPIC_INFO(VECPRI_POLARITY_POSITIVE)))
+			flow_type = IRQ_TYPE_EDGE_RISING;
+		else if (info == (MPIC_INFO(VECPRI_SENSE_EDGE) |
+				  MPIC_INFO(VECPRI_POLARITY_NEGATIVE)))
+			flow_type = IRQ_TYPE_EDGE_FALLING;
+		else if (info == (MPIC_INFO(VECPRI_SENSE_LEVEL) |
+				  MPIC_INFO(VECPRI_POLARITY_POSITIVE)))
+			flow_type = IRQ_TYPE_LEVEL_HIGH;
+		else if (info == (MPIC_INFO(VECPRI_SENSE_LEVEL) |
+				  MPIC_INFO(VECPRI_POLARITY_NEGATIVE)))
+			flow_type = IRQ_TYPE_LEVEL_LOW;
 	}
 
 	/* Apply to irq desc */
-- 
1.8.3.2

Cheers,
--
Luis

WARNING: multiple messages have this Message-ID (diff)
From: Luis Henriques <luis.henriques@canonical.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Scott Wood <scottwood@freescale.com>,
	Wang Dongsheng <dongsheng.wang@freescale.com>,
	Jia Hongtao <hongtao.jia@freescale.com>,
	Alexander Gordeev <agordeev@redhat.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: [PATCH] powerpc/mpic: Fix build errors for CONFIG_MPIC_WEIRD
Date: Mon, 20 Jan 2014 19:42:16 +0000	[thread overview]
Message-ID: <20140120194212.GA5684@hercules> (raw)

When CONFIG_MPIC_WEIRD is defined, the following build error occurs:

arch/powerpc/sysdev/mpic.c: In function 'mpic_set_irq_type':
arch/powerpc/sysdev/mpic.c:892:9: error: case label does not reduce to an integer constant
         MPIC_INFO(VECPRI_POLARITY_POSITIVE):
         ^
arch/powerpc/sysdev/mpic.c:896:9: error: case label does not reduce to an integer constant
         MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
         ^
arch/powerpc/sysdev/mpic.c:900:9: error: case label does not reduce to an integer constant
         MPIC_INFO(VECPRI_POLARITY_POSITIVE):
         ^
arch/powerpc/sysdev/mpic.c:904:9: error: case label does not reduce to an integer constant
         MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
         ^

This is because the case labels are built by accessing mpic->hw_set, and not an
integer constant.

Fixes: 446f6d06fab0 ("powerpc/mpic: Properly set default triggers")
Cc: <stable@vger.kernel.org> (3.4+)
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/powerpc/sysdev/mpic.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 0e166ed..e7bf1a2 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -886,25 +886,21 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
 
 	/* Default: read HW settings */
 	if (flow_type == IRQ_TYPE_DEFAULT) {
-		switch(vold & (MPIC_INFO(VECPRI_POLARITY_MASK) |
-			       MPIC_INFO(VECPRI_SENSE_MASK))) {
-			case MPIC_INFO(VECPRI_SENSE_EDGE) |
-			     MPIC_INFO(VECPRI_POLARITY_POSITIVE):
-				flow_type = IRQ_TYPE_EDGE_RISING;
-				break;
-			case MPIC_INFO(VECPRI_SENSE_EDGE) |
-			     MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
-				flow_type = IRQ_TYPE_EDGE_FALLING;
-				break;
-			case MPIC_INFO(VECPRI_SENSE_LEVEL) |
-			     MPIC_INFO(VECPRI_POLARITY_POSITIVE):
-				flow_type = IRQ_TYPE_LEVEL_HIGH;
-				break;
-			case MPIC_INFO(VECPRI_SENSE_LEVEL) |
-			     MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
-				flow_type = IRQ_TYPE_LEVEL_LOW;
-				break;
-		}
+		unsigned int info;
+		info = vold & (MPIC_INFO(VECPRI_POLARITY_MASK) |
+			       MPIC_INFO(VECPRI_SENSE_MASK));
+		if (info == (MPIC_INFO(VECPRI_SENSE_EDGE) |
+			     MPIC_INFO(VECPRI_POLARITY_POSITIVE)))
+			flow_type = IRQ_TYPE_EDGE_RISING;
+		else if (info == (MPIC_INFO(VECPRI_SENSE_EDGE) |
+				  MPIC_INFO(VECPRI_POLARITY_NEGATIVE)))
+			flow_type = IRQ_TYPE_EDGE_FALLING;
+		else if (info == (MPIC_INFO(VECPRI_SENSE_LEVEL) |
+				  MPIC_INFO(VECPRI_POLARITY_POSITIVE)))
+			flow_type = IRQ_TYPE_LEVEL_HIGH;
+		else if (info == (MPIC_INFO(VECPRI_SENSE_LEVEL) |
+				  MPIC_INFO(VECPRI_POLARITY_NEGATIVE)))
+			flow_type = IRQ_TYPE_LEVEL_LOW;
 	}
 
 	/* Apply to irq desc */
-- 
1.8.3.2

Cheers,
--
Luis

             reply	other threads:[~2014-01-20 19:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20 19:42 Luis Henriques [this message]
2014-01-20 19:42 ` [PATCH] powerpc/mpic: Fix build errors for CONFIG_MPIC_WEIRD Luis Henriques

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140120194212.GA5684@hercules \
    --to=luis.henriques@canonical.com \
    --cc=agordeev@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dongsheng.wang@freescale.com \
    --cc=grant.likely@linaro.org \
    --cc=hongtao.jia@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=robh+dt@kernel.org \
    --cc=scottwood@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.