Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: sunxi: sun50i-h5 use platform_irq_count

platform_irq_count() 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>
Link: https://lore.kernel.org/r/1576672860-14420-2-git-send-email-peng.fan@nxp.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Peng Fan and committed by
Linus Walleij
f314f20b 4b4e41f3

+11 -2
+11 -2
drivers/pinctrl/sunxi/pinctrl-sun50i-h5.c
··· 19 19 #include <linux/platform_device.h> 20 20 #include <linux/of.h> 21 21 #include <linux/of_device.h> 22 - #include <linux/of_irq.h> 23 22 #include <linux/pinctrl/pinctrl.h> 24 23 25 24 #include "pinctrl-sunxi.h" ··· 548 549 549 550 static int sun50i_h5_pinctrl_probe(struct platform_device *pdev) 550 551 { 551 - switch (of_irq_count(pdev->dev.of_node)) { 552 + int ret; 553 + 554 + ret = platform_irq_count(pdev); 555 + if (ret < 0) { 556 + if (ret != -EPROBE_DEFER) 557 + dev_err(&pdev->dev, "Couldn't determine irq count: %pe\n", 558 + ERR_PTR(ret)); 559 + return ret; 560 + } 561 + 562 + switch (ret) { 552 563 case 2: 553 564 dev_warn(&pdev->dev, 554 565 "Your device tree's pinctrl node is broken, which has no IRQ of PG bank routed.\n");