Skip to contentSkip to conversation

regmap: Cache single values read from the chip

PATCH New Mark Brown 1 participant 1 message Apr 30, 2012

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 regmap: Cache single values read from the chip

If we don't have a cached value for a register and we can cache it then when we do a read a value we should add it to the cache to save rereading it later on. Do this for single register reads, for block reads the code would be a little more complex and this covers most practical usage.

---
 drivers/base/regmap/regmap.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/base/regmap/regmap.c +3 -0
index 178989a..b57bb86 100644
@@ -698,6 +698,9 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
 		trace_regmap_reg_read(map->dev, reg, *val);
 	}
 
+	if (!map->cache_bypass)
+		regcache_write(map, reg, *val);
+
 	return ret;
 }
 
Signature · 1 line
1.7.10