Re: [PATCH 0/3] ASoC: cs35l41/cs35l45/cs4265: sort the reg_defaults tables

Charles Keepax <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-sound
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.