[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <om5c5wmziw5wywzwp3qirruaaxjughcneupkyzl4hi3jzfuhhg@f5cfsjwabday>
Date: Thu, 15 Aug 2024 16:30:15 -0500
From: Bjorn Andersson <andersson@...nel.org>
To: Satya Priya Kakitapalli <quic_skakitap@...cinc.com>
Cc: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, Ajit Pandey <quic_ajipan@...cinc.com>,
Imran Shaik <quic_imrashai@...cinc.com>, Taniya Das <quic_tdas@...cinc.com>,
Jagadeesh Kona <quic_jkona@...cinc.com>, kernel test robot <lkp@...el.com>,
Dan Carpenter <dan.carpenter@...aro.org>, Vladimir Zapolskiy <vladimir.zapolskiy@...aro.org>
Subject: Re: [PATCH V2] clk: qcom: clk-alpha-pll: Simplify the
zonda_pll_adjust_l_val()
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@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Closes: https://lore.kernel.org/r/202408110724.8pqbpDiD-lkp@intel.com/
> Signed-off-by: Satya Priya Kakitapalli <quic_skakitap@...cinc.com>
> Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@...aro.org>
> ---
> 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
>
Powered by blists - more mailing lists