[RFC 1/2] ARM:Tegra: Device Tree Support: Initialize the audio card from the device tree.
Russell King - ARM Linux
linux at arm.linux.org.uk
Fri Jun 3 16:20:09 EST 2011
On Fri, Jun 03, 2011 at 10:32:52AM +0800, Barry Song wrote:
> but there is really no an unified rule by now, for exmaple, samsung
> just required platform device names matched with the string parameter
> to get a clock.
> it looks like clk_get in plat-samsung depends on the string more than
> device and the clock name is in SoC level.
Samsung has been broken in respect of this for quite some time, and I've
been nagging Ben about it ever since I provided clkdev. The problem is
that Ben doesn't have the time to fix Samsung...
> same situation for mach-at91/clock.c:
>
> /* clocks cannot be de-registered no refcounting necessary */
> struct clk *clk_get(struct device *dev, const char *id)
> {
> struct clk *clk;
>
> list_for_each_entry(clk, &clocks, node) {
> if (strcmp(id, clk->name) == 0)
> return clk;
> if (clk->function && (dev == clk->dev) && strcmp(id,
> clk->function) == 0)
> return clk;
> }
>
> return ERR_PTR(-ENOENT);
> }
> EXPORT_SYMBOL(clk_get);
That's broken, and it's incompatible with DT in any case because the
only way to set 'clk->dev' is to have devices statically declared.
OMAP used to be broken until I converted it to clkdev, and when I did
their drivers became more simple because they didn't need to ifdef
clocknames and such like.
> msm required device struct matched:
> struct clk *clk_get(struct device *dev, const char *id)
> {
> struct clk *clk;
>
> mutex_lock(&clocks_mutex);
>
> list_for_each_entry(clk, &clocks, list)
> if (!strcmp(id, clk->name) && clk->dev == dev)
> goto found_it;
>
> list_for_each_entry(clk, &clocks, list)
> if (!strcmp(id, clk->name) && clk->dev == NULL)
> goto found_it;
>
> clk = ERR_PTR(-ENOENT);
> found_it:
> mutex_unlock(&clocks_mutex);
> return clk;
> }
> EXPORT_SYMBOL(clk_get);
Again, that's incompatible with DT in any case, as we don't know what
'clk->dev' would be if the devices aren't statically declared. So this
is broken too.
Each need to be converted to clkdev _before_ they even start thinking
about device trees.
More information about the devicetree-discuss
mailing list