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: 6125881 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D26CB9F349 for ; Mon, 30 Mar 2015 22:03:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F14392043C for ; Mon, 30 Mar 2015 22:03:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 1D9F9202F8 for ; Mon, 30 Mar 2015 22:03:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YchjJ-0001Rf-CD; Mon, 30 Mar 2015 22:00:21 +0000 Received: from mail-wi0-f175.google.com ([209.85.212.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ychgl-0008Nw-Q8 for linux-arm-kernel@lists.infradead.org; Mon, 30 Mar 2015 21:57:44 +0000 Received: by wibgn9 with SMTP id gn9so2379359wib.1 for ; Mon, 30 Mar 2015 14:57:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PhUQAQ+5MMZY788DDa5d8uUpMhHRgdIzOSFw/dkrlWw=; b=BUWKOIMNDmwnyCqXyef5A1VP7DdKiDviczbEWJMP/kuRVL6Pv+QOX8mjOezl0uv5c+ d1AYieVH/Pj7zNI2KvAEbsDjmo+y70rAwzLmSUH7JYalkMdkwg804kXhP7Ur2OkaeQME RcfWBBVqTOZclxX5cGiZwWKuT4Ds7yY7Xig/XvgrwIATqmHdwo3wT9BkFiZhTc84xY8+ JDozCC1Tz3rkJErrnTSt50LhQvCz8Fxdt2z8KNSpK6Fhn1PZTnIvul92Fg6E5UJLEMQm jR5yJP0Vur0JQ+BFM0eEwDFMMyYl3sxVRST5WOtP84GkP9JVarowFx1D88/9xEgYqucF Da9w== X-Gm-Message-State: ALoCoQlfiCukqqM3unpCTZJKQGwbY5Wt27tEPFF+jetj9t3WZ0pzfEyLVu1Nsnv+YqQrj1ks9NvV 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150330_145744_044016_43734801 X-CRM114-Status: GOOD ( 10.26 ) X-Spam-Score: -0.7 (/) Cc: devicetree@vger.kernel.org, arnd@arndb.de, Greg Kroah-Hartman , s.hauer@pengutronix.de, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, Rob Herring , Srinivas Kandagatla , Mark Brown , Kumar Gala , Maxime Ripard , linux-api@vger.kernel.org, linux-arm-msm@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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");