aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorElaine Zhang <zhangqing@rock-chips.com>2016-08-18 17:01:55 +0800
committerMark Brown <broonie@kernel.org>2016-08-18 11:09:12 +0100
commit815806e39bf6f7e7b34875d4a9609dbe76661782 (patch)
tree159196282922d63c2c2a5dc52f7f6053060fb0f2 /drivers
parentb2c7f5d9c939a37c1ce7f86a642de70e3033ee9e (diff)
downloadlinux-stericsson-815806e39bf6f7e7b34875d4a9609dbe76661782.tar.gz
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 <zhangqing@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/regmap/regmap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 51fa7d66a393..25d26bb18970 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);