regmap: Move initialization of regcache related fields to regcache_init

Move the initialization regcache related fields of the regmap struct to
regcache_init. This allows us to keep regmap and regcache code better
separated.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Lars-Peter Clausen
2011-11-16 16:28:16 +01:00
committed by Mark Brown
parent c2b1ecd13c
commit e5e3b8abed
3 changed files with 10 additions and 9 deletions

View File

@@ -87,7 +87,7 @@ err_free:
return ret;
}
int regcache_init(struct regmap *map)
int regcache_init(struct regmap *map, const struct regmap_config *config)
{
int ret;
int i;
@@ -108,6 +108,13 @@ int regcache_init(struct regmap *map)
return -EINVAL;
}
map->reg_defaults = config->reg_defaults;
map->num_reg_defaults = config->num_reg_defaults;
map->num_reg_defaults_raw = config->num_reg_defaults_raw;
map->reg_defaults_raw = config->reg_defaults_raw;
map->cache_size_raw = (config->val_bits / 8) * config->num_reg_defaults_raw;
map->cache_word_size = config->val_bits / 8;
map->cache = NULL;
map->cache_ops = cache_types[i];