diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2011-09-29 09:36:25 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-30 08:57:47 -0400 |
commit | 13753a9088af23c61e2f5c10a8f3ea136d8ebab5 (patch) | |
tree | 44c7a109f98995800f55ffd8b0cf0cefca158caf /drivers | |
parent | 5fcd2560767cead8f0c741340e132c5417d9f73b (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')
-rw-r--r-- | drivers/base/regmap/regcache-indexed.c | 4 | ||||
-rw-r--r-- | drivers/base/regmap/regcache-lzo.c | 2 | ||||
-rw-r--r-- | drivers/base/regmap/regcache-rbtree.c | 2 | ||||
-rw-r--r-- | drivers/base/regmap/regcache.c | 4 |
4 files changed, 7 insertions, 5 deletions
diff --git a/drivers/base/regmap/regcache-indexed.c b/drivers/base/regmap/regcache-indexed.c index 268497aee46d..2e10bb13bfc4 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) | |||
45 | int ret; | 45 | int ret; |
46 | 46 | ||
47 | for (i = 0; i < map->num_reg_defaults; i++) { | 47 | for (i = 0; i < map->num_reg_defaults; i++) { |
48 | ret = regmap_write(map, map->reg_defaults[i].reg, | 48 | ret = _regmap_write(map, map->reg_defaults[i].reg, |
49 | map->reg_defaults[i].def); | 49 | map->reg_defaults[i].def); |
50 | if (ret < 0) | 50 | if (ret < 0) |
51 | return ret; | 51 | return ret; |
52 | dev_dbg(map->dev, "Synced register %#x, value %#x\n", | 52 | 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 9079cb50b0b9..ad6af925f56c 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) | |||
339 | if (ret) | 339 | if (ret) |
340 | return ret; | 340 | return ret; |
341 | map->cache_bypass = 1; | 341 | map->cache_bypass = 1; |
342 | ret = regmap_write(map, i, val); | 342 | ret = _regmap_write(map, i, val); |
343 | map->cache_bypass = 0; | 343 | map->cache_bypass = 0; |
344 | if (ret) | 344 | if (ret) |
345 | return ret; | 345 | return ret; |
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index de32ced1917a..40f23dd8478c 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) | |||
327 | if (val == def) | 327 | if (val == def) |
328 | continue; | 328 | continue; |
329 | map->cache_bypass = 1; | 329 | map->cache_bypass = 1; |
330 | ret = regmap_write(map, regtmp, val); | 330 | ret = _regmap_write(map, regtmp, val); |
331 | map->cache_bypass = 0; | 331 | map->cache_bypass = 0; |
332 | if (ret) | 332 | if (ret) |
333 | return ret; | 333 | return ret; |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 2caf6e49c389..59e432c0163d 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -230,6 +230,7 @@ int regcache_sync(struct regmap *map) | |||
230 | 230 | ||
231 | BUG_ON(!map->cache_ops); | 231 | BUG_ON(!map->cache_ops); |
232 | 232 | ||
233 | mutex_lock(&map->lock); | ||
233 | dev_dbg(map->dev, "Syncing %s cache\n", | 234 | dev_dbg(map->dev, "Syncing %s cache\n", |
234 | map->cache_ops->name); | 235 | map->cache_ops->name); |
235 | name = map->cache_ops->name; | 236 | name = map->cache_ops->name; |
@@ -242,7 +243,7 @@ int regcache_sync(struct regmap *map) | |||
242 | if (ret < 0) | 243 | if (ret < 0) |
243 | goto out; | 244 | goto out; |
244 | map->cache_bypass = 1; | 245 | map->cache_bypass = 1; |
245 | ret = regmap_write(map, i, val); | 246 | ret = _regmap_write(map, i, val); |
246 | map->cache_bypass = 0; | 247 | map->cache_bypass = 0; |
247 | if (ret < 0) | 248 | if (ret < 0) |
248 | goto out; | 249 | goto out; |
@@ -254,6 +255,7 @@ int regcache_sync(struct regmap *map) | |||
254 | } | 255 | } |
255 | out: | 256 | out: |
256 | trace_regcache_sync(map->dev, name, "stop"); | 257 | trace_regcache_sync(map->dev, name, "stop"); |
258 | mutex_unlock(&map->lock); | ||
257 | 259 | ||
258 | return ret; | 260 | return ret; |
259 | } | 261 | } |