From patchwork Tue Mar 24 22:29:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 46286 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED93C2159D for ; Tue, 24 Mar 2015 22:29:57 +0000 (UTC) Received: by lbdu14 with SMTP id u14sf1077340lbd.3 for ; Tue, 24 Mar 2015 15:29:56 -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=VXfFE6IU11PN/KAmNdh5MmCZRi1Sm5KyEH3goaNuWJo=; b=FkHXYg0FyeZaYkPqoGLyA5yOvDHcwGU2l0IYnqz7unExSezW7XqjCQXI6U+WP7L/hO Dh9sfp5d/aKHlmgB8m7FGgH6CfLiqF5xuy2fYlI3GKhlmN1YvdQZyInra4er7veQEIHg wQJV9ESJHwDmaf+qAu3PJS+Y4gyLPwjptb4FHEg/2UeMXAGxcLR86P/e9/wQ1uKH4GhC aXvsHUQHp89L4fhDLTMdxyA0D573idGHReEQdjiCgixDV1yR6Pdgv3P4ivfPvXtAyaBH E+XQLcWn7yXlSl6T4BbVwNPilwyDttBz+dAkg4U1zhderzU/qTF6YwYrJGqRwzYy8OeG 28sA== X-Gm-Message-State: ALoCoQlb88Dc7TdlZU2VR8s/TT3NZRviBe4i+T+8TVSN+KOfeRaVSwK9puuYkmztpzKSeWRaekTG X-Received: by 10.152.88.33 with SMTP id bd1mr1387687lab.2.1427236196932; Tue, 24 Mar 2015 15:29:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.4 with SMTP id lc4ls26062lac.104.gmail; Tue, 24 Mar 2015 15:29:56 -0700 (PDT) X-Received: by 10.112.173.133 with SMTP id bk5mr5679505lbc.94.1427236196753; Tue, 24 Mar 2015 15:29:56 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id yt20si442571lbb.89.2015.03.24.15.29.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Mar 2015 15:29:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by laae1 with SMTP id e1so5787359laa.2 for ; Tue, 24 Mar 2015 15:29:56 -0700 (PDT) X-Received: by 10.112.141.202 with SMTP id rq10mr5732023lbb.88.1427236196655; Tue, 24 Mar 2015 15:29:56 -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 k9csp1731894lbq; Tue, 24 Mar 2015 15:29:55 -0700 (PDT) X-Received: by 10.67.7.102 with SMTP id db6mr11729949pad.14.1427236194912; Tue, 24 Mar 2015 15:29:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dp4si779927pdb.101.2015.03.24.15.29.54; Tue, 24 Mar 2015 15:29:54 -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 S1753317AbbCXW3t (ORCPT + 27 others); Tue, 24 Mar 2015 18:29:49 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:36434 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752756AbbCXW3p (ORCPT ); Tue, 24 Mar 2015 18:29:45 -0400 Received: by wibg7 with SMTP id g7so87599108wib.1 for ; Tue, 24 Mar 2015 15:29:44 -0700 (PDT) X-Received: by 10.180.160.226 with SMTP id xn2mr22227994wib.43.1427236184098; Tue, 24 Mar 2015 15:29:44 -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 ha10sm825493wjc.37.2015.03.24.15.29.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Mar 2015 15:29:43 -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 1/9] regmap: Introduce regmap_get_max_register. Date: Tue, 24 Mar 2015 22:29:39 +0000 Message-Id: <1427236179-18580-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: 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.215.50 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 d2f8a81..6fd234b 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2616,6 +2616,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 4419b99..c46dbf3 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");