summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2014-01-24 15:40:39 -0800
committerNitin Garg <nitin.garg@freescale.com>2015-04-14 14:00:26 -0500
commitef3cc4a68a7eb1581a17cd207d4afa5b95785a3c (patch)
treeb958c4ecf27cdbf67bc4f629b0f8852e97827af1
parent9c9b351e28aed2c7537d10594c2bba1a0e485ed2 (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> (cherry picked from commit 78ba73eecd2256790926859849801c0446766c0a) Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
-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 154e7a8c0a04..3bfeeb12457c 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,
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;