Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754565AbbLKDWy (ORCPT ); Thu, 10 Dec 2015 22:22:54 -0500 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:2862 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754483AbbLKDWu (ORCPT ); Thu, 10 Dec 2015 22:22:50 -0500 X-RM-TRANSID: 2ee7566a4188e8a-1460d X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2eea566a418746a-53c58 From: Xiubo Li To: broonie@kernel.org Cc: ckeepax@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org, Xiubo Li Subject: [PATCHv2 1/2] regmap: cache: Add warning info for the cache check Date: Fri, 11 Dec 2015 11:23:19 +0800 Message-Id: <1449804200-8008-2-git-send-email-lixiubo@cmss.chinamobile.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449804200-8008-1-git-send-email-lixiubo@cmss.chinamobile.com> References: <1449804200-8008-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: 1477 Lines: 47 If there is no cache used for the drivers, the register defaults or the register defaults raw are not need any more. This patch will check this and print a warning. Signed-off-by: Xiubo Li --- drivers/base/regmap/regcache.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 1c0210a..d4e96dd 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -100,15 +100,19 @@ 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) { + if (config->reg_defaults || config->num_reg_defaults_raw) + dev_warn(map->dev, + "No cache used with register defaults set!\n"); + 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/