Commit 949eb1a4 authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Linus Walleij

gpio/omap: fix build error when OF_GPIO is not defined.

The OMAP GPIO driver check if the chip has an associated
Device Tree node using the struct gpio_chip of_node member.

But this is only build if CONFIG_OF_GPIO is defined which
leads to the following error when using omap1_defconfig:

linux/drivers/gpio/gpio-omap.c: In function 'omap_gpio_chip_init':
linux/drivers/gpio/gpio-omap.c:1080:17: error: 'struct gpio_chip' has no member named 'of_node'
linux/drivers/gpio/gpio-omap.c: In function 'omap_gpio_irq_map':
linux/drivers/gpio/gpio-omap.c:1116:16: error: 'struct gpio_chip' has no member named 'of_node'
Reported-by: default avatarKevin Hilman <khilman@linaro.org>
Signed-off-by: default avatarJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent b4419e1a
...@@ -1037,6 +1037,18 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start, ...@@ -1037,6 +1037,18 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start,
IRQ_NOREQUEST | IRQ_NOPROBE, 0); IRQ_NOREQUEST | IRQ_NOPROBE, 0);
} }
#if defined(CONFIG_OF_GPIO)
static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip)
{
return chip->of_node != NULL;
}
#else
static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip)
{
return false;
}
#endif
static void omap_gpio_chip_init(struct gpio_bank *bank) static void omap_gpio_chip_init(struct gpio_bank *bank)
{ {
int j; int j;
...@@ -1077,7 +1089,7 @@ static void omap_gpio_chip_init(struct gpio_bank *bank) ...@@ -1077,7 +1089,7 @@ static void omap_gpio_chip_init(struct gpio_bank *bank)
* irq_create_of_mapping() only for the GPIO lines that * irq_create_of_mapping() only for the GPIO lines that
* are used as interrupts. * are used as interrupts.
*/ */
if (!bank->chip.of_node) if (!omap_gpio_chip_boot_dt(&bank->chip))
for (j = 0; j < bank->width; j++) for (j = 0; j < bank->width; j++)
irq_create_mapping(bank->domain, j); irq_create_mapping(bank->domain, j);
irq_set_chained_handler(bank->irq, gpio_irq_handler); irq_set_chained_handler(bank->irq, gpio_irq_handler);
...@@ -1113,7 +1125,7 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, ...@@ -1113,7 +1125,7 @@ static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq,
* but until then this has to be done on a per driver * but until then this has to be done on a per driver
* basis. Remove this once this is managed by the core. * basis. Remove this once this is managed by the core.
*/ */
if (bank->chip.of_node) { if (omap_gpio_chip_boot_dt(&bank->chip)) {
gpio = irq_to_gpio(bank, hwirq); gpio = irq_to_gpio(bank, hwirq);
ret = gpio_request_one(gpio, GPIOF_IN, NULL); ret = gpio_request_one(gpio, GPIOF_IN, NULL);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment