Re: [PATCH] regcache: Use a consistent sort for defaults table

From: Charles Keepax

Date: Thu Aug 06 2026 - 04:49:04 EST


On Wed, Aug 05, 2026 at 06:51:00PM +0100, Mark Brown wrote:
> When we look up registers in the defaults table we use a binary search,
> and we have a regcache_sort_defaults() API to help drivers that constuct
> their defaults tables on the fly. Unfortunately the lookup and the sort
> don't use the same comparison function, and to make matters worse the
> comparison function used during lookups is written for signed register
> numbers rather than the unsigned ones we actually have so can produce
> suprising results when some of the addresses have the top bit set.
>
> Standardise on the more explicitly coded function to ensure consistent
> results.
>
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
> ---

Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
Tested-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>

Thanks,
Charles