Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] chemical: bme680: Convert to static the const lookup table
@ 2024-07-25 23:18 Vasileios Amoiridis
  2024-07-27 15:08 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Vasileios Amoiridis @ 2024-07-25 23:18 UTC (permalink / raw)
  To: jic23, lars
  Cc: himanshujha199640, linux-iio, linux-kernel, Vasileios Amoiridis

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

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
---
 drivers/iio/chemical/bme680_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
index 74ac887d8d8e..5d2e750ca2b9 100644
--- a/drivers/iio/chemical/bme680_core.c
+++ b/drivers/iio/chemical/bme680_core.c
@@ -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,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] chemical: bme680: Convert to static the const lookup table
  2024-07-25 23:18 [PATCH] chemical: bme680: Convert to static the const lookup table Vasileios Amoiridis
@ 2024-07-27 15:08 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2024-07-27 15:08 UTC (permalink / raw)
  To: Vasileios Amoiridis; +Cc: lars, himanshujha199640, linux-iio, linux-kernel

On Fri, 26 Jul 2024 01:18:18 +0200
Vasileios Amoiridis <vassilisamir@gmail.com> wrote:

> By converting it to static, we ensure that this will be placed by the
> compiler in the read-only area.
> 
> Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Applied.

> ---
>  drivers/iio/chemical/bme680_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
> index 74ac887d8d8e..5d2e750ca2b9 100644
> --- a/drivers/iio/chemical/bme680_core.c
> +++ b/drivers/iio/chemical/bme680_core.c
> @@ -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,


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-27 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25 23:18 [PATCH] chemical: bme680: Convert to static the const lookup table Vasileios Amoiridis
2024-07-27 15:08 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox