Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp310691yba; Wed, 24 Apr 2019 01:22:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4wpIVNIKNe2uv1M6CcmykvvkywwDdmq2ULdBMjWMidRgNNbckXV6z7ZemiZkjmB95YM1S X-Received: by 2002:a17:902:2965:: with SMTP id g92mr31467617plb.267.1556094162263; Wed, 24 Apr 2019 01:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556094162; cv=none; d=google.com; s=arc-20160816; b=YKy1kL3o7A/KE9Sh0jK8HoRUablOTcCIsTiFHoxyyskmrxLO1dkbS98ggUUq/Inrmz AWnFbFpBuG6uOapqFM5KJymkBq6SowIViAfQ4pIXFWOTR8lUkoFIvzzBPTHaUB69aWOb KGDpgHctQ7NFK0Ldo+neaEX/Pmp2eNAbvaTJ5jor6isFTuUcEBtoGXU2vGKtQjEabYTd 96PSgS0Bcj6BQSFAFQcsCVd7JE7y1agieF6KcFRq8UeK9fX6Urb7sdEVBVI4veYrtwUP Cgy0EowukDqvWgNucP8UckrsdyJfebtNhLiuxfrnnbPAwSwOezENPJDvNN3EGuhLt3Ob 6TyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=At55itXmygSufAahnC17S1WQOsPGsNDMqXZmyecuw4E=; b=ouwcbHC2Kp4OK/AQvA4WoSL0silRM+81e2TWTo7fQsybj40GclPqH8djpVDXfc6W8v uDucqbc0W4UKfBPzq9yYiFLegdGHzGCM9gAw/qwsFiwN9ytjjS4h6qUJEnbSRYb2qN/h 0kJFq9YUFaiLYV63gbSiif3OzGbAsmoVemfsyEU0PFq6EUcH0aM078vqFG3G//aeRoPw 17v9Ixbdi77bh1Yfhop2cXtAgcKyleYK4FEDsYWgFvJXZYZiAH0HOfRc7SHD/4y3ScOb Ua81fPYrQx5Un9KJR5mwYYeU8vhm7o0++HJsnpiL1/TYrKnuwzNPXr2dKJNIMPXb6/8r FJMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uPJD37Yj; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si17881523plt.4.2019.04.24.01.22.26; Wed, 24 Apr 2019 01:22:42 -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=@kernel.org header.s=default header.b=uPJD37Yj; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730073AbfDXIUo (ORCPT + 99 others); Wed, 24 Apr 2019 04:20:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:46772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727361AbfDXIUn (ORCPT ); Wed, 24 Apr 2019 04:20:43 -0400 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 885FE21900; Wed, 24 Apr 2019 08:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556094042; bh=yG3qsSuduz/nKvqukmeETxhK6K+WkAcjlRfQsAPIcA8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uPJD37YjrmMc5NTVk/xzL8Ct8XKGCU9sIy8D1vudcaM5xq2o2TykyKPv8jq800u+K Xt6++QfG5TGp43iD/5+gzcM05OvX2U+U/40QLlbf886dPFvlw4cE4P5SNLcJ+8gCw5 kg7sbZ5l26YT9p2r9tf1zGUbEApQZFOvzE4JS7EA= Received: by mail-lj1-f175.google.com with SMTP id l7so16010349ljg.6; Wed, 24 Apr 2019 01:20:42 -0700 (PDT) X-Gm-Message-State: APjAAAUqUjxw1GNcZqX84rIWOPZK+iNNzl0GsO+6nNpCrP5EcMmS62To dtP6AmpncVt9IeVoEIRoMGDz13NcJ3iGcWGS2u4= X-Received: by 2002:a2e:9895:: with SMTP id b21mr16561939ljj.183.1556094040764; Wed, 24 Apr 2019 01:20:40 -0700 (PDT) MIME-Version: 1.0 References: <20190404171735.12815-1-s.nawrocki@samsung.com> <20190404171735.12815-5-s.nawrocki@samsung.com> <1d2238be-1758-2413-42f1-d571706de766@samsung.com> In-Reply-To: <1d2238be-1758-2413-42f1-d571706de766@samsung.com> From: Krzysztof Kozlowski Date: Wed, 24 Apr 2019 10:20:29 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 4/8] soc: samsung: Add Exynos Adaptive Supply Voltage driver To: Sylwester Nawrocki Cc: kgene@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, Chanwoo Choi , myungjoo.ham@samsung.com, "linux-samsung-soc@vger.kernel.org" , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, pankaj.dubey@samsung.com, =?UTF-8?B?QmFydMWCb21pZWogxbtvxYJuaWVya2lld2ljeg==?= , Marek Szyprowski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 24 Apr 2019 at 10:10, Sylwester Nawrocki wrote: > > On 4/23/19 12:50, Krzysztof Kozlowski wrote: > >> +static int exynos5422_asv_get_table(void) > >> +{ > >> + unsigned int reg = exynos_chipid_read(EXYNOS_CHIPID_REG_PKG_ID); > > > > One more thought: you read this register multiple times in the same > > function. I think it is not needed - just read once, store the value > > and use the helpers to parse it. > > Yes, I have noticed that as well. I'm not sure though if it is worth > to additionally cache registers manually like this when we use the > regmap. I have already converted that code to use the regmap API for > v2. And these are barely few registers reads at the driver > initialization time, not any hot path. By default regmap does not use caching so there is no benefit out of it. In the same time reading with regmap involves its layer of abstraction with locks, indirect calls etc... I agree that there is no point for implementing specific "caching" but with the same code readability/simplicity you can have it without multiple regmap accesses one after another. Consider this: unsigned int pkgid = exynos_chipid_read(EXYNOS_CHIPID_REG_PKG_ID); asv->table = exynos5422_asv_get_table(pkgid); asv->is_bin2 = exynos5422_asv_check_bin2(pkgid); (and probably renaming the helpers) The code is equivalent. The same readability. Best regards, Krzysztof