From patchwork Tue Mar 24 22:30:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 6086631 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1982DBF90F for ; Tue, 24 Mar 2015 22:34:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3475A2011E for ; Tue, 24 Mar 2015 22:34:01 +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 617AF20034 for ; Tue, 24 Mar 2015 22:34: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 1YaXM2-0005wO-GF; Tue, 24 Mar 2015 22:31:22 +0000 Received: from mail-wi0-f170.google.com ([209.85.212.170]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YaXLA-0004ap-Hm for linux-arm-kernel@lists.infradead.org; Tue, 24 Mar 2015 22:30:29 +0000 Received: by wibg7 with SMTP id g7so87607087wib.1 for ; Tue, 24 Mar 2015 15:30:04 -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=4Ka0ayYXGnI2j1aoNYu28nFtk7qxFkOVSCPkoKirq/Q=; b=bCOCOjveB0yHtXBCC5uaQGSG466nqiJ/posFf9xvD8PnXae/nmK0FpCvXcoXlIiV0H c36BzY/enCeA/mhB59qzCqTKV27HHaIm8WwGYFfxTvFSIB1KzaPee6ZAlrAo8AViIvAU PKxOTJaBK/lg8MLkNIGOgXkbjcuiPzrV98ri/nxeSdzdw71yEmqrs6ecDUilyCGrFe0J JsDFZVLxedPdZX2xcXLrvtfMPGBRElZO6qElmeRzvMoW1tKsndRQuYeyOrT8ocStVS0g XUpTAJZnKo3FGeZYd3AdHLfUHcYa5T0KP6VAtgqfjiSCpzAECci4tVy9sbuRk9mXiHr5 PiPA== X-Gm-Message-State: ALoCoQnOZVzj/FiQeY6NlrJlcxgiX03P4fE6+l5ifLU0jW/K7+p4syikiTR2WaKTyfjMnCdzkdCs X-Received: by 10.180.86.6 with SMTP id l6mr24185165wiz.18.1427236204532; Tue, 24 Mar 2015 15:30:04 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-2-99-228-8.as13285.net. [2.99.228.8]) by mx.google.com with ESMTPSA id bd1sm17783779wib.13.2015.03.24.15.30.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Mar 2015 15:30:03 -0700 (PDT) From: Srinivas Kandagatla To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/9] regmap: Introduce regmap_get_reg_stride. Date: Tue, 24 Mar 2015 22:30:00 +0000 Message-Id: <1427236200-18625-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427236116-18531-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1427236116-18531-1-git-send-email-srinivas.kandagatla@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150324_153028_779575_243172DE X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: devicetree@vger.kernel.org, arnd@arndb.de, Greg Kroah-Hartman , Mark Brown , Kumar Gala , sboyd@codeaurora.org, linux-kernel@vger.kernel.org, Rob Herring , Srinivas Kandagatla , linux-api@vger.kernel.org, Maxime Ripard , 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 | 11 +++++++++++ include/linux/regmap.h | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 6fd234b..44d3d94 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2628,6 +2628,17 @@ 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 c46dbf3..b58067c 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");