GPIO fixes for the v5.3 merge window:

- Revert a SPIO GPIO fix that didn't fix anything 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAl0vPEkACgkQQRCzN7AZ
 XXOL0g/8DxfjkoyS0+GQDJAx1wANj9xZP5OzDEEpzV8YHZmAK4q8ucyt5jJarO7q
 v75T5dpcqudG3oRRwLUzA8qZJBGl/M9T82T3bRu9d3KYZhkOoXp2LkyD3m8prvr6
 9bd4mjPzr78ro5EJhHFEFkjhNlpGxcFvmP3wMR1BOGCMlnv975J7RH24hOdu+CWO
 /a3CaKpPdWlPDjgclWYql3MNBvSE6M87azOQWSPJhabSmUqFUGzyo4Fk5NLxwHl1
 oixBgLXRBJ/rOtuzLW+LFi9iW9N0QvHQgQuEQm7p21+E4T0Bqdv0xADl2ThKFJUj
 Vu6gAfYxJt3hvfEW3/Vcd3MsclLCvgYveAX1hHR/OxuZv69fOpM7LkWB6g5MYanG
 238SYb13dvzDRYjh6lKiOxGMZSRBA5Bw9jf/03l1b7S3olmsoD4Zuc3mstcGdBrl
 qt4eRKCekkP7txbn2i50PLd2hGV0HjO2sNeNXdW8o+qEjDRcxLXiXv+MBDZTeEhJ
 RSMOegzyyHVPDKS+0sQAHXHKYqiw9117Fe8swbgHjkTxdtsER8spot7PdKF0Lblu
 WU2SXdbltqcufo883LG0Kzgx3xwvt/ncYoUB4gHLfx+sFxPY1wbeOHjOreWJ4QOs
 ycd21YiCdZLk9ExrOPQ4NSniXX9bzH2FlovT/bHYMpl75pKa7Ig=
 =/5s0
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2019-07-17 13:05:21 -07:00
commit c3c08f939a
3 changed files with 20 additions and 28 deletions

View File

@ -238,8 +238,9 @@ static int davinci_gpio_probe(struct platform_device *pdev)
for (i = 0; i < nirq; i++) { for (i = 0; i < nirq; i++) {
chips->irqs[i] = platform_get_irq(pdev, i); chips->irqs[i] = platform_get_irq(pdev, i);
if (chips->irqs[i] < 0) { if (chips->irqs[i] < 0) {
dev_info(dev, "IRQ not populated, err = %d\n", if (chips->irqs[i] != -EPROBE_DEFER)
chips->irqs[i]); dev_info(dev, "IRQ not populated, err = %d\n",
chips->irqs[i]);
return chips->irqs[i]; return chips->irqs[i];
} }
} }

View File

@ -259,6 +259,13 @@ static const struct irq_domain_ops em_gio_irq_domain_ops = {
.xlate = irq_domain_xlate_twocell, .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) static int em_gio_probe(struct platform_device *pdev)
{ {
struct em_gio_priv *p; struct em_gio_priv *p;
@ -333,39 +340,30 @@ static int em_gio_probe(struct platform_device *pdev)
return -ENXIO; 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, if (devm_request_irq(&pdev->dev, irq[0]->start,
em_gio_irq_handler, 0, name, p)) { em_gio_irq_handler, 0, name, p)) {
dev_err(&pdev->dev, "failed to request low IRQ\n"); dev_err(&pdev->dev, "failed to request low IRQ\n");
ret = -ENOENT; return -ENOENT;
goto err1;
} }
if (devm_request_irq(&pdev->dev, irq[1]->start, if (devm_request_irq(&pdev->dev, irq[1]->start,
em_gio_irq_handler, 0, name, p)) { em_gio_irq_handler, 0, name, p)) {
dev_err(&pdev->dev, "failed to request high IRQ\n"); dev_err(&pdev->dev, "failed to request high IRQ\n");
ret = -ENOENT; return -ENOENT;
goto err1;
} }
ret = devm_gpiochip_add_data(&pdev->dev, gpio_chip, p); ret = devm_gpiochip_add_data(&pdev->dev, gpio_chip, p);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to add GPIO controller\n"); dev_err(&pdev->dev, "failed to add GPIO controller\n");
goto err1; return ret;
} }
return 0; 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[] = { 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 = { static struct platform_driver em_gio_device_driver = {
.probe = em_gio_probe, .probe = em_gio_probe,
.remove = em_gio_remove,
.driver = { .driver = {
.name = "em_gio", .name = "em_gio",
.of_match_table = em_gio_dt_ids, .of_match_table = em_gio_dt_ids,

View File

@ -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 * Legacy handling of SPI active high chip select. If we have a
* property named "cs-gpios" we need to inspect the child node * property named "cs-gpios" we need to inspect the child node
* to determine if the flags should have inverted semantics. * 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) && if (IS_ENABLED(CONFIG_SPI_MASTER) && !strcmp(propname, "cs-gpios") &&
!strcmp(propname, "cs-gpios") &&
!of_device_is_compatible(np, "spi-gpio") &&
of_property_read_bool(np, "cs-gpios")) { of_property_read_bool(np, "cs-gpios")) {
struct device_node *child; struct device_node *child;
u32 cs; u32 cs;
@ -161,6 +154,7 @@ static void of_gpio_flags_quirks(struct device_node *np,
of_node_full_name(child)); of_node_full_name(child));
*flags |= OF_GPIO_ACTIVE_LOW; *flags |= OF_GPIO_ACTIVE_LOW;
} }
of_node_put(child);
break; break;
} }
} }