mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Denis Orlov <denorl2009@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] clk: fix clk_round_rate() behaviour
Date: Mon, 16 May 2022 11:07:21 +0200	[thread overview]
Message-ID: <20220516090721.GN25578@pengutronix.de> (raw)
In-Reply-To: <20220516070049.11963-1-denorl2009@gmail.com>

Hi Denis,

On Mon, May 16, 2022 at 10:00:49AM +0300, Denis Orlov wrote:
> Right now this function returns the current rate of the clock in the
> case when the round_rate() is not given in the clock's ops. This breaks
> clk_set_rate(), which calls clk_round_rate() to check if the resulting
> frequency would be the same as the one that is already set.
> Make it so that clk_round_rate() returns the frequency that was given as
> argument in this case.
> 
> Signed-off-by: Denis Orlov <denorl2009@gmail.com>
> ---
>  drivers/clk/clk.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 52e309e877..7492717d3c 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -139,16 +139,16 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
>  	if (IS_ERR(clk))
>  		return 0;
>  
> +	if (!clk->ops->round_rate)
> +		return rate;
> +
>  	parent = clk_get_parent(clk);
>  	if (parent)
>  		parent_rate = clk_get_rate(parent);
>  
>  	hw = clk_to_clk_hw(clk);
>  
> -	if (clk->ops->round_rate)
> -		return clk->ops->round_rate(hw, rate, &parent_rate);
> -
> -	return clk_get_rate(clk);
> +	return clk->ops->round_rate(hw, rate, &parent_rate);
>  }

I smell problems with this patch. Which clocks do you have that do not
have a round_rate hook but still allow to set its rate?

Sascha

-- 
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


  reply	other threads:[~2022-05-16  9:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16  7:00 Denis Orlov
2022-05-16  9:07 ` Sascha Hauer [this message]
2022-05-19  8:12   ` Денис Орлов

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=20220516090721.GN25578@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=denorl2009@gmail.com \
    /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