From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A6EFC3A5A1 for ; Wed, 28 Aug 2019 15:44:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AE542070B for ; Wed, 28 Aug 2019 15:44:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FtdxS8G2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726454AbfH1Pol (ORCPT ); Wed, 28 Aug 2019 11:44:41 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36460 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbfH1Pol (ORCPT ); Wed, 28 Aug 2019 11:44:41 -0400 Received: by mail-pf1-f193.google.com with SMTP id w2so59529pfi.3 for ; Wed, 28 Aug 2019 08:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=message-id:mime-version:content-transfer-encoding:in-reply-to :references:cc:subject:to:from:user-agent:date; bh=Jx78g9+c3oSx9PoQ5GPvw3BbBJk++uJnwmqxETMCaDw=; b=FtdxS8G25sXjQIfGPQnEVNL1c1QtBlRqPlrr5X2IDZ8KqOJJcBbakYqZ1/RknvIHvU q68jrefN9dYhDpTsG/9+Na8XE7aPe12tA2vKuUGe7r9vWiyeoiPOvtZCjPOaL5MGRDVT HMXKC2QMK2prUDpXktHsEuQKQGE+8tSCmtNL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version :content-transfer-encoding:in-reply-to:references:cc:subject:to:from :user-agent:date; bh=Jx78g9+c3oSx9PoQ5GPvw3BbBJk++uJnwmqxETMCaDw=; b=Zgr0V2ddZZsVtaKGhcVX1MvEKs1Y/rLLTmxtl79cghIwRIlTGDJ7xlrl+yL8mwBGI5 jxcbeEAB9vpbIKIzC3zj4LGoDFZtWflp46JsTp5to6ODvyZY0/sRU0PhyJrikik48u7L uVRkH9dNyoJwUq9wn7cpaVRmbfMk8E/90K0Z2NASwTp0zhyGY11Sx+Jc7njA327wce9+ YlurcmVSV5o2YdcWZQlVz+bLW7gqnkdpZsAyZ76B43MKgaZuDk0EDSBLS/Y9tGSyIxuv dqZcKZCz2yLBg3sLnPtJtcLPe3F7dO4ySJCvKvKRyYkEPgUiHI90ZgqCZuvEpCH0VOxG qjaA== X-Gm-Message-State: APjAAAX/mMBLldD5yjLEmQfc0FSHZDiY/Z3aOU3GvHW/6jinoun+VOJP SbcYAKZlhdfxv80aT84k7jQNBg== X-Google-Smtp-Source: APXvYqzY9v6YG3rvk6EhG6cDIUiFdX3gZS5f2YMEto/kGAYjz8HV33Zv3cGN5nMxnqyoka5FceyNNg== X-Received: by 2002:aa7:946d:: with SMTP id t13mr5579110pfq.121.1567007080982; Wed, 28 Aug 2019 08:44:40 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id m145sm4747764pfd.68.2019.08.28.08.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 08:44:40 -0700 (PDT) Message-ID: <5d66a168.1c69fb81.570fd.ae07@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <64a3d07ebe5c4cfb4643d91f5f6605e8a4ffa48b.1566907161.git.amit.kucheria@linaro.org> <5d65ccfd.1c69fb81.95798.20d8@mx.google.com> Cc: Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui , Andy Gross , Bjorn Andersson , Eduardo Valentin , linux-arm-msm , Linux Kernel Mailing List , Marc Gonzalez , Brian Masney , Linux PM list Subject: Re: [PATCH v2 14/15] drivers: thermal: tsens: Create function to return sign-extended temperature To: Amit Kucheria From: Stephen Boyd User-Agent: alot/0.8.1 Date: Wed, 28 Aug 2019 08:44:39 -0700 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Quoting Amit Kucheria (2019-08-28 03:35:28) > (Resending, replied only to Stephen by mistake) >=20 > On Wed, Aug 28, 2019 at 6:08 AM Stephen Boyd wrote: > > > > Quoting Amit Kucheria (2019-08-27 05:14:10) > > > @@ -310,6 +328,10 @@ int __init init_common(struct tsens_priv *priv) > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 goto err_put_device; > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > > > + > > > + =C2=A0 =C2=A0 =C2=A0 /* Save away resolution of signed temperature = value for this IP */ > > > + =C2=A0 =C2=A0 =C2=A0 priv->tempres =3D priv->fields[LAST_TEMP_0].ms= b - priv->fields > [LAST_TEMP_0].lsb; > > > + > > > > Why not just calculate this in the function that uses it? Is there a > > reason to stash it away in the struct? >=20 > To avoid recalculating in an often-called function. It doesn't change for= an IP > version. >=20 > We can't make it static either inside that function since the initializer= isn't > constant. >=20 This sounds like a super micro optimization. It's a couple derefs and a subtraction. If it isn't used anywhere else please just move it into the function where it's used.