Re: [PATCH 6.12.y-cip 2/8] clk: renesas: r9a09g077: Add xSPI core and module clocks

Pavel Machek <[email protected]> Thu, 16 Jul 2026 12:48:15 +0200
Newsgroups org.cip-project.lists.cip-dev
Message-ID <[email protected]>
Hi!

Minor details here:

> Signed-off-by: Geert Uytterhoeven <[email protected]>
> [PL: manually applied the changes]
> Signed-off-by: Lad Prabhakar <[email protected]>

> +++ b/drivers/clk/renesas/r9a09g077-cpg.c
> @@ -295,6 +334,151 @@ r9a09g077_cpg_mux_clk_register(struct device *dev,
>  	return clk_hw->clk;
>  }
>  
> +static unsigned int r9a09g077_cpg_fselxspi_get_divider(struct clk_hw *hw, unsigned long rate,
> +						       unsigned int num_parents)
> +{
> +	struct clk_fixed_factor *ff;
> +	struct clk_hw *parent_hw;
> +	unsigned long best_rate;
> +	unsigned int i;
> +
> +	for (i = 0; i < num_parents; i++) {
> +		parent_hw = clk_hw_get_parent_by_index(hw, i);
> +		best_rate = clk_hw_round_rate(parent_hw, rate);
> +
> +		if (best_rate == rate) {
> +			ff = to_clk_fixed_factor(parent_hw);
> +			return ff->div;
> +		}
> +	}
> +
> +	/* No parent could provide the exact rate - this should not happen */
> +	return 0;
> +}

If it can't happen, WARN() may be suitable?

> +
> +static struct clk * __init
> +r9a09g077_cpg_fselxspi_div_clk_register(struct device *dev,
> +					const struct cpg_core_clk *core,
> +					void __iomem *addr,
...
> +	if (!xspi_div_ops) {
> +		xspi_div_ops = devm_kzalloc(dev, sizeof(*xspi_div_ops), GFP_KERNEL);
> +		if (!xspi_div_ops)
> +			return  ERR_PTR(-ENOMEM);

One space would be enough between return and ERR.

> +		memcpy(xspi_div_ops, &clk_divider_ops,
> +		       sizeof(const struct clk_ops));

And the memcpy does fit on single line.

(May not be worth cleaning up unless you are doing changes for that anyway).

Thanks and best regards,
										Pavel
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCali27wAKCRAw5/Bqldv6
8pqLAKDBsXqSF7tgEPAYBDsAjn4nMF7ldgCeIwcUpIFZxRp5Si2h2FpjICXdnt8=
=h1jy
-----END PGP SIGNATURE-----