@@ -328,7 +328,7 @@ static int gpio_to_irq_unbanked(struct gpio_chip
*chip, unsigned offset)
* can provide direct-mapped IRQs to AINTC (up to 32 GPIOs).
*/
if (offset < d->gpio_unbanked)
- return d->gpio_irq + offset;
+ return d->irq_base + offset;
else
return -ENODEV;
}
@@ -341,7 +341,7 @@ static int gpio_irq_type_unbanked(struct irq_data
*data, unsigned trigger)
d = (struct davinci_gpio_controller *)data->handler_data;
g = (struct davinci_gpio_regs __iomem *)d->regs;
- mask = __gpio_mask(data->irq - d->gpio_irq);
+ mask = __gpio_mask(data->irq - d->irq_base);
if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
return -EINVAL;
@@ -419,6 +419,8 @@ static int davinci_gpio_irq_setup(struct
platform_device *pdev)
/* pass "bank 0" GPIO IRQs to AINTC */
chips[0].chip.to_irq = gpio_to_irq_unbanked;
+ chips[0].irq_base = bank_irq;
+ chips[0].gpio_unbanked = pdata->gpio_unbanked;
binten = BIT(0);
/* AINTC handles mask/unmask; GPIO handles triggering */
b/include/linux/platform_data/gpio-davinci.h
@@ -42,7 +42,6 @@ struct davinci_gpio_controller {
void __iomem *clr_data;
void __iomem *in_data;
int gpio_unbanked;
- unsigned gpio_irq;
};
==================================================================
Also all places where davinci_gpio_register() is called need to be
updated to use instead of "sizeof". Like:
@@ -906,8 +906,8 @@ static struct davinci_gpio_platform_data
dm355_gpio_platform_data = {
int __init dm355_gpio_register(void)
{
return davinci_gpio_register(dm355_gpio_resources,
- sizeof(dm355_gpio_resources),
- &dm355_gpio_platform_data);
+ ARRAY_SIZE(dm355_gpio_resources),
+ &dm355_gpio_platform_data);
}