]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/base/regmap/regcache.c
Merge remote-tracking branches 'regmap/topic/cache', 'regmap/topic/irq', 'regmap...
[karo-tx-linux.git] / drivers / base / regmap / regcache.c
index 16426aa1457c31e236f65310d253990b593852c7..29b4128da0b08ce6b8eda048557ed9093b07efa0 100644 (file)
@@ -249,11 +249,12 @@ static int regcache_default_sync(struct regmap *map, unsigned int min,
 {
        unsigned int reg;
 
-       for (reg = min; reg <= max; reg++) {
+       for (reg = min; reg <= max; reg += map->reg_stride) {
                unsigned int val;
                int ret;
 
-               if (regmap_volatile(map, reg))
+               if (regmap_volatile(map, reg) ||
+                   !regmap_writeable(map, reg))
                        continue;
 
                ret = regcache_read(map, reg, &val);
@@ -632,10 +633,10 @@ static int regcache_sync_block_raw_flush(struct regmap *map, const void **data,
        if (*data == NULL)
                return 0;
 
-       count = cur - base;
+       count = (cur - base) / map->reg_stride;
 
        dev_dbg(map->dev, "Writing %zu bytes for %d registers from 0x%x-0x%x\n",
-               count * val_bytes, count, base, cur - 1);
+               count * val_bytes, count, base, cur - map->reg_stride);
 
        map->cache_bypass = 1;