diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index 6483e0bda0cfb97a48489f13a30e55c36c893e47..954f7b73238fdca2b529e1f593cb46bd0c955ab1 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h @@ -106,7 +106,7 @@ static inline void regmap_debugfs_exit(struct regmap *map) { } #endif /* regcache core declarations */ -int regcache_init(struct regmap *map); +int regcache_init(struct regmap *map, const struct regmap_config *config); void regcache_exit(struct regmap *map); int regcache_read(struct regmap *map, unsigned int reg, unsigned int *value); diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 27fae58ff4cb95105a1160d40a5d3559b6d813b4..0ad6cfb2c8cc27d0cdd3b2cf6b389ab3f0a115c3 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -87,7 +87,7 @@ static int regcache_hw_init(struct regmap *map) 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]; diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index b84ebf9eecf0d1f752388e533d9e516ab69117a3..3cf4785c3afece000e3109219c787927d8d2b874 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -159,12 +159,6 @@ struct regmap *regmap_init(struct device *dev, map->volatile_reg = config->volatile_reg; map->precious_reg = config->precious_reg; map->cache_type = config->cache_type; - 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; if (config->read_flag_mask || config->write_flag_mask) { map->read_flag_mask = config->read_flag_mask; @@ -227,7 +221,7 @@ struct regmap *regmap_init(struct device *dev, goto err_map; } - ret = regcache_init(map); + ret = regcache_init(map, config); if (ret < 0) goto err_free_workbuf;