From patchwork Mon Mar 30 21:56:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 46554 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 38CDB218BE for ; Mon, 30 Mar 2015 21:57:08 +0000 (UTC) Received: by wgfh4 with SMTP id h4sf27690395wgf.1 for ; Mon, 30 Mar 2015 14:57:07 -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=QcxAzgt3enV6Xq9Jg+6eubsTbeYY70eum/9GZ6B8FK0=; b=HqWvXVdiovRSEG8cM5JP5nMPGd3nhIDgN6VrW1YlZMDL78XJuAdImBiFCtP7vwRMju gY5iGQvJvUmmfx/hO/bwOpzTqfEZnlV2OxyxdsATEU432Vp7j9HbPcWndPTKPA4SCGi2 xG5rTE7S2C2/c8pUDYJ161V7r5F/NM9BlGmMS03h+wuz/klOUeeGZ+AyCoJktI8D5mle 5IQ1si3szsxZm05FCrhlEZD9t1SZt2WCiJ8dG/VJzf7vrcnyrpW3LkPvMDz2KgvePvP5 7kUgdSz3InwkgyTWxMREKG00T0OAh6w28XDL1qZzHBx7CaPVBkelMlrrZ2WeNyeWa/c1 ZeXA== X-Gm-Message-State: ALoCoQkapNub+UNc19aYWroTHs4sFR3mcq7Sfbn/l01K+lKcwvktMg+vURL4BMZI0j7oVkjOlluk X-Received: by 10.180.126.37 with SMTP id mv5mr4127951wib.3.1427752627545; Mon, 30 Mar 2015 14:57:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.9 with SMTP id r9ls632025lae.22.gmail; Mon, 30 Mar 2015 14:57:07 -0700 (PDT) X-Received: by 10.112.26.209 with SMTP id n17mr28147682lbg.84.1427752627265; Mon, 30 Mar 2015 14:57:07 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id dl7si7892144lad.6.2015.03.30.14.57.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Mar 2015 14:57:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lboc7 with SMTP id c7so48024477lbo.1 for ; Mon, 30 Mar 2015 14:57:07 -0700 (PDT) X-Received: by 10.152.163.35 with SMTP id yf3mr1810364lab.86.1427752627152; Mon, 30 Mar 2015 14:57:07 -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 k9csp1409915lbq; Mon, 30 Mar 2015 14:57:06 -0700 (PDT) X-Received: by 10.66.141.231 with SMTP id rr7mr62884787pab.72.1427752625288; Mon, 30 Mar 2015 14:57:05 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id my8si16420050pbc.235.2015.03.30.14.57.04; Mon, 30 Mar 2015 14:57:05 -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 S1753693AbbC3V4s (ORCPT + 27 others); Mon, 30 Mar 2015 17:56:48 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:36248 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753448AbbC3V4d (ORCPT ); Mon, 30 Mar 2015 17:56:33 -0400 Received: by wgra20 with SMTP id a20so189218113wgr.3 for ; Mon, 30 Mar 2015 14:56:32 -0700 (PDT) X-Received: by 10.180.74.135 with SMTP id t7mr26543835wiv.72.1427752592058; Mon, 30 Mar 2015 14:56:32 -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 k1sm17536083wjn.9.2015.03.30.14.56.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Mar 2015 14:56:31 -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 01/10] regmap: Introduce regmap_get_max_register. Date: Mon, 30 Mar 2015 22:56:27 +0100 Message-Id: <1427752587-17087-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.217.170 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 eeprom 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 f99b098..d703921 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2617,6 +2617,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 ? : -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");