[PATCH 04/10] clk: implement parent pass through functions

Stephen Boyd sboyd at codeaurora.org
Tue Apr 19 13:20:28 EDT 2011


On 04/15/2011 12:08 PM, Sascha Hauer wrote:
> A common case for clocks is that certain operations are not implemented
> and shall be passed through to the parent. Add convenience functions
> for this purpose
>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> Cc: Jeremy Kerr <jeremy.kerr at canonical.com>
>

I was hoping we could just build the parent handling into the core
instead of having every clk_ops->enable call the parent ops.

Something like: if the clk_ops doesn't have a get_parent,
clk_get_parent() would return NULL, and if the clk_ops doesn't have a
set_parent, clk_set_parent() would do nothing.

Then clk_enable()/clk_disable() would call clk_get_parent() and then
clk_enable() on that (whatever it is) before calling down into the
ops->enable() function. Of course this means NULL is now the "no parent"
value as opposed to ERR_PTR(-ENOSYS) but I'm willing to live with that
since it makes things a bit simpler when you only have to check for NULL
in the clk_enable()/clk_disable() path as opposed to NULL and IS_ERR.

I'm afraid this patch means every time the clk_ops wants to enable its
parent (which is almost always the case), it has to do so explicitly
when we really just want to concentrate on what enabling means for that
clock (namely setting some bits in some registers). Thoughts?

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.




More information about the linux-arm-kernel mailing list