linux/drivers/base
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
..
firmware_loader sound updates for 7.2-rc1 2026-06-17 11:18:45 +01:00
power bpf-next-7.2 2026-06-17 09:18:14 +01:00
regmap regcache: Sort the local copy of an unsorted reg_defaults array 2026-08-06 13:01:39 +01:00
test drivers: base: test: Add ...find_device_by...(... NULL) tests 2024-12-24 09:48:09 +01:00
arch_numa.c arch_numa: Restore nid checks before registering a memblock with a node 2024-12-01 22:04:52 +02:00
arch_topology.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
attribute_container.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
auxiliary_sysfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
auxiliary.c ACPI support updates for 7.1-rc1 2026-04-13 19:25:07 -07:00
base.h driver core: constify group arrays arguments in driver_add_groups and driver_remove_groups 2026-05-22 13:32:05 +02:00
bus.c driver core: reject devices with unregistered buses 2026-05-02 17:50:50 +02:00
cacheinfo.c sched/cache: Calculate the LLC size and store it in sched_domain 2026-05-18 21:33:15 +02:00
class.c kernfs: pass struct ns_common instead of const void * for namespace tags 2026-04-09 14:36:52 +02:00
component.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
container.c driver core: container: make container_subsys const 2023-12-21 13:56:10 +01:00
core.c driver core: Constify core device attributes 2026-05-22 13:36:55 +02:00
cpu.c driver core: Replace dev->offline + ->offline_disabled with accessors 2026-04-26 23:51:02 +02:00
dd.c driver core: Use system_percpu_wq instead of system_wq 2026-06-02 15:08:56 +02:00
devcoredump.c devcoredump: Remove exit call 2026-05-22 13:26:51 +02:00
devres.c devres: rename and export set_node_dbginfo() 2026-03-18 00:02:59 +01:00
devtmpfs.c devtmpfs: Replace simple_strtoul with kstrtoint in mount_param 2026-01-16 16:44:43 +01:00
driver.c driver core: remove driver_set_override() 2026-05-30 22:25:50 +02:00
faux.c driver core: faux: clean up init error handling 2026-05-02 17:50:50 +02:00
firmware.c
hypervisor.c
init.c driver core: make software nodes available earlier 2026-04-04 00:33:49 +02:00
isa.c isa: switch to dynamic root device 2026-05-04 22:05:03 +02:00
Kconfig driver core: Make deferred_probe_timeout default a Kconfig option 2026-03-30 20:45:27 +02:00
Makefile Revert "revocable: Add Kunit test cases" 2026-02-06 16:08:48 +01:00
map.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
memory.c mm.git review status for mm-hotfixes-stable..mm-stable 2026-06-19 10:14:34 -07:00
module.c drivers: base: handle module_kobject creation 2025-04-16 15:10:55 +02:00
node.c drivers/base/memory: make memory block get/put explicit 2026-06-02 15:22:12 -07:00
physical_location.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
physical_location.h driver core: physical_location.h remove extern from function prototypes 2023-03-24 15:35:48 +01:00
pinctrl.c driver core: Replace dev->of_node_reused with dev_of_node_reused() 2026-04-26 23:50:20 +02:00
platform-msi.c platform-msi: Remove stale comment 2026-02-26 10:48:19 +01:00
platform.c driver core: platform: set mod_name in driver registration 2026-06-08 23:28:24 +02:00
property.c device property: fix fwnode reference leak in fwnode_graph_get_endpoint_by_id() 2026-05-22 13:33:09 +02:00
soc.c base: soc: rename and export soc_device_get_machine() 2026-03-12 16:18:49 +01:00
swnode.c software node: provide wrappers around kobject_get/put() 2026-05-09 20:22:40 +02:00
syscore.c syscore: Pass context data to callbacks 2025-11-14 10:01:52 +01:00
topology.c sysfs: treewide: switch back to attribute_group::bin_attrs 2025-06-17 10:44:15 +02:00
trace.c
trace.h devres: Fix page faults when tracing devres from unloaded modules 2024-10-14 08:21:09 +02:00
transport_class.c SCSI misc on 20260212 2026-02-12 15:43:02 -08:00