aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/regmap/regcache.c')
-rw-r--r--drivers/base/regmap/regcache.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index e69ff3e4742c..f0a3db6ff9c2 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -58,8 +58,7 @@ static int regcache_hw_init(struct regmap *map)
58 58
59 /* calculate the size of reg_defaults */ 59 /* calculate the size of reg_defaults */
60 for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) { 60 for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) {
61 val = regcache_get_val(map->reg_defaults_raw, 61 val = regcache_get_val(map, map->reg_defaults_raw, i);
62 i, map->cache_word_size);
63 if (regmap_volatile(map, i * map->reg_stride)) 62 if (regmap_volatile(map, i * map->reg_stride))
64 continue; 63 continue;
65 count++; 64 count++;
@@ -75,8 +74,7 @@ static int regcache_hw_init(struct regmap *map)
75 /* fill the reg_defaults */ 74 /* fill the reg_defaults */
76 map->num_reg_defaults = count; 75 map->num_reg_defaults = count;
77 for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) { 76 for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) {
78 val = regcache_get_val(map->reg_defaults_raw, 77 val = regcache_get_val(map, map->reg_defaults_raw, i);
79 i, map->cache_word_size);
80 if (regmap_volatile(map, i * map->reg_stride)) 78 if (regmap_volatile(map, i * map->reg_stride))
81 continue; 79 continue;
82 map->reg_defaults[j].reg = i * map->reg_stride; 80 map->reg_defaults[j].reg = i * map->reg_stride;
@@ -417,10 +415,10 @@ void regcache_cache_bypass(struct regmap *map, bool enable)
417} 415}
418EXPORT_SYMBOL_GPL(regcache_cache_bypass); 416EXPORT_SYMBOL_GPL(regcache_cache_bypass);
419 417
420bool regcache_set_val(void *base, unsigned int idx, 418bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
421 unsigned int val, unsigned int word_size) 419 unsigned int val)
422{ 420{
423 switch (word_size) { 421 switch (map->cache_word_size) {
424 case 1: { 422 case 1: {
425 u8 *cache = base; 423 u8 *cache = base;
426 if (cache[idx] == val) 424 if (cache[idx] == val)
@@ -448,13 +446,13 @@ bool regcache_set_val(void *base, unsigned int idx,
448 return false; 446 return false;
449} 447}
450 448
451unsigned int regcache_get_val(const void *base, unsigned int idx, 449unsigned int regcache_get_val(struct regmap *map, const void *base,
452 unsigned int word_size) 450 unsigned int idx)
453{ 451{
454 if (!base) 452 if (!base)
455 return -EINVAL; 453 return -EINVAL;
456 454
457 switch (word_size) { 455 switch (map->cache_word_size) {
458 case 1: { 456 case 1: {
459 const u8 *cache = base; 457 const u8 *cache = base;
460 return cache[idx]; 458 return cache[idx];