Skip to contentSkip to conversation

regmap: Use mas_walk() instead of mas_find()

PATCH In review Mark Brown 1 participant 2 messages Apr 4, 2023 – Apr 5, 2023

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

PATCH v2 1/1 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.

---
Changes in v2:
- Don't set index and last again needlessly.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 drivers/base/regmap/regcache-maple.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/regmap/regcache-maple.c +2 -2
index 497cc708d277..e48f5b0c96cb 100644
@@ -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();

---
base-commit: f033c26de5a5734625d2dd1dc196745fae186f1b
change-id: 20230403-regmap-maple-walk-fine-982bbd2dcfe5

Best regards,

Signature · 1 line
Mark Brown <[email protected]>
author maintainer
#1 lore raw
Quoted 5 lines · Mark Brown

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.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/1] regmap: Use mas_walk() instead of mas_find()

      commit: fac79bad889bb167a37492181646992c8c48903b

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark