From: Jonathan Cameron <jic23@kernel.org>
To: Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>
Cc: "Jean-Baptiste Maneyrol via B4 Relay"
<devnull+jean-baptiste.maneyrol.tdk.com@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/2] iio: imu: inv_icm42600: add WoM support
Date: Sat, 21 Jun 2025 18:07:30 +0100 [thread overview]
Message-ID: <20250621180730.2b517019@jic23-huawei> (raw)
In-Reply-To: <FR3P281MB175789F6AADF5D0D15BC89A1CE70A@FR3P281MB1757.DEUP281.PROD.OUTLOOK.COM>
On Mon, 16 Jun 2025 07:42:16 +0000
Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com> wrote:
> >
> >________________________________________
> >From: Jonathan Cameron <jic23@kernel.org>
> >Sent: Saturday, June 14, 2025 14:53
> >To: Jean-Baptiste Maneyrol via B4 Relay <devnull+jean-baptiste.maneyrol.tdk.com@kernel.org>
> >Cc: Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; Lars-Peter Clausen <lars@metafoo.de>; David Lechner <dlechner@baylibre.com>; Nuno Sá <nuno.sa@analog.com>; Andy Shevchenko <andy@kernel.org>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
> >Subject: Re: [PATCH v4 1/2] iio: imu: inv_icm42600: add WoM support
> >
> >This Message Is From an External Sender
> >This message came from outside your organization.
> >
> >On Fri, 13 Jun 2025 09:34:26 +0200
> >Jean-Baptiste Maneyrol via B4 Relay <devnull+jean-baptiste.maneyrol.tdk.com@kernel.org> wrote:
> >
> >> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
> >>
> >> Add WoM as accel roc rising x|y|z event.
> >>
> >> Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
> >Hi Jean-Baptiste.
> >
> >A couple of comments inline.
> >Ideally pull the movement of the timestamp struct to before the DMA safe
> >buffers to a precursor patch. That is a bit subtle to have hiding in here.
> >
> >The guards thing can be for next time you are doing a cleanup series on this
> >driver if you prefer.
> >
> >Jonathan
>
> Hello Jonathan,
>
> concerning the full driver rewrite asked by Andy to switch to uXX/sXX kernel types,
> can I put it inside this series?
Sure.
>
> Otherwise, should it be in a separate patch and perhaps with a fixed tag so it
> can be backported to enable automatic backport of further fix patches?
It shouldn't be fixes tagged as that won't be a fix as such.
Backport wise we might need to call it out the first time something is based
on it but the stable maintainers are pretty good at spotting these sorts
of broad mechanical changes that enable a later fix so they'll probably just
pick it up when needed.
>
> Or can it be after this series is accepted? I would prefer that.
I want the end result with the kernel types, but not that fussed on ordering.
Whilst it may seem churn heavy this stuff is usually reasonably easy to
result when fixes cross such a patch.
I'll catch up with the other thread as I see there is already such a patch
being discussed.
> >> /**
> >> * struct inv_icm42600_state - driver state variables
> >> * @lock: lock for serializing multiple registers access.
> >> @@ -148,9 +156,10 @@ struct inv_icm42600_suspended {
> >> * @suspended: suspended sensors configuration.
> >> * @indio_gyro: gyroscope IIO device.
> >> * @indio_accel: accelerometer IIO device.
> >> - * @buffer: data transfer buffer aligned for DMA.
> >> - * @fifo: FIFO management structure.
> >> * @timestamp: interrupt timestamps.
> >> + * @apex: APEX (Advanced Pedometer and Event detection) management
> >> + * @fifo: FIFO management structure.
> >> + * @buffer: data transfer buffer aligned for DMA.
> >> */
> >> struct inv_icm42600_state {
> >> struct mutex lock;
> >> @@ -164,12 +173,13 @@ struct inv_icm42600_state {
> >> struct inv_icm42600_suspended suspended;
> >> struct iio_dev *indio_gyro;
> >> struct iio_dev *indio_accel;
> >> - uint8_t buffer[2] __aligned(IIO_DMA_MINALIGN);
> >> - struct inv_icm42600_fifo fifo;
> >> struct {
> >> int64_t gyro;
> >> int64_t accel;
> >> } timestamp;
> >This was a bit subtle and had me going for a minute.
> >The timestamp should never have been at this location in the structure because
> >it's mid way through various regions with forced alignment. It isn't actually a bug
> >I think though (beyond unnecessary padding) because the fifo struct obeyed c spec rule
> >that anything after it must be aligned to it's largest aligned element which was
> >IIO_DMA_MINALIGN.
> >
> >Maybe move this in a precursor patch where you can talk about whether it was a problem
> >or not?
>
> I can move it in a separate patch at the beginning of the series. This fix was asked
> by you to avoid potential hard bugs, but it dates sorry.
yeah. I was wrong I think but definitely subtle kind of code that we don't want
if we can avoid it. A precursor tidying it up with the reasoning would be good
from a reviewability point of view.
Jonathan
next prev parent reply other threads:[~2025-06-21 17:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 7:34 [PATCH v4 0/2] Add support for WoM (Wake-on-Motion) feature Jean-Baptiste Maneyrol via B4 Relay
2025-06-13 7:34 ` [PATCH v4 1/2] iio: imu: inv_icm42600: add WoM support Jean-Baptiste Maneyrol via B4 Relay
2025-06-13 8:29 ` Andy Shevchenko
2025-06-13 12:46 ` Jean-Baptiste Maneyrol
2025-06-13 12:53 ` Andy Shevchenko
2025-06-13 12:54 ` Andy Shevchenko
2025-06-13 13:43 ` Jean-Baptiste Maneyrol
2025-06-13 14:41 ` Andy Shevchenko
2025-06-13 15:01 ` Andy Shevchenko
2025-06-13 17:14 ` Jean-Baptiste Maneyrol
2025-06-13 21:02 ` Andy Shevchenko
2025-06-14 12:41 ` Jonathan Cameron
2025-06-14 12:53 ` Jonathan Cameron
2025-06-16 7:42 ` Jean-Baptiste Maneyrol
2025-06-21 17:07 ` Jonathan Cameron [this message]
2025-06-13 7:34 ` [PATCH v4 2/2] iio: imu: inv_icm42600: add wakeup functionality for Wake-on-Motion Jean-Baptiste Maneyrol via B4 Relay
2025-06-13 8:31 ` Andy Shevchenko
2025-06-13 11:42 ` Jean-Baptiste Maneyrol
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=20250621180730.2b517019@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jean-Baptiste.Maneyrol@tdk.com \
--cc=andy@kernel.org \
--cc=devnull+jean-baptiste.maneyrol.tdk.com@kernel.org \
--cc=dlechner@baylibre.com \
--cc=lars@metafoo.de \
--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