Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1037789ybl; Wed, 28 Aug 2019 08:46:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRuwtyG57KtHDJb9j2qzUPW9gALx0N4JdZRU/YGCn2nSOC2YGE55QMq3T/Ej5tMFoRi8Yi X-Received: by 2002:a17:902:4b:: with SMTP id 69mr5002872pla.89.1567007163902; Wed, 28 Aug 2019 08:46:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567007163; cv=none; d=google.com; s=arc-20160816; b=yDwECFtVxEkJgSuZAVxz8P2r5plFDndB3Prqf6JUpwiRmlukgRgUcWIXgiHRYihMCa joTY0YYPnOXjcIIOBEWji8LUJPJgHdPoU4L+aEtFLU0U1g/p1qs6oNhFGvWL4wmF6CB7 FFK4A/mCN5saiT/irlrWNfgZLLvxIF20JxTxS8pE59cPqEeKzvaSFhxi35BFRVEYnCLs Wlq0gupkV/susVEC/4+cZsBnPNA+pfYemSFJJFBpCI2LYy+CA4k725c+BinABzKcqaF9 LTEPUq65AMTqwzUJcZNfqYHEBqQaI4mXvepCrAynG7axWH6Bjxd06O4xSXZ7eI/IVCm9 jIIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:from:to:subject:cc :references:in-reply-to:content-transfer-encoding:mime-version :message-id:dkim-signature; bh=Jx78g9+c3oSx9PoQ5GPvw3BbBJk++uJnwmqxETMCaDw=; b=m9cVsG0pFiP5dPjO8dIt5yfuWeJfEHlRuL4/fr/TvBa354GxXSpajQq6D1c2mz30DJ kWoqbKh8omyr2xfNj/T5MK+3lMHhwhEl7+LNpAyubp8QKlNfokUOueHejAhIEwKUFodQ mGeKVLIVbj5NCK875Vb4fuxrTCcu6xINy5s2cG0YhK0qGxLnAJ1t0Cq9TA5qH/XocPms ExTLY9FG7RkhImJiMw4PuUBJZ8uL8DP7iGxM3IIgHTRDMLTgKsEibtxVMzJyJuffp/2h 0PmcZ/gwevxovTVQO30qxAyhVjqOS6PvzmE7x7twidbPntGEqm6cEfAZfTVK6wD9aSLv ifcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FtdxS8G2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k98si2113507pje.41.2019.08.28.08.45.46; Wed, 28 Aug 2019 08:46:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FtdxS8G2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726506AbfH1Pom (ORCPT + 99 others); Wed, 28 Aug 2019 11:44:42 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40386 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726400AbfH1Pol (ORCPT ); Wed, 28 Aug 2019 11:44:41 -0400 Received: by mail-pf1-f196.google.com with SMTP id w16so45082pfn.7 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=mxYiku0oGD5Mp1uc6DZc5/LkRp+pRgqmx6syVYMDCDp/G787YTCNnkc3unSxhROh2+ 48HP5urnVTTX0BM9hFGeYpQuCqbRt7AbOsDth1Ff8Yrwyb4sxrFrfu1MqidGL/OB/BrJ 91RhezFLWAx/L1O1UucIutEchKb7lsMEjyHHA4ALwg9MbQbjwzAsuNCfsQS0OcUmVJf4 7ghbDDHx/4ybt23phAAlraUhTpsVaZisnLTnxuyNqwGq1mCzeYplJucyCnSO1SgFrR3z 02/KZ4EDy0hgKnH3h9WUwP8l9X8kj6b6Qek3emb1W3rljH/DaC9/vCaQ0eJrGQB7oezw Scyw== X-Gm-Message-State: APjAAAUD2m5KLBfgbNez8MrvI00PFh6sGlb+6XHOsywSGDhLgaZVzGa8 yYPa0VdsIo8YA4AUWIyRnLrIXg== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.