linux/drivers/base/regmap
Peter Ujfalusi 4b05ccb17f
regcache: Sort the local copy of an unsorted reg_defaults array
regcache_lookup_reg() bsearch()es the reg_defaults array, which requires
it to be sorted by ascending register address.  Entries following a
descending step are never found, so regcache_reg_needs_sync() reports
that they need a sync and they are written to the device on every
regcache_sync() even when they were never touched.

Detect the misordering while reg_defaults is validated against the
register stride and sort the local copy.  The check needs no new loop
and sort() only runs for the affected drivers, which are also warned
about.

Note that sort() is not stable, so for arrays with duplicated register
addresses it remains unspecified which entry is found.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260805132250.2637-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-08-06 13:01:39 +01:00
..
internal.h regmap: debugfs: fix race condition in dummy name allocation 2026-04-09 20:50:54 +01:00
Kconfig regmap: mdio: make it depend on PHYLIB 2026-03-18 18:27:12 -07:00
Makefile regmap: Provide a ram backed regmap with raw support 2023-06-12 14:47:54 +01:00
regcache-flat.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
regcache-maple.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
regcache-rbtree.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
regcache.c regcache: Sort the local copy of an unsorted reg_defaults array 2026-08-06 13:01:39 +01:00
regmap-ac97.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-debugfs.c regmap: debugfs: fix race condition in dummy name allocation 2026-04-09 20:50:54 +01:00
regmap-fsi.c regmap: Add FSI bus support 2022-11-25 19:17:02 +00:00
regmap-i2c.c regmap-i2c: fix sparse warning in regmap_smbus_word_write_reg16 2026-05-21 09:47:39 +01:00
regmap-i3c.c regmap: i3c: Add non-devm regmap_init_i3c() helper 2026-04-10 11:46:15 +01:00
regmap-irq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
regmap-kunit.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
regmap-mdio.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-mmio.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
regmap-ram.c regmap: ram: fix memory leaks in __regmap_init_ram() on error 2026-04-17 12:07:31 +01:00
regmap-raw-ram.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
regmap-sccb.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-sdw-mbq.c regmap: sdw-mbq: Fix spelling mistake "undeferable" -> "undeferrable" 2026-04-27 06:48:16 +09:00
regmap-sdw.c regmap: Drop capitalisation in MODULE_DESCRIPTION() 2024-04-10 22:45:52 +01:00
regmap-slimbus.c regmap: slimbus: fix bus_context pointer in regmap init calls 2025-10-23 15:19:58 +01:00
regmap-spi-avmm.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
regmap-spi.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
regmap-spmi.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap-w1.c regmap: add missing MODULE_DESCRIPTION() macros 2024-06-24 13:38:40 +01:00
regmap.c regmap: reject volatile update_bits() in cache-only mode 2026-05-28 15:15:46 +01:00
trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00