]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: sunxi-ng: Constify struct ccu_reset_map
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 20 Sep 2024 20:25:24 +0000 (22:25 +0200)
committerChen-Yu Tsai <wens@csie.org>
Fri, 25 Oct 2024 15:35:49 +0000 (23:35 +0800)
'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>
25 files changed:
drivers/clk/sunxi-ng/ccu-sun20i-d1-r.c
drivers/clk/sunxi-ng/ccu-sun20i-d1.c
drivers/clk/sunxi-ng/ccu-sun4i-a10.c
drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c
drivers/clk/sunxi-ng/ccu-sun50i-a100.c
drivers/clk/sunxi-ng/ccu-sun50i-a64.c
drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
drivers/clk/sunxi-ng/ccu-sun50i-h6.c
drivers/clk/sunxi-ng/ccu-sun50i-h616.c
drivers/clk/sunxi-ng/ccu-sun5i.c
drivers/clk/sunxi-ng/ccu-sun6i-a31.c
drivers/clk/sunxi-ng/ccu-sun8i-a23.c
drivers/clk/sunxi-ng/ccu-sun8i-a33.c
drivers/clk/sunxi-ng/ccu-sun8i-a83t.c
drivers/clk/sunxi-ng/ccu-sun8i-de2.c
drivers/clk/sunxi-ng/ccu-sun8i-h3.c
drivers/clk/sunxi-ng/ccu-sun8i-r.c
drivers/clk/sunxi-ng/ccu-sun8i-r40.c
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c
drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c
drivers/clk/sunxi-ng/ccu-sun9i-a80.c
drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c
drivers/clk/sunxi-ng/ccu_common.h
drivers/clk/sunxi-ng/ccu_reset.h

index de36e21d3eaf16c1dd74401758370e2109cfb19d..4084714adb15b01eed1eb53ebb9eed9bc85e29ed 100644 (file)
@@ -91,7 +91,7 @@ static struct clk_hw_onecell_data sun20i_d1_r_hw_clks = {
        },
 };
 
-static struct ccu_reset_map sun20i_d1_r_ccu_resets[] = {
+static const struct ccu_reset_map sun20i_d1_r_ccu_resets[] = {
        [RST_BUS_R_TIMER]       = { 0x11c, BIT(16) },
        [RST_BUS_R_TWD]         = { 0x12c, BIT(16) },
        [RST_BUS_R_PPU]         = { 0x1ac, BIT(16) },
index 9b5cfac2ee70cb286b47d4976fd9ca91560839ea..9633d4506891213a51978fc4a15c268a06be3bdf 100644 (file)
@@ -1232,7 +1232,7 @@ static struct clk_hw_onecell_data sun20i_d1_hw_clks = {
        },
 };
 
-static struct ccu_reset_map sun20i_d1_ccu_resets[] = {
+static const struct ccu_reset_map sun20i_d1_ccu_resets[] = {
        [RST_MBUS]              = { 0x540, BIT(30) },
        [RST_BUS_DE]            = { 0x60c, BIT(16) },
        [RST_BUS_DI]            = { 0x62c, BIT(16) },
index d1a1683baff4ecc1dface68c5322801ed53c932f..54c794c508286e31ff5b1cf3e8e9eb0084c6f973 100644 (file)
@@ -1382,7 +1382,7 @@ static struct clk_hw_onecell_data sun7i_a20_hw_clks = {
        .num    = CLK_NUMBER_SUN7I,
 };
 
-static struct ccu_reset_map sunxi_a10_a20_ccu_resets[] = {
+static const struct ccu_reset_map sunxi_a10_a20_ccu_resets[] = {
        [RST_USB_PHY0]          = { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          = { 0x0cc, BIT(1) },
        [RST_USB_PHY2]          = { 0x0cc, BIT(2) },
index 2c791761a6467bce3023cb355ba8763af50043f6..cdd9721f9e7d65c1fdcb8534252d236d8cd21309 100644 (file)
@@ -166,7 +166,7 @@ static struct clk_hw_onecell_data sun50i_a100_r_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun50i_a100_r_ccu_resets[] = {
+static const struct ccu_reset_map sun50i_a100_r_ccu_resets[] = {
        [RST_R_APB1_TIMER]      =  { 0x11c, BIT(16) },
        [RST_R_APB1_BUS_PWM]    =  { 0x13c, BIT(16) },
        [RST_R_APB1_PPU]        =  { 0x17c, BIT(16) },
index bbaa82978716a942bbae7ae7ab0d83e671ff4a43..1b6a49bc718459f9593fd2266b082434cfc3e5bd 100644 (file)
@@ -1061,7 +1061,7 @@ static struct clk_hw_onecell_data sun50i_a100_hw_clks = {
        .num = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun50i_a100_ccu_resets[] = {
+static const struct ccu_reset_map sun50i_a100_ccu_resets[] = {
        [RST_MBUS]              = { 0x540, BIT(30) },
 
        [RST_BUS_DE]            = { 0x60c, BIT(16) },
index c255dba2c96db3885996026fd952e9874f460c71..82d7dcbca1cc94cd89c7ce4eca21554acbe98aa3 100644 (file)
@@ -858,7 +858,7 @@ static struct clk_hw_onecell_data sun50i_a64_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun50i_a64_ccu_resets[] = {
+static const struct ccu_reset_map sun50i_a64_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          =  { 0x0cc, BIT(1) },
        [RST_USB_HSIC]          =  { 0x0cc, BIT(2) },
index c72815841111645d858f1823bf4bb0d84dc6b508..d0ce2779c55085a2546bc1fb489ad9fa964dcfeb 100644 (file)
@@ -179,7 +179,7 @@ static struct clk_hw_onecell_data sun50i_h616_r_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
+static const struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
        [RST_R_APB1_TIMER]      =  { 0x11c, BIT(16) },
        [RST_R_APB1_TWD]        =  { 0x12c, BIT(16) },
        [RST_R_APB1_PWM]        =  { 0x13c, BIT(16) },
@@ -190,7 +190,7 @@ static struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
        [RST_R_APB1_W1]         =  { 0x1ec, BIT(16) },
 };
 
-static struct ccu_reset_map sun50i_h616_r_ccu_resets[] = {
+static const struct ccu_reset_map sun50i_h616_r_ccu_resets[] = {
        [RST_R_APB1_TWD]        =  { 0x12c, BIT(16) },
        [RST_R_APB2_I2C]        =  { 0x19c, BIT(16) },
        [RST_R_APB2_RSB]        =  { 0x1bc, BIT(16) },
index a20b621ad8f1d1dd50f94a227c3e1f290a155546..bd6fc3df911d792ecd77e86613221c83ae9b54c9 100644 (file)
@@ -1076,7 +1076,7 @@ static struct clk_hw_onecell_data sun50i_h6_hw_clks = {
        .num = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun50i_h6_ccu_resets[] = {
+static const struct ccu_reset_map sun50i_h6_ccu_resets[] = {
        [RST_MBUS]              = { 0x540, BIT(30) },
 
        [RST_BUS_DE]            = { 0x60c, BIT(16) },
index b383ae2b2d449630dd5c4d997f826b9f090d1dbc..b001d0c03534f97b9cea8100066ee8e1d53b5132 100644 (file)
@@ -1002,7 +1002,7 @@ static struct clk_hw_onecell_data sun50i_h616_hw_clks = {
        .num = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun50i_h616_ccu_resets[] = {
+static const struct ccu_reset_map sun50i_h616_ccu_resets[] = {
        [RST_MBUS]              = { 0x540, BIT(30) },
 
        [RST_BUS_DE]            = { 0x60c, BIT(16) },
index 1f4bc0e773a7ed546d31daa96ff89153712fbe40..c9bf1fdb8a8a5fe698da61e035627119ae1fa165 100644 (file)
@@ -731,7 +731,7 @@ static struct clk_hw_onecell_data sun5i_a10s_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun5i_a10s_ccu_resets[] = {
+static const struct ccu_reset_map sun5i_a10s_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          =  { 0x0cc, BIT(1) },
 
index e8b8d2dd7f2cce2a094da2db76e0065804c65b2f..c2ad1209633ee85e8d1efd5ad221324031dd019d 100644 (file)
@@ -1146,7 +1146,7 @@ static struct clk_hw_onecell_data sun6i_a31_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun6i_a31_ccu_resets[] = {
+static const struct ccu_reset_map sun6i_a31_ccu_resets[] = {
        [RST_USB_PHY0]          = { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          = { 0x0cc, BIT(1) },
        [RST_USB_PHY2]          = { 0x0cc, BIT(2) },
index 6c2a08f722a84a9fab719ebc434c0494de13a69b..9433dbac038e16a2f1bf8dbc30ddfcfd6568b0ee 100644 (file)
@@ -668,7 +668,7 @@ static struct clk_hw_onecell_data sun8i_a23_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun8i_a23_ccu_resets[] = {
+static const struct ccu_reset_map sun8i_a23_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          =  { 0x0cc, BIT(1) },
        [RST_USB_HSIC]          =  { 0x0cc, BIT(2) },
index 5e0bc08a9ce3c5cbf3690dabf2810b469e6ec7d0..1ffc5ab9bc3cbab036ef44f49e0c17319a54b7dd 100644 (file)
@@ -712,7 +712,7 @@ static struct clk_hw_onecell_data sun8i_a33_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun8i_a33_ccu_resets[] = {
+static const struct ccu_reset_map sun8i_a33_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          =  { 0x0cc, BIT(1) },
        [RST_USB_HSIC]          =  { 0x0cc, BIT(2) },
index cb4c6b16c4677157be67a08c8dd39a5edadbcf57..a51fb2c10c94256efc52483c82af6a87ca938446 100644 (file)
@@ -797,7 +797,7 @@ static struct clk_hw_onecell_data sun8i_a83t_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun8i_a83t_ccu_resets[] = {
+static const struct ccu_reset_map sun8i_a83t_ccu_resets[] = {
        [RST_USB_PHY0]          = { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          = { 0x0cc, BIT(1) },
        [RST_USB_HSIC]          = { 0x0cc, BIT(2) },
index 7683ea08d8e30ac9f8d00eaeef9c3fb12281276d..a742f83746d1ec30f9ef61078f110cbf9cfed6f7 100644 (file)
@@ -146,7 +146,7 @@ static struct clk_hw_onecell_data sun50i_a64_de2_hw_clks = {
        .num    = CLK_NUMBER_WITH_ROT,
 };
 
-static struct ccu_reset_map sun8i_a83t_de2_resets[] = {
+static const struct ccu_reset_map sun8i_a83t_de2_resets[] = {
        [RST_MIXER0]    = { 0x08, BIT(0) },
        /*
         * Mixer1 reset line is shared with wb, so only RST_WB is
@@ -156,7 +156,7 @@ static struct ccu_reset_map sun8i_a83t_de2_resets[] = {
        [RST_ROT]       = { 0x08, BIT(3) },
 };
 
-static struct ccu_reset_map sun8i_h3_de2_resets[] = {
+static const struct ccu_reset_map sun8i_h3_de2_resets[] = {
        [RST_MIXER0]    = { 0x08, BIT(0) },
        /*
         * Mixer1 reset line is shared with wb, so only RST_WB is
@@ -166,14 +166,14 @@ static struct ccu_reset_map sun8i_h3_de2_resets[] = {
        [RST_WB]        = { 0x08, BIT(2) },
 };
 
-static struct ccu_reset_map sun50i_a64_de2_resets[] = {
+static const struct ccu_reset_map sun50i_a64_de2_resets[] = {
        [RST_MIXER0]    = { 0x08, BIT(0) },
        [RST_MIXER1]    = { 0x08, BIT(1) },
        [RST_WB]        = { 0x08, BIT(2) },
        [RST_ROT]       = { 0x08, BIT(3) },
 };
 
-static struct ccu_reset_map sun50i_h5_de2_resets[] = {
+static const struct ccu_reset_map sun50i_h5_de2_resets[] = {
        [RST_MIXER0]    = { 0x08, BIT(0) },
        [RST_MIXER1]    = { 0x08, BIT(1) },
        [RST_WB]        = { 0x08, BIT(2) },
index 13e57db2f8d55528f31a70f7d3045501abccf36f..74da5d27af72ac616f1f7947ffb970b0689949c0 100644 (file)
@@ -876,7 +876,7 @@ static struct clk_hw_onecell_data sun50i_h5_hw_clks = {
        .num    = CLK_NUMBER_H5,
 };
 
-static struct ccu_reset_map sun8i_h3_ccu_resets[] = {
+static const struct ccu_reset_map sun8i_h3_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          =  { 0x0cc, BIT(1) },
        [RST_USB_PHY2]          =  { 0x0cc, BIT(2) },
@@ -939,7 +939,7 @@ static struct ccu_reset_map sun8i_h3_ccu_resets[] = {
        [RST_BUS_SCR0]          =  { 0x2d8, BIT(20) },
 };
 
-static struct ccu_reset_map sun50i_h5_ccu_resets[] = {
+static const struct ccu_reset_map sun50i_h5_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          =  { 0x0cc, BIT(1) },
        [RST_USB_PHY2]          =  { 0x0cc, BIT(2) },
index da6569334d68b48750e1555e1f964cd0f6ed32e7..2b3e094a32cbdc411c451d6d57628535ef97df68 100644 (file)
@@ -178,7 +178,7 @@ static struct clk_hw_onecell_data sun50i_a64_r_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun8i_a83t_r_ccu_resets[] = {
+static const struct ccu_reset_map sun8i_a83t_r_ccu_resets[] = {
        [RST_APB0_IR]           =  { 0xb0, BIT(1) },
        [RST_APB0_TIMER]        =  { 0xb0, BIT(2) },
        [RST_APB0_RSB]          =  { 0xb0, BIT(3) },
@@ -186,14 +186,14 @@ static struct ccu_reset_map sun8i_a83t_r_ccu_resets[] = {
        [RST_APB0_I2C]          =  { 0xb0, BIT(6) },
 };
 
-static struct ccu_reset_map sun8i_h3_r_ccu_resets[] = {
+static const struct ccu_reset_map sun8i_h3_r_ccu_resets[] = {
        [RST_APB0_IR]           =  { 0xb0, BIT(1) },
        [RST_APB0_TIMER]        =  { 0xb0, BIT(2) },
        [RST_APB0_UART]         =  { 0xb0, BIT(4) },
        [RST_APB0_I2C]          =  { 0xb0, BIT(6) },
 };
 
-static struct ccu_reset_map sun50i_a64_r_ccu_resets[] = {
+static const struct ccu_reset_map sun50i_a64_r_ccu_resets[] = {
        [RST_APB0_IR]           =  { 0xb0, BIT(1) },
        [RST_APB0_TIMER]        =  { 0xb0, BIT(2) },
        [RST_APB0_RSB]          =  { 0xb0, BIT(3) },
index 2f51ceab8016f8715c1236c1ae5968023cc5cf3e..a374aeeca3f4c5ded2d0bafcabad9063e6b0e396 100644 (file)
@@ -1162,7 +1162,7 @@ static struct clk_hw_onecell_data sun8i_r40_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun8i_r40_ccu_resets[] = {
+static const struct ccu_reset_map sun8i_r40_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
        [RST_USB_PHY1]          =  { 0x0cc, BIT(1) },
        [RST_USB_PHY2]          =  { 0x0cc, BIT(2) },
index d24c0d8dfee4cceab5ae75dd5f37e193b4100f38..00d04f7ad94db451b35a7b0f004adc372582261f 100644 (file)
@@ -644,7 +644,7 @@ static struct clk_hw_onecell_data sun8i_v3_hw_clks = {
        .num    = CLK_I2S0 + 1,
 };
 
-static struct ccu_reset_map sun8i_v3s_ccu_resets[] = {
+static const struct ccu_reset_map sun8i_v3s_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
 
        [RST_MBUS]              =  { 0x0fc, BIT(31) },
@@ -679,7 +679,7 @@ static struct ccu_reset_map sun8i_v3s_ccu_resets[] = {
        [RST_BUS_UART2]         =  { 0x2d8, BIT(18) },
 };
 
-static struct ccu_reset_map sun8i_v3_ccu_resets[] = {
+static const struct ccu_reset_map sun8i_v3_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
 
        [RST_MBUS]              =  { 0x0fc, BIT(31) },
index 0975ac58949f45f4f0c0cde56d91ae3222b1eb2d..d561c15f51221af17ad2ebfb532d6243b87f5795 100644 (file)
@@ -177,7 +177,7 @@ static struct clk_hw_onecell_data sun9i_a80_de_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun9i_a80_de_resets[] = {
+static const struct ccu_reset_map sun9i_a80_de_resets[] = {
        [RST_FE0]       = { 0x0c, BIT(0) },
        [RST_FE1]       = { 0x0c, BIT(1) },
        [RST_FE2]       = { 0x0c, BIT(2) },
index e5527c8cc64ff4c60355f2106801968f935eb620..9e2b8d47fc546eaf35b03d053e53724c49aaa6e7 100644 (file)
@@ -68,7 +68,7 @@ static struct clk_hw_onecell_data sun9i_a80_usb_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun9i_a80_usb_resets[] = {
+static const struct ccu_reset_map sun9i_a80_usb_resets[] = {
        [RST_USB0_HCI]          = { 0x0, BIT(17) },
        [RST_USB1_HCI]          = { 0x0, BIT(18) },
        [RST_USB2_HCI]          = { 0x0, BIT(19) },
index 756dd8fca6b0a43f1714df361c079d600f5c9755..5da9a16b4ec706f5baf1e78c055ff0c36b8d0a0a 100644 (file)
@@ -1108,7 +1108,7 @@ static struct clk_hw_onecell_data sun9i_a80_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map sun9i_a80_ccu_resets[] = {
+static const struct ccu_reset_map sun9i_a80_ccu_resets[] = {
        /* AHB0 reset controls */
        [RST_BUS_FD]            = { 0x5a0, BIT(0) },
        [RST_BUS_VE]            = { 0x5a0, BIT(1) },
index 52f1a04269f8c1a04ea9a487cea38d198a7f5dc4..fb37c0fc4fdec0ae66225fe32865ca0186e26baf 100644 (file)
@@ -477,7 +477,7 @@ static struct clk_hw_onecell_data suniv_hw_clks = {
        .num    = CLK_NUMBER,
 };
 
-static struct ccu_reset_map suniv_ccu_resets[] = {
+static const struct ccu_reset_map suniv_ccu_resets[] = {
        [RST_USB_PHY0]          =  { 0x0cc, BIT(0) },
 
        [RST_BUS_DMA]           =  { 0x2c0, BIT(6) },
index 329734f8cf42b41263fbc4eb2de9bb1315e498e1..dd330426a6e5f39825606f345b231ce4186d0a7b 100644 (file)
@@ -50,7 +50,7 @@ struct sunxi_ccu_desc {
 
        struct clk_hw_onecell_data      *hw_clks;
 
-       struct ccu_reset_map            *resets;
+       const struct ccu_reset_map      *resets;
        unsigned long                   num_resets;
 };
 
index e9b973cae4af9a2c0c5eb5915ccc3537ab512506..941276a8ec2ee3d1f28c45583aaac95c70a94400 100644 (file)
@@ -17,7 +17,7 @@ struct ccu_reset_map {
 
 struct ccu_reset {
        void __iomem                    *base;
-       struct ccu_reset_map            *reset_map;
+       const struct ccu_reset_map      *reset_map;
        spinlock_t                      *lock;
 
        struct reset_controller_dev     rcdev;