};
 
 static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
 };
 
 static struct twl4030_platform_data sdp2430_twldata = {
 
 }
 
 static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .pulldowns      = BIT(2) | BIT(6) | BIT(8) | BIT(13)
                                | BIT(16) | BIT(17),
        .setup          = sdp3430_twl_gpio_setup,
 
        .codec          = &twl6040_codec,
        .vibra          = &twl6040_vibra,
        .audpwron_gpio  = 127,
-       .irq_base       = TWL6040_CODEC_IRQ_BASE,
 };
 
 static struct twl4030_platform_data sdp4430_twldata = {
 
 }
 
 static struct twl4030_gpio_platform_data cm_t35_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .setup          = cm_t35_twl_gpio_setup,
 };
 
 
 }
 
 static struct twl4030_gpio_platform_data devkit8000_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .use_leds       = true,
        .pulldowns      = BIT(1) | BIT(2) | BIT(6) | BIT(8) | BIT(13)
                                | BIT(15) | BIT(16) | BIT(17),
 
 };
 
 static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .use_leds       = true,
        .setup          = igep_twl_gpio_setup,
 };
 
 }
 
 static struct twl4030_gpio_platform_data ldp_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .setup          = ldp_twl_gpio_setup,
 };
 
 
 }
 
 static struct twl4030_gpio_platform_data beagle_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .use_leds       = true,
        .pullups        = BIT(1),
        .pulldowns      = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13)
 
 }
 
 static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .use_leds       = true,
        .setup          = omap3evm_twl_gpio_setup,
 };
 
 };
 
 static struct twl4030_gpio_platform_data omap3logic_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .use_leds       = true,
        .pullups        = BIT(1),
        .pulldowns      = BIT(2)  | BIT(6)  | BIT(7)  | BIT(8)
 
 }
 
 static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .setup          = omap3pandora_twl_gpio_setup,
 };
 
 
 }
 
 static struct twl4030_gpio_platform_data omap3stalker_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .use_leds       = true,
        .setup          = omap3stalker_twl_gpio_setup,
 };
 
 }
 
 static struct twl4030_gpio_platform_data touchbook_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .use_leds       = true,
        .pullups        = BIT(1),
        .pulldowns      = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13)
 
 static struct twl6040_platform_data twl6040_data = {
        .codec          = &twl6040_codec,
        .audpwron_gpio  = 127,
-       .irq_base       = TWL6040_CODEC_IRQ_BASE,
 };
 
 /* Panda board uses the common PMIC configuration */
 
 }
 
 static struct twl4030_gpio_platform_data overo_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .use_leds       = true,
        .setup          = overo_twl_gpio_setup,
 };
 
 
 /* TWL */
 static struct twl4030_gpio_platform_data rm680_gpio_data = {
-       .gpio_base              = OMAP_MAX_GPIO_LINES,
-       .irq_base               = TWL4030_GPIO_IRQ_BASE,
-       .irq_end                = TWL4030_GPIO_IRQ_END,
        .pullups                = BIT(0),
        .pulldowns              = BIT(1) | BIT(2) | BIT(8) | BIT(15),
 };
 
 }
 
 static struct twl4030_gpio_platform_data rx51_gpio_data = {
-       .gpio_base              = OMAP_MAX_GPIO_LINES,
-       .irq_base               = TWL4030_GPIO_IRQ_BASE,
-       .irq_end                = TWL4030_GPIO_IRQ_END,
        .pulldowns              = BIT(0) | BIT(1) | BIT(2) | BIT(3)
                                | BIT(4) | BIT(5)
                                | BIT(8) | BIT(9) | BIT(10) | BIT(11)
 
 }
 
 static struct twl4030_gpio_platform_data zoom_gpio_data = {
-       .gpio_base      = OMAP_MAX_GPIO_LINES,
-       .irq_base       = TWL4030_GPIO_IRQ_BASE,
-       .irq_end        = TWL4030_GPIO_IRQ_END,
        .setup          = zoom_twl_gpio_setup,
 };
 
 
 
 
 static struct gpio_chip twl_gpiochip;
+static int twl4030_gpio_base;
 static int twl4030_gpio_irq_base;
 
 /* genirq interfaces are not available to modules */
        twl_gpiochip.dev = &pdev->dev;
 
        if (pdata) {
-               twl_gpiochip.base = pdata->gpio_base;
-
                /*
                 * NOTE:  boards may waste power if they don't set pullups
                 * and pulldowns correctly ... default for non-ULPI pins is
                dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
                twl_gpiochip.ngpio = 0;
                gpio_twl4030_remove(pdev);
-       } else if (pdata && pdata->setup) {
+               goto out;
+       }
+
+       twl4030_gpio_base = twl_gpiochip.base;
+
+       if (pdata && pdata->setup) {
                int status;
 
                status = pdata->setup(&pdev->dev,
-                               pdata->gpio_base, TWL4030_GPIO_MAX);
+                               twl4030_gpio_base, TWL4030_GPIO_MAX);
                if (status)
                        dev_dbg(&pdev->dev, "setup --> %d\n", status);
        }
 
+out:
        return ret;
 }
 
 
        if (pdata && pdata->teardown) {
                status = pdata->teardown(&pdev->dev,
-                               pdata->gpio_base, TWL4030_GPIO_MAX);
+                               twl4030_gpio_base, TWL4030_GPIO_MAX);
                if (status) {
                        dev_dbg(&pdev->dev, "teardown --> %d\n", status);
                        return status;
 
 
 /* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
 struct twl4030_gpio_platform_data {
-       int             gpio_base;
-       unsigned        irq_base, irq_end;
-
        /* package the two LED signals as output-only GPIOs? */
        bool            use_leds;
 
 
 
 struct twl6040_platform_data {
        int audpwron_gpio;      /* audio power-on gpio */
-       unsigned int irq_base;
 
        struct twl6040_codec_data *codec;
        struct twl6040_vibra_data *vibra;