From: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
To: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: Virtual devices (cpufreq etc) and DT
Date: Thu, 4 Aug 2011 11:23:21 +0100 [thread overview]
Message-ID: <20110804102321.GC2899@pulham.picochip.com> (raw)
In-Reply-To: <4E39775C.4090305-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Hi Rob,
On Wed, Aug 03, 2011 at 11:29:16AM -0500, Rob Herring wrote:
[...]
> 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.
Jamie
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index f2b1224..bc5ae55 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -80,9 +80,10 @@ EXPORT_SYMBOL(clk_get_sys);
struct clk *clk_get(struct device *dev, const char *con_id)
{
const char *dev_id = dev ? dev_name(dev) : NULL;
- struct clk *clk;
+ struct clk *clk = NULL;
- clk = of_clk_get(dev, con_id);
+ if (dev->of_node)
+ clk = of_clk_get(dev->of_node, con_id);
if (clk && __clk_get(clk))
return clk;
next prev parent reply other threads:[~2011-08-04 10:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-03 9:50 Virtual devices (cpufreq etc) and DT Jamie Iles
[not found] ` <20110803095019.GB2607-apL1N+EY0C9YtYNIL7UdTEEOCMrvLtNR@public.gmane.org>
2011-08-03 16:29 ` Rob Herring
[not found] ` <4E39775C.4090305-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-08-03 16:41 ` Jamie Iles
[not found] ` <20110803164128.GQ2607-apL1N+EY0C9YtYNIL7UdTEEOCMrvLtNR@public.gmane.org>
2011-08-03 16:54 ` Rob Herring
[not found] ` <4E397D29.4090500-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-08-04 9:54 ` Jamie Iles
2011-08-04 10:23 ` Jamie Iles [this message]
[not found] ` <20110804102321.GC2899-apL1N+EY0C9YtYNIL7UdTEEOCMrvLtNR@public.gmane.org>
2011-08-04 10:33 ` Grant Likely
[not found] ` <CACxGe6tq_fpcwVZPYvPTkoLkkU0c3KeuCR+-UQSCcZcAo9vOUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-04 10:44 ` Jamie Iles
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110804102321.GC2899@pulham.picochip.com \
--to=jamie-wmlquqddiekakbo8gow8eq@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).