regmap: Fixes for v3.10
The biggest fix here is Lars-Peter's fix for custom locking callbacks which is pretty localised but important for those devices that use the feature. Otherwise we've got a couple of fairly small cleanups which would have been sent sooner were it not for letting Lars-Peter's patch soak for a while. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJRtZ9aAAoJELSic+t+oim9FKsP/09KdtRUMGIjJQFX3Lm4bEoU 0ZQhvV6ozQWa+3faKlUeBu61yUx4R+zAgxO3rJHSEZM2+50bTZ9t70InvHOegKU7 ipayoR/4cS23kK0uZJL9TURmoK4JuII+QVlTX/Fn9siJrrFvoSSOHjv7DxGzPZtt o4xgK+R8WU6zTUVIf2ncHzryaKPMs50tEt7FjPTMn+MetWsn0kgYxk3VLsORQqnL VJwzusJn/Z+vIy4kr9NAFGV6UljecRrIzFmn98kVHgMW1nEjr3vEE1upP2Y1TrF3 flZqooulg7qlc2bL60/aakWXAWQ33lKZCvtMHykk46cUFN0faSbL3V9wk1N/85AN n6wHZKHA9APGMeImv1nL+p3DLZkhY3HYpuOgoSP8ocUpZ7y7C0wH+oGBO3nmLGjK 4vEGPClsNFrdeF5viViIQ7ECHd9ls7t182gj3UJJjKPi27N5KppXM2ki3TQZABsS Q+iZ1dk/GYdyUV2E6LhoBGNnB9v6zo5pi/bABT59KuM0G6SuieRpPbchxo0VIvqY 6cUZrzJ8Kn9VRDIc5/RIgijm9VjhbGGas/gc5nr014IKiSHMjPVXvBQ3NYw7yQw/ SFtLgu2UBb+twQ7TWGK7BG6clHtwvSEjnvCFzPJ1q77c1gXzNfY8mCOYjfyEZ5Tb JuxD5znZHTvNLo+1QRQh =mOJz -----END PGP SIGNATURE----- Merge tag 'regmap-v3.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap Pull regmap fixes from Mark Brown: "The biggest fix here is Lars-Peter's fix for custom locking callbacks which is pretty localised but important for those devices that use the feature. Otherwise we've got a couple of fairly small cleanups which would have been sent sooner were it not for letting Lars-Peter's patch soak for a while" * tag 'regmap-v3.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: rbtree: Fixed node range check on sync regmap: regcache: Fixup locking for custom lock callbacks regmap: debugfs: Check return value of regmap_write()
This commit is contained in:
Коммит
30f5f73926
|
@ -143,7 +143,7 @@ static int rbtree_show(struct seq_file *s, void *ignored)
|
|||
int registers = 0;
|
||||
int this_registers, average;
|
||||
|
||||
map->lock(map);
|
||||
map->lock(map->lock_arg);
|
||||
|
||||
mem_size = sizeof(*rbtree_ctx);
|
||||
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)
|
|||
seq_printf(s, "%d nodes, %d registers, average %d registers, used %zu bytes\n",
|
||||
nodes, registers, average, mem_size);
|
||||
|
||||
map->unlock(map);
|
||||
map->unlock(map->lock_arg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -391,8 +391,6 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
|
|||
for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) {
|
||||
rbnode = rb_entry(node, struct regcache_rbtree_node, node);
|
||||
|
||||
if (rbnode->base_reg < min)
|
||||
continue;
|
||||
if (rbnode->base_reg > max)
|
||||
break;
|
||||
if (rbnode->base_reg + rbnode->blklen < min)
|
||||
|
|
|
@ -270,7 +270,7 @@ int regcache_sync(struct regmap *map)
|
|||
|
||||
BUG_ON(!map->cache_ops || !map->cache_ops->sync);
|
||||
|
||||
map->lock(map);
|
||||
map->lock(map->lock_arg);
|
||||
/* Remember the initial bypass state */
|
||||
bypass = map->cache_bypass;
|
||||
dev_dbg(map->dev, "Syncing %s cache\n",
|
||||
|
@ -306,7 +306,7 @@ out:
|
|||
trace_regcache_sync(map->dev, name, "stop");
|
||||
/* Restore the bypass state */
|
||||
map->cache_bypass = bypass;
|
||||
map->unlock(map);
|
||||
map->unlock(map->lock_arg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
|
|||
|
||||
BUG_ON(!map->cache_ops || !map->cache_ops->sync);
|
||||
|
||||
map->lock(map);
|
||||
map->lock(map->lock_arg);
|
||||
|
||||
/* Remember the initial bypass state */
|
||||
bypass = map->cache_bypass;
|
||||
|
@ -352,7 +352,7 @@ out:
|
|||
trace_regcache_sync(map->dev, name, "stop region");
|
||||
/* Restore the bypass state */
|
||||
map->cache_bypass = bypass;
|
||||
map->unlock(map);
|
||||
map->unlock(map->lock_arg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -372,11 +372,11 @@ EXPORT_SYMBOL_GPL(regcache_sync_region);
|
|||
*/
|
||||
void regcache_cache_only(struct regmap *map, bool enable)
|
||||
{
|
||||
map->lock(map);
|
||||
map->lock(map->lock_arg);
|
||||
WARN_ON(map->cache_bypass && enable);
|
||||
map->cache_only = enable;
|
||||
trace_regmap_cache_only(map->dev, enable);
|
||||
map->unlock(map);
|
||||
map->unlock(map->lock_arg);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regcache_cache_only);
|
||||
|
||||
|
@ -391,9 +391,9 @@ EXPORT_SYMBOL_GPL(regcache_cache_only);
|
|||
*/
|
||||
void regcache_mark_dirty(struct regmap *map)
|
||||
{
|
||||
map->lock(map);
|
||||
map->lock(map->lock_arg);
|
||||
map->cache_dirty = true;
|
||||
map->unlock(map);
|
||||
map->unlock(map->lock_arg);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regcache_mark_dirty);
|
||||
|
||||
|
@ -410,11 +410,11 @@ EXPORT_SYMBOL_GPL(regcache_mark_dirty);
|
|||
*/
|
||||
void regcache_cache_bypass(struct regmap *map, bool enable)
|
||||
{
|
||||
map->lock(map);
|
||||
map->lock(map->lock_arg);
|
||||
WARN_ON(map->cache_only && enable);
|
||||
map->cache_bypass = enable;
|
||||
trace_regmap_cache_bypass(map->dev, enable);
|
||||
map->unlock(map);
|
||||
map->unlock(map->lock_arg);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regcache_cache_bypass);
|
||||
|
||||
|
|
|
@ -265,6 +265,7 @@ static ssize_t regmap_map_write_file(struct file *file,
|
|||
char *start = buf;
|
||||
unsigned long reg, value;
|
||||
struct regmap *map = file->private_data;
|
||||
int ret;
|
||||
|
||||
buf_size = min(count, (sizeof(buf)-1));
|
||||
if (copy_from_user(buf, user_buf, buf_size))
|
||||
|
@ -282,7 +283,9 @@ static ssize_t regmap_map_write_file(struct file *file,
|
|||
/* Userspace has been fiddling around behind the kernel's back */
|
||||
add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE);
|
||||
|
||||
regmap_write(map, reg, value);
|
||||
ret = regmap_write(map, reg, value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return buf_size;
|
||||
}
|
||||
#else
|
||||
|
|
Загрузка…
Ссылка в новой задаче