From patchwork Mon Mar 30 21:57:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 46555 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 802B3218BE for ; Mon, 30 Mar 2015 21:57:36 +0000 (UTC) Received: by lbbug6 with SMTP id ug6sf22722335lbb.3 for ; Mon, 30 Mar 2015 14:57:35 -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=AsX7cOXqECazq0nQGy3FIGEoeR0Svi9CPFy7xI7u+40=; b=LEdIwFbJ4z4m6MyyQIkELUjAUCiWyTvqR97j/dc3PS3KtjriBj2gwP35RU2uWCqiWv DM/nIavQ31HHTcS2e+7PXtour6f0jfTLfnqq+TTM4mBK1JlZMDtMpk7ubiYSyB/BZWi2 qANtZTvgumynzAG7h4w5Aj/WUPOyn9jDd2OVwKEM4C/gqKwaL7vqymPT23Nb59/zkM8F VNTXvAy+U6+YwoirHkWLJZ0WAjSR13cU/L41lCwEXJ9j16+piT6V6GPXhkHi+UIa+xAs 5x0WODWfQonzIRfyX68ShG+9ZIj+CTxkAt1mRnEttXxqgDWcNlFC9FzIfGxf2F1xsZAI HKAQ== X-Gm-Message-State: ALoCoQkzef5/UqCBVeQZcPoTZaJRfZf3U/8vnYhIqRJ1HiQXchk6t6Lhglyiz7HwiXO4NHqeRVzA X-Received: by 10.180.90.175 with SMTP id bx15mr4125146wib.3.1427752655494; Mon, 30 Mar 2015 14:57:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.4 with SMTP id lk4ls52730lac.15.gmail; Mon, 30 Mar 2015 14:57:35 -0700 (PDT) X-Received: by 10.112.51.138 with SMTP id k10mr28192318lbo.82.1427752655108; Mon, 30 Mar 2015 14:57:35 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id s1si7869872lbf.154.2015.03.30.14.57.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Mar 2015 14:57:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lahp7 with SMTP id p7so95558648lah.2 for ; Mon, 30 Mar 2015 14:57:35 -0700 (PDT) X-Received: by 10.152.19.199 with SMTP id h7mr29207261lae.32.1427752654860; Mon, 30 Mar 2015 14:57:34 -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.57.201 with SMTP id k9csp1410059lbq; Mon, 30 Mar 2015 14:57:34 -0700 (PDT) X-Received: by 10.70.46.41 with SMTP id s9mr61470037pdm.37.1427752653058; Mon, 30 Mar 2015 14:57:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bz13si16517101pdb.6.2015.03.30.14.57.32; Mon, 30 Mar 2015 14:57:33 -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 S1753783AbbC3V52 (ORCPT + 27 others); Mon, 30 Mar 2015 17:57:28 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:37363 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753781AbbC3V5X (ORCPT ); Mon, 30 Mar 2015 17:57:23 -0400 Received: by wiaa2 with SMTP id a2so2413734wia.0 for ; Mon, 30 Mar 2015 14:57:21 -0700 (PDT) X-Received: by 10.180.72.175 with SMTP id e15mr26970232wiv.28.1427752641458; Mon, 30 Mar 2015 14:57:21 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-78-145-247-151.as13285.net. [78.145.247.151]) by mx.google.com with ESMTPSA id at4sm17531384wjc.16.2015.03.30.14.57.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Mar 2015 14:57:20 -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 Subject: [PATCH v4 02/10] regmap: Introduce regmap_get_reg_stride. Date: Mon, 30 Mar 2015 22:57:17 +0100 Message-Id: <1427752637-17131-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427752492-17039-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1427752492-17039-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.52 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 eeprom 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 d703921..ac44d43 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2629,6 +2629,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");