]> 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 a9d8d7be6aa31cb79ee066a247e24e11e7271395..29b4128da0b08ce6b8eda048557ed9093b07efa0 100644 (file)
@@ -313,10 +313,6 @@ int regcache_sync(struct regmap *map)
        /* Apply any patch first */
        map->cache_bypass = 1;
        for (i = 0; i < map->patch_regs; i++) {
-               if (map->patch[i].reg % map->reg_stride) {
-                       ret = -EINVAL;
-                       goto out;
-               }
                ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def);
                if (ret != 0) {
                        dev_err(map->dev, "Failed to write %x = %x: %d\n",
@@ -637,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;