Thread (20 messages) 20 messages, 5 authors, 10h ago

Re: [PATCH v2 3/6] clk: renesas: Add R-Car X5H CPG driver

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2026-07-09 09:50:04
Also in: linux-arm-kernel, linux-clk, linux-devicetree, linux-renesas-soc, lkml

Hi Marek,

On Wed, 8 Jul 2026 at 23:55, Marek Vasut [off-list ref] wrote:
On 7/8/26 12:15 PM, Geert Uytterhoeven wrote:
quoted
+static int register_fixed_clks(struct r8a78000_cpg_priv *priv)
+{
+     struct device *dev = priv->dev;
+     unsigned long rate;
+     struct clk_hw *hw;
+     const char *name;
+
+     for (unsigned int i = 0; i < ARRAY_SIZE(fixed_clk_rates); i++) {
+             rate = fixed_clk_rates[i];
+             name = devm_kasprintf(dev, GFP_KERNEL, "cpg-%lu", rate);
+             if (!name)
+                     return -ENOMEM;
+
+             hw = clk_hw_register_fixed_rate(dev, name, NULL, 0, rate);
Would it be viable to use devm_clk_hw_register_fixed_rate() here ?
Yes, I think so; thanks!
quoted
+             if (IS_ERR(hw)) {
+                     while (i-- > 0)
+                             clk_hw_unregister_fixed_rate(priv->fixed_hws[i]);
+                     return PTR_ERR(hw);
+             }
+
+             priv->fixed_hws[i] = hw;
+     }
+
+     return devm_add_action_or_reset(dev, unregister_fixed_clks, priv);
And then this, and unregister_fixed_clks() can go, and
r8a78000_cpg_priv.fixed_hws[] is no longer needed after probe.
quoted
+}
Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help