Pull novell-bugzilla-156426 into release branch
[pandora-kernel.git] / arch / arm / mach-ixp4xx / common.c
index 4bdc9d4..00b761f 100644 (file)
@@ -91,7 +91,7 @@ static void ixp4xx_config_irq(unsigned irq, enum ixp4xx_irq_type type);
 /*
  * IRQ -> GPIO mapping table
  */
-static int irq2gpio[32] = {
+static signed char irq2gpio[32] = {
        -1, -1, -1, -1, -1, -1,  0,  1,
        -1, -1, -1, -1, -1, -1, -1, -1,
        -1, -1, -1,  2,  3,  4,  5,  6,
@@ -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 */
@@ -147,6 +153,9 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)
        /* Set the new style */
        *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE));
 
+       /* Configure the line as an input */
+       gpio_line_config(line, IXP4XX_GPIO_IN);
+
        return 0;
 }