Re: [PATCH 07/19] clk: fixed-factor: add clk_hw_register_fixed_factor_with_accuracy

Stephen Boyd
2025-09-20T05:14:59Z

Quoting Benoît Monin (2025-09-03 05:47:14)
> diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
> index e62ae8794d445f685156276d5135448f340fca3f..7c76658a725f9b268da2485769979e5ba213d25b 100644
> --- a/drivers/clk/clk-fixed-factor.c
> +++ b/drivers/clk/clk-fixed-factor.c
> @@ -217,6 +217,18 @@ struct clk_hw *clk_hw_register_fixed_factor(struct device *dev,
> }
> EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor);
>
> +struct clk_hw *clk_hw_register_fixed_factor_with_accuracy(struct device *dev,
> + const char *name, const char *parent_name, unsigned long flags,
> + unsigned int mult, unsigned int div, unsigned long acc)
> +{
> + const struct clk_parent_data pdata = { .index = -1 };

This is wrong. We're passing parent data and also setting the parent
name with a string the original way. Do you have a parent?

> +
> + return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL,
> + &pdata, flags, mult, div, acc,
> + CLK_FIXED_FACTOR_FIXED_ACCURACY, false);
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor_with_accuracy);

There are a handful of these wrappers now. Can we have one function that
takes all possibilities and then static inline functions that call one
exported function? We can pass some structs to that function to keep
the argument count "low", so those structs live on the stack for a short
time.

> +
> struct clk_hw *clk_hw_register_fixed_factor_fwname(struct device *dev,
> struct device_node *np, const char *name, const char *fw_name,
> unsigned long flags, unsigned int mult, unsigned int div)