Re: [PATCH][next] iio: pressure: bmp280-core: Make read-only const array conversion_time_max static

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 22 Jul 2024 16:17:38 +0100
Colin Ian King <colin.i.king@xxxxxxxxx> wrote:

> Don't populate the read-only array conversion_time_max on the stack at
> run time, instead make it static.
> 
> Signed-off-by: Colin Ian King <colin.i.king@xxxxxxxxx>

I'm almost 100% the compiler can hoist this off the stack if it feels like
it but sure, it might not and adding the static keyword probably obliges
it to do so. Is that better or worse? Probably better.

Ah well, I don't feel strongly and it's probably a good thing.
Applied to the testing branch of iio.git for now. I'll rebase on rc1 once available.

Thanks,

Jonathan


> ---
>  drivers/iio/pressure/bmp280-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> index 49081b729618..9ead52954de3 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -1865,7 +1865,7 @@ EXPORT_SYMBOL_NS(bmp580_chip_info, IIO_BMP280);
>  
>  static int bmp180_wait_for_eoc(struct bmp280_data *data, u8 ctrl_meas)
>  {
> -	const int conversion_time_max[] = { 4500, 7500, 13500, 25500 };
> +	static const int conversion_time_max[] = { 4500, 7500, 13500, 25500 };
>  	unsigned int delay_us;
>  	unsigned int ctrl;
>  	int ret;





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux