Re: [PATCH 0/3] ASoC: cs35l41/cs35l45/cs4265: sort the reg_defaults tables
Charles Keepax <[email protected]> Wed, 5 Aug 2026 11:10:40 +0100
| Newsgroups | org.kernel.vger.linux-sound,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Aug 05, 2026 at 12:59:30PM +0300, Péter Ujfalusi wrote:
> On 05/08/2026 12:56, Richard Fitzgerald wrote:
> > On 05/08/2026 10:52 am, Péter Ujfalusi wrote:
> >> On 05/08/2026 12:38, Richard Fitzgerald wrote:
> >>> On 05/08/2026 10:25 am, Charles Keepax wrote:
> >>>> On Wed, Aug 05, 2026 at 12:10:10PM +0300, Péter Ujfalusi wrote:
> >>>>> On 05/08/2026 12:00, Richard Fitzgerald wrote:
> >> diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/
> >> regcache.c
> >> index aa8f2efed779..ce4b11d8a758 100644
> >> --- a/drivers/base/regmap/regcache.c
> >> +++ b/drivers/base/regmap/regcache.c
> >> @@ -123,6 +123,7 @@ static void regcache_hw_exit(struct regmap *map)
> >> Â Â int regcache_init(struct regmap *map, const struct regmap_config
> >> *config)
> >> Â {
> >> +Â Â Â bool sort_defaults = false;
> >> Â Â Â Â Â int count = 0;
> >> Â Â Â Â Â int ret;
> >> Â Â Â Â Â int i;
> >> @@ -149,10 +150,15 @@ int regcache_init(struct regmap *map, const
> >> struct regmap_config *config)
> >> Â Â Â Â Â Â Â Â Â return -EINVAL;
> >> Â Â Â Â Â }
> >> Â -Â Â Â for (i = 0; i < config->num_reg_defaults; i++)
> >> +Â Â Â for (i = 0; i < config->num_reg_defaults; i++) {
> >> Â Â Â Â Â Â Â Â Â if (config->reg_defaults[i].reg % map->reg_stride)
> >> Â Â Â Â Â Â Â Â Â Â Â Â Â return -EINVAL;
> >> Â +Â Â Â Â Â Â Â if (i && config->reg_defaults[i - 1].reg >
>
> > I don't think we need to sort them. Just fail, so that an unsorted table
> > must be fixed.
>
> That would be a big regression all around the place, ordering w/ the
> debug message if developer is interested is much better.
I think I would come down between the two of you. I definitely
agree with Richard on don't sort them, just encourages drivers to
be wrong. But I also agree with you, don't hard fail. I would
vote for just print an error message and carry on. That way no
regressions, but also a nice big warning message to let people
know what is wrong when they see problems.
Thanks,
Charles