[PATCH 06/10] clk: Add support for a generic clock multiplexer
Russell King - ARM Linux
linux at arm.linux.org.uk
Mon Apr 18 14:34:21 EDT 2011
On Mon, Apr 18, 2011 at 10:54:49AM -0700, Stephen Boyd wrote:
> On 04/18/2011 06:33 AM, Sascha Hauer wrote:
> >>>
> >>> +/**
> >>> + * clock multiplexer
> >>> + *
> >>> + * @clk clock source
> >>> + * @reg the register this multiplexer can be configured with
> >>> + * @shift the shift to the start bit of this multiplexer
> >>> + * @width the width in bits of this multiplexer
> >>> + * @num_clks number of parent clocks
> >>> + * @lock register lock
> >>> + * @clks array of possible parents for this multiplexer. Can contain
> >>> + * holes with NULL in it for invalid register settings
> >> NULL is a valid clk, isn't it?
> > You're right. I think for invalid mux settings we should ERR_PTR(-EINVAL)
> > or similar to the array.
>
> Note that if you're using clkdev you can't actually return a NULL clock
> to the caller of clk_get() due to:
>
> struct clk *clk_get_sys(const char *dev_id, const char *con_id)
> {
> struct clk *clk;
>
> mutex_lock(&clocks_mutex);
> clk = clk_find(dev_id, con_id);
> if (clk && !__clk_get(clk))
> clk = NULL;
> mutex_unlock(&clocks_mutex);
>
> return clk ? clk : ERR_PTR(-ENOENT);
> }
>
>
> So all this talk about NULL being a valid clock returned to drivers is
> kinda pointless unless the mach has a custom clk_get() implementation.
Oops, clk_get_sys() and clk_find() really should be fixed for this. I'll
sort a patch for it.
More information about the linux-arm-kernel
mailing list