Linux IIO development
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: pressure: bmp280: drop sensor_data array
Date: Tue, 22 Apr 2025 16:22:45 -0500	[thread overview]
Message-ID: <12dac98d-3e6b-4c2b-8ac0-d526bdb5efd4@baylibre.com> (raw)
In-Reply-To: <CAHp75Ve_C6BXo75xy4+xZ5b1O9-TT5TGGQDgTR_F1s3TFK3p6Q@mail.gmail.com>

On 4/22/25 3:57 PM, Andy Shevchenko wrote:
> On Tue, Apr 22, 2025 at 10:28 PM David Lechner <dlechner@baylibre.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@kernel.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.


  reply	other threads:[~2025-04-22 21:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 19:28 [PATCH] iio: pressure: bmp280: drop sensor_data array David Lechner
2025-04-22 20:57 ` Andy Shevchenko
2025-04-22 21:22   ` David Lechner [this message]
2025-04-22 22:19     ` Andy Shevchenko
2025-04-22 22:32       ` David Lechner
2025-04-22 22:38         ` Andy Shevchenko
2025-04-26 15:27           ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12dac98d-3e6b-4c2b-8ac0-d526bdb5efd4@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox