]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
regmap-irq: handle const struct regmap_irq_sub_irq_map
authorThomas Weißschuh <linux@weissschuh.net>
Sat, 6 Jul 2024 11:13:42 +0000 (13:13 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 8 Jul 2024 11:50:16 +0000 (12:50 +0100)
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>
drivers/base/regmap/regmap-irq.c
include/linux/regmap.h
scripts/const_structs.checkpatch

index 45fd13ef13fc645ef7b31233308e6b35f6ef1222..d3ec1345b5b53a423c04bc274bf850bdb32b2d80 100644 (file)
@@ -305,8 +305,8 @@ static inline int read_sub_irq_data(struct regmap_irq_chip_data *data,
                                           unsigned int b)
 {
        const struct regmap_irq_chip *chip = data->chip;
+       const struct regmap_irq_sub_irq_map *subreg;
        struct regmap *map = data->map;
-       struct regmap_irq_sub_irq_map *subreg;
        unsigned int reg;
        int i, ret = 0;
 
index a6bc2980a98be88cef0fb9ed9b9ae635f587f873..2da1cfc522337cb2f46e46f8e7085bad68a3f77f 100644 (file)
@@ -1607,7 +1607,7 @@ struct regmap_irq_chip {
 
        unsigned int main_status;
        unsigned int num_main_status_bits;
-       struct regmap_irq_sub_irq_map *sub_reg_offsets;
+       const struct regmap_irq_sub_irq_map *sub_reg_offsets;
        int num_main_regs;
 
        unsigned int status_base;
index 1bfbb3d7f2e0fb3622deed77c89ef10777a1d03e..cc62980cfa6e287127f19eb441690d39c0bd414c 100644 (file)
@@ -72,6 +72,7 @@ regmap_bus
 regmap_config
 regmap_irq
 regmap_irq_chip
+regmap_irq_sub_irq_map
 regmap_range
 regmap_range_cfg
 regulator_ops