From patchwork Tue Aug 26 11:24:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 35994 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A13E620551 for ; Tue, 26 Aug 2014 11:24:41 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id 29sf50229894yhl.6 for ; Tue, 26 Aug 2014 04:24:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:date :message-id:subject:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=LBBxR6Rv2yqk4FRbd43aY+dcgXdlUV6lB+8FOnLE8yY=; b=N/LU3+lT2fX4g/C476iIK73qnPq/SkaAPFcg3yla/vuzTqe+5dnJDNOTirMSmhdRD0 4+ETCr1V2KamQZ43+U5dFo+an29vfeBEAJ2IOg/R53DMwvMaVpW1cDSwZd+VtrosdAwt HlMlGCwiXVosm10Tiw2exjaWT9PY9m+65mxOmOmqRFFu9UMemy9vpU68U8GeXO8+Fk2K sqDjwYM7oJQvkrwQSE9nVXqSn6ByAoWcHw4j1JVmcwDBliVbLCHCHPC1fPgLW/0F91/S 0vLotj9tOc2ESgtYnMjXyn3B+ZF9Mhx/OjYbP2rz7Qu4aQU9O5rhNYfiB03jPy9CIZAm k5Hw== X-Gm-Message-State: ALoCoQkRddoCbHDPQW+CXkWeF4VmbHFif4rapNTzKaXPCsX5+EPBka5UXsyi4yDI9yMaxiOo44gs X-Received: by 10.236.143.2 with SMTP id k2mr17628433yhj.18.1409052281487; Tue, 26 Aug 2014 04:24:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.11 with SMTP id y11ls2432624qgy.23.gmail; Tue, 26 Aug 2014 04:24:41 -0700 (PDT) X-Received: by 10.220.96.137 with SMTP id h9mr536308vcn.46.1409052281390; Tue, 26 Aug 2014 04:24:41 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id b5si1199333vdi.91.2014.08.26.04.24.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 04:24:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so16328183vcb.24 for ; Tue, 26 Aug 2014 04:24:41 -0700 (PDT) X-Received: by 10.220.169.72 with SMTP id x8mr555109vcy.45.1409052281303; Tue, 26 Aug 2014 04:24:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp190158vcb; Tue, 26 Aug 2014 04:24:40 -0700 (PDT) X-Received: by 10.66.219.104 with SMTP id pn8mr18287398pac.133.1409052279873; Tue, 26 Aug 2014 04:24:39 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ka10si3783698pbd.160.2014.08.26.04.24.39 for ; Tue, 26 Aug 2014 04:24:39 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757657AbaHZLY2 (ORCPT + 26 others); Tue, 26 Aug 2014 07:24:28 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:33950 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757534AbaHZLYZ (ORCPT ); Tue, 26 Aug 2014 07:24:25 -0400 Received: from cpc11-sgyl31-2-0-cust672.sgyl.cable.virginm.net ([94.175.94.161] helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XMErL-0003AB-D4; Tue, 26 Aug 2014 11:24:20 +0000 Received: from broonie by debutante with local (Exim 4.84) (envelope-from ) id 1XMErI-0002lc-Bz; Tue, 26 Aug 2014 12:24:16 +0100 From: Mark Brown To: Scott Jiang , Lars-Peter Clausen Cc: linux-kernel@vger.kernel.org, Mark Brown Date: Tue, 26 Aug 2014 12:24:15 +0100 Message-Id: <1409052255-10601-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.1.0.rc1 X-SA-Exim-Connect-IP: 94.175.94.161 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Subject: [PATCH] regmap: Fix handling of volatile registers for format_write() chips X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: broonie@kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mark Brown A previous over-zealous factorisation of code means that we only treat registers as volatile if they are readable. For most devices this is fine since normally most registers can be read and volatility implies readability but for format_write() devices where there is no readback from the hardware and we use volatility to mean simply uncacheability this means that we end up treating all registers as cacheble. A bigger refactoring of the code to clarify this is in order but as a fix make a minimal change and only check readability when checking volatility if there is no format_write() operation defined for the device. Signed-off-by: Mark Brown Tested-by: Lars-Peter Clausen --- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index bb4502a48be5..44c2df8284d7 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -110,7 +110,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg) bool regmap_volatile(struct regmap *map, unsigned int reg) { - if (!regmap_readable(map, reg)) + if (!map->format.format_write && !regmap_readable(map, reg)) return false; if (map->volatile_reg)