From: Elaine Zhang Date: Thu, 18 Aug 2016 09:01:55 +0000 (+0800) Subject: regmap: drop cache if the bus transfer error X-Git-Tag: v4.8-rc8~17^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=815806e39bf6f7e7b34875d4a9609dbe76661782;p=platform%2Fkernel%2Flinux-exynos.git regmap: drop cache if the bus transfer error regmap_write ->_regmap_raw_write -->regcache_write first and than use map->bus->write to wirte i2c or spi But if the i2c or spi transfer failed, But the cache is updated, So if I use regmap_read will get the cache data which is not the real register value. Signed-off-by: Elaine Zhang Signed-off-by: Mark Brown --- diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 51fa7d6..25d26bb 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1474,6 +1474,8 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, ret = map->bus->write(map->bus_context, buf, len); kfree(buf); + } else if (ret != 0 && !map->cache_bypass && map->format.parse_val) { + regcache_drop_region(map, reg, reg + 1); } trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes);