diff mbox

PM / OPP: Add clock-latency-ns support

Message ID 20150811185421.GM2839@codeaurora.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Stephen Boyd Aug. 11, 2015, 6:54 p.m. UTC
On 08/11, Dan Carpenter wrote:
> On Tue, Aug 11, 2015 at 01:42:28PM +0530, Viresh Kumar wrote:
> > 
> > The problem is that the value here is of type 'unsigned long' which is
> > 32/64 bit on 32/64 bit machines.
> 
> Yep.  It won't work on 64 bit big endian machines as described earlier.
> 
> > 
> > So, I looked at how other places in code has done it, and that's what
> > I found.
> 
> It's not portable.  Sometimes we don't care about that because we know
> we don't care about 64 bit big endian systems.  Hence, my email.
> 

Making it portable should be simple enough by having a temporary
variable of type u32 though.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---8<---
diff mbox

Patch

diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 51b220e615d3..022715d1894c 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -919,6 +919,7 @@  static int _opp_add_static_v2(struct device *dev, struct device_node *np)
 	struct dev_pm_opp *new_opp;
 	u64 rate;
 	int ret;
+	u32 val;
 
 	/* Hold our list modification lock here */
 	mutex_lock(&dev_opp_list_lock);
@@ -946,14 +947,15 @@  static int _opp_add_static_v2(struct device *dev, struct device_node *np)
 	new_opp->np = np;
 	new_opp->dynamic = false;
 	new_opp->available = true;
-	of_property_read_u32(np, "clock-latency-ns",
-			     (u32 *)&new_opp->clock_latency_ns);
+	of_property_read_u32(np, "clock-latency-ns", &val);
+	new_opp->clock_latency_ns = val;
 
 	ret = opp_get_microvolt(new_opp, dev);
 	if (ret)
 		goto free_opp;
 
-	of_property_read_u32(np, "opp-microamp", (u32 *)&new_opp->u_amp);
+	of_property_read_u32(np, "opp-microamp", &val);
+	new_opp->u_amp = val;
 
 	ret = _opp_add(dev, new_opp, dev_opp);
 	if (ret)