[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMFlhlml1yifewHY@gerhold.net>
Date: Wed, 26 Jul 2023 20:34:39 +0200
From: Stephan Gerhold <stephan@...hold.net>
To: Konrad Dybcio <konrad.dybcio@...aro.org>
Cc: Bjorn Andersson <andersson@...nel.org>,
Andy Gross <agross@...nel.org>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Marijn Suijten <marijn.suijten@...ainline.org>,
linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] clk: qcom: reset: Use the correct type of
sleep/delay based on length
On Wed, Jul 26, 2023 at 03:26:20PM +0200, Konrad Dybcio wrote:
> Based on the length of the delay (see: [1]), use the correct sleep/delay
> functions.
>
> [1] https://www.kernel.org/doc/Documentation/timers/timers-howto.txt
> Fixes: b36ba30c8ac6 ("clk: qcom: Add reset controller support")
If anything this would fix 2cb8a39b6781 ("clk: qcom: reset: Allow
specifying custom reset delay") since before there was udelay(1)
hardcoded (which is correct).
But given that we just allowed small delays <= 255us so far it was
probably okay-ish, so I think it's not worth bringing this to the
attention of backporters with the Fixes tag.
> Signed-off-by: Konrad Dybcio <konrad.dybcio@...aro.org>
> ---
> drivers/clk/qcom/reset.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c
> index 0e914ec7aeae..928995c3f369 100644
> --- a/drivers/clk/qcom/reset.c
> +++ b/drivers/clk/qcom/reset.c
> @@ -14,9 +14,15 @@
> static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)
> {
> struct qcom_reset_controller *rst = to_qcom_reset_controller(rcdev);
> + u16 delay_us = rst->reset_map[id].udelay ?: 1;
>
> rcdev->ops->assert(rcdev, id);
> - udelay(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */
> +
> + if (delay_us < 10)
> + udelay(delay_us);
> + else
> + usleep_range(delay_us, delay_us + 5);
> +
There is fsleep() that implements this logic in a similar way already:
fsleep(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */
Thanks,
Stephan
Powered by blists - more mailing lists