From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] clk: bail out early when rate is already desired one
Date: Mon, 7 Jun 2021 17:46:12 +0200 [thread overview]
Message-ID: <8d61da9c-a55a-9c98-2918-7f9c95df324f@pengutronix.de> (raw)
In-Reply-To: <20210607141256.24801-1-s.hauer@pengutronix.de>
On 07.06.21 16:12, Sascha Hauer wrote:
> Return successfully from clk_set_rate() when the rate is already the
> desired one. This prevents a failure in clk_set_rate() when the current
> clock doesn't have a set_rate hook.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/clk/clk.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 8b90f30486..ba726c342c 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -169,6 +169,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
> if (IS_ERR(clk))
> return PTR_ERR(clk);
>
> + if (clk_get_rate(clk) == clk_round_rate(clk, rate))
> + return 0;
> +
> if (!clk->ops->set_rate)
> return -ENOSYS;
This means we can drop 459bf1fd31da ("ARM: clk: rk3188: don't set same
clk rate twice"), right?
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-06-07 15:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-07 14:12 Sascha Hauer
2021-06-07 15:46 ` Ahmad Fatoum [this message]
2021-06-16 8:29 ` Sascha Hauer
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=8d61da9c-a55a-9c98-2918-7f9c95df324f@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/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