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>
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 2caf6e4..59e432c 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -230,6 +230,7 @@
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 @@
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 @@
}
out:
trace_regcache_sync(map->dev, name, "stop");
+ mutex_unlock(&map->lock);
return ret;
}