Re: Virtual devices (cpufreq etc) and DT
From: Grant Likely <hidden>
Date: 2011-08-04 10:33:37
On Thu, Aug 4, 2011 at 11:23 AM, Jamie Iles [off-list ref] wrote:
Hi Rob, On Wed, Aug 03, 2011 at 11:29:16AM -0500, Rob Herring wrote: [...]quoted
Making of_clk_get take a struct device_node ptr instead of struct device fixes the problem. Here's a patch that does that. Rob From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> Subject: [PATCH] of/clk: use struct device_node for of_clk_get In order to allow clock retrieval without having a struct device, use the OF node pointer instead for of_clk_get. Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> --- drivers/clk/clkdev.c | 3 ++- drivers/of/clock.c | 12 +++++------- include/linux/of_clk.h | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-)diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 9252b4f..a8f1d29 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c@@ -89,7 +89,8 @@ struct clk *clk_get(struct device *dev, const char*con_id) const char *dev_id = dev ? dev_name(dev) : NULL; struct clk *clk; - clk = of_clk_get(dev, con_id); + if (dev) + clk = of_clk_get(dev->of_node, con_id); if (clk && __clk_get(clk)) return clk;I've just tried this patch and it works a treat, but I had to change this hunk to the one below to stop the compiler warning about a possible uninitialized use of clk.
You could also change of_clk_get() to simply return null if it is passed a null of_node. That would allow drivers to be a tad simpler. g.