1
0
Fork 0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-01-23 08:35:19 -05:00

regmap: Use mas_walk() instead of mas_find()

Liam recommends using mas_walk() instead of mas_find() for our use case so
let's do that, it avoids some minor overhead associated with being able to
restart the operation which we don't need since we do a simple search.

Suggested-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230403-regmap-maple-walk-fine-v2-1-c07371c8a867@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Mark Brown 2023-04-04 20:42:28 +01:00
parent 451941ac1e
commit fac79bad88
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0

View file

@ -22,7 +22,7 @@ static int regcache_maple_read(struct regmap *map,
rcu_read_lock();
entry = mas_find(&mas, reg);
entry = mas_walk(&mas);
if (!entry) {
rcu_read_unlock();
return -ENOENT;
@ -47,7 +47,7 @@ static int regcache_maple_write(struct regmap *map, unsigned int reg,
rcu_read_lock();
entry = mas_find(&mas, reg);
entry = mas_walk(&mas);
if (entry) {
entry[reg - mas.index] = val;
rcu_read_unlock();