From: jonathanh@nvidia.com (Jon Hunter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/5] soc/tegra: pmc: Use of_clk_get_parent_count() instead of open coding
Date: Wed, 11 Apr 2018 10:07:47 +0100 [thread overview]
Message-ID: <a96706de-f680-7ef2-53fd-d2cf07b6061b@nvidia.com> (raw)
In-Reply-To: <1523364701-15383-5-git-send-email-geert+renesas@glider.be>
On 10/04/18 13:51, Geert Uytterhoeven wrote:
> As of_clk_get_parent_count() returns zero on failure, while
> of_count_phandle_with_args() might return a negative error code, this
> also fixes the issue of possibly using a very big number in the
> allocation below.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This depends on "[PATCH v2 1/5] clk: Extract OF clock helpers in
> <linux/of_clk.h>".
>
> v2:
> - of_clk_get_parent_count() was moved to <linux/of_clk.h>.
> ---
> drivers/soc/tegra/pmc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
> index d9fcdb592b3966a5..d8cb48a4b8eb1b78 100644
> --- a/drivers/soc/tegra/pmc.c
> +++ b/drivers/soc/tegra/pmc.c
> @@ -31,6 +31,7 @@
> #include <linux/iopoll.h>
> #include <linux/of.h>
> #include <linux/of_address.h>
> +#include <linux/of_clk.h>
> #include <linux/of_platform.h>
> #include <linux/platform_device.h>
> #include <linux/pm_domain.h>
> @@ -725,7 +726,7 @@ static int tegra_powergate_of_get_clks(struct tegra_powergate *pg,
> unsigned int i, count;
> int err;
>
> - count = of_count_phandle_with_args(np, "clocks", "#clock-cells");
> + count = of_clk_get_parent_count(np);
> if (count == 0)
> return -ENODEV;
>
>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Cheers
Jon
next prev parent reply other threads:[~2018-04-11 9:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 12:51 [PATCH v2 0/5] Use of_clk_get_parent_count() instead of open coding Geert Uytterhoeven
2018-04-10 12:51 ` [PATCH v2 1/5] clk: Extract OF clock helpers in <linux/of_clk.h> Geert Uytterhoeven
2018-04-10 13:15 ` Heiko Stuebner
2018-04-13 21:16 ` Rob Herring
2018-04-16 16:05 ` Stephen Boyd
2018-04-10 12:51 ` [PATCH v2 2/5] ARM: timer-sp: Use of_clk_get_parent_count() instead of open coding Geert Uytterhoeven
2018-04-17 8:50 ` Daniel Lezcano
2018-04-26 11:56 ` Linus Walleij
2018-04-10 12:51 ` [PATCH v2 3/5] soc: rockchip: power-domain: " Geert Uytterhoeven
2018-04-10 13:17 ` Heiko Stuebner
2018-04-10 12:51 ` [PATCH v2 4/5] soc/tegra: pmc: " Geert Uytterhoeven
2018-04-11 9:07 ` Jon Hunter [this message]
2018-04-10 12:51 ` [PATCH v2 5/5] pinctrl: sunxi: " Geert Uytterhoeven
2018-04-10 13:01 ` Maxime Ripard
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=a96706de-f680-7ef2-53fd-d2cf07b6061b@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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