linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] pinctrl: mvebu: armada-37xx: use use platform api
@ 2019-12-18 12:43 Peng Fan
  2019-12-18 12:43 ` [PATCH 2/2] pinctrl: sunxi: sun50i-h5 use platform_irq_count Peng Fan
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Peng Fan @ 2019-12-18 12:43 UTC (permalink / raw)
  To: jason, andrew, gregory.clement, sebastian.hesselbarth,
	linus.walleij, mripard, wens
  Cc: linux-arm-kernel, linux-gpio, linux-kernel, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

platform_irq_count() and platform_get_irq() is the more generic
way (independent of device trees) to determine the count of available
interrupts. So use this instead.

As platform_irq_count() might return an error code (which
of_irq_count doesn't) some additional handling is necessary.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
index aa9dcde0f069..cc66a6429a06 100644
--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
@@ -15,7 +15,6 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
-#include <linux/of_irq.h>
 #include <linux/pinctrl/pinconf-generic.h>
 #include <linux/pinctrl/pinconf.h>
 #include <linux/pinctrl/pinctrl.h>
@@ -739,7 +738,14 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev,
 		return ret;
 	}
 
-	nr_irq_parent = of_irq_count(np);
+	nr_irq_parent = platform_irq_count(pdev);
+	if (nr_irq_parent < 0) {
+		if (nr_irq_parent != -EPROBE_DEFER)
+			dev_err(dev, "Couldn't determine irq count: %pe\n",
+				ERR_PTR(nr_irq_parent));
+		return nr_irq_parent;
+	}
+
 	spin_lock_init(&info->irq_lock);
 
 	if (!nr_irq_parent) {
@@ -776,7 +782,7 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev,
 	if (!girq->parents)
 		return -ENOMEM;
 	for (i = 0; i < nr_irq_parent; i++) {
-		int irq = irq_of_parse_and_map(np, i);
+		int irq = platform_get_irq(pdev, i);
 
 		if (irq < 0)
 			continue;
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-01-23 15:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 12:43 [PATCH 1/2] pinctrl: mvebu: armada-37xx: use use platform api Peng Fan
2019-12-18 12:43 ` [PATCH 2/2] pinctrl: sunxi: sun50i-h5 use platform_irq_count Peng Fan
2020-01-07  8:56   ` Linus Walleij
2019-12-18 12:48 ` [PATCH 1/2] pinctrl: mvebu: armada-37xx: use use platform api Fabio Estevam
2019-12-18 12:53   ` Peng Fan
2019-12-18 12:57     ` Fabio Estevam
2019-12-18 14:59       ` Andrew Lunn
2019-12-18 15:09         ` Fabio Estevam
2019-12-18 15:28           ` Fabio Estevam
2020-01-08  7:52           ` Uwe Kleine-König
2020-01-16  8:28 ` Peng Fan
2020-01-23 15:06   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).