Commit aa90939d authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij

gpio: dwapb: Don't use IRQ 0 as valid Linux interrupt

IRQ 0 is not valid in Linux interrupt number space.
Refactor the code with this kept in mind.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Acked-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/20200519131233.59032-3-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent d7cc2360
...@@ -417,7 +417,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, ...@@ -417,7 +417,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
int i; int i;
for (i = 0; i < pp->ngpio; i++) { for (i = 0; i < pp->ngpio; i++) {
if (pp->irq[i] >= 0) if (pp->irq[i])
irq_set_chained_handler_and_data(pp->irq[i], irq_set_chained_handler_and_data(pp->irq[i],
dwapb_irq_handler, gpio); dwapb_irq_handler, gpio);
} }
...@@ -538,20 +538,20 @@ static void dwapb_get_irq(struct device *dev, struct fwnode_handle *fwnode, ...@@ -538,20 +538,20 @@ static void dwapb_get_irq(struct device *dev, struct fwnode_handle *fwnode,
struct dwapb_port_property *pp) struct dwapb_port_property *pp)
{ {
struct device_node *np = NULL; struct device_node *np = NULL;
int j; int irq = -ENXIO, j;
if (fwnode_property_read_bool(fwnode, "interrupt-controller")) if (fwnode_property_read_bool(fwnode, "interrupt-controller"))
np = to_of_node(fwnode); np = to_of_node(fwnode);
for (j = 0; j < pp->ngpio; j++) { for (j = 0; j < pp->ngpio; j++) {
pp->irq[j] = -ENXIO;
if (np) if (np)
pp->irq[j] = of_irq_get(np, j); irq = of_irq_get(np, j);
else if (has_acpi_companion(dev)) else if (has_acpi_companion(dev))
pp->irq[j] = platform_get_irq_optional(to_platform_device(dev), j); irq = platform_get_irq_optional(to_platform_device(dev), j);
if (irq > 0)
pp->irq[j] = irq;
if (pp->irq[j] >= 0) if (pp->irq[j])
pp->has_irq = true; pp->has_irq = true;
} }
......
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