[PATCH 2/3] Input: cap11xx - Convert to use maple tree register cache

Mark Brown posted 3 patches 2 years, 3 months ago
[PATCH 2/3] Input: cap11xx - Convert to use maple tree register cache
Posted by Mark Brown 2 years, 3 months ago
The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/input/keyboard/cap11xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
index 39ed3b9ddc65..77843ad15d4c 100644
--- a/drivers/input/keyboard/cap11xx.c
+++ b/drivers/input/keyboard/cap11xx.c
@@ -174,7 +174,7 @@ static const struct regmap_config cap11xx_regmap_config = {
 	.reg_defaults = cap11xx_reg_defaults,
 
 	.num_reg_defaults = ARRAY_SIZE(cap11xx_reg_defaults),
-	.cache_type = REGCACHE_RBTREE,
+	.cache_type = REGCACHE_MAPLE,
 	.volatile_reg = cap11xx_volatile_reg,
 };
 

-- 
2.39.2
Re: [PATCH 2/3] Input: cap11xx - Convert to use maple tree register cache
Posted by Dmitry Torokhov 2 years, 3 months ago
Hi Mark,

On Sun, Oct 01, 2023 at 01:43:39AM +0200, Mark Brown wrote:
> The maple tree register cache is based on a much more modern data structure
> than the rbtree cache and makes optimisation choices which are probably
> more appropriate for modern systems than those made by the rbtree cache.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  drivers/input/keyboard/cap11xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
> index 39ed3b9ddc65..77843ad15d4c 100644
> --- a/drivers/input/keyboard/cap11xx.c
> +++ b/drivers/input/keyboard/cap11xx.c
> @@ -174,7 +174,7 @@ static const struct regmap_config cap11xx_regmap_config = {
>  	.reg_defaults = cap11xx_reg_defaults,
>  
>  	.num_reg_defaults = ARRAY_SIZE(cap11xx_reg_defaults),
> -	.cache_type = REGCACHE_RBTREE,
> +	.cache_type = REGCACHE_MAPLE,

I do not think these driver care much about the cache type. Optimal one
might even depend on the architecture. I wonder if we could have
something like REGCACHE_DEFAULT to signal that whatever is the "best
default" implementation it should be used?

Thanks.

-- 
Dmitry
Re: [PATCH 2/3] Input: cap11xx - Convert to use maple tree register cache
Posted by Mark Brown 2 years, 3 months ago
On Mon, Oct 02, 2023 at 11:16:51PM -0700, Dmitry Torokhov wrote:
> On Sun, Oct 01, 2023 at 01:43:39AM +0200, Mark Brown wrote:

> > -	.cache_type = REGCACHE_RBTREE,
> > +	.cache_type = REGCACHE_MAPLE,

> I do not think these driver care much about the cache type. Optimal one
> might even depend on the architecture. I wonder if we could have
> something like REGCACHE_DEFAULT to signal that whatever is the "best
> default" implementation it should be used?

I do sometimes wonder about that but there's also been enough issues
with the earlier stage of the transition and shaking out bugs in the
new code that it makes me a bit nervous about using one.  It has also
been a useful exercise to go through and actually look at the users, but
that could be done any time.