From patchwork Thu May 21 16:42:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 48863 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2DA2221411 for ; Thu, 21 May 2015 16:43:23 +0000 (UTC) Received: by wixv7 with SMTP id v7sf5583584wix.0 for ; Thu, 21 May 2015 09:43:22 -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=jKkKFmzyNHSo9BpdmF4eRojbgXSKSugjsyhjGH7ZfBA=; b=fI1/YWt4RbVWlUdx6/7G5eSsRM9jnbpqQhRUg9FfaeXANdyE0D7IjF9eGBLJxQd/EY uE96k9nY2jyAaqzlZxr+utl/QJ/10jnR7znL96uuhnJi9FlihLVuWtir5OIhCyvSAbm1 ub+a13HCsc91wYNpPjUL6Nn6it7Ly0Ug+8BpQhWE6XzGHnHAyzTn3fYb7E1WMJgiAhUb 1cnH/FCMEPoWSQN/WgPofimnpl/lbu6IU2NwKhTGPkCrSs2UjmKy9s2TXYpsnlgNJmuj y/aoDKeadZd2TR8EXAUeirYicBiKoQBT10i9T8DQFnUjmpEyKYRdohTw6Ja0tB7IwBzE KSbQ== X-Gm-Message-State: ALoCoQmoFC5EgGXp5Y03cJUHADssDtIOf059XcVAVShFsS8ZULn+BH4EBzGqt9r8IM68ScZURH9d X-Received: by 10.112.42.236 with SMTP id r12mr3461701lbl.2.1432226602070; Thu, 21 May 2015 09:43:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.232 with SMTP id p8ls382549laf.13.gmail; Thu, 21 May 2015 09:43:21 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr3047530lab.35.1432226601895; Thu, 21 May 2015 09:43:21 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id a1si13600976lbc.45.2015.05.21.09.43.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 May 2015 09:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbcmx3 with SMTP id mx3so22391007lbc.1 for ; Thu, 21 May 2015 09:43:21 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr3100571lbc.32.1432226601356; Thu, 21 May 2015 09:43:21 -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 hn6csp722033lbb; Thu, 21 May 2015 09:43:20 -0700 (PDT) X-Received: by 10.68.136.134 with SMTP id qa6mr7440510pbb.66.1432226599494; Thu, 21 May 2015 09:43:19 -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.00; Thu, 21 May 2015 09:43:19 -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 S1756534AbbEUQmz (ORCPT + 28 others); Thu, 21 May 2015 12:42:55 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:36579 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756502AbbEUQmu (ORCPT ); Thu, 21 May 2015 12:42:50 -0400 Received: by wizk4 with SMTP id k4so21313766wiz.1 for ; Thu, 21 May 2015 09:42:49 -0700 (PDT) X-Received: by 10.194.10.72 with SMTP id g8mr6964206wjb.28.1432226569192; Thu, 21 May 2015 09:42:49 -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 gj7sm3684748wib.4.2015.05.21.09.42.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 09:42:48 -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 01/11] regmap: Introduce regmap_get_max_register. Date: Thu, 21 May 2015 17:42:43 +0100 Message-Id: <1432226563-8689-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.217.181 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_max_register() function which would be used by the infrastructures like nvmem framework built on top of regmap. 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 6273ff0..d6c8404 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2613,6 +2613,18 @@ int regmap_get_val_bytes(struct regmap *map) } EXPORT_SYMBOL_GPL(regmap_get_val_bytes); +/** + * regmap_get_max_register(): Report the max register value + * + * Report the max register value, mainly intended to for use by + * generic infrastructure built on top of regmap. + */ +int regmap_get_max_register(struct regmap *map) +{ + return map->max_register ? map->max_register : -EINVAL; +} +EXPORT_SYMBOL_GPL(regmap_get_max_register); + 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 116655d..2d87ded 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -433,6 +433,7 @@ int regmap_update_bits_check_async(struct regmap *map, unsigned int reg, unsigned int mask, unsigned int val, bool *change); int regmap_get_val_bytes(struct regmap *map); +int regmap_get_max_register(struct regmap *map); int regmap_async_complete(struct regmap *map); bool regmap_can_raw_write(struct regmap *map); @@ -676,6 +677,12 @@ static inline int regmap_get_val_bytes(struct regmap *map) return -EINVAL; } +static inline int regmap_get_max_register(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");