[RFC 2/3] clk: Using the "is_enabled" to determine the clock state

Sascha Hauer s.hauer at pengutronix.de
Fri Mar 15 04:52:35 EDT 2013


On Fri, Mar 15, 2013 at 10:35:39AM +0400, Alexander Shiyan wrote:
> 
> Signed-off-by: Alexander Shiyan <shc_work at mail.ru>
> ---
>  drivers/clk/clk.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index cb94755..d5dbbd9 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -213,6 +213,8 @@ int clk_register(struct clk *clk)
>  
>  	if (clk->flags & CLK_ALWAYS_ENABLED) {
>  		clk->enable_count = 1;
> +	} else if (clk->ops->is_enabled) {
> +		clk->enable_count = clk->ops->is_enabled(clk);
>  	}

No. The enable_count should be a pure software counter only which helps
us to keep track whether we can disable a clk on the next clk_disable or
whether there are still users left.

This reminds me that I created a similar patch for this a few days ago.
I'll send in a minute.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list