Skip to content

Commit 86b0fc4

Browse files
tititiou36lag-linaro
authored andcommitted
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 <[email protected]> Reviewed-by: Matti Vaittinen <[email protected]> Link: https://lore.kernel.org/r/037e28e587ae899da9acdb45c606d75ec61f858b.1750501700.git.christophe.jaillet@wanadoo.fr Signed-off-by: Lee Jones <[email protected]>
1 parent 6865c64 commit 86b0fc4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/mfd/rohm-bd71828.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static struct gpio_keys_button button = {
2525
.type = EV_KEY,
2626
};
2727

28-
static struct gpio_keys_platform_data bd71828_powerkey_data = {
28+
static const struct gpio_keys_platform_data bd71828_powerkey_data = {
2929
.buttons = &button,
3030
.nbuttons = 1,
3131
.name = "bd71828-pwrkey",
@@ -43,7 +43,7 @@ static const struct resource bd71828_rtc_irqs[] = {
4343
DEFINE_RES_IRQ_NAMED(BD71828_INT_RTC2, "bd70528-rtc-alm-2"),
4444
};
4545

46-
static struct resource bd71815_power_irqs[] = {
46+
static const struct resource bd71815_power_irqs[] = {
4747
DEFINE_RES_IRQ_NAMED(BD71815_INT_DCIN_RMV, "bd71815-dcin-rmv"),
4848
DEFINE_RES_IRQ_NAMED(BD71815_INT_CLPS_OUT, "bd71815-clps-out"),
4949
DEFINE_RES_IRQ_NAMED(BD71815_INT_CLPS_IN, "bd71815-clps-in"),
@@ -93,7 +93,7 @@ static struct resource bd71815_power_irqs[] = {
9393
DEFINE_RES_IRQ_NAMED(BD71815_INT_TEMP_BAT_HI_DET, "bd71815-bat-hi-det"),
9494
};
9595

96-
static struct mfd_cell bd71815_mfd_cells[] = {
96+
static const struct mfd_cell bd71815_mfd_cells[] = {
9797
{ .name = "bd71815-pmic", },
9898
{ .name = "bd71815-clk", },
9999
{ .name = "bd71815-gpo", },
@@ -109,7 +109,7 @@ static struct mfd_cell bd71815_mfd_cells[] = {
109109
},
110110
};
111111

112-
static struct mfd_cell bd71828_mfd_cells[] = {
112+
static const struct mfd_cell bd71828_mfd_cells[] = {
113113
{ .name = "bd71828-pmic", },
114114
{ .name = "bd71828-gpio", },
115115
{ .name = "bd71828-led", .of_compatible = "rohm,bd71828-leds" },
@@ -493,7 +493,7 @@ static int bd71828_i2c_probe(struct i2c_client *i2c)
493493
const struct regmap_config *regmap_config;
494494
const struct regmap_irq_chip *irqchip;
495495
unsigned int chip_type;
496-
struct mfd_cell *mfd;
496+
const struct mfd_cell *mfd;
497497
int cells;
498498
int button_irq;
499499
int clkmode_reg;

0 commit comments

Comments
 (0)