Skip to content

Commit c7e09a6

Browse files
tititiou36wens
authored andcommitted
clk: sunxi-ng: Constify struct ccu_reset_map
'struct ccu_reset_map' are not modified in these drivers. Constifying this structure moves some data to a read-only section, so increase overall security. On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 1533 2224 0 3757 ead drivers/clk/sunxi-ng/ccu-sun20i-d1-r.o After: ===== text data bss dec hex filename 1597 2160 0 3757 ead drivers/clk/sunxi-ng/ccu-sun20i-d1-r.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://patch.msgid.link/44745f27034fa670605cd16966a39b7fe88fe5a6.1726863905.git.christophe.jaillet@wanadoo.fr Signed-off-by: Chen-Yu Tsai <wens@csie.org>
1 parent d0c322b commit c7e09a6

25 files changed

+33
-33
lines changed

drivers/clk/sunxi-ng/ccu-sun20i-d1-r.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static struct clk_hw_onecell_data sun20i_d1_r_hw_clks = {
9191
},
9292
};
9393

94-
static struct ccu_reset_map sun20i_d1_r_ccu_resets[] = {
94+
static const struct ccu_reset_map sun20i_d1_r_ccu_resets[] = {
9595
[RST_BUS_R_TIMER] = { 0x11c, BIT(16) },
9696
[RST_BUS_R_TWD] = { 0x12c, BIT(16) },
9797
[RST_BUS_R_PPU] = { 0x1ac, BIT(16) },

drivers/clk/sunxi-ng/ccu-sun20i-d1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ static struct clk_hw_onecell_data sun20i_d1_hw_clks = {
12321232
},
12331233
};
12341234

1235-
static struct ccu_reset_map sun20i_d1_ccu_resets[] = {
1235+
static const struct ccu_reset_map sun20i_d1_ccu_resets[] = {
12361236
[RST_MBUS] = { 0x540, BIT(30) },
12371237
[RST_BUS_DE] = { 0x60c, BIT(16) },
12381238
[RST_BUS_DI] = { 0x62c, BIT(16) },

drivers/clk/sunxi-ng/ccu-sun4i-a10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ static struct clk_hw_onecell_data sun7i_a20_hw_clks = {
13821382
.num = CLK_NUMBER_SUN7I,
13831383
};
13841384

1385-
static struct ccu_reset_map sunxi_a10_a20_ccu_resets[] = {
1385+
static const struct ccu_reset_map sunxi_a10_a20_ccu_resets[] = {
13861386
[RST_USB_PHY0] = { 0x0cc, BIT(0) },
13871387
[RST_USB_PHY1] = { 0x0cc, BIT(1) },
13881388
[RST_USB_PHY2] = { 0x0cc, BIT(2) },

drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static struct clk_hw_onecell_data sun50i_a100_r_hw_clks = {
166166
.num = CLK_NUMBER,
167167
};
168168

169-
static struct ccu_reset_map sun50i_a100_r_ccu_resets[] = {
169+
static const struct ccu_reset_map sun50i_a100_r_ccu_resets[] = {
170170
[RST_R_APB1_TIMER] = { 0x11c, BIT(16) },
171171
[RST_R_APB1_BUS_PWM] = { 0x13c, BIT(16) },
172172
[RST_R_APB1_PPU] = { 0x17c, BIT(16) },

drivers/clk/sunxi-ng/ccu-sun50i-a100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ static struct clk_hw_onecell_data sun50i_a100_hw_clks = {
10611061
.num = CLK_NUMBER,
10621062
};
10631063

1064-
static struct ccu_reset_map sun50i_a100_ccu_resets[] = {
1064+
static const struct ccu_reset_map sun50i_a100_ccu_resets[] = {
10651065
[RST_MBUS] = { 0x540, BIT(30) },
10661066

10671067
[RST_BUS_DE] = { 0x60c, BIT(16) },

drivers/clk/sunxi-ng/ccu-sun50i-a64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ static struct clk_hw_onecell_data sun50i_a64_hw_clks = {
858858
.num = CLK_NUMBER,
859859
};
860860

861-
static struct ccu_reset_map sun50i_a64_ccu_resets[] = {
861+
static const struct ccu_reset_map sun50i_a64_ccu_resets[] = {
862862
[RST_USB_PHY0] = { 0x0cc, BIT(0) },
863863
[RST_USB_PHY1] = { 0x0cc, BIT(1) },
864864
[RST_USB_HSIC] = { 0x0cc, BIT(2) },

drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static struct clk_hw_onecell_data sun50i_h616_r_hw_clks = {
179179
.num = CLK_NUMBER,
180180
};
181181

182-
static struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
182+
static const struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
183183
[RST_R_APB1_TIMER] = { 0x11c, BIT(16) },
184184
[RST_R_APB1_TWD] = { 0x12c, BIT(16) },
185185
[RST_R_APB1_PWM] = { 0x13c, BIT(16) },
@@ -190,7 +190,7 @@ static struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
190190
[RST_R_APB1_W1] = { 0x1ec, BIT(16) },
191191
};
192192

193-
static struct ccu_reset_map sun50i_h616_r_ccu_resets[] = {
193+
static const struct ccu_reset_map sun50i_h616_r_ccu_resets[] = {
194194
[RST_R_APB1_TWD] = { 0x12c, BIT(16) },
195195
[RST_R_APB2_I2C] = { 0x19c, BIT(16) },
196196
[RST_R_APB2_RSB] = { 0x1bc, BIT(16) },

drivers/clk/sunxi-ng/ccu-sun50i-h6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ static struct clk_hw_onecell_data sun50i_h6_hw_clks = {
10761076
.num = CLK_NUMBER,
10771077
};
10781078

1079-
static struct ccu_reset_map sun50i_h6_ccu_resets[] = {
1079+
static const struct ccu_reset_map sun50i_h6_ccu_resets[] = {
10801080
[RST_MBUS] = { 0x540, BIT(30) },
10811081

10821082
[RST_BUS_DE] = { 0x60c, BIT(16) },

drivers/clk/sunxi-ng/ccu-sun50i-h616.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ static struct clk_hw_onecell_data sun50i_h616_hw_clks = {
10021002
.num = CLK_NUMBER,
10031003
};
10041004

1005-
static struct ccu_reset_map sun50i_h616_ccu_resets[] = {
1005+
static const struct ccu_reset_map sun50i_h616_ccu_resets[] = {
10061006
[RST_MBUS] = { 0x540, BIT(30) },
10071007

10081008
[RST_BUS_DE] = { 0x60c, BIT(16) },

drivers/clk/sunxi-ng/ccu-sun5i.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ static struct clk_hw_onecell_data sun5i_a10s_hw_clks = {
731731
.num = CLK_NUMBER,
732732
};
733733

734-
static struct ccu_reset_map sun5i_a10s_ccu_resets[] = {
734+
static const struct ccu_reset_map sun5i_a10s_ccu_resets[] = {
735735
[RST_USB_PHY0] = { 0x0cc, BIT(0) },
736736
[RST_USB_PHY1] = { 0x0cc, BIT(1) },
737737

0 commit comments

Comments
 (0)