arm/imx/gpio: GPIO_INT_{HIGH,LOW}_LEV are not necessarily constant

Previous thread: ARM: S5PV210: Add S5PC110 configuration file by Linux Kernel Mailing List on Friday, March 12, 2010 - 6:04 pm. (1 message)

Next thread: arm/imx/gpio: use fls to find set bits in the irq status register by Linux Kernel Mailing List on Friday, March 12, 2010 - 6:02 pm. (1 message)
From: Linux Kernel Mailing List
Date: Friday, March 12, 2010 - 6:02 pm

Gitweb:     http://git.kernel.org/linus/3d40f7fef45c0173e98dcdad6a9d642127331c66
Commit:     3d40f7fef45c0173e98dcdad6a9d642127331c66
Parent:     4a50d00cb90dd5dd79e40281a8719a1fc673c2a5
Author:     Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
AuthorDate: Fri Feb 5 22:14:37 2010 +0100
Committer:  Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
CommitDate: Wed Feb 24 10:06:56 2010 +0100

    arm/imx/gpio: GPIO_INT_{HIGH,LOW}_LEV are not necessarily constant
    
    GPIO_INT_LOW_LEV is defined as
    
    	(cpu_is_mx1_mx2() ? 0x3 : 0x0)
    
    so depending on compiler optimisation and enabled SoCs this doesn't
    qualify as a constant expression as needed by a switch statement.
    Ditto for GPIO_INT_HIGH_LEV.
    
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/plat-mxc/gpio.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index d65ebe3..3cba1dd 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -140,16 +140,13 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio)
 	val = __raw_readl(reg);
 	edge = (val >> (bit << 1)) & 3;
 	val &= ~(0x3 << (bit << 1));
-	switch (edge) {
-	case GPIO_INT_HIGH_LEV:
+	if (edge == GPIO_INT_HIGH_LEV) {
 		edge = GPIO_INT_LOW_LEV;
 		pr_debug("mxc: switch GPIO %d to low trigger\n", gpio);
-		break;
-	case GPIO_INT_LOW_LEV:
+	} else if (edge == GPIO_INT_LOW_LEV) {
 		edge = GPIO_INT_HIGH_LEV;
 		pr_debug("mxc: switch GPIO %d to high trigger\n", gpio);
-		break;
-	default:
+	} else {
 		pr_err("mxc: invalid configuration for GPIO %d: %x\n",
 		       gpio, edge);
 		return;
--

Previous thread: ARM: S5PV210: Add S5PC110 configuration file by Linux Kernel Mailing List on Friday, March 12, 2010 - 6:04 pm. (1 message)

Next thread: arm/imx/gpio: use fls to find set bits in the irq status register by Linux Kernel Mailing List on Friday, March 12, 2010 - 6:02 pm. (1 message)