summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2011-09-29 14:36:25 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-09-30 13:57:47 +0100
commit13753a9088af23c61e2f5c10a8f3ea136d8ebab5 (patch)
tree44c7a109f98995800f55ffd8b0cf0cefca158caf /drivers/base
parent5fcd2560767cead8f0c741340e132c5417d9f73b (diff)
regmap: Lock the sync path, ensure we use the lockless _regmap_write()
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache-indexed.c4
-rw-r--r--drivers/base/regmap/regcache-lzo.c2
-rw-r--r--drivers/base/regmap/regcache-rbtree.c2
-rw-r--r--drivers/base/regmap/regcache.c4
4 files changed, 7 insertions, 5 deletions
diff --git a/drivers/base/regmap/regcache-indexed.c b/drivers/base/regmap/regcache-indexed.c
index 268497aee46..2e10bb13bfc 100644
--- a/drivers/base/regmap/regcache-indexed.c
+++ b/drivers/base/regmap/regcache-indexed.c
@@ -45,8 +45,8 @@ static int regcache_indexed_sync(struct regmap *map)
int ret;
for (i = 0; i < map->num_reg_defaults; i++) {
- ret = regmap_write(map, map->reg_defaults[i].reg,
- map->reg_defaults[i].def);
+ ret = _regmap_write(map, map->reg_defaults[i].reg,
+ map->reg_defaults[i].def);
if (ret < 0)
return ret;
dev_dbg(map->dev, "Synced register %#x, value %#x\n",
diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c
index 9079cb50b0b..ad6af925f56 100644
--- a/drivers/base/regmap/regcache-lzo.c
+++ b/drivers/base/regmap/regcache-lzo.c
@@ -339,7 +339,7 @@ static int regcache_lzo_sync(struct regmap *map)
if (ret)
return ret;
map->cache_bypass = 1;
- ret = regmap_write(map, i, val);
+ ret = _regmap_write(map, i, val);
map->cache_bypass = 0;
if (ret)
return ret;
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index de32ced1917..40f23dd8478 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -327,7 +327,7 @@ static int regcache_rbtree_sync(struct regmap *map)
if (val == def)
continue;
map->cache_bypass = 1;
- ret = regmap_write(map, regtmp, val);
+ ret = _regmap_write(map, regtmp, val);
map->cache_bypass = 0;
if (ret)
return ret;
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 2caf6e49c38..59e432c0163 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -230,6 +230,7 @@ int regcache_sync(struct regmap *map)
BUG_ON(!map->cache_ops);
+ mutex_lock(&map->lock);
dev_dbg(map->dev, "Syncing %s cache\n",
map->cache_ops->name);
name = map->cache_ops->name;
@@ -242,7 +243,7 @@ int regcache_sync(struct regmap *map)
if (ret < 0)
goto out;
map->cache_bypass = 1;
- ret = regmap_write(map, i, val);
+ ret = _regmap_write(map, i, val);
map->cache_bypass = 0;
if (ret < 0)
goto out;
@@ -254,6 +255,7 @@ int regcache_sync(struct regmap *map)
}
out:
trace_regcache_sync(map->dev, name, "stop");
+ mutex_unlock(&map->lock);
return ret;
}