Skip to contentSkip to conversation

chemical: bme680: Convert to static the const lookup table

PATCH Applied Vasileios Amoiridis 2 participants 2 messages Jul 25, 2024 – Jul 27, 2024 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 chemical: bme680: Convert to static the const lookup table

By converting it to static, we ensure that this will be placed by the compiler in the read-only area.

---
 drivers/iio/chemical/bme680_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/chemical/bme680_core.c +1 -1
index 74ac887d8d8e..5d2e750ca2b9 100644
@@ -438,7 +438,7 @@ static u32 bme680_compensate_gas(struct bme680_data *data, u16 gas_res_adc,
 	u32 calc_gas_res;
 
 	/* Look up table for the possible gas range values */
-	const u32 lookupTable[16] = {2147483647u, 2147483647u,
+	static const u32 lookupTable[16] = {2147483647u, 2147483647u,
 				2147483647u, 2147483647u, 2147483647u,
 				2126008810u, 2147483647u, 2130303777u,
 				2147483647u, 2147483647u, 2143188679u,
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 4 lines · On Fri, 26 Jul 2024 01:18:18 +0200 Vasileios Amoiridis…

By converting it to static, we ensure that this will be placed by the compiler in the read-only area.

Applied.

Quoted 17 lines
---
 drivers/iio/chemical/bme680_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/chemical/bme680_core.c +1 -1
index 74ac887d8d8e..5d2e750ca2b9 100644
@@ -438,7 +438,7 @@ static u32 bme680_compensate_gas(struct bme680_data *data, u16 gas_res_adc,
 	u32 calc_gas_res;
 
 	/* Look up table for the possible gas range values */
-	const u32 lookupTable[16] = {2147483647u, 2147483647u,
+	static const u32 lookupTable[16] = {2147483647u, 2147483647u,
 				2147483647u, 2147483647u, 2147483647u,
 				2126008810u, 2147483647u, 2130303777u,
 				2147483647u, 2147483647u, 2143188679u,