* [PATCH] clk: davinci: Use of_get_available_child_by_name()
@ 2025-02-01 16:10 Biju Das
2025-02-26 23:52 ` Stephen Boyd
0 siblings, 1 reply; 3+ messages in thread
From: Biju Das @ 2025-02-01 16:10 UTC (permalink / raw)
To: David Lechner, Michael Turquette, Stephen Boyd
Cc: Biju Das, linux-clk, Geert Uytterhoeven, Biju Das
Simplify of_davinci_pll_init() by using of_get_available_child_by_name().
While at it, move of_node_put(child) inside the if block to avoid
additional check if of_child is NULL.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
This patch is only compile tested and depend upon[1]
[1] https://lore.kernel.org/all/20250201093126.7322-1-biju.das.jz@bp.renesas.com/
---
drivers/clk/davinci/pll.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/clk/davinci/pll.c b/drivers/clk/davinci/pll.c
index 82727b1fc67a..75b01f79414d 100644
--- a/drivers/clk/davinci/pll.c
+++ b/drivers/clk/davinci/pll.c
@@ -763,13 +763,13 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node,
return PTR_ERR(clk);
}
- child = of_get_child_by_name(node, "pllout");
- if (of_device_is_available(child))
+ child = of_get_available_child_by_name(node, "pllout");
+ if (child)
of_clk_add_provider(child, of_clk_src_simple_get, clk);
of_node_put(child);
- child = of_get_child_by_name(node, "sysclk");
- if (of_device_is_available(child)) {
+ child = of_get_available_child_by_name(node, "sysclk");
+ if (child) {
struct clk_onecell_data *clk_data;
struct clk **clks;
int n_clks = max_sysclk_id + 1;
@@ -803,11 +803,11 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node,
clks[(*div_info)->id] = clk;
}
of_clk_add_provider(child, of_clk_src_onecell_get, clk_data);
+ of_node_put(child);
}
- of_node_put(child);
- child = of_get_child_by_name(node, "auxclk");
- if (of_device_is_available(child)) {
+ child = of_get_available_child_by_name(node, "auxclk");
+ if (child) {
char child_name[MAX_NAME_SIZE];
snprintf(child_name, MAX_NAME_SIZE, "%s_auxclk", info->name);
@@ -818,11 +818,12 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node,
child_name, PTR_ERR(clk));
else
of_clk_add_provider(child, of_clk_src_simple_get, clk);
+
+ of_node_put(child);
}
- of_node_put(child);
- child = of_get_child_by_name(node, "obsclk");
- if (of_device_is_available(child)) {
+ child = of_get_available_child_by_name(node, "obsclk");
+ if (child) {
if (obsclk_info)
clk = davinci_pll_obsclk_register(dev, obsclk_info, base);
else
@@ -833,8 +834,8 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node,
PTR_ERR(clk));
else
of_clk_add_provider(child, of_clk_src_simple_get, clk);
+ of_node_put(child);
}
- of_node_put(child);
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: davinci: Use of_get_available_child_by_name()
2025-02-01 16:10 [PATCH] clk: davinci: Use of_get_available_child_by_name() Biju Das
@ 2025-02-26 23:52 ` Stephen Boyd
2025-02-27 6:24 ` Biju Das
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2025-02-26 23:52 UTC (permalink / raw)
To: Biju Das, David Lechner, Michael Turquette
Cc: Biju Das, linux-clk, Geert Uytterhoeven, Biju Das
Quoting Biju Das (2025-02-01 08:10:09)
> Simplify of_davinci_pll_init() by using of_get_available_child_by_name().
>
> While at it, move of_node_put(child) inside the if block to avoid
> additional check if of_child is NULL.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> This patch is only compile tested and depend upon[1]
> [1] https://lore.kernel.org/all/20250201093126.7322-1-biju.das.jz@bp.renesas.com/
> ---
Please resend this when the dependency is in Linus' tree.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] clk: davinci: Use of_get_available_child_by_name()
2025-02-26 23:52 ` Stephen Boyd
@ 2025-02-27 6:24 ` Biju Das
0 siblings, 0 replies; 3+ messages in thread
From: Biju Das @ 2025-02-27 6:24 UTC (permalink / raw)
To: Stephen Boyd, David Lechner, Michael Turquette
Cc: linux-clk@vger.kernel.org, Geert Uytterhoeven, biju.das.au
Hi Stephan,
> -----Original Message-----
> From: Stephen Boyd <sboyd@kernel.org>
> Sent: 26 February 2025 23:53
> Subject: Re: [PATCH] clk: davinci: Use of_get_available_child_by_name()
>
> Quoting Biju Das (2025-02-01 08:10:09)
> > Simplify of_davinci_pll_init() by using of_get_available_child_by_name().
> >
> > While at it, move of_node_put(child) inside the if block to avoid
> > additional check if of_child is NULL.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > This patch is only compile tested and depend upon[1] [1]
> > https://lore.kernel.org/all/20250201093126.7322-1-biju.das.jz@bp.renes
> > as.com/
> > ---
>
> Please resend this when the dependency is in Linus' tree.
Sure.
Cheers,
Biju
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-27 6:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-01 16:10 [PATCH] clk: davinci: Use of_get_available_child_by_name() Biju Das
2025-02-26 23:52 ` Stephen Boyd
2025-02-27 6:24 ` Biju Das
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox