aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2014-01-24 18:40:39 -0500
committerMark Brown <broonie@linaro.org>2014-01-27 13:25:11 -0500
commit78ba73eecd2256790926859849801c0446766c0a (patch)
treebb8876ab01f0ab70ec7d754cf131fcc7a8384ced
parent86776fc174973e556be7d668763f509a81124f8b (diff)
regmap: cache: Handle stride > 1 in sync_block_raw_flush
regcache_sync_block_raw_flush takes the address of the base register and the address of one past the last register to write to. "count" is the number of registers in the range, not the number of bytes, it should be (end addr - start addr) / stride. Without accounting for strides greater than one, registers past the end might be synced or the writeable_reg callback at the beginning of _regmap_raw_write will fail and nothing will be written. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/base/regmap/regcache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index d4dd77134814..dd56177b7010 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -636,10 +636,10 @@ static int regcache_sync_block_raw_flush(struct regmap *map, const void **data,
636 if (*data == NULL) 636 if (*data == NULL)
637 return 0; 637 return 0;
638 638
639 count = cur - base; 639 count = (cur - base) / map->reg_stride;
640 640
641 dev_dbg(map->dev, "Writing %zu bytes for %d registers from 0x%x-0x%x\n", 641 dev_dbg(map->dev, "Writing %zu bytes for %d registers from 0x%x-0x%x\n",
642 count * val_bytes, count, base, cur - 1); 642 count * val_bytes, count, base, cur - map->reg_stride);
643 643
644 map->cache_bypass = 1; 644 map->cache_bypass = 1;
645 645