From: Vladimir Zapolskiy <vz@mleia.com>
To: "André Gustavo Nakagomi Lopez" <andregnl@usp.br>,
jic23@kernel.org, lars@metafoo.de
Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: lpc18xx_adc: Reorder clk_get_rate function call
Date: Sun, 24 Oct 2021 23:12:39 +0300 [thread overview]
Message-ID: <bd79117b-91cc-da4b-abdd-2a41db8b330a@mleia.com> (raw)
In-Reply-To: <YXW3azIjPzGjvjTX@Andryuu.br>
Hi André,
On 10/24/21 10:43 PM, André Gustavo Nakagomi Lopez wrote:
> clk_get_rate is not garanteed to work if called before clk_prepare_enable.
typo, s/garanteed/guaranteed/
>
> Reorder clk_get_rate, so it's called after clk_prepare_enable and
> after devm_add_action_or_reset of lpc18xx_clk_disable.
>
> Signed-off-by: André Gustavo Nakagomi Lopez <andregnl@usp.br>
> ---
> drivers/iio/adc/lpc18xx_adc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/lpc18xx_adc.c b/drivers/iio/adc/lpc18xx_adc.c
> index ceefa4d793cf..ae9c9384f23e 100644
> --- a/drivers/iio/adc/lpc18xx_adc.c
> +++ b/drivers/iio/adc/lpc18xx_adc.c
> @@ -157,9 +157,6 @@ static int lpc18xx_adc_probe(struct platform_device *pdev)
> return dev_err_probe(&pdev->dev, PTR_ERR(adc->clk),
> "error getting clock\n");
>
> - rate = clk_get_rate(adc->clk);
> - clkdiv = DIV_ROUND_UP(rate, LPC18XX_ADC_CLK_TARGET);
> -
> adc->vref = devm_regulator_get(&pdev->dev, "vref");
> if (IS_ERR(adc->vref))
> return dev_err_probe(&pdev->dev, PTR_ERR(adc->vref),
> @@ -192,6 +189,9 @@ static int lpc18xx_adc_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> + rate = clk_get_rate(adc->clk);
> + clkdiv = DIV_ROUND_UP(rate, LPC18XX_ADC_CLK_TARGET);
> +
> adc->cr_reg = (clkdiv << LPC18XX_ADC_CR_CLKDIV_SHIFT) |
> LPC18XX_ADC_CR_PDN;
> writel(adc->cr_reg, adc->base + LPC18XX_ADC_CR);
>
Thank you for the change, per se this particular change is not needed on
LPC18xx/43xx platform, however I don't object to it.
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
--
Best wishes,
Vladimir
next prev parent reply other threads:[~2021-10-24 20:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-24 19:43 André Gustavo Nakagomi Lopez
2021-10-24 20:12 ` Vladimir Zapolskiy [this message]
2021-10-25 12:18 ` André Gustavo Nakagomi Lopez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bd79117b-91cc-da4b-abdd-2a41db8b330a@mleia.com \
--to=vz@mleia.com \
--cc=andregnl@usp.br \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®