Skip to content

Commit 1c67992

Browse files
tititiou36Linus Walleij
authored andcommitted
pinctrl: ocelot: Constify some structures
'struct ocelot_match_data and 'struct irq_chip' are not modified in this driver. Constifying these structures moves some data to a read-only section, so increase overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 41459 9008 80 50547 c573 drivers/pinctrl/pinctrl-ocelot.o After: ===== text data bss dec hex filename 42803 7640 80 50523 c55b drivers/pinctrl/pinctrl-ocelot.o Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/32edcf0567fffd0b1a219e7e2dad7e0bd8c5aaf4.1734023550.git.christophe.jaillet@wanadoo.fr Signed-off-by: Linus Walleij <[email protected]>
1 parent fa4752d commit 1c67992

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/pinctrl/pinctrl-ocelot.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,7 @@ static const struct pinctrl_ops ocelot_pctl_ops = {
17771777
.dt_free_map = pinconf_generic_dt_free_map,
17781778
};
17791779

1780-
static struct ocelot_match_data luton_desc = {
1780+
static const struct ocelot_match_data luton_desc = {
17811781
.desc = {
17821782
.name = "luton-pinctrl",
17831783
.pins = luton_pins,
@@ -1788,7 +1788,7 @@ static struct ocelot_match_data luton_desc = {
17881788
},
17891789
};
17901790

1791-
static struct ocelot_match_data serval_desc = {
1791+
static const struct ocelot_match_data serval_desc = {
17921792
.desc = {
17931793
.name = "serval-pinctrl",
17941794
.pins = serval_pins,
@@ -1799,7 +1799,7 @@ static struct ocelot_match_data serval_desc = {
17991799
},
18001800
};
18011801

1802-
static struct ocelot_match_data ocelot_desc = {
1802+
static const struct ocelot_match_data ocelot_desc = {
18031803
.desc = {
18041804
.name = "ocelot-pinctrl",
18051805
.pins = ocelot_pins,
@@ -1810,7 +1810,7 @@ static struct ocelot_match_data ocelot_desc = {
18101810
},
18111811
};
18121812

1813-
static struct ocelot_match_data jaguar2_desc = {
1813+
static const struct ocelot_match_data jaguar2_desc = {
18141814
.desc = {
18151815
.name = "jaguar2-pinctrl",
18161816
.pins = jaguar2_pins,
@@ -1821,7 +1821,7 @@ static struct ocelot_match_data jaguar2_desc = {
18211821
},
18221822
};
18231823

1824-
static struct ocelot_match_data servalt_desc = {
1824+
static const struct ocelot_match_data servalt_desc = {
18251825
.desc = {
18261826
.name = "servalt-pinctrl",
18271827
.pins = servalt_pins,
@@ -1832,7 +1832,7 @@ static struct ocelot_match_data servalt_desc = {
18321832
},
18331833
};
18341834

1835-
static struct ocelot_match_data sparx5_desc = {
1835+
static const struct ocelot_match_data sparx5_desc = {
18361836
.desc = {
18371837
.name = "sparx5-pinctrl",
18381838
.pins = sparx5_pins,
@@ -1850,7 +1850,7 @@ static struct ocelot_match_data sparx5_desc = {
18501850
},
18511851
};
18521852

1853-
static struct ocelot_match_data lan966x_desc = {
1853+
static const struct ocelot_match_data lan966x_desc = {
18541854
.desc = {
18551855
.name = "lan966x-pinctrl",
18561856
.pins = lan966x_pins,
@@ -1867,7 +1867,7 @@ static struct ocelot_match_data lan966x_desc = {
18671867
},
18681868
};
18691869

1870-
static struct ocelot_match_data lan969x_desc = {
1870+
static const struct ocelot_match_data lan969x_desc = {
18711871
.desc = {
18721872
.name = "lan969x-pinctrl",
18731873
.pins = lan969x_pins,
@@ -2116,7 +2116,7 @@ static void ocelot_irq_ack(struct irq_data *data)
21162116

21172117
static int ocelot_irq_set_type(struct irq_data *data, unsigned int type);
21182118

2119-
static struct irq_chip ocelot_level_irqchip = {
2119+
static const struct irq_chip ocelot_level_irqchip = {
21202120
.name = "gpio",
21212121
.irq_mask = ocelot_irq_mask,
21222122
.irq_ack = ocelot_irq_ack,
@@ -2126,7 +2126,7 @@ static struct irq_chip ocelot_level_irqchip = {
21262126
GPIOCHIP_IRQ_RESOURCE_HELPERS
21272127
};
21282128

2129-
static struct irq_chip ocelot_irqchip = {
2129+
static const struct irq_chip ocelot_irqchip = {
21302130
.name = "gpio",
21312131
.irq_mask = ocelot_irq_mask,
21322132
.irq_ack = ocelot_irq_ack,

0 commit comments

Comments
 (0)