Browse Source

treewide: add const to static arrays

Allows more compiler optimization.

Signed-off-by: Rosen Penev <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/19932
Signed-off-by: Hauke Mehrtens <[email protected]>
Rosen Penev 6 months ago
parent
commit
5b263f3360

+ 1 - 1
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"),

+ 1 - 1
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"),

+ 2 - 2
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[] = {
 };
 
 

+ 2 - 2
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[] = {
 };
 
 

+ 2 - 2
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[] = {
 };
 
 

+ 2 - 2
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[] = {
 };
 
 

+ 2 - 2
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[] = {
 };
 
 

+ 2 - 2
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[] = {
 };
 
 

+ 1 - 1
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",

+ 1 - 1
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",

+ 9 - 9
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, },

+ 2 - 2
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[] = {
 };
 
 

+ 2 - 2
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[] = {
 };
 
 

+ 2 - 2
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[] = {
 };
 
 

+ 2 - 2
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[] = {
 };
 
 

+ 1 - 1
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 <[email protected]>
 +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,