From patchwork Tue Aug 11 18:54:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 6994311 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D44E89F344 for ; Tue, 11 Aug 2015 18:54:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 067A4205E6 for ; Tue, 11 Aug 2015 18:54:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6CE0204F6 for ; Tue, 11 Aug 2015 18:54:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752579AbbHKSyX (ORCPT ); Tue, 11 Aug 2015 14:54:23 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:56364 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752577AbbHKSyX (ORCPT ); Tue, 11 Aug 2015 14:54:23 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id E12EB141249; Tue, 11 Aug 2015 18:54:22 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id C983214124E; Tue, 11 Aug 2015 18:54:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sboyd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 35C85141249; Tue, 11 Aug 2015 18:54:22 +0000 (UTC) Date: Tue, 11 Aug 2015 11:54:21 -0700 From: Stephen Boyd To: Dan Carpenter Cc: Viresh Kumar , linux-pm@vger.kernel.org Subject: Re: PM / OPP: Add clock-latency-ns support Message-ID: <20150811185421.GM2839@codeaurora.org> References: <20150810163804.GA10496@mwanda> <20150811081228.GC5509@linux> <20150811135122.GL5096@mwanda> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150811135122.GL5096@mwanda> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 ---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)