Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1464943
| From | Elaine Zhang <zhangqing@rock-chips.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 0/1] regmap: drop cache if the bus transfer error |
| Date | 2016-08-18 08:50 +0200 |
| Message-ID | <s7pjj-4o3-13@gated-at.bofh.it> (permalink) |
| References | <s7pjj-4o3-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
---
drivers/base/regmap/regmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 1f011f9d6dcb..369a4c3c933e 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1497,6 +1497,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);
--
1.9.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 0/1] regmap: drop cache if the bus transfer error Elaine Zhang <zhangqing@rock-chips.com> - 2016-08-18 08:50 +0200 Applied "regmap: drop cache if the bus transfer error" to the regmap tree Mark Brown <broonie@kernel.org> - 2016-08-18 12:20 +0200
csiph-web