Re: [PATCH] clk: starfive: Make _clk_get become a common helper function

From: Stephen Boyd
Date: Mon Jan 13 2025 - 17:48:41 EST


Quoting Changhuang Liang (2024-11-20 19:14:26)
> Introduce num_reg to store the number of clocks, this helps to make
> _clk_get become a common helper function which called jh71x0_clk_get().
> With this, it helps to simplify the code and extend the code in the
> future.
>
> Signed-off-by: Changhuang Liang <changhuang.liang@xxxxxxxxxxxxxxxx>
> ---

I was waiting for someone to review this patch.

> drivers/clk/starfive/clk-starfive-jh7100-audio.c | 14 ++------------
> drivers/clk/starfive/clk-starfive-jh7110-aon.c | 14 ++------------
> drivers/clk/starfive/clk-starfive-jh7110-isp.c | 14 ++------------
> drivers/clk/starfive/clk-starfive-jh7110-stg.c | 14 ++------------
> drivers/clk/starfive/clk-starfive-jh7110-sys.c | 14 ++------------
> drivers/clk/starfive/clk-starfive-jh7110-vout.c | 14 ++------------
> drivers/clk/starfive/clk-starfive-jh71x0.c | 12 ++++++++++++
> drivers/clk/starfive/clk-starfive-jh71x0.h | 2 ++
> 8 files changed, 26 insertions(+), 72 deletions(-)
>
> diff --git a/drivers/clk/starfive/clk-starfive-jh71x0.h b/drivers/clk/starfive/clk-starfive-jh71x0.h
> index e3f441393e48..634d8cb91592 100644
> --- a/drivers/clk/starfive/clk-starfive-jh71x0.h
> +++ b/drivers/clk/starfive/clk-starfive-jh71x0.h
> @@ -117,9 +117,11 @@ struct jh71x0_clk_priv {
> struct clk *original_clk;
> struct notifier_block pll_clk_nb;
> struct clk_hw *pll[3];
> + unsigned int num_reg;
> struct jh71x0_clk reg[];

Please add __counted_by() annotation. Look at struct clk_hw_onecell_data
for an example.