mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regmap: Cache single values read from the chip
@ 2012-04-30 21:55 Mark Brown
  0 siblings, 0 replies; only message in thread
From: Mark Brown @ 2012-04-30 21:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mark Brown

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.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/base/regmap/regmap.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 178989a..b57bb86 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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;
 }
 
-- 
1.7.10


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-04-30 21:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-30 21:55 [PATCH] regmap: Cache single values read from the chip Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®