[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F6A0F05.90104@wwwdotorg.org>
Date: Wed, 21 Mar 2012 11:25:25 -0600
From: Stephen Warren <swarren@...dotorg.org>
To: Dong Aisheng <aisheng.dong@...escale.com>
CC: "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"grant.likely@...retlab.ca" <grant.likely@...retlab.ca>,
"rob.herring@...xeda.com" <rob.herring@...xeda.com>,
"linus.walleij@...ricsson.com" <linus.walleij@...ricsson.com>,
Dong Aisheng-B29396 <B29396@...escale.com>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"dongas86@...il.com" <dongas86@...il.com>,
"shawn.guo@...aro.org" <shawn.guo@...aro.org>,
"thomas.abraham@...aro.org" <thomas.abraham@...aro.org>,
"tony@...mide.com" <tony@...mide.com>,
"sjg@...omium.org" <sjg@...omium.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree-discuss@...ts.ozlabs.org"
<devicetree-discuss@...ts.ozlabs.org>,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>
Subject: Re: [PATCH V2 3/6] pinctrl: core device tree mapping table parsing
support
On 03/21/2012 09:48 AM, Stephen Warren wrote:
> On 03/21/2012 01:31 AM, Dong Aisheng wrote:
>> On Wed, Mar 21, 2012 at 01:44:36AM +0800, Stephen Warren wrote:
...
>>> +int pinctrl_dt_to_map(struct pinctrl *p)
>>> +{
>>> + struct device_node *np = p->dev->of_node;
>>> + int state, ret;
>>> + char *propname;
>>> + struct property *prop;
>>> + const char *statename;
>>> + const __be32 *list;
>>> + int size, config;
>>> + phandle phandle;
>>> + struct device_node *np_config;
>>> + struct pinctrl_dt_map *dt_map;
>>
>> Add NULL np checking?
>
> Oops yes. I though I had that somewhere, but evidently not...
It turns out this isn't needed; of_node_get() and of_find_property()
both handle a NULL np just fine. Still, I suppose this might not always
be true for arbitrary code that's in pinctrl_dt_to_map(), so perhaps we
should add this anyway.
>>> + }
>>> +
>>> + /* For every referenced pin configuration node in it */
>>> + for (config = 0; config < size; config++) {
>>> + phandle = be32_to_cpup(list++);
>>> +
>>> + /* Look up the pin configuration node */
>>> + np_config = of_find_node_by_phandle(phandle);
>>
>> One option is using of_parse_phandle, then we do not need calculate
>> the phandle offset by ourselves.
>> Like:
>> np_config = of_parse_phandle(propname , config);
>
> Yes, that's a good idea. I'll try that.
I looked at this more, and the existing code is a lot more efficient;
of_parse_phandle() internally calls of_find_property() each time, which
this pinctrl code has already done. I'd rather just leave this as it is.
Are you OK with that?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists