From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Antoni Pokusinski <apokusinski01@gmail.com>,
<dlechner@baylibre.com>, <nuno.sa@analog.com>, <andy@kernel.org>,
<marcelo.schmitt1@gmail.com>, <linux-iio@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] iio: mpl3115: add threshold events support
Date: Tue, 4 Nov 2025 14:03:15 +0000 [thread overview]
Message-ID: <20251104140315.0000394d@huawei.com> (raw)
In-Reply-To: <aQhmNDoI8k3KvyMR@smile.fi.intel.com>
On Mon, 3 Nov 2025 10:22:12 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Sun, Nov 02, 2025 at 10:38:08AM +0000, Jonathan Cameron wrote:
> > On Fri, 31 Oct 2025 21:18:22 +0100
> > Antoni Pokusinski <apokusinski01@gmail.com> wrote:
>
> ...
>
>
> > Generally looks good to me, but some comments on the 24 bit value reading.
>
> > > + i2c_smbus_read_i2c_block_data(data->client,
> > > + MPL3115_OUT_PRESS,
> > > + 3, (u8 *)&val_press);
> >
> > This is an oddity. Why read into a __be32 when it's a 24bit number?
> > I guess it doesn't really matter as you just need a big enough space
> > and throw the value away. However, I'd read it into a u8 [3]; then size off that
> > as well.
> >
> > There are two existing cases of this in the driver. One of them should use
> > get_unaligned_be24 on a u8[3] buffer. The other one is more complex as it's
> > reading directly into the scan buffer that gets pushed to the kfifo and is
> > reading into a u8 buffer ultimately anyway so at least there is no
> > real suggestion of it being 32 bits (just a +4 shift to deal with natural
> > alignment as the storage has to be power of 2 in that case.).
> >
> > hmm. I think either we should tidy up the easy case (_read_info_raw) +
> > use a u8[3] here or just stick to this being odd.
> > My preference would be to have another patch tidying up the other case
> > + use a u8[3] here.
>
> Just a side question... Wondering, if we actually can defined __be24 and __le24
> types (or at least u24) for really explicit cases.
Would be useful for readability. Particularly if we could make it work with the
type checking stuff similar to the endian markings, but restricted to only be
accessed with the unaligned accessors. Possibly worth doing even without that.
Jonathan
>
next prev parent reply other threads:[~2025-11-04 14:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 20:18 [PATCH v2 0/2] iio: mpl3115: support for events Antoni Pokusinski
2025-10-31 20:18 ` [PATCH v2 1/2] iio: mpl3115: add threshold events support Antoni Pokusinski
2025-11-02 10:38 ` Jonathan Cameron
2025-11-03 8:22 ` Andy Shevchenko
2025-11-04 14:03 ` Jonathan Cameron [this message]
2025-10-31 20:18 ` [PATCH v2 2/2] iio: ABI: document pressure event attributes Antoni Pokusinski
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=20251104140315.0000394d@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=apokusinski01@gmail.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--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