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

mfd: 88pm886: Constify struct regmap_irq_chip and some other structures

'struct regmap_irq_chip' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.

While at it, also constify some other structures.

On a x86_64, with allmodconfig, as an example:
Before:
======
text data bss dec hex filename
5032 3304 64 8400 20d0 drivers/mfd/88pm886.o

After:
=====
text data bss dec hex filename
5800 2536 64 8400 20d0 drivers/mfd/88pm886.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/1681629840761e30494cb8920668710df60a81b8.1746996137.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Christophe JAILLET and committed by
Lee Jones
950a3c38 bdc76c19

+4 -4
+4 -4
drivers/mfd/88pm886.c
··· 16 16 .max_register = PM886_REG_RTC_SPARE6, 17 17 }; 18 18 19 - static struct regmap_irq pm886_regmap_irqs[] = { 19 + static const struct regmap_irq pm886_regmap_irqs[] = { 20 20 REGMAP_IRQ_REG(PM886_IRQ_ONKEY, 0, PM886_INT_ENA1_ONKEY), 21 21 }; 22 22 23 - static struct regmap_irq_chip pm886_regmap_irq_chip = { 23 + static const struct regmap_irq_chip pm886_regmap_irq_chip = { 24 24 .name = "88pm886", 25 25 .irqs = pm886_regmap_irqs, 26 26 .num_irqs = ARRAY_SIZE(pm886_regmap_irqs), ··· 30 30 .unmask_base = PM886_REG_INT_ENA_1, 31 31 }; 32 32 33 - static struct resource pm886_onkey_resources[] = { 33 + static const struct resource pm886_onkey_resources[] = { 34 34 DEFINE_RES_IRQ_NAMED(PM886_IRQ_ONKEY, "88pm886-onkey"), 35 35 }; 36 36 37 - static struct mfd_cell pm886_devs[] = { 37 + static const struct mfd_cell pm886_devs[] = { 38 38 MFD_CELL_RES("88pm886-onkey", pm886_onkey_resources), 39 39 MFD_CELL_NAME("88pm886-regulator"), 40 40 MFD_CELL_NAME("88pm886-rtc"),