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

Configure Feed

Select the types of activity you want to include in your feed.

mfd: rohm-bd71828: Constify some structures

Several structures are not modified in this driver. Constifying them moves
some data to a read-only section, so increases overall security, especially
when the structure holds some function pointers. This is the case for
'gpio_keys_platform_data' and 'mfd_cell'.

On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
18321 13952 192 32465 7ed1 drivers/mfd/rohm-bd71828.o

After:
=====
text data bss dec hex filename
22897 9376 192 32465 7ed1 drivers/mfd/rohm-bd71828.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/037e28e587ae899da9acdb45c606d75ec61f858b.1750501700.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Christophe JAILLET and committed by
Lee Jones
86b0fc4b 6865c645

+5 -5
+5 -5
drivers/mfd/rohm-bd71828.c
··· 25 25 .type = EV_KEY, 26 26 }; 27 27 28 - static struct gpio_keys_platform_data bd71828_powerkey_data = { 28 + static const struct gpio_keys_platform_data bd71828_powerkey_data = { 29 29 .buttons = &button, 30 30 .nbuttons = 1, 31 31 .name = "bd71828-pwrkey", ··· 43 43 DEFINE_RES_IRQ_NAMED(BD71828_INT_RTC2, "bd70528-rtc-alm-2"), 44 44 }; 45 45 46 - static struct resource bd71815_power_irqs[] = { 46 + static const struct resource bd71815_power_irqs[] = { 47 47 DEFINE_RES_IRQ_NAMED(BD71815_INT_DCIN_RMV, "bd71815-dcin-rmv"), 48 48 DEFINE_RES_IRQ_NAMED(BD71815_INT_CLPS_OUT, "bd71815-clps-out"), 49 49 DEFINE_RES_IRQ_NAMED(BD71815_INT_CLPS_IN, "bd71815-clps-in"), ··· 93 93 DEFINE_RES_IRQ_NAMED(BD71815_INT_TEMP_BAT_HI_DET, "bd71815-bat-hi-det"), 94 94 }; 95 95 96 - static struct mfd_cell bd71815_mfd_cells[] = { 96 + static const struct mfd_cell bd71815_mfd_cells[] = { 97 97 { .name = "bd71815-pmic", }, 98 98 { .name = "bd71815-clk", }, 99 99 { .name = "bd71815-gpo", }, ··· 109 109 }, 110 110 }; 111 111 112 - static struct mfd_cell bd71828_mfd_cells[] = { 112 + static const struct mfd_cell bd71828_mfd_cells[] = { 113 113 { .name = "bd71828-pmic", }, 114 114 { .name = "bd71828-gpio", }, 115 115 { .name = "bd71828-led", .of_compatible = "rohm,bd71828-leds" }, ··· 493 493 const struct regmap_config *regmap_config; 494 494 const struct regmap_irq_chip *irqchip; 495 495 unsigned int chip_type; 496 - struct mfd_cell *mfd; 496 + const struct mfd_cell *mfd; 497 497 int cells; 498 498 int button_irq; 499 499 int clkmode_reg;