Re: [PATCH V2] clk: qcom: clk-alpha-pll: Simplify the zonda_pll_adjust_l_val()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 14, 2024 at 03:50:05PM GMT, Satya Priya Kakitapalli wrote:
> In zonda_pll_adjust_l_val() replace the divide operator with comparison
> operator since comparisons are faster than divisions. Also, simplify the
> logic and remove the unnecessary 'quotient' local variable.
> 
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Closes: https://lore.kernel.org/r/202408110724.8pqbpDiD-lkp@xxxxxxxxx/
> Signed-off-by: Satya Priya Kakitapalli <quic_skakitap@xxxxxxxxxxx>
> Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@xxxxxxxxxx>
> ---
> Changes in V2:
>  - Simplify the logic and remove unnecessary quotient variable.
>  - Remove Fixes tag as this is just a simplification.
> 
>  drivers/clk/qcom/clk-alpha-pll.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c
> index 2f620ccb41cb..4ce3347beb39 100644
> --- a/drivers/clk/qcom/clk-alpha-pll.c
> +++ b/drivers/clk/qcom/clk-alpha-pll.c
> @@ -2120,14 +2120,11 @@ static void clk_zonda_pll_disable(struct clk_hw *hw)
>  
>  static void zonda_pll_adjust_l_val(unsigned long rate, unsigned long prate, u32 *l)
>  {
> -	u64 remainder, quotient;
> +	u64 remainder;
>  
> -	quotient = rate;
> -	remainder = do_div(quotient, prate);
> -	*l = quotient;
> +	remainder = do_div(rate, prate);

This does not compile on arm32 target.

Regards,
Bjorn

>  
> -	if ((remainder * 2) / prate)
> -		*l = *l + 1;
> +	*l = rate + (u32)(remainder * 2 >= prate);
>  }
>  
>  static int clk_zonda_pll_set_rate(struct clk_hw *hw, unsigned long rate,
> -- 
> 2.25.1
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux