* [PATCH 1/2] regmap: Bypass the cache when applying patches
@ 2012-01-25 21:07 Mark Brown
2012-01-25 21:07 ` [PATCH 2/2] regmap: Skip patch application when the cache is not dirty on sync Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2012-01-25 21:07 UTC (permalink / raw)
To: linux-kernel; +Cc: patches, Mark Brown
Otherwise any patch that affects a register which is writable may trash
cached values.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/base/regmap/regcache.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 0d54668..bfe48e4 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -268,6 +268,7 @@ int regcache_sync(struct regmap *map)
trace_regcache_sync(map->dev, name, "start");
/* Apply any patch first */
+ map->cache_bypass = 1;
for (i = 0; i < map->patch_regs; i++) {
ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def);
if (ret != 0) {
@@ -276,6 +277,7 @@ int regcache_sync(struct regmap *map)
goto out;
}
}
+ map->cache_bypass = 0;
if (!map->cache_dirty)
goto out;
--
1.7.9.rc1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] regmap: Skip patch application when the cache is not dirty on sync
2012-01-25 21:07 [PATCH 1/2] regmap: Bypass the cache when applying patches Mark Brown
@ 2012-01-25 21:07 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-01-25 21:07 UTC (permalink / raw)
To: linux-kernel; +Cc: patches, Mark Brown
On the basis that if we don't actually need to resync the cache then the
patches are probably also already applied.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/base/regmap/regcache.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index bfe48e4..d103401 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -267,6 +267,9 @@ int regcache_sync(struct regmap *map)
name = map->cache_ops->name;
trace_regcache_sync(map->dev, name, "start");
+ if (!map->cache_dirty)
+ goto out;
+
/* Apply any patch first */
map->cache_bypass = 1;
for (i = 0; i < map->patch_regs; i++) {
@@ -279,8 +282,6 @@ int regcache_sync(struct regmap *map)
}
map->cache_bypass = 0;
- if (!map->cache_dirty)
- goto out;
if (map->cache_ops->sync) {
ret = map->cache_ops->sync(map);
} else {
--
1.7.9.rc1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-25 21:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25 21:07 [PATCH 1/2] regmap: Bypass the cache when applying patches Mark Brown
2012-01-25 21:07 ` [PATCH 2/2] regmap: Skip patch application when the cache is not dirty on sync Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).