devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@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:33:37 +0100	[thread overview]
Message-ID: <CACxGe6tq_fpcwVZPYvPTkoLkkU0c3KeuCR+-UQSCcZcAo9vOUA@mail.gmail.com> (raw)
In-Reply-To: <20110804102321.GC2899-apL1N+EY0C9YtYNIL7UdTEEOCMrvLtNR@public.gmane.org>

On Thu, Aug 4, 2011 at 11:23 AM, Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org> wrote:
> 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.

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.

  parent reply	other threads:[~2011-08-04 10:33 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
     [not found]         ` <20110804102321.GC2899-apL1N+EY0C9YtYNIL7UdTEEOCMrvLtNR@public.gmane.org>
2011-08-04 10:33           ` Grant Likely [this message]
     [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=CACxGe6tq_fpcwVZPYvPTkoLkkU0c3KeuCR+-UQSCcZcAo9vOUA@mail.gmail.com \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=jamie-wmLquQDDieKakBO8gow8eQ@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).