Re: [PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-22 Thread Viresh Kumar
On 19-09-15, 15:22, Stephen Boyd wrote: > On 09/18, Viresh Kumar wrote: > > On 17-09-15, 11:13, Stephen Boyd wrote: > > > > + count = of_property_count_u32_elems(opp->np, "opp-microvolt"); > > > > + if (count < 0) { > > > > > > We can't test count for -EINVAL to detect the missing

Re: [PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-22 Thread Viresh Kumar
On 19-09-15, 15:22, Stephen Boyd wrote: > On 09/18, Viresh Kumar wrote: > > On 17-09-15, 11:13, Stephen Boyd wrote: > > > > + count = of_property_count_u32_elems(opp->np, "opp-microvolt"); > > > > + if (count < 0) { > > > > > > We can't test count for -EINVAL to detect the missing

Re: [PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-19 Thread Stephen Boyd
On 09/18, Viresh Kumar wrote: > On 17-09-15, 11:13, Stephen Boyd wrote: > > > + count = of_property_count_u32_elems(opp->np, "opp-microvolt"); > > > + if (count < 0) { > > > > We can't test count for -EINVAL to detect the missing property > > because -EINVAL is also returned on a non-multiple of

Re: [PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-19 Thread Stephen Boyd
On 09/18, Viresh Kumar wrote: > On 17-09-15, 11:13, Stephen Boyd wrote: > > > + count = of_property_count_u32_elems(opp->np, "opp-microvolt"); > > > + if (count < 0) { > > > > We can't test count for -EINVAL to detect the missing property > > because -EINVAL is also returned on a non-multiple of

Re: [PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-18 Thread Viresh Kumar
On 17-09-15, 11:13, Stephen Boyd wrote: > > + count = of_property_count_u32_elems(opp->np, "opp-microvolt"); > > + if (count < 0) { > > We can't test count for -EINVAL to detect the missing property > because -EINVAL is also returned on a non-multiple of u32 length > property? Maybe we

Re: [PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-18 Thread Viresh Kumar
On 17-09-15, 11:13, Stephen Boyd wrote: > > + count = of_property_count_u32_elems(opp->np, "opp-microvolt"); > > + if (count < 0) { > > We can't test count for -EINVAL to detect the missing property > because -EINVAL is also returned on a non-multiple of u32 length > property? Maybe we

Re: [PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-17 Thread Stephen Boyd
On 09/17, Viresh Kumar wrote: > +++ b/drivers/base/power/opp.c > @@ -889,13 +889,22 @@ static int _opp_add_dynamic(struct device *dev, > unsigned long freq, > /* TODO: Support multiple regulators */ > static int opp_get_microvolt(struct dev_pm_opp *opp, struct device *dev) > { > + struct

[PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-17 Thread Viresh Kumar
of_property_count_u32_elems() will never return 0, but a -ve error value of a positive count. And so the current !count check is wrong. Also, a missing "opp-microvolt" property isn't a problem and so we need to do of_find_property() separately to confirm that. Fixes: 274659029c9d ("PM / OPP: Add

[PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-17 Thread Viresh Kumar
of_property_count_u32_elems() will never return 0, but a -ve error value of a positive count. And so the current !count check is wrong. Also, a missing "opp-microvolt" property isn't a problem and so we need to do of_find_property() separately to confirm that. Fixes: 274659029c9d ("PM / OPP: Add

Re: [PATCH] PM / OPP: of_property_count_u32_elems() can return errors

2015-09-17 Thread Stephen Boyd
On 09/17, Viresh Kumar wrote: > +++ b/drivers/base/power/opp.c > @@ -889,13 +889,22 @@ static int _opp_add_dynamic(struct device *dev, > unsigned long freq, > /* TODO: Support multiple regulators */ > static int opp_get_microvolt(struct dev_pm_opp *opp, struct device *dev) > { > + struct