From 5b263f3360bfc1c74a17d3ce1710d5c528084156 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 31 Aug 2025 14:01:55 -0700 Subject: [PATCH] treewide: add const to static arrays Allows more compiler optimization. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/19932 Signed-off-by: Hauke Mehrtens --- .../kernel/button-hotplug/src/button-hotplug.c | 2 +- .../src/gpio-button-hotplug.c | 2 +- .../ltq-atm/src/ifxmips_atm_fw_amazon_se.h | 4 ++-- .../lantiq/ltq-atm/src/ifxmips_atm_fw_ar9.h | 4 ++-- .../ltq-atm/src/ifxmips_atm_fw_ar9_retx.h | 4 ++-- .../lantiq/ltq-atm/src/ifxmips_atm_fw_danube.h | 4 ++-- .../ltq-atm/src/ifxmips_atm_fw_danube_retx.h | 4 ++-- .../lantiq/ltq-atm/src/ifxmips_atm_fw_vr9.h | 4 ++-- .../lantiq/ltq-deu/src/ifxmips_async_aes.c | 2 +- .../lantiq/ltq-deu/src/ifxmips_async_des.c | 2 +- .../kernel/lantiq/ltq-deu/src/ifxmips_tcrypt.h | 18 +++++++++--------- .../ltq-ptm/src/ifxmips_ptm_fw_amazon_se.h | 4 ++-- .../lantiq/ltq-ptm/src/ifxmips_ptm_fw_ar9.h | 4 ++-- .../lantiq/ltq-ptm/src/ifxmips_ptm_fw_danube.h | 4 ++-- .../lantiq/ltq-ptm/src/ifxmips_ptm_fw_vr9.h | 4 ++-- ...-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch | 2 +- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/package/kernel/button-hotplug/src/button-hotplug.c b/package/kernel/button-hotplug/src/button-hotplug.c index 1b77cd7922..2819d29b94 100644 --- a/package/kernel/button-hotplug/src/button-hotplug.c +++ b/package/kernel/button-hotplug/src/button-hotplug.c @@ -72,7 +72,7 @@ extern u64 uevent_next_seqnum(void); .name = (_name), \ } -static struct bh_map button_map[] = { +static const struct bh_map button_map[] = { BH_MAP(BTN_0, "BTN_0"), BH_MAP(BTN_1, "BTN_1"), BH_MAP(BTN_2, "BTN_2"), diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 0c16f34b0d..5b40e34950 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -72,7 +72,7 @@ extern u64 uevent_next_seqnum(void); .name = (_name), \ } -static struct bh_map button_map[] = { +static const struct bh_map button_map[] = { BH_MAP(BTN_0, "BTN_0"), BH_MAP(BTN_1, "BTN_1"), BH_MAP(BTN_2, "BTN_2"), diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_amazon_se.h b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_amazon_se.h index b0a9c91bc4..0ce80945f5 100644 --- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_amazon_se.h +++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_amazon_se.h @@ -34,7 +34,7 @@ #define ATM_FW_VER_MINOR 16 -static unsigned int firmware_binary_code[] = { +static const unsigned int firmware_binary_code[] = { 0x800004b8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000ffe0, 0x00000000, 0x00000000, 0x00000000, 0xc1000002, 0xd90c00f8, 0xc2000002, 0xda0800f9, 0x80004cc8, 0xc2000000, 0xda0800f9, 0x80004330, @@ -450,7 +450,7 @@ static unsigned int firmware_binary_code[] = { 0x9d000000, 0xcd4000f8, 0x00000000, 0x00000000, 0x9d000000, 0x4158a000, 0xcd4000f8, 0x00000000, }; -static unsigned int firmware_binary_data[] = { +static const unsigned int firmware_binary_data[] = { }; diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_ar9.h b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_ar9.h index 5ee6d23bb1..d0164df7a8 100644 --- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_ar9.h +++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_ar9.h @@ -32,7 +32,7 @@ #define ATM_FW_VER_MINOR 16 -static unsigned int ar9_fw_bin[] = { +static const unsigned int ar9_fw_bin[] = { 0x800004b8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000ffe0, 0x00000000, 0x00000000, 0x00000000, 0xc1000002, 0xd90c00f8, 0xc2000002, 0xda0800f9, 0x80004980, 0xc2000000, 0xda0800f9, 0x80003fe8, @@ -432,7 +432,7 @@ static unsigned int ar9_fw_bin[] = { 0xcd4000f8, 0x00000000, }; -static unsigned int ar9_fw_data[] = { +static const unsigned int ar9_fw_data[] = { }; diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_ar9_retx.h b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_ar9_retx.h index 51e4f9c6c9..3cc62e696d 100644 --- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_ar9_retx.h +++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_ar9_retx.h @@ -32,7 +32,7 @@ #define ATM_FW_VER_MINOR 15 -static unsigned int firmware_binary_code[] = { +static const unsigned int firmware_binary_code[] = { 0x800004B8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000FFE0, 0x00000000, 0x00000000, 0x00000000, 0xC1000002, 0xD90C00F8, 0xC2000002, 0xDA0800F9, 0xC0001B50, 0x8C100000, 0x00000000, 0x00000000, @@ -604,7 +604,7 @@ static unsigned int firmware_binary_code[] = { 0xCDC000F8, 0xC1C00000, 0xC0004734, 0x9CC00000, 0xCDC000F8, 0xC0004732, 0xCD8000F8, }; -static unsigned int firmware_binary_data[] = { +static const unsigned int firmware_binary_data[] = { }; diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_danube.h b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_danube.h index 57b7586bd0..60de8d1d70 100644 --- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_danube.h +++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_danube.h @@ -35,7 +35,7 @@ // add multiple queue per PVC feature -static unsigned int danube_fw_bin[] = { +static const unsigned int danube_fw_bin[] = { 0x800004A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000FFC8, 0x00000000, 0x00000000, 0x00000000, 0xC1000002, 0xD90C0000, 0xC2000002, 0xDA080001, 0x80004968, 0xC2000000, 0xDA080001, 0x80003FD0, @@ -435,7 +435,7 @@ static unsigned int danube_fw_bin[] = { 0xCD400000, 0x00000000, }; -static unsigned int danube_fw_data[] = { +static const unsigned int danube_fw_data[] = { }; diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_danube_retx.h b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_danube_retx.h index 1c915dbba1..bf31753ed3 100644 --- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_danube_retx.h +++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_danube_retx.h @@ -33,7 +33,7 @@ #define ATM_FW_VER_MINOR 15 -static unsigned int firmware_binary_code[] = { +static const unsigned int firmware_binary_code[] = { 0x800004A0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000FFC8, 0x00000000, 0x00000000, 0x00000000, 0xC1000002, 0xD90C0000, 0xC2000002, 0xDA080001, 0xC0001B50, 0x8C100000, 0x00000000, 0x00000000, @@ -605,7 +605,7 @@ static unsigned int firmware_binary_code[] = { 0xCDC00000, 0xC1C00000, 0xC0004734, 0x9CC00000, 0xCDC00000, 0xC0004732, 0xCD800000, }; -static unsigned int firmware_binary_data[] = { +static const unsigned int firmware_binary_data[] = { }; diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_vr9.h b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_vr9.h index 42a26ec539..8b73c07147 100644 --- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_vr9.h +++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_fw_vr9.h @@ -32,7 +32,7 @@ #define ATM_FW_VER_MINOR 24 -static u32 vr9_fw_bin[] = { +static const u32 vr9_fw_bin[] = { 0x800004B8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000FFE0, 0x00000000, 0x00000000, 0x00000000, 0xC1000002, 0xD90C00F8, 0xC2000002, 0xDA0800F9, 0x80004390, 0xC2000000, 0xDA0800F9, 0x80003A10, @@ -419,7 +419,7 @@ static u32 vr9_fw_bin[] = { 0xCE0000F8, 0xC000697E, 0xCE4000F8, 0x9D000000, 0x4158A000, 0xCD4000F8, 0x00000000, }; -static u32 vr9_fw_data[] = { +static const u32 vr9_fw_data[] = { }; diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c index cdf9a89a1a..09354b9fdd 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c @@ -956,7 +956,7 @@ struct lq_aes_alg { }; /* AES supported algo array */ -static struct lq_aes_alg aes_drivers_alg[] = { +static const struct lq_aes_alg aes_drivers_alg[] = { { .alg = { .cra_name = "aes", diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c index e96379f1d4..3eb9f86997 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c @@ -754,7 +754,7 @@ struct lq_des_alg { }; /* DES Supported algo array */ -static struct lq_des_alg des_drivers_alg [] = { +static const struct lq_des_alg des_drivers_alg [] = { { .alg = { .cra_name = "des", diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_tcrypt.h b/package/kernel/lantiq/ltq-deu/src/ifxmips_tcrypt.h index 1e7047b593..5c301bdd46 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_tcrypt.h +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_tcrypt.h @@ -38,7 +38,7 @@ static int alg_speed_test(const char *alg, const char *driver, struct cipher_speed_template *t, unsigned int tcount, u8 *keysize); -static struct cipher_speed_template des3_speed_template[] = { +static const struct cipher_speed_template des3_speed_template[] = { { .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" "\x55\x55\x55\x55\x55\x55\x55\x55" @@ -50,18 +50,18 @@ static struct cipher_speed_template des3_speed_template[] = { /* * Cipher speed tests */ -static u8 speed_template_8[] = {8, 0}; -static u8 speed_template_24[] = {24, 0}; -static u8 speed_template_8_32[] = {8, 32, 0}; -static u8 speed_template_16_32[] = {16, 32, 0}; -static u8 speed_template_16_24_32[] = {16, 24, 32, 0}; -static u8 speed_template_32_40_48[] = {32, 40, 48, 0}; -static u8 speed_template_32_48_64[] = {32, 48, 64, 0}; +static const u8 speed_template_8[] = {8, 0}; +static const u8 speed_template_24[] = {24, 0}; +static const u8 speed_template_8_32[] = {8, 32, 0}; +static const u8 speed_template_16_32[] = {16, 32, 0}; +static const u8 speed_template_16_24_32[] = {16, 24, 32, 0}; +static const u8 speed_template_32_40_48[] = {32, 40, 48, 0}; +static const u8 speed_template_32_48_64[] = {32, 48, 64, 0}; /* * Digest speed tests */ -static struct hash_speed generic_hash_speed_template[] = { +static const struct hash_speed generic_hash_speed_template[] = { { .blen = 16, .plen = 16, }, { .blen = 64, .plen = 16, }, { .blen = 64, .plen = 64, }, diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_amazon_se.h b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_amazon_se.h index ae33bcc66a..663a8b7af6 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_amazon_se.h +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_amazon_se.h @@ -32,7 +32,7 @@ #define PTM_FW_VER_MINOR 17 -static unsigned int firmware_binary_code[] = { +static const unsigned int firmware_binary_code[] = { 0x800004b8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000ffe0, 0x00000000, 0x00000000, 0x00000000, 0xc1000002, 0xd90c00f8, 0xc2000002, 0xda0800f9, 0x800055e0, 0xc2000000, 0xda0800f9, 0x80005580, @@ -486,7 +486,7 @@ static unsigned int firmware_binary_code[] = { 0xcd4000f8, 0x00000000, 0x00000000, }; -static unsigned int firmware_binary_data[] = { +static const unsigned int firmware_binary_data[] = { }; diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_ar9.h b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_ar9.h index a61d313852..bb370e1558 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_ar9.h +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_ar9.h @@ -30,7 +30,7 @@ #define PTM_FW_VER_MINOR 17 -static unsigned int firmware_binary_code[] = { +static const unsigned int firmware_binary_code[] = { 0x800004b8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000ffe0, 0x00000000, 0x00000000, 0x00000000, 0xc1000002, 0xd90c00f8, 0xc2000002, 0xda0800f9, 0x80005270, 0xc2000000, 0xda0800f9, 0x80005210, @@ -466,7 +466,7 @@ static unsigned int firmware_binary_code[] = { 0x4194a000, 0x5d940040, 0x88000012, 0xc59400f8, 0x9d000000, 0xcd4000f8, 0x00000000, 0x00000000, }; -static unsigned int firmware_binary_data[] = { +static const unsigned int firmware_binary_data[] = { }; diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_danube.h b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_danube.h index 3451682fb2..4484eb2667 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_danube.h +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_danube.h @@ -31,7 +31,7 @@ #define PTM_FW_VER_MINOR 17 -static unsigned int firmware_binary_code[] = { +static const unsigned int firmware_binary_code[] = { 0x800004a0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000ffc8, 0x00000000, 0x00000000, 0x00000000, 0xc1000002, 0xd90c0000, 0xc2000002, 0xda080001, 0x80005618, 0xc2000000, 0xda080001, 0x800055b8, @@ -482,7 +482,7 @@ static unsigned int firmware_binary_code[] = { 0x4194a000, 0x5d940040, 0x8800fffa, 0xc5940000, 0x9d000000, 0xcd400000, 0x00000000, 0x00000000, }; -static unsigned int firmware_binary_data[] = { +static const unsigned int firmware_binary_data[] = { }; diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_vr9.h b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_vr9.h index 3aa9f1851f..599d5099c7 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_vr9.h +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_fw_vr9.h @@ -28,7 +28,7 @@ ** 01/08/2014 Lantiq PPE FW Team VR9 E1 PPE Firmware Binary *******************************************************************************/ -static unsigned int firmware_binary_code[] = { +static const unsigned int firmware_binary_code[] = { 0x80000980, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x8000ffe0, 0x00000000, 0x00000000, 0x00000000, 0x94000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, @@ -471,7 +471,7 @@ static unsigned int firmware_binary_code[] = { 0x84009b42, 0x6f9d0010, 0x739da000, 0x6f9e0010, 0x735da000, 0x6f9f0010, 0x735da000, 0xc1c0001e, 0x775da000, 0xc000e440, 0xcf4000f8, 0x80009ae8, 0x00000000, 0x00000000, 0x00000000,}; -static unsigned int firmware_binary_data[] = { +static const unsigned int firmware_binary_data[] = { }; diff --git a/target/linux/mvebu/patches-6.12/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch b/target/linux/mvebu/patches-6.12/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch index 6f99497c36..e697a64066 100644 --- a/target/linux/mvebu/patches-6.12/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch +++ b/target/linux/mvebu/patches-6.12/902-drivers-mfd-Add-a-driver-for-IEI-WT61P803-PUZZLE-MCU.patch @@ -820,7 +820,7 @@ Cc: Robert Marko +static IEI_WT61P803_PUZZLE_ATTR_RW(power_loss_recovery, IEI_WT61P803_PUZZLE_POWER_LOSS_RECOVERY, 0); +static IEI_WT61P803_PUZZLE_ATTR_RO(power_status, IEI_WT61P803_PUZZLE_POWER_STATUS, 0); + -+static struct attribute *iei_wt61p803_puzzle_attrs[] = { ++static const struct attribute *iei_wt61p803_puzzle_attrs[] = { + &dev_attr_version.dev_attr.attr, + &dev_attr_build_info.dev_attr.attr, + &dev_attr_bootloader_mode.dev_attr.attr, -- 2.30.2