#include <linux/device.h>
#include <linux/seq_file.h>
static inline unsigned int regcache_flat_get_index(const struct regmap *map,
return regcache_get_index_by_order(map, reg);
static int regcache_flat_init(struct regmap *map)
if (!map || map->reg_stride_order < 0 || !map->max_register)
map->cache = kcalloc(regcache_flat_get_index(map, map->max_register)
+ 1, sizeof(unsigned int), GFP_KERNEL);
for (i = 0; i < map->num_reg_defaults; i++) {
unsigned int reg = map->reg_defaults[i].reg;
unsigned int index = regcache_flat_get_index(map, reg);
cache[index] = map->reg_defaults[i].def;
static int regcache_flat_exit(struct regmap *map)
static int regcache_flat_read(struct regmap *map,
unsigned int reg, unsigned int *value)
unsigned int *cache = map->cache;
unsigned int index = regcache_flat_get_index(map, reg);