regmap: cache: Add warning info for the cache check

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 <lixiubo@cmss.chinamobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Xiubo Li 2015-12-11 11:23:19 +08:00 коммит произвёл Mark Brown
Родитель 8005c49d9a
Коммит 8cfe2fd356
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -100,15 +100,19 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
int i; int i;
void *tmp_buf; 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 (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; map->cache_bypass = true;
return 0; 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++) for (i = 0; i < ARRAY_SIZE(cache_types); i++)
if (cache_types[i]->type == map->cache_type) if (cache_types[i]->type == map->cache_type)
break; break;