[PATCH RFC] clk: add support for automatic parent handling

Russell King - ARM Linux linux at arm.linux.org.uk
Fri Apr 29 18:07:46 EDT 2011


On Fri, Apr 29, 2011 at 05:31:44PM +0200, Thomas Gleixner wrote:
> Lets look at a simple example (locking omitted)
> 
> clk_enable(clk) {
> 	if (clk->enable_count == 0) {
>   	   res = clk->ops->enable(clk);
> 	   if (res)
> 	      return res;
>         }
> 	enable_count++;
> 	return 0;
> };   
> 
> So in each enable op you have:
> 
> *_enable(clk)
> {
> 	res = clk_enable(clk_get_parent(clk));
> 	if (res)
> 		return res;
> 
> 	res = hw_magic_enable(clk);
> 	if (res)
> 		clk_disable(clk_get_parent(clk));
> 	return res;
> }
> 
> Instead of having at the core level:
> 
> clk_enable(clk)
> {
> 	if (clk->enable_count == 0) {
> 		res = clk_enable(clk_get_parent(clk));
> 		if (res)
> 			return res;
> 
> 		res = clk->ops->enable(clk);
> 		if (res) {
> 			clk_disable(clk_get_parent(clk));
> 			return res;
> 		}
> 	}
> 	clk->enable_count++;
> 	return 0;
> }

I'm going to give up discussing this with you - you have no desire to
even understand what I'm saying.  I don't see any point continuing this
discussion any further.



More information about the linux-arm-kernel mailing list