From patchwork Thu May 21 16:42:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 48864 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 66E2121411 for ; Thu, 21 May 2015 16:43:26 +0000 (UTC) Received: by wivs14 with SMTP id s14sf5575105wiv.1 for ; Thu, 21 May 2015 09:43:25 -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:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=PnjEB0UhjUFWTHcPlZ+HKaHbfJv2++jkLPupzgSZsoI=; b=B8K5aaqKLxr7ztc4f3ium7ATZgi3/ArRrH7ys39/DfG0om8TYKPF2G+WhnwExTWqeX CcEokcmEv1apj1g10+PyBLZeUiWJVCNC6MMSM0pH7qm8MO4MVQEv4n/+sx2M/lMEp6k5 IcGjjU4qseC4uv9R4LzxEyggsxJQ/Z+TbCjztRJQSEdIdM3jHZtBATxOqEvK44QVOt3N AygA/UOB2wIc/EJeFkkL/HjCzTuYxURfn5GBh82r71BtrTIJcxQjJUFQJOIVCSvu0P2H tXDzEiewa2cxIJC/Uv4RkgV3Nb8qy+BgVlFgunAj8Ecx1j+QEq9o2gmNwYpSMztuO197 V/mQ== X-Gm-Message-State: ALoCoQln/UKbDAHF+aTRT8NjuSJFt33y+wCb9ThSqyHD6c+Zo1NhIvihepHUeEjGVX+TjD6wKLKp X-Received: by 10.112.122.39 with SMTP id lp7mr3433256lbb.5.1432226605692; Thu, 21 May 2015 09:43:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.42 with SMTP id j10ls325679laf.27.gmail; Thu, 21 May 2015 09:43:25 -0700 (PDT) X-Received: by 10.112.63.201 with SMTP id i9mr2945080lbs.93.1432226605514; Thu, 21 May 2015 09:43:25 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id d5si9558025lag.4.2015.05.21.09.43.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2015 09:43:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by laat2 with SMTP id t2so106865386laa.1 for ; Thu, 21 May 2015 09:43:25 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr3013337lbc.88.1432226605087; Thu, 21 May 2015 09:43:25 -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.112.108.230 with SMTP id hn6csp722064lbb; Thu, 21 May 2015 09:43:24 -0700 (PDT) X-Received: by 10.66.141.77 with SMTP id rm13mr7366122pab.14.1432226603258; Thu, 21 May 2015 09:43:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pe8si7072535pac.157.2015.05.21.09.43.19; Thu, 21 May 2015 09:43:23 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756667AbbEUQnF (ORCPT + 28 others); Thu, 21 May 2015 12:43:05 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:36789 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756543AbbEUQnA (ORCPT ); Thu, 21 May 2015 12:43:00 -0400 Received: by wizk4 with SMTP id k4so21318928wiz.1 for ; Thu, 21 May 2015 09:42:59 -0700 (PDT) X-Received: by 10.180.90.209 with SMTP id by17mr10183724wib.2.1432226579682; Thu, 21 May 2015 09:42:59 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-2-96-95-164.as13285.net. [2.96.95.164]) by mx.google.com with ESMTPSA id b10sm3691512wic.1.2015.05.21.09.42.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 09:42:59 -0700 (PDT) From: Srinivas Kandagatla To: linux-arm-kernel@lists.infradead.org Cc: Maxime Ripard , Rob Herring , Kumar Gala , Mark Brown , s.hauer@pengutronix.de, Greg Kroah-Hartman , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, arnd@arndb.de, sboyd@codeaurora.org, Srinivas Kandagatla , pantelis.antoniou@konsulko.com, mporter@konsulko.com Subject: [PATCH v5 02/11] regmap: Introduce regmap_get_reg_stride. Date: Thu, 21 May 2015 17:42:54 +0100 Message-Id: <1432226574-8733-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1432226535-8640-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1432226535-8640-1-git-send-email-srinivas.kandagatla@linaro.org> 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: srinivas.kandagatla@linaro.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.215.50 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: , This patch introduces regmap_get_reg_stride() function which would be used by the infrastructures like nvmem framework built on top of regmap. Mostly this function would be used for sanity checks on inputs within such infrastructure. Signed-off-by: Srinivas Kandagatla --- drivers/base/regmap/regmap.c | 12 ++++++++++++ include/linux/regmap.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index d6c8404..e5eef6f 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2625,6 +2625,18 @@ int regmap_get_max_register(struct regmap *map) } EXPORT_SYMBOL_GPL(regmap_get_max_register); +/** + * regmap_get_reg_stride(): Report the register address stride + * + * Report the register address stride, mainly intended to for use by + * generic infrastructure built on top of regmap. + */ +int regmap_get_reg_stride(struct regmap *map) +{ + return map->reg_stride; +} +EXPORT_SYMBOL_GPL(regmap_get_reg_stride); + int regmap_parse_val(struct regmap *map, const void *buf, unsigned int *val) { diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 2d87ded..59c55ea 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -434,6 +434,7 @@ int regmap_update_bits_check_async(struct regmap *map, unsigned int reg, bool *change); int regmap_get_val_bytes(struct regmap *map); int regmap_get_max_register(struct regmap *map); +int regmap_get_reg_stride(struct regmap *map); int regmap_async_complete(struct regmap *map); bool regmap_can_raw_write(struct regmap *map); @@ -683,6 +684,12 @@ static inline int regmap_get_max_register(struct regmap *map) return -EINVAL; } +static inline int regmap_get_reg_stride(struct regmap *map) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + static inline int regcache_sync(struct regmap *map) { WARN_ONCE(1, "regmap API is disabled");