Commit 5bc067b7 authored by Nicolas Ferre's avatar Nicolas Ferre

ARM: at91/gpio: non-DT builds do not have gpio_chip.of_node field

Protect build failure in case of non-DT configuration: the
gpio_chip structure does not have a of_node field in case of
!CONFIG_OF_GPIO.

Keep this in a separate patch as it can be reverted if the
field is added for both DT/non-DT cases.
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
parent 21f81872
...@@ -496,12 +496,17 @@ postcore_initcall(at91_gpio_debugfs_init); ...@@ -496,12 +496,17 @@ postcore_initcall(at91_gpio_debugfs_init);
static void __init at91_gpio_irqdomain(struct at91_gpio_chip *at91_gpio) static void __init at91_gpio_irqdomain(struct at91_gpio_chip *at91_gpio)
{ {
int irq_base; int irq_base;
#if defined(CONFIG_OF)
struct device_node *of_node = at91_gpio->chip.of_node;
#else
struct device_node *of_node = NULL;
#endif
irq_base = irq_alloc_descs(-1, 0, at91_gpio->chip.ngpio, 0); irq_base = irq_alloc_descs(-1, 0, at91_gpio->chip.ngpio, 0);
if (irq_base < 0) if (irq_base < 0)
panic("at91_gpio.%d: error %d: couldn't allocate IRQ numbers.\n", panic("at91_gpio.%d: error %d: couldn't allocate IRQ numbers.\n",
at91_gpio->pioc_idx, irq_base); at91_gpio->pioc_idx, irq_base);
at91_gpio->domain = irq_domain_add_legacy(at91_gpio->chip.of_node, at91_gpio->domain = irq_domain_add_legacy(of_node,
at91_gpio->chip.ngpio, at91_gpio->chip.ngpio,
irq_base, 0, irq_base, 0,
&irq_domain_simple_ops, NULL); &irq_domain_simple_ops, NULL);
......
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