diff options
| -rw-r--r-- | drivers/base/regmap/regcache-rbtree.c | 6 | ||||
| -rw-r--r-- | drivers/base/regmap/regcache.c | 20 | ||||
| -rw-r--r-- | drivers/base/regmap/regmap-debugfs.c | 5 |
3 files changed, 16 insertions, 15 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index aa0875f6f1b7..02f490bad30f 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 | } |
| @@ -391,8 +391,6 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, | |||
| 391 | for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) { | 391 | for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) { |
| 392 | rbnode = rb_entry(node, struct regcache_rbtree_node, node); | 392 | rbnode = rb_entry(node, struct regcache_rbtree_node, node); |
| 393 | 393 | ||
| 394 | if (rbnode->base_reg < min) | ||
| 395 | continue; | ||
| 396 | if (rbnode->base_reg > max) | 394 | if (rbnode->base_reg > max) |
| 397 | break; | 395 | break; |
| 398 | if (rbnode->base_reg + rbnode->blklen < min) | 396 | if (rbnode->base_reg + rbnode->blklen < min) |
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 | ||
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 23b701f5fd2f..975719bc3450 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
| @@ -265,6 +265,7 @@ static ssize_t regmap_map_write_file(struct file *file, | |||
| 265 | char *start = buf; | 265 | char *start = buf; |
| 266 | unsigned long reg, value; | 266 | unsigned long reg, value; |
| 267 | struct regmap *map = file->private_data; | 267 | struct regmap *map = file->private_data; |
| 268 | int ret; | ||
| 268 | 269 | ||
| 269 | buf_size = min(count, (sizeof(buf)-1)); | 270 | buf_size = min(count, (sizeof(buf)-1)); |
| 270 | if (copy_from_user(buf, user_buf, buf_size)) | 271 | if (copy_from_user(buf, user_buf, buf_size)) |
| @@ -282,7 +283,9 @@ static ssize_t regmap_map_write_file(struct file *file, | |||
| 282 | /* Userspace has been fiddling around behind the kernel's back */ | 283 | /* Userspace has been fiddling around behind the kernel's back */ |
| 283 | add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE); | 284 | add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE); |
| 284 | 285 | ||
| 285 | regmap_write(map, reg, value); | 286 | ret = regmap_write(map, reg, value); |
| 287 | if (ret < 0) | ||
| 288 | return ret; | ||
| 286 | return buf_size; | 289 | return buf_size; |
| 287 | } | 290 | } |
| 288 | #else | 291 | #else |
