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

mfd: 88pm80x: Constify read-only regmap structs

`pm800_irq`, `pm805_irq` and `pm805_irq_chip` are not modified and can
be declared as const to move their data to a read-only section.

In order to keep the const modifier for the regmap_irq_chip structures,
the pointer used to reference them must be converted to const as well.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240704-mfd-const-regmap_config-v2-8-0c8785b1331d@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Javier Carrasco and committed by
Lee Jones
2a9f8995 9842c621

+4 -4
+1 -1
drivers/mfd/88pm800.c
··· 391 391 regmap_del_irq_chip(chip->irq, chip->irq_data); 392 392 } 393 393 394 - static struct regmap_irq_chip pm800_irq_chip = { 394 + static const struct regmap_irq_chip pm800_irq_chip = { 395 395 .name = "88pm800", 396 396 .irqs = pm800_irqs, 397 397 .num_irqs = ARRAY_SIZE(pm800_irqs),
+2 -2
drivers/mfd/88pm805.c
··· 73 73 }, 74 74 }; 75 75 76 - static struct regmap_irq pm805_irqs[] = { 76 + static const struct regmap_irq pm805_irqs[] = { 77 77 /* INT0 */ 78 78 [PM805_IRQ_LDO_OFF] = { 79 79 .mask = PM805_INT1_HP1_SHRT, ··· 163 163 regmap_del_irq_chip(chip->irq, chip->irq_data); 164 164 } 165 165 166 - static struct regmap_irq_chip pm805_irq_chip = { 166 + static const struct regmap_irq_chip pm805_irq_chip = { 167 167 .name = "88pm805", 168 168 .irqs = pm805_irqs, 169 169 .num_irqs = ARRAY_SIZE(pm805_irqs),
+1 -1
include/linux/mfd/88pm80x.h
··· 294 294 struct i2c_client *client; 295 295 struct i2c_client *companion; 296 296 struct regmap *regmap; 297 - struct regmap_irq_chip *regmap_irq_chip; 297 + const struct regmap_irq_chip *regmap_irq_chip; 298 298 struct regmap_irq_chip_data *irq_data; 299 299 int type; 300 300 int irq;