]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: renesas: rzg2l: Add rzg2l_mod_clock_init_mstop_helper()
authorBiju Das <biju.das.jz@bp.renesas.com>
Tue, 24 Mar 2026 11:43:10 +0000 (11:43 +0000)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 26 Mar 2026 18:40:17 +0000 (19:40 +0100)
Refactor the mstop initialisation logic in rzg2l_mod_clock_init_mstop()
into a dedicated helper function rzg2l_mod_clock_init_mstop_helper().
This decouples the logic for setting module stop state on disabled
clocks from the iteration loop, allowing it to be reused during resume
to re-enable critical clocks.

No functional change.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20260324114329.268249-6-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/clk/renesas/rzg2l-cpg.c

index a38401c18dcfb9e6e14148eb7aa80d3ab0e68e70..738a4b182f27bcf4bda23281d816e09ed6c56d6a 100644 (file)
@@ -1594,6 +1594,20 @@ static struct mstop *rzg2l_mod_clock_get_mstop(struct rzg2l_cpg_priv *priv, u32
        return NULL;
 }
 
+static void rzg2l_mod_clock_init_mstop_helper(struct rzg2l_cpg_priv *priv,
+                                             struct mod_clock *clk)
+{
+       /*
+        * Out of reset all modules are enabled. Set module state in case
+        * associated clocks are disabled at probe. Otherwise module is in
+        * invalid HW state.
+        */
+       scoped_guard(spinlock_irqsave, &priv->rmw_lock) {
+               if (!rzg2l_mod_clock_is_enabled(&clk->hw))
+                       rzg2l_mod_clock_module_set_state(clk, true);
+       }
+}
+
 static void rzg2l_mod_clock_init_mstop(struct rzg2l_cpg_priv *priv)
 {
        struct mod_clock *clk;
@@ -1603,15 +1617,7 @@ static void rzg2l_mod_clock_init_mstop(struct rzg2l_cpg_priv *priv)
                if (!clk->mstop)
                        continue;
 
-               /*
-                * Out of reset all modules are enabled. Set module state
-                * in case associated clocks are disabled at probe. Otherwise
-                * module is in invalid HW state.
-                */
-               scoped_guard(spinlock_irqsave, &priv->rmw_lock) {
-                       if (!rzg2l_mod_clock_is_enabled(&clk->hw))
-                               rzg2l_mod_clock_module_set_state(clk, true);
-               }
+               rzg2l_mod_clock_init_mstop_helper(priv, clk);
        }
 }