diff options
| author | Lars-Peter Clausen <lars@metafoo.de> | 2013-05-23 11:23:49 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-05-23 12:02:14 -0400 |
| commit | f20c783c3ae33c30fd7cf0616db18d30cb6e802b (patch) | |
| tree | 0a23a7fc9ca9770ceb4a1a29063a88f178b5ecac | |
| parent | c7788792a5e7b0d5d7f96d0766b4cb6112d47d75 (diff) | |
regmap: regcache: Fixup locking for custom lock callbacks
The parameter passed to the regmap lock/unlock callbacks needs to be
map->lock_arg, regcache passes just map. This works fine in the case that no
custom locking callbacks are used since in this case map->lock_arg equals map,
but will break when custom locking callbacks are used. The issue was introduced
in commit 0d4529c5("regmap: make lock/unlock functions customizable") and is
fixed by this patch.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| -rw-r--r-- | drivers/base/regmap/regcache-rbtree.c | 4 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache.c | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index aa0875f6f1b7..b4e343b64c83 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
| @@ -143,7 +143,7 @@ static int rbtree_show(struct seq_file *s, void *ignored) | |||
| 143 | int registers = 0; | 143 | int registers = 0; |
| 144 | int this_registers, average; | 144 | int this_registers, average; |
| 145 | 145 | ||
| 146 | map->lock(map); | 146 | map->lock(map->lock_arg); |
| 147 | 147 | ||
| 148 | mem_size = sizeof(*rbtree_ctx); | 148 | mem_size = sizeof(*rbtree_ctx); |
| 149 | mem_size += BITS_TO_LONGS(map->cache_present_nbits) * sizeof(long); | 149 | mem_size += BITS_TO_LONGS(map->cache_present_nbits) * sizeof(long); |
| @@ -170,7 +170,7 @@ static int rbtree_show(struct seq_file *s, void *ignored) | |||
| 170 | seq_printf(s, "%d nodes, %d registers, average %d registers, used %zu bytes\n", | 170 | seq_printf(s, "%d nodes, %d registers, average %d registers, used %zu bytes\n", |
| 171 | nodes, registers, average, mem_size); | 171 | nodes, registers, average, mem_size); |
| 172 | 172 | ||
| 173 | map->unlock(map); | 173 | map->unlock(map->lock_arg); |
| 174 | 174 | ||
| 175 | return 0; | 175 | return 0; |
| 176 | } | 176 | } |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 75923f2396bd..507ee2da0f6e 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
| @@ -270,7 +270,7 @@ int regcache_sync(struct regmap *map) | |||
| 270 | 270 | ||
| 271 | BUG_ON(!map->cache_ops || !map->cache_ops->sync); | 271 | BUG_ON(!map->cache_ops || !map->cache_ops->sync); |
| 272 | 272 | ||
| 273 | map->lock(map); | 273 | map->lock(map->lock_arg); |
| 274 | /* Remember the initial bypass state */ | 274 | /* Remember the initial bypass state */ |
| 275 | bypass = map->cache_bypass; | 275 | bypass = map->cache_bypass; |
| 276 | dev_dbg(map->dev, "Syncing %s cache\n", | 276 | dev_dbg(map->dev, "Syncing %s cache\n", |
| @@ -306,7 +306,7 @@ out: | |||
| 306 | trace_regcache_sync(map->dev, name, "stop"); | 306 | trace_regcache_sync(map->dev, name, "stop"); |
| 307 | /* Restore the bypass state */ | 307 | /* Restore the bypass state */ |
| 308 | map->cache_bypass = bypass; | 308 | map->cache_bypass = bypass; |
| 309 | map->unlock(map); | 309 | map->unlock(map->lock_arg); |
| 310 | 310 | ||
| 311 | return ret; | 311 | return ret; |
| 312 | } | 312 | } |
| @@ -333,7 +333,7 @@ int regcache_sync_region(struct regmap *map, unsigned int min, | |||
| 333 | 333 | ||
| 334 | BUG_ON(!map->cache_ops || !map->cache_ops->sync); | 334 | BUG_ON(!map->cache_ops || !map->cache_ops->sync); |
| 335 | 335 | ||
| 336 | map->lock(map); | 336 | map->lock(map->lock_arg); |
| 337 | 337 | ||
| 338 | /* Remember the initial bypass state */ | 338 | /* Remember the initial bypass state */ |
| 339 | bypass = map->cache_bypass; | 339 | bypass = map->cache_bypass; |
| @@ -352,7 +352,7 @@ out: | |||
| 352 | trace_regcache_sync(map->dev, name, "stop region"); | 352 | trace_regcache_sync(map->dev, name, "stop region"); |
| 353 | /* Restore the bypass state */ | 353 | /* Restore the bypass state */ |
| 354 | map->cache_bypass = bypass; | 354 | map->cache_bypass = bypass; |
| 355 | map->unlock(map); | 355 | map->unlock(map->lock_arg); |
| 356 | 356 | ||
| 357 | return ret; | 357 | return ret; |
| 358 | } | 358 | } |
| @@ -372,11 +372,11 @@ EXPORT_SYMBOL_GPL(regcache_sync_region); | |||
| 372 | */ | 372 | */ |
| 373 | void regcache_cache_only(struct regmap *map, bool enable) | 373 | void regcache_cache_only(struct regmap *map, bool enable) |
| 374 | { | 374 | { |
| 375 | map->lock(map); | 375 | map->lock(map->lock_arg); |
| 376 | WARN_ON(map->cache_bypass && enable); | 376 | WARN_ON(map->cache_bypass && enable); |
| 377 | map->cache_only = enable; | 377 | map->cache_only = enable; |
| 378 | trace_regmap_cache_only(map->dev, enable); | 378 | trace_regmap_cache_only(map->dev, enable); |
| 379 | map->unlock(map); | 379 | map->unlock(map->lock_arg); |
| 380 | } | 380 | } |
| 381 | EXPORT_SYMBOL_GPL(regcache_cache_only); | 381 | EXPORT_SYMBOL_GPL(regcache_cache_only); |
| 382 | 382 | ||
| @@ -391,9 +391,9 @@ EXPORT_SYMBOL_GPL(regcache_cache_only); | |||
| 391 | */ | 391 | */ |
| 392 | void regcache_mark_dirty(struct regmap *map) | 392 | void regcache_mark_dirty(struct regmap *map) |
| 393 | { | 393 | { |
| 394 | map->lock(map); | 394 | map->lock(map->lock_arg); |
| 395 | map->cache_dirty = true; | 395 | map->cache_dirty = true; |
| 396 | map->unlock(map); | 396 | map->unlock(map->lock_arg); |
| 397 | } | 397 | } |
| 398 | EXPORT_SYMBOL_GPL(regcache_mark_dirty); | 398 | EXPORT_SYMBOL_GPL(regcache_mark_dirty); |
| 399 | 399 | ||
| @@ -410,11 +410,11 @@ EXPORT_SYMBOL_GPL(regcache_mark_dirty); | |||
| 410 | */ | 410 | */ |
| 411 | void regcache_cache_bypass(struct regmap *map, bool enable) | 411 | void regcache_cache_bypass(struct regmap *map, bool enable) |
| 412 | { | 412 | { |
| 413 | map->lock(map); | 413 | map->lock(map->lock_arg); |
| 414 | WARN_ON(map->cache_only && enable); | 414 | WARN_ON(map->cache_only && enable); |
| 415 | map->cache_bypass = enable; | 415 | map->cache_bypass = enable; |
| 416 | trace_regmap_cache_bypass(map->dev, enable); | 416 | trace_regmap_cache_bypass(map->dev, enable); |
| 417 | map->unlock(map); | 417 | map->unlock(map->lock_arg); |
| 418 | } | 418 | } |
| 419 | EXPORT_SYMBOL_GPL(regcache_cache_bypass); | 419 | EXPORT_SYMBOL_GPL(regcache_cache_bypass); |
| 420 | 420 | ||
