Re: [PATCH] clk: bail out early when rate is already desired one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux