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

Russell King - ARM Linux linux at arm.linux.org.uk
Fri Apr 29 06:30:55 EDT 2011


On Wed, Apr 20, 2011 at 09:52:15PM +0200, Thomas Gleixner wrote:
> On Wed, 20 Apr 2011, Uwe Kleine-König wrote:
> > struct clk has no parent member, there is only clk_get_parent(). If
> 
> Which is a complete failure to begin with. Why the heck do you need a
> callback to figure that out?

Thomas, you're wrong.  You're looking at things far too simply, because
all you can see is a tree of clocks.

When you have MUXes, a clock can have one of many parents.  So a single
clk->parent doesn't hack it.  That's one reason why clk_get_parent()
exists, so that MUXes can return the appropriate parent for the current
MUX setting.

You may wish to store the current setting in clk->parent, but I'd argue
that's a recipe for things going wrong when the MUX settings differ from
the cached clk->parent value.  Instead, having clk_get_parent()s
implementation return the _current_ parent and let MUXes do the right
thing depending on hardware is much easier and more reliably correct.

So I don't agree with you on some of these points.



More information about the linux-arm-kernel mailing list