[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKohpokaVPn7yNPNAGrE6juGaOYuxZvVsbmkOZmyi9rDub6t7g@mail.gmail.com>
Date: Tue, 1 Jul 2014 16:44:04 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Rob Herring <rob.herring@...aro.org>
Cc: Mike Turquette <mturquette@...aro.org>,
Grant Likely <grant.likely@...aro.org>,
Stephen Boyd <sboyd@...eaurora.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Shawn Guo <shawn.guo@...aro.org>,
Lists linaro-kernel <linaro-kernel@...ts.linaro.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Arvind Chauhan <arvind.chauhan@....com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
linux-arm-msm@...r.kernel.org, Sachin Kamat <spk.linux@...il.com>,
Thomas P Abraham <thomas.ab@...sung.com>,
Nishanth Menon <nm@...com>, Tomasz Figa <t.figa@...sung.com>,
Mark Brown <broonie@...nel.org>,
Mark Rutland <Mark.Rutland@....com>
Subject: Re: [PATCH 2/2] cpufreq: cpu0: Extend support beyond CPU0
On 1 July 2014 00:03, Rob Herring <rob.herring@...aro.org> wrote:
>> What about comparing "clocks" property in cpu DT nodes?
>
> What if a different clock is selected for some reason.
I don't know why that will happen for CPUs sharing clock line.
> I think a clock api function would be better.
@Mike: What do you think? I think we can get a clock API for
this.
> That being said, I don't really have any issue with such a function.
> Some comments on the implementation.
>> +static int of_property_match(const struct device_node *np1,
>> + const struct device_node *np2,
>> + const char *list_name)
>> +{
>> + const __be32 *list1, *list2, *list1_end;
>
> s/list/prop/
>
> Everywhere.
Ok.
>> + int size1, size2;
>> + phandle phandle1, phandle2;
>> +
>> + /* Retrieve the list property */
>> + list1 = of_get_property(np1, list_name, &size1);
>> + if (!list1)
>> + return -ENOENT;
>> +
>> + list2 = of_get_property(np2, list_name, &size2);
>> + if (!list2)
>> + return -ENOENT;
>> +
>> + if (size1 != size2)
>> + return 0;
>> +
>> + list1_end = list1 + size1 / sizeof(*list1);
>> +
>> + /* Loop over the phandles */
>> + while (list1 < list1_end) {
>> + phandle1 = be32_to_cpup(list1++);
>> + phandle2 = be32_to_cpup(list2++);
>> +
>> + if (phandle1 != phandle2)
>> + return 0;
>> + }
>
> You can just do a memcmp here.
Yeah, that would be much better.
> This is wrong anyway because you don't know #clock-cells size.
I was actually comparing all the clock-cells, whatever there number
is to make sure "clocks" properties are exactly same. Anyway
memcmp will still guarantee that.
Thanks for your review.
--
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