Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regmap-irq: handle const struct regmap_irq_sub_irq_map

The struct instances supplied by the drivers are never modified.
Handle them as const in the regmap core allowing the drivers to put them
into .rodata.

Also add a new entry to const_structs.checkpatch to make sure future
instances of this struct already enter the tree as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20240706-regmap-const-structs-v1-2-d08c776da787@weissschuh.net
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Thomas Weißschuh and committed by
Mark Brown
f21711bb 0f02ba48

+3 -2
+1 -1
drivers/base/regmap/regmap-irq.c
··· 305 305 unsigned int b) 306 306 { 307 307 const struct regmap_irq_chip *chip = data->chip; 308 + const struct regmap_irq_sub_irq_map *subreg; 308 309 struct regmap *map = data->map; 309 - struct regmap_irq_sub_irq_map *subreg; 310 310 unsigned int reg; 311 311 int i, ret = 0; 312 312
+1 -1
include/linux/regmap.h
··· 1607 1607 1608 1608 unsigned int main_status; 1609 1609 unsigned int num_main_status_bits; 1610 - struct regmap_irq_sub_irq_map *sub_reg_offsets; 1610 + const struct regmap_irq_sub_irq_map *sub_reg_offsets; 1611 1611 int num_main_regs; 1612 1612 1613 1613 unsigned int status_base;
+1
scripts/const_structs.checkpatch
··· 72 72 regmap_config 73 73 regmap_irq 74 74 regmap_irq_chip 75 + regmap_irq_sub_irq_map 75 76 regmap_range 76 77 regmap_range_cfg 77 78 regulator_ops