Re: [PATCH] iio: chemical: scd30: make command lookup table const
From: Jonathan Cameron
Date: Mon May 11 2026 - 07:30:40 EST
On Fri, 8 May 2026 17:39:17 +0400
Giorgi Tchankvetadze <giorgitchankvetadze1997@xxxxxxxxx> wrote:
> scd30_i2c_cmd_lookup_tbl contains fixed opcodes and is
> only read by scd30_i2c_command(). Make it const to document that it's immutable
> and allow it to be placed in read-only memory.
>
> Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@xxxxxxxxx>
Applied to the testing branch of iio.git. Thanks,
Jonathan
> ---
> drivers/iio/chemical/scd30_i2c.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/chemical/scd30_i2c.c b/drivers/iio/chemical/scd30_i2c.c
> index 436df9c61a71..bf465cc71be7 100644
> --- a/drivers/iio/chemical/scd30_i2c.c
> +++ b/drivers/iio/chemical/scd30_i2c.c
> @@ -20,7 +20,7 @@
> #define SCD30_I2C_MAX_BUF_SIZE 18
> #define SCD30_I2C_CRC8_POLYNOMIAL 0x31
>
> -static u16 scd30_i2c_cmd_lookup_tbl[] = {
> +static const u16 scd30_i2c_cmd_lookup_tbl[] = {
> [CMD_START_MEAS] = 0x0010,
> [CMD_STOP_MEAS] = 0x0104,
> [CMD_MEAS_INTERVAL] = 0x4600,