]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mfd: tps65219: Constify struct regmap_irq_sub_irq_map and tps65219_chip_data
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 21 Jun 2025 18:28:20 +0000 (20:28 +0200)
committerLee Jones <lee@kernel.org>
Thu, 24 Jul 2025 10:27:07 +0000 (11:27 +0100)
'struct regmap_irq_sub_irq_map' and 'struct tps65219_chip_data' are not
modified in this driver.

Constifying these structures moves some data to a read-only section, so
increases overall security.

On a x86_64, with allmodconfig:
Before:
======
   text    data     bss     dec     hex filename
  27804   10016     256   38076    94bc drivers/mfd/tps65219.o

After:
=====
   text    data     bss     dec     hex filename
  27893    9792     256   37941    9435 drivers/mfd/tps65219.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/117946696551de41b706ea9b973a7ccaacea5178.1750530460.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/tps65219.c

index f6387345457ec748097b0fcc483affdca4e14b13..83b8ab4707c21ff464bead73834aa94d133fd504 100644 (file)
@@ -260,7 +260,7 @@ static const struct regmap_irq_sub_irq_map tps65215_sub_irq_offsets[] = {
        REGMAP_IRQ_MAIN_REG_OFFSET(bit7_offsets),
 };
 
-static struct regmap_irq_sub_irq_map tps65214_sub_irq_offsets[] = {
+static const struct regmap_irq_sub_irq_map tps65214_sub_irq_offsets[] = {
        REGMAP_IRQ_MAIN_REG_OFFSET(tps65214_bit0_offsets),
        REGMAP_IRQ_MAIN_REG_OFFSET(tps65214_bit1_offsets),
        REGMAP_IRQ_MAIN_REG_OFFSET(tps65214_bit2_offsets),
@@ -455,7 +455,7 @@ struct tps65219_chip_data {
        int n_cells;
 };
 
-static struct tps65219_chip_data chip_info_table[] = {
+static const struct tps65219_chip_data chip_info_table[] = {
        [TPS65214] = {
                .irq_chip = &tps65214_irq_chip,
                .cells = tps65214_cells,
@@ -476,7 +476,7 @@ static struct tps65219_chip_data chip_info_table[] = {
 static int tps65219_probe(struct i2c_client *client)
 {
        struct tps65219 *tps;
-       struct tps65219_chip_data *pmic;
+       const struct tps65219_chip_data *pmic;
        bool pwr_button;
        int ret;