From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Gregory CLEMENT <gregory.clement@bootlin.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Fabien Dessenne <fabien.dessenne@foss.st.com>,
Linus Walleij <linus.walleij@linaro.org>,
<linux-gpio@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-amlogic@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
<linux-renesas-soc@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>,
Kevin Hilman <khilman@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
Andrew Lunn <andrew@lunn.ch>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: [PATCH v1 5/5] pinctrl: armada-37xx: Replace custom code by gpiochip_count() call
Date: Sat, 26 Mar 2022 11:41:31 +0300 [thread overview]
Message-ID: <3415996d-e8b5-2416-fb66-e65779a9b507@omp.ru> (raw)
In-Reply-To: <20220325200338.54270-5-andriy.shevchenko@linux.intel.com>
Hello!
On 3/25/22 11:03 PM, Andy Shevchenko wrote:
> Since we have generic function to count GPIO controller nodes
> under given device, there is no need to open code it. Replace
> custom code by gpiochip_count() call.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 24 +++++++++------------
> 1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> index 08cad14042e2..ba94125f6566 100644
> --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
> @@ -728,22 +728,18 @@ static int armada_37xx_irqchip_register(struct platform_device *pdev,
> struct gpio_irq_chip *girq = &gc->irq;
> struct device *dev = &pdev->dev;
> struct device_node *np;
> - int ret = -ENODEV, i, nr_irq_parent;
> + unsigned int nr_child_nodes, i;
> + int ret;
>
> /* Check if we have at least one gpio-controller child node */
> - for_each_child_of_node(dev->of_node, np) {
> - if (of_property_read_bool(np, "gpio-controller")) {
> - ret = 0;
> - break;
> - }
> - }
> - if (ret)
> - return dev_err_probe(dev, ret, "no gpio-controller child node\n");
> + nr_child_nodes = gpiochip_count(dev);
> + if (!nr_child_nodes)
> + return dev_err_probe(dev, -ENODEV, "no gpio-controller child node\n");
>
> - nr_irq_parent = of_irq_count(np);
> spin_lock_init(&info->irq_lock);
>
> - if (!nr_irq_parent) {
> + nr_child_nodes = of_irq_count(np);
Mhm, 'np' is no longer assigned to at this point...
> + if (!nr_child_nodes) {
> dev_err(dev, "invalid or no IRQ\n");
> return 0;
> }
[...]
MBR, Sergey
next prev parent reply other threads:[~2022-03-26 8:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 20:03 [PATCH v1 1/5] gpiolib: Introduce gpiochip_count() helper Andy Shevchenko
2022-03-25 20:03 ` [PATCH v1 2/5] pinctrl: stm32: Replace custom code by gpiochip_count() call Andy Shevchenko
2022-03-29 7:59 ` Fabien DESSENNE
2022-03-29 11:14 ` Andy Shevchenko
2022-03-29 12:07 ` Fabien DESSENNE
2022-03-29 12:25 ` Andy Shevchenko
2022-03-25 20:03 ` [PATCH v1 3/5] pinctrl: renesas: " Andy Shevchenko
2022-03-25 20:03 ` [PATCH v1 4/5] pinctrl: meson: " Andy Shevchenko
2022-03-29 12:29 ` Neil Armstrong
2022-03-25 20:03 ` [PATCH v1 5/5] pinctrl: armada-37xx: " Andy Shevchenko
2022-03-26 8:41 ` Sergey Shtylyov [this message]
2022-03-27 19:58 ` Andy Shevchenko
2022-03-28 7:35 ` [PATCH v1 1/5] gpiolib: Introduce gpiochip_count() helper Geert Uytterhoeven
2022-03-28 9:14 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3415996d-e8b5-2416-fb66-e65779a9b507@omp.ru \
--to=s.shtylyov@omp.ru \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=fabien.dessenne@foss.st.com \
--cc=geert+renesas@glider.be \
--cc=gregory.clement@bootlin.com \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linus.walleij@linaro.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=narmstrong@baylibre.com \
--cc=sebastian.hesselbarth@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox