Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755603AbbLQIpB (ORCPT ); Thu, 17 Dec 2015 03:45:01 -0500 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:3867 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752869AbbLQIo7 (ORCPT ); Thu, 17 Dec 2015 03:44:59 -0500 X-RM-TRANSID: 2ee5567276083ed-96baf X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee956727608355-8074e From: Xiubo Li To: broonie@kernel.org Cc: linux-kernel@vger.kernel.org, Xiubo Li Subject: [PATCH 2/3] regcache: Introduce the index parsing API Date: Thu, 17 Dec 2015 16:45:29 +0800 Message-Id: <1450341930-5090-3-git-send-email-lixiubo@cmss.chinamobile.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450341930-5090-1-git-send-email-lixiubo@cmss.chinamobile.com> References: <1450341930-5090-1-git-send-email-lixiubo@cmss.chinamobile.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 982 Lines: 33 Here introduces regcache_get_index() for regmap cache, which uses the register stride order and bit rotation. Signed-off-by: Xiubo Li --- drivers/base/regmap/internal.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index d43784e..60699e6 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h @@ -270,4 +270,10 @@ static inline unsigned int regmap_get_offset(const struct regmap *map, return index << map->reg_stride_order; } +static inline unsigned int regcache_get_index(const struct regmap *map, + unsigned int reg) +{ + return reg >> map->reg_stride_order; +} + #endif -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/