[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <12dac98d-3e6b-4c2b-8ac0-d526bdb5efd4@baylibre.com>
Date: Tue, 22 Apr 2025 16:22:45 -0500
From: David Lechner <dlechner@...libre.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Jonathan Cameron <jic23@...nel.org>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: pressure: bmp280: drop sensor_data array
On 4/22/25 3:57 PM, Andy Shevchenko wrote:
> On Tue, Apr 22, 2025 at 10:28 PM David Lechner <dlechner@...libre.com> wrote:
>>
>> Drop the sensor_data array from struct bmp280_data and replace it using
>> local structs in each interrupt handler.
>>
>> The sensor_data array in struct bmp280_data is not used to share data
>> between functions and isn't used for DMA, so there isn't really a need
>> to have it in the struct. Instead, we can use the struct pattern for
>> scan data in each interrupt handler. This has the advantage of allowing
>> us to see the actual layout of each scan buffer for each different type
>> of supported sensor. It also avoid juggling values between local
>
> of the supported
I think what I wrote is correct grammar. Same as if I would have written
"each type of sensor". I would not write "each type of the sensor".
>
>> variables and the array which makes the code a bit simpler by avoiding
>> some extra assignments.
>>
>> We can also drop the BME280_NUM_MAX_CHANNELS macro as it is no longer
>> used.
>
> I like this change so much, thanks!
> But one comment below.
>
> Reviewed-by: Andy Shevchenko <andy@...nel.org>
>
> ...
>
>> /* Pressure calculations */
>> - memcpy(&data->sensor_data[offset], &data->buf[3], 3);
>> -
>> - offset += sizeof(s32);
>> + memcpy(&buffer.comp_press, &data->buf[3], 3);
>>
>> /* Temperature calculations */
>> - memcpy(&data->sensor_data[offset], &data->buf[0], 3);
>> + memcpy(&buffer.comp_temp, &data->buf[0], 3);
>
> Shouldn't these memcpy():s be get_unaligned_be24()/get_unaligned_le24()?
>
The scan_type.endianness is already defined as IIO_LE, so we must preserve the
the little-endian order, even on big-endian systems.
Powered by blists - more mailing lists