Re: [PATCH v4 07/11] clk: sunxi-ng: nm: Support finding closest rate

From: Frank Oltmanns
Date: Sun Jul 23 2023 - 03:26:38 EST



On 2023-07-17 at 16:12:30 +0200, Maxime Ripard <mripard@xxxxxxxxxx> wrote:
> [[PGP Signed Part:Undecided]]
> On Mon, Jul 17, 2023 at 03:34:31PM +0200, Frank Oltmanns wrote:
>> Use the helper function ccu_is_better_rate() to determine the rate that
>> is closest to the requested rate, thereby supporting rates that are
>> higher than the requested rate if the clock uses the
>> CCU_FEATURE_CLOSEST_RATE.
>>
>> Add the macro SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST which
>> sets CCU_FEATURE_CLOSEST_RATE.
>>
>> To avoid code duplication, add the macros
>> SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_FEAT that allows selecting
>> arbitrary features and use it in the original
>> SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX as well as the newly introduced
>> SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX_CLOSEST macros.
>>
>> Signed-off-by: Frank Oltmanns <frank@xxxxxxxxxxxx>
>> ---
>> drivers/clk/sunxi-ng/ccu_nm.c | 11 ++++------
>> drivers/clk/sunxi-ng/ccu_nm.h | 48 ++++++++++++++++++++++++++++++++++++++++---
>> 2 files changed, 49 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/clk/sunxi-ng/ccu_nm.c b/drivers/clk/sunxi-ng/ccu_nm.c
>> index c1fd11542c45..35d00783d748 100644
>> --- a/drivers/clk/sunxi-ng/ccu_nm.c
>> +++ b/drivers/clk/sunxi-ng/ccu_nm.c
>> @@ -28,7 +28,7 @@ static unsigned long ccu_nm_calc_rate(unsigned long parent,
>> }
>>
>> static unsigned long ccu_nm_find_best(unsigned long parent, unsigned long rate,
>> - struct _ccu_nm *nm)
>> + struct _ccu_nm *nm, struct ccu_common *common)
>
> The common pointer must be the first argument.
>

Same question as for patch 08: Should I also pull *nm to the beginning?
If so, do you have a preference on the order of *nm and *common?

Thanks,
Frank

>
> Once fixed,
> Acked-by: Maxime Ripard <mripard@xxxxxxxxxx>
>
> Maxime
>
> [[End of PGP Signed Part]]