diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-05-23 09:06:15 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-05-23 10:07:33 -0400 |
commit | 81485f5220770c381ac076573642ac44f13723af (patch) | |
tree | 23fd0b7bbce5752ea0cb3924964f84037ce46fbb /drivers/base/regmap/regcache.c | |
parent | 7278af5fb3eb7247449fd4489dacb75b9ba86f73 (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>
Diffstat (limited to 'drivers/base/regmap/regcache.c')
-rw-r--r-- | drivers/base/regmap/regcache.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 8a0ab5fa75f5..4bfa219ef37d 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 | } |
@@ -378,7 +378,7 @@ int regcache_drop_region(struct regmap *map, unsigned int min, | |||
378 | if (!map->cache_present && !(map->cache_ops && map->cache_ops->drop)) | 378 | if (!map->cache_present && !(map->cache_ops && map->cache_ops->drop)) |
379 | return -EINVAL; | 379 | return -EINVAL; |
380 | 380 | ||
381 | map->lock(map); | 381 | map->lock(map->lock_arg); |
382 | 382 | ||
383 | trace_regcache_drop_region(map->dev, min, max); | 383 | trace_regcache_drop_region(map->dev, min, max); |
384 | 384 | ||
@@ -389,7 +389,7 @@ int regcache_drop_region(struct regmap *map, unsigned int min, | |||
389 | if (map->cache_ops && map->cache_ops->drop) | 389 | if (map->cache_ops && map->cache_ops->drop) |
390 | ret = map->cache_ops->drop(map, min, max); | 390 | ret = map->cache_ops->drop(map, min, max); |
391 | 391 | ||
392 | map->unlock(map); | 392 | map->unlock(map->lock_arg); |
393 | 393 | ||
394 | return ret; | 394 | return ret; |
395 | } | 395 | } |
@@ -409,11 +409,11 @@ EXPORT_SYMBOL_GPL(regcache_drop_region); | |||
409 | */ | 409 | */ |
410 | void regcache_cache_only(struct regmap *map, bool enable) | 410 | void regcache_cache_only(struct regmap *map, bool enable) |
411 | { | 411 | { |
412 | map->lock(map); | 412 | map->lock(map->lock_arg); |
413 | WARN_ON(map->cache_bypass && enable); | 413 | WARN_ON(map->cache_bypass && enable); |
414 | map->cache_only = enable; | 414 | map->cache_only = enable; |
415 | trace_regmap_cache_only(map->dev, enable); | 415 | trace_regmap_cache_only(map->dev, enable); |
416 | map->unlock(map); | 416 | map->unlock(map->lock_arg); |
417 | } | 417 | } |
418 | EXPORT_SYMBOL_GPL(regcache_cache_only); | 418 | EXPORT_SYMBOL_GPL(regcache_cache_only); |
419 | 419 | ||
@@ -428,9 +428,9 @@ EXPORT_SYMBOL_GPL(regcache_cache_only); | |||
428 | */ | 428 | */ |
429 | void regcache_mark_dirty(struct regmap *map) | 429 | void regcache_mark_dirty(struct regmap *map) |
430 | { | 430 | { |
431 | map->lock(map); | 431 | map->lock(map->lock_arg); |
432 | map->cache_dirty = true; | 432 | map->cache_dirty = true; |
433 | map->unlock(map); | 433 | map->unlock(map->lock_arg); |
434 | } | 434 | } |
435 | EXPORT_SYMBOL_GPL(regcache_mark_dirty); | 435 | EXPORT_SYMBOL_GPL(regcache_mark_dirty); |
436 | 436 | ||
@@ -447,11 +447,11 @@ EXPORT_SYMBOL_GPL(regcache_mark_dirty); | |||
447 | */ | 447 | */ |
448 | void regcache_cache_bypass(struct regmap *map, bool enable) | 448 | void regcache_cache_bypass(struct regmap *map, bool enable) |
449 | { | 449 | { |
450 | map->lock(map); | 450 | map->lock(map->lock_arg); |
451 | WARN_ON(map->cache_only && enable); | 451 | WARN_ON(map->cache_only && enable); |
452 | map->cache_bypass = enable; | 452 | map->cache_bypass = enable; |
453 | trace_regmap_cache_bypass(map->dev, enable); | 453 | trace_regmap_cache_bypass(map->dev, enable); |
454 | map->unlock(map); | 454 | map->unlock(map->lock_arg); |
455 | } | 455 | } |
456 | EXPORT_SYMBOL_GPL(regcache_cache_bypass); | 456 | EXPORT_SYMBOL_GPL(regcache_cache_bypass); |
457 | 457 | ||