From patchwork Fri Dec 13 17:14:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 3341861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EFC5A9F380 for ; Fri, 13 Dec 2013 17:14:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC756206B2 for ; Fri, 13 Dec 2013 17:14:41 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 875E3205EC for ; Fri, 13 Dec 2013 17:14:40 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VrWJx-0004CV-AP; Fri, 13 Dec 2013 17:14:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VrWJu-000408-Mx; Fri, 13 Dec 2013 17:14:34 +0000 Received: from smtp.codeaurora.org ([198.145.11.231]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VrWJq-0003zF-Qi for linux-arm-kernel@lists.infradead.org; Fri, 13 Dec 2013 17:14:31 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id A6EDF13EF9E; Fri, 13 Dec 2013 17:14:08 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 97AE413F307; Fri, 13 Dec 2013 17:14:08 +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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (i-global252.qualcomm.com [199.106.103.252]) (using SSLv3 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 410FC13EF9E; Fri, 13 Dec 2013 17:14:08 +0000 (UTC) Date: Fri, 13 Dec 2013 09:14:07 -0800 From: Stephen Boyd To: Mark Brown Subject: [PATCH] regmap: Allow regmap_bulk_read() to work for "no-bus" regmaps Message-ID: <20131213171407.GN21983@codeaurora.org> References: <1386718523-2587-1-git-send-email-sboyd@codeaurora.org> <1386718523-2587-4-git-send-email-sboyd@codeaurora.org> <20131210235000.GK11468@sirena.org.uk> <52A7AE1B.3040201@codeaurora.org> <20131211005106.GL11468@sirena.org.uk> <52A7C0C3.2070805@codeaurora.org> <20131211132729.GT11468@sirena.org.uk> <52AA42FD.4040503@codeaurora.org> <20131213104128.GT11044@sirena.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20131213104128.GT11044@sirena.org.uk> User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131213_121430_941021_3012335A X-CRM114-Status: GOOD ( 22.70 ) X-Spam-Score: -1.9 (-) Cc: Samuel Ortiz , Srinivas Ramana , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP regmap_bulk_read() should decay to performing individual reads if we're using a "no-bus" regmap. Unfortunately, it returns an error because there is no map->bus pointer. Fix it. Signed-off-by: Stephen Boyd --- On 12/13/13 02:41, Mark Brown wrote: > On Thu, Dec 12, 2013 at 03:13:01PM -0800, Stephen Boyd wrote: > >>> bulk_read() should decay to individual reads if there isn't a block >>> operaton and it's not like the hardware actually supports bulk reads >>> anyway. > >> So regmap_bulk_read() should work if I don't have a map->bus? To make it >> work with reg_read/write I had to do this. I'm not sure how to make >> bulk_write work. > > Yes, I'd expect the operation to work. Your changes below are mostly > fine (we should add an additional check for values that aren't integer > numbers of bytes, I can add that) - can you send as a signed off patch > please and I'll apply? Here you go. Do you have any suggestions on how to make regmap_bulk_write() work? drivers/base/regmap/regmap.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 9c021d9..1ccd61b 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1897,14 +1897,10 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, size_t val_bytes = map->format.val_bytes; bool vol = regmap_volatile_range(map, reg, val_count); - if (!map->bus) - return -EINVAL; - if (!map->format.parse_inplace) - return -EINVAL; if (reg % map->reg_stride) return -EINVAL; - if (vol || map->cache_type == REGCACHE_NONE) { + if (map->bus && map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) { /* * Some devices does not support bulk read, for * them we have a series of single read operations.