Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758206AbbLCC1y (ORCPT ); Wed, 2 Dec 2015 21:27:54 -0500 Received: from n9-45.mail.139.com ([221.176.9.45]:62734 "EHLO n9-45.mail.139.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758014AbbLCC1x (ORCPT ); Wed, 2 Dec 2015 21:27:53 -0500 X-Greylist: delayed 543 seconds by postgrey-1.27 at vger.kernel.org; Wed, 02 Dec 2015 21:27:52 EST X-Richmail-Antispam: sCL2rVi0borhSzeOjpYxWEmrxqxSIjpgsIL2jVqxeZIR0RM= X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2f15565fa685935-ac0fe From: Xiubo Li To: broonie@kernel.org Cc: linux-kernel@vger.kernel.org, Xiubo Li Subject: [PATCH] regmap: speed up the regcache_init() Date: Thu, 3 Dec 2015 10:19:10 +0800 Message-Id: <1449109150-26793-1-git-send-email-lixiubo@cmss.chinamobile.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1384 Lines: 43 If the cache is not used by the device driver, there is not need to check the striding of the registers. It will just return 0 from regcache_init() and let the register striding be checked in proper place when needed. Signed-off-by: Xiubo Li --- drivers/base/regmap/regcache.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 4c07802..edc3bd9 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -100,15 +100,15 @@ int regcache_init(struct regmap *map, const struct regmap_config *config) int i; void *tmp_buf; - for (i = 0; i < config->num_reg_defaults; i++) - if (config->reg_defaults[i].reg % map->reg_stride) - return -EINVAL; - if (map->cache_type == REGCACHE_NONE) { map->cache_bypass = true; return 0; } + for (i = 0; i < config->num_reg_defaults; i++) + if (config->reg_defaults[i].reg % map->reg_stride) + return -EINVAL; + for (i = 0; i < ARRAY_SIZE(cache_types); i++) if (cache_types[i]->type == map->cache_type) break; -- 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/