Re: [PATCH v13 4/5] clk: en7523: generalize register clocks function
From: Brian Masney
Date: Thu Nov 19 2026 - 19:04:24 EST
Hi Christian,
On Tue, Nov 17, 2026 at 07:24:42PM +0100, Christian Marangi wrote:
> Airoha AN7583 SoC will use the same logic used by Airoha EN7581 SoC to
> register clocks. Generalize it to register clocks defined in soc_data.
>
> Add the clocks definition in EN7581 SoC to support this new implementation.
>
> Signed-off-by: Christian Marangi <ansuelsmth@xxxxxxxxx>
> ---
> drivers/clk/clk-en7523.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
> index 6aa6dfaf414e..f12b69f8d453 100644
> --- a/drivers/clk/clk-en7523.c
> +++ b/drivers/clk/clk-en7523.c
> @@ -147,6 +147,7 @@ struct en_clk_priv {
>
> struct en_clk_soc_data {
> u32 num_clocks;
> + const struct en_clk_desc *base_clks;
> const struct clk_ops pcie_ops;
> int (*hw_init)(struct platform_device *pdev,
> struct clk_hw_onecell_data *clk_data);
> @@ -802,12 +803,15 @@ static int en7523_clk_hw_init(struct platform_device *pdev,
> static void en7581_register_clocks(struct device *dev, struct clk_hw_onecell_data *clk_data,
> struct regmap *map, void __iomem *base)
> {
> + const struct en_clk_soc_data *soc_data;
> struct clk_hw *hw;
> u32 rate;
> int i;
>
> - for (i = 0; i < ARRAY_SIZE(en7581_base_clks); i++) {
> - const struct en_clk_desc *desc = &en7581_base_clks[i];
> + soc_data = device_get_match_data(dev);
> +
> + for (i = 0; i < soc_data->num_clocks - 1; i++) {
Can there be a proper count stored so that you don't have to do the - 1
here. If I recall, that's done in some other places in this driver.
Brian