From: Rob Herring <robherring2@gmail.com>
To: Rajendra Nayak <rnayak@ti.com>
Cc: Mike Turquette <mturquette@ti.com>,
Shawn Guo <shawn.guo@linaro.org>,
Prashant Gaikwad <pgaikwad@nvidia.com>,
aletes.xgr@gmail.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Archit Taneja <archit@ti.com>, loml <linux-omap@vger.kernel.org>,
Tony Lindgren <tony@atomide.com>,
"Cousson, Benoit" <b-cousson@ti.com>
Subject: Re: [PATCH] clk: fix compile for OF && !COMMON_CLK
Date: Tue, 17 Jul 2012 08:46:27 -0500 [thread overview]
Message-ID: <50056CB3.90004@gmail.com> (raw)
In-Reply-To: <50056648.6000906@ti.com>
On 07/17/2012 08:19 AM, Rajendra Nayak wrote:
> Rob, Mike,
>
> On Tuesday 17 July 2012 07:38 AM, Rob Herring wrote:
>> On 07/16/2012 07:12 PM, Mike Turquette wrote:
>>> On 20120716-16:46, Rob Herring wrote:
>>>> From: Rob Herring<rob.herring@calxeda.com>
>>>>
>>>> With commit 766e6a4ec602d0c107 (clk: add DT clock binding support),
>>>> compiling with OF&& !COMMON_CLK is broken.
>>>>
>>>
>>> Hi Rob,
>>>
>>> Thanks for sending this quickly.
>>>
>>> <snip>
>>>> @@ -313,19 +314,19 @@ int clk_add_alias(const char *alias, const
>>>> char *alias_dev_name, char *id,
>>>> struct device_node;
>>>> struct of_phandle_args;
>>>>
>>>> -#ifdef CONFIG_OF
>>>> +#if defined(CONFIG_OF)&& defined(CONFIG_COMMON_CLK)
>>>> struct clk *of_clk_get(struct device_node *np, int index);
>>>> struct clk *of_clk_get_by_name(struct device_node *np, const char
>>>> *name);
>>>> struct clk *of_clk_get_from_provider(struct of_phandle_args
>>>> *clkspec);
>>>> #else
>>>> static inline struct clk *of_clk_get(struct device_node *np, int
>>>> index)
>>>> {
>>>> - return NULL;
>>>> + return ERR_PTR(-EINVAL);
>
> So how is this expected to work on platforms (like OMAP) which have
> CONFIG_OF enabled but not CONFIG_COMMON_CLK?
>
As I mentioned in my other reply, this really belongs with Shawn's patch
that changes the return value checking from NULL to err values.
> Archit has been seeing issues with failed clk_get's in the omap dss
> driver on linux-next.
> The clk_gets pass a valid dev pointer and an alias/con-id.
>
> With the $Subject patch, the of_clk_get_by_name() for our builds always
> returns a ERR_PTR(-EINVAL).
>
> Even if we do get the right of_clk_get_by_name() built in,
> there is another issue on OMAP where in we have CONFIG_OF
> enabled/selected by default for all OMAP2+ builds, even when we
> *do not* pass a dt blob to the kernel.
>
> So would the below code fail in such cases because it expects a
> valid of_node to be populated for a device (which also has clock
> information in it)? if CONFIG_OF is set.
>
> struct clk *clk_get(struct device *dev, const char *con_id)
> {
> const char *dev_id = dev ? dev_name(dev) : NULL;
> struct clk *clk;
>
> if (dev) {
> ---->
> Any reason why this isn't
> if (dev->of_node) {
> ---->
dev may be null, we could do (dev && dev->of_node) though. Either way
the error handling here needs to do the right thing.
> clk = of_clk_get_by_name(dev->of_node, con_id);
> if (clk && __clk_get(clk))
> return clk;
> }
>
> return clk_get_sys(dev_id, con_id);
> }
>
> regards,
> Rajendra
>
>
>
>
>
WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: fix compile for OF && !COMMON_CLK
Date: Tue, 17 Jul 2012 08:46:27 -0500 [thread overview]
Message-ID: <50056CB3.90004@gmail.com> (raw)
In-Reply-To: <50056648.6000906@ti.com>
On 07/17/2012 08:19 AM, Rajendra Nayak wrote:
> Rob, Mike,
>
> On Tuesday 17 July 2012 07:38 AM, Rob Herring wrote:
>> On 07/16/2012 07:12 PM, Mike Turquette wrote:
>>> On 20120716-16:46, Rob Herring wrote:
>>>> From: Rob Herring<rob.herring@calxeda.com>
>>>>
>>>> With commit 766e6a4ec602d0c107 (clk: add DT clock binding support),
>>>> compiling with OF&& !COMMON_CLK is broken.
>>>>
>>>
>>> Hi Rob,
>>>
>>> Thanks for sending this quickly.
>>>
>>> <snip>
>>>> @@ -313,19 +314,19 @@ int clk_add_alias(const char *alias, const
>>>> char *alias_dev_name, char *id,
>>>> struct device_node;
>>>> struct of_phandle_args;
>>>>
>>>> -#ifdef CONFIG_OF
>>>> +#if defined(CONFIG_OF)&& defined(CONFIG_COMMON_CLK)
>>>> struct clk *of_clk_get(struct device_node *np, int index);
>>>> struct clk *of_clk_get_by_name(struct device_node *np, const char
>>>> *name);
>>>> struct clk *of_clk_get_from_provider(struct of_phandle_args
>>>> *clkspec);
>>>> #else
>>>> static inline struct clk *of_clk_get(struct device_node *np, int
>>>> index)
>>>> {
>>>> - return NULL;
>>>> + return ERR_PTR(-EINVAL);
>
> So how is this expected to work on platforms (like OMAP) which have
> CONFIG_OF enabled but not CONFIG_COMMON_CLK?
>
As I mentioned in my other reply, this really belongs with Shawn's patch
that changes the return value checking from NULL to err values.
> Archit has been seeing issues with failed clk_get's in the omap dss
> driver on linux-next.
> The clk_gets pass a valid dev pointer and an alias/con-id.
>
> With the $Subject patch, the of_clk_get_by_name() for our builds always
> returns a ERR_PTR(-EINVAL).
>
> Even if we do get the right of_clk_get_by_name() built in,
> there is another issue on OMAP where in we have CONFIG_OF
> enabled/selected by default for all OMAP2+ builds, even when we
> *do not* pass a dt blob to the kernel.
>
> So would the below code fail in such cases because it expects a
> valid of_node to be populated for a device (which also has clock
> information in it)? if CONFIG_OF is set.
>
> struct clk *clk_get(struct device *dev, const char *con_id)
> {
> const char *dev_id = dev ? dev_name(dev) : NULL;
> struct clk *clk;
>
> if (dev) {
> ---->
> Any reason why this isn't
> if (dev->of_node) {
> ---->
dev may be null, we could do (dev && dev->of_node) though. Either way
the error handling here needs to do the right thing.
> clk = of_clk_get_by_name(dev->of_node, con_id);
> if (clk && __clk_get(clk))
> return clk;
> }
>
> return clk_get_sys(dev_id, con_id);
> }
>
> regards,
> Rajendra
>
>
>
>
>
next prev parent reply other threads:[~2012-07-17 13:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-16 21:46 [PATCH] clk: fix compile for OF && !COMMON_CLK Rob Herring
2012-07-16 21:46 ` Rob Herring
2012-07-17 0:12 ` Mike Turquette
2012-07-17 0:12 ` Mike Turquette
2012-07-17 2:08 ` Rob Herring
2012-07-17 2:08 ` Rob Herring
2012-07-17 13:19 ` Rajendra Nayak
2012-07-17 13:19 ` Rajendra Nayak
2012-07-17 13:34 ` Rajendra Nayak
2012-07-17 13:34 ` Rajendra Nayak
2012-07-17 13:46 ` Rob Herring [this message]
2012-07-17 13:46 ` Rob Herring
2012-07-17 13:54 ` Rajendra Nayak
2012-07-17 13:54 ` Rajendra Nayak
2012-07-17 0:43 ` Alexandre Pereira da Silva
2012-07-17 0:43 ` Alexandre Pereira da Silva
2012-07-17 4:58 ` Prashant Gaikwad
2012-07-17 4:58 ` Prashant Gaikwad
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=50056CB3.90004@gmail.com \
--to=robherring2@gmail.com \
--cc=aletes.xgr@gmail.com \
--cc=archit@ti.com \
--cc=b-cousson@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mturquette@ti.com \
--cc=pgaikwad@nvidia.com \
--cc=rnayak@ti.com \
--cc=shawn.guo@linaro.org \
--cc=tony@atomide.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.