All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>, linux-pm@vger.kernel.org
Subject: Re: PM / OPP: Add clock-latency-ns support
Date: Tue, 11 Aug 2015 11:54:21 -0700	[thread overview]
Message-ID: <20150811185421.GM2839@codeaurora.org> (raw)
In-Reply-To: <20150811135122.GL5096@mwanda>

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 --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)

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2015-08-11 18:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 16:38 PM / OPP: Add clock-latency-ns support Dan Carpenter
2015-08-11  8:12 ` Viresh Kumar
2015-08-11 13:53   ` Dan Carpenter
2015-08-11 18:54     ` Stephen Boyd [this message]
2015-08-12  6:57       ` Viresh Kumar
2015-08-12  7:58         ` Dan Carpenter

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=20150811185421.GM2839@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    /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.