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: 46287 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 567602159D for ; Tue, 24 Mar 2015 22:30:13 +0000 (UTC) Received: by labgq15 with SMTP id gq15sf1122569lab.0 for ; Tue, 24 Mar 2015 15:30:12 -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=hNoha4zZDG6ns4dr8W+sZ0M6Jxu00kl9vopTvYkVa+U=; b=AOnKGutXJqGQSqkzZiJFrQFJBF8/IM/YUBIhMFxZmZ+U9L4cegvHU8U79ZGMDKl0YY OT/+bEkuL8hcEzLQ/cxdgXxSRqYmE6gm/Uc2H3F3eoDf0Lgri7tabDposuILAljfe/xU oprGkiAD+x9yxk4lSuhW9NuoMM6JPb06nr84qg25Uk9ISsQNmpeA7NNI3QI3Hw1YjWDR WRiK9KHEION3ee/UuUhaBj4ucqfHBycNN5Zde53pnxteI+rMjEDSXl6SDm1s0ExRHQvb Jdx8mufwml+usz/Kg2iE0QS7zF6376/kki6Sko0Mi6qz3R6yp9aVz0V67PMV7wcOCm5B u+TQ== X-Gm-Message-State: ALoCoQmBycZPA+HfXPFdwcAEvv84MpZK1ASTa5YYM15/fautBme3zmh3QEuQIKMLNwRz767lKPRx X-Received: by 10.112.97.37 with SMTP id dx5mr1395073lbb.16.1427236212295; Tue, 24 Mar 2015 15:30:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.10 with SMTP id 10ls25502lay.26.gmail; Tue, 24 Mar 2015 15:30:12 -0700 (PDT) X-Received: by 10.112.166.102 with SMTP id zf6mr5713572lbb.24.1427236212148; Tue, 24 Mar 2015 15:30:12 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id ku7si442227lac.112.2015.03.24.15.30.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Mar 2015 15:30:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laae1 with SMTP id e1so5791584laa.2 for ; Tue, 24 Mar 2015 15:30:12 -0700 (PDT) X-Received: by 10.112.162.232 with SMTP id yd8mr5573125lbb.41.1427236212012; Tue, 24 Mar 2015 15:30:12 -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 k9csp1732002lbq; Tue, 24 Mar 2015 15:30:11 -0700 (PDT) X-Received: by 10.70.54.103 with SMTP id i7mr11608476pdp.114.1427236210226; Tue, 24 Mar 2015 15:30:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sy1si744892pbc.176.2015.03.24.15.30.09; Tue, 24 Mar 2015 15:30:10 -0700 (PDT) Received-SPF: none (google.com: devicetree-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 S1753279AbbCXWaH (ORCPT + 5 others); Tue, 24 Mar 2015 18:30:07 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:35083 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753348AbbCXWaG (ORCPT ); Tue, 24 Mar 2015 18:30:06 -0400 Received: by wgdm6 with SMTP id m6so6443103wgd.2 for ; Tue, 24 Mar 2015 15:30:04 -0700 (PDT) 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 Cc: Maxime Ripard , Rob Herring , Kumar Gala , Mark Brown , 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 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> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@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.47 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 | 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");