aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2014-01-24 18:40:39 -0500
committerNicolin Chen <Guangyu.Chen@freescale.com>2014-06-19 05:06:28 -0400
commit6079fb818211bc8f7c86287ceab5e04e70f4e476 (patch)
tree7823c00435c48b5d0009d2043048963bf9c93ede
parent48dbccdb017195c8a2fba6cc5e5b103f2a20e3e5 (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 46283fd3c4c0..ed0c6c0c08c7 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -588,10 +588,10 @@ static int regcache_sync_block_raw_flush(struct regmap *map, const void **data,
588 if (*data == NULL) 588 if (*data == NULL)
589 return 0; 589 return 0;
590 590
591 count = cur - base; 591 count = (cur - base) / map->reg_stride;
592 592
593 dev_dbg(map->dev, "Writing %zu bytes for %d registers from 0x%x-0x%x\n", 593 dev_dbg(map->dev, "Writing %zu bytes for %d registers from 0x%x-0x%x\n",
594 count * val_bytes, count, base, cur - 1); 594 count * val_bytes, count, base, cur - map->reg_stride);
595 595
596 map->cache_bypass = 1; 596 map->cache_bypass = 1;
597 597