Commit c3c08f93 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gpio-v5.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:

 - Revert a SPIO GPIO fix that didn't fix anything but instead created
   new problems.

 - Remove the EM GPIO irqdomain in a safe manner.

 - Fix a memory leak in the gpio quirks.

 - Make the DaVinci error path silent on probe deferral.

* tag 'gpio-v5.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  Revert "gpio/spi: Fix spi-gpio regression on active high CS"
  gpio: em: remove the gpiochip before removing the irq domain
  gpiolib: of: fix a memory leak in of_gpio_flags_quirks()
  gpio: davinci: silence error prints in case of EPROBE_DEFER
parents 57ab5f74 88785b7f
......@@ -238,8 +238,9 @@ static int davinci_gpio_probe(struct platform_device *pdev)
for (i = 0; i < nirq; i++) {
chips->irqs[i] = platform_get_irq(pdev, i);
if (chips->irqs[i] < 0) {
dev_info(dev, "IRQ not populated, err = %d\n",
chips->irqs[i]);
if (chips->irqs[i] != -EPROBE_DEFER)
dev_info(dev, "IRQ not populated, err = %d\n",
chips->irqs[i]);
return chips->irqs[i];
}
}
......
......@@ -259,6 +259,13 @@ static const struct irq_domain_ops em_gio_irq_domain_ops = {
.xlate = irq_domain_xlate_twocell,
};
static void em_gio_irq_domain_remove(void *data)
{
struct irq_domain *domain = data;
irq_domain_remove(domain);
}
static int em_gio_probe(struct platform_device *pdev)
{
struct em_gio_priv *p;
......@@ -333,39 +340,30 @@ static int em_gio_probe(struct platform_device *pdev)
return -ENXIO;
}
ret = devm_add_action_or_reset(&pdev->dev, em_gio_irq_domain_remove,
p->irq_domain);
if (ret)
return ret;
if (devm_request_irq(&pdev->dev, irq[0]->start,
em_gio_irq_handler, 0, name, p)) {
dev_err(&pdev->dev, "failed to request low IRQ\n");
ret = -ENOENT;
goto err1;
return -ENOENT;
}
if (devm_request_irq(&pdev->dev, irq[1]->start,
em_gio_irq_handler, 0, name, p)) {
dev_err(&pdev->dev, "failed to request high IRQ\n");
ret = -ENOENT;
goto err1;
return -ENOENT;
}
ret = devm_gpiochip_add_data(&pdev->dev, gpio_chip, p);
if (ret) {
dev_err(&pdev->dev, "failed to add GPIO controller\n");
goto err1;
return ret;
}
return 0;
err1:
irq_domain_remove(p->irq_domain);
return ret;
}
static int em_gio_remove(struct platform_device *pdev)
{
struct em_gio_priv *p = platform_get_drvdata(pdev);
irq_domain_remove(p->irq_domain);
return 0;
}
static const struct of_device_id em_gio_dt_ids[] = {
......@@ -376,7 +374,6 @@ MODULE_DEVICE_TABLE(of, em_gio_dt_ids);
static struct platform_driver em_gio_device_driver = {
.probe = em_gio_probe,
.remove = em_gio_remove,
.driver = {
.name = "em_gio",
.of_match_table = em_gio_dt_ids,
......
......@@ -118,15 +118,8 @@ static void of_gpio_flags_quirks(struct device_node *np,
* Legacy handling of SPI active high chip select. If we have a
* property named "cs-gpios" we need to inspect the child node
* to determine if the flags should have inverted semantics.
*
* This does not apply to an SPI device named "spi-gpio", because
* these have traditionally obtained their own GPIOs by parsing
* the device tree directly and did not respect any "spi-cs-high"
* property on the SPI bus children.
*/
if (IS_ENABLED(CONFIG_SPI_MASTER) &&
!strcmp(propname, "cs-gpios") &&
!of_device_is_compatible(np, "spi-gpio") &&
if (IS_ENABLED(CONFIG_SPI_MASTER) && !strcmp(propname, "cs-gpios") &&
of_property_read_bool(np, "cs-gpios")) {
struct device_node *child;
u32 cs;
......@@ -161,6 +154,7 @@ static void of_gpio_flags_quirks(struct device_node *np,
of_node_full_name(child));
*flags |= OF_GPIO_ACTIVE_LOW;
}
of_node_put(child);
break;
}
}
......
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