Re: [PATCH] regmap: cache: Handle stride > 1 in sync_block_raw_flush
On Fri, Jan 24, 2014 at 03:40:39PM -0800, Dylan Reid wrote: > 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 Applied, thanks. signature.asc Description: Digital signature
Re: [PATCH] regmap: cache: Handle stride 1 in sync_block_raw_flush
On Fri, Jan 24, 2014 at 03:40:39PM -0800, Dylan Reid wrote: 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 Applied, thanks. signature.asc Description: Digital signature
[PATCH] 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 --- drivers/base/regmap/regcache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index d4dd771..dd56177 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; -- 1.8.1.3.605.g02339dd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] 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 dgr...@chromium.org --- drivers/base/regmap/regcache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index d4dd771..dd56177 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; -- 1.8.1.3.605.g02339dd -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/