Skip to content

Commit fa3e973

Browse files
bijudasgeertu
authored andcommitted
clk: renesas: rzg2l: Add rzg2l_mod_clock_init_mstop_helper()
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>
1 parent 867fb0b commit fa3e973

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

drivers/clk/renesas/rzg2l-cpg.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,20 @@ static struct mstop *rzg2l_mod_clock_get_mstop(struct rzg2l_cpg_priv *priv, u32
15941594
return NULL;
15951595
}
15961596

1597+
static void rzg2l_mod_clock_init_mstop_helper(struct rzg2l_cpg_priv *priv,
1598+
struct mod_clock *clk)
1599+
{
1600+
/*
1601+
* Out of reset all modules are enabled. Set module state in case
1602+
* associated clocks are disabled at probe. Otherwise module is in
1603+
* invalid HW state.
1604+
*/
1605+
scoped_guard(spinlock_irqsave, &priv->rmw_lock) {
1606+
if (!rzg2l_mod_clock_is_enabled(&clk->hw))
1607+
rzg2l_mod_clock_module_set_state(clk, true);
1608+
}
1609+
}
1610+
15971611
static void rzg2l_mod_clock_init_mstop(struct rzg2l_cpg_priv *priv)
15981612
{
15991613
struct mod_clock *clk;
@@ -1603,15 +1617,7 @@ static void rzg2l_mod_clock_init_mstop(struct rzg2l_cpg_priv *priv)
16031617
if (!clk->mstop)
16041618
continue;
16051619

1606-
/*
1607-
* Out of reset all modules are enabled. Set module state
1608-
* in case associated clocks are disabled at probe. Otherwise
1609-
* module is in invalid HW state.
1610-
*/
1611-
scoped_guard(spinlock_irqsave, &priv->rmw_lock) {
1612-
if (!rzg2l_mod_clock_is_enabled(&clk->hw))
1613-
rzg2l_mod_clock_module_set_state(clk, true);
1614-
}
1620+
rzg2l_mod_clock_init_mstop_helper(priv, clk);
16151621
}
16161622
}
16171623

0 commit comments

Comments
 (0)