[ARM] 3347/1: Bugfix for ixp4xx_set_irq_type()
authorMårten Wikström <marten.wikstrom@passito.se>
Wed, 22 Feb 2006 22:27:23 +0000 (22:27 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 22 Feb 2006 22:27:23 +0000 (22:27 +0000)
Patch from Mårten Wikström

This patch fixes a bug in ixp4xx_set_irq_type() which leads to
GPIO being incorrectly set to both edge triggered for raising
as well as falling edge interrupt types. See the previous
discussion on patch 3312/1.

Signed-off-by: Mårten Wikström <marten.wikstrom@passito.se>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-ixp4xx/common.c

index 4bdc9d4526cdfdb6b67a65a65781bfc3efa74aff..fbadf3021b9ea0e70074d4388ee127df012dfc4b 100644 (file)
@@ -111,24 +111,30 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)
        if (line < 0)
                return -EINVAL;
 
-       if (type & IRQT_BOTHEDGE) {
+       switch (type){
+       case IRQT_BOTHEDGE:
                int_style = IXP4XX_GPIO_STYLE_TRANSITIONAL;
                irq_type = IXP4XX_IRQ_EDGE;
-       } else  if (type & IRQT_RISING) {
+               break;
+       case IRQT_RISING:
                int_style = IXP4XX_GPIO_STYLE_RISING_EDGE;
                irq_type = IXP4XX_IRQ_EDGE;
-       } else if (type & IRQT_FALLING) {
+               break;
+       case IRQT_FALLING:
                int_style = IXP4XX_GPIO_STYLE_FALLING_EDGE;
                irq_type = IXP4XX_IRQ_EDGE;
-       } else if (type & IRQT_HIGH) {
+               break;
+       case IRQT_HIGH:
                int_style = IXP4XX_GPIO_STYLE_ACTIVE_HIGH;
                irq_type = IXP4XX_IRQ_LEVEL;
-       } else if (type & IRQT_LOW) {
+               break;
+       case IRQT_LOW:
                int_style = IXP4XX_GPIO_STYLE_ACTIVE_LOW;
                irq_type = IXP4XX_IRQ_LEVEL;
-       } else
+               break;
+       default:
                return -EINVAL;
-
+       }
        ixp4xx_config_irq(irq, irq_type);
 
        if (line >= 8) {        /* pins 8-15 */