From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"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 1/4] iio: imu: inv_icm42600: sleep before enabling FIFO data
Date: Fri, 21 Aug 2026 16:21:49 +0300 [thread overview]
Message-ID: <aohQ7Y6m1j19vQWi@ashevche-desk.local> (raw)
In-Reply-To: <BE1P281MB1426D50075F4223A98D870F7CEA32@BE1P281MB1426.DEUP281.PROD.OUTLOOK.COM>
On Fri, Aug 21, 2026 at 12:50:37PM +0000, Jean-Baptiste Maneyrol wrote:
> >From: Andy Shevchenko <andriy.shevchenko@intel.com>
> >Sent: Friday, August 21, 2026 13:15
> >On Thu, Aug 20, 2026 at 09:02:37PM +0200, Jean-Baptiste Maneyrol via B4 Relay wrote:
...
> >> + /* sleep maximum required time */
> >> + sleep = max(sleep_accel, sleep_temp);
> >> + if (sleep) {
> >> + mutex_unlock(&st->lock);
> >> + msleep(sleep);
> >> + mutex_lock(&st->lock);
> >> + }
> >
> >Doesn't sounds correct. Here it breaks the atomicity. Is it a problem?
> >(Imagine a few CPUs doing something with this driver, is any other thread may
> > intervene the flow here?)
>
> there is no risk here because we are inside the buffer enable function, and
> there is an internal IIO mutex here preventing multiple calls. The driver mutex
> is used to serialize access to the chip, mainly because we have 2 independent
> sensors inside, accelerometer and gyroscope. We need to unlock it here to prevent
> stopping data from the other sensor if it is enabled. For example, when we enable
> gyroscope while accelerometer is running, we don't want to block the chip and
> prevent sending of accelerometer data during 30ms. This is even more important
> because the FIFO can easily overflow at high rates, and there would be data
> loss.
>
> Hope I'm clear enough in my explanations.
Can we have some (short) comment in the code as well?
...
> >> + /* sleep maximum required time */
> >> + sleep = max(sleep_gyro, sleep_temp);
> >> + if (sleep) {
> >> + mutex_unlock(&st->lock);
> >> + msleep(sleep);
> >> + mutex_lock(&st->lock);
> >> + }
Ditto.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-21 13:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 19:02 [PATCH 0/4] inv_icm42600 driver enhancements Jean-Baptiste Maneyrol via B4 Relay
2026-08-20 19:02 ` Jean-Baptiste Maneyrol
2026-08-20 19:02 ` [PATCH 1/4] iio: imu: inv_icm42600: sleep before enabling FIFO data Jean-Baptiste Maneyrol via B4 Relay
2026-08-20 19:02 ` Jean-Baptiste Maneyrol
2026-08-21 0:06 ` Jonathan Cameron
2026-08-21 12:39 ` Jean-Baptiste Maneyrol
2026-08-21 11:15 ` Andy Shevchenko
2026-08-21 12:50 ` Jean-Baptiste Maneyrol
2026-08-21 13:21 ` Andy Shevchenko [this message]
2026-08-20 19:02 ` [PATCH 2/4] iio: imu: inv_icm42600: use 2 sensors fixed packet size of 16 bytes Jean-Baptiste Maneyrol via B4 Relay
2026-08-20 19:02 ` Jean-Baptiste Maneyrol
2026-08-21 0:09 ` Jonathan Cameron
2026-08-21 12:59 ` Jean-Baptiste Maneyrol
2026-08-20 19:02 ` [PATCH 3/4] iio: imu: inv_icm42600: simplify watermark computation by using gcd Jean-Baptiste Maneyrol via B4 Relay
2026-08-20 19:02 ` Jean-Baptiste Maneyrol
2026-08-21 0:14 ` Jonathan Cameron
2026-08-21 13:01 ` Jean-Baptiste Maneyrol
2026-08-20 19:02 ` [PATCH 4/4] iio: imu: inv_icm42600: do not read FIFO count for watermark it Jean-Baptiste Maneyrol via B4 Relay
2026-08-20 19:02 ` Jean-Baptiste Maneyrol
2026-08-21 0:28 ` Jonathan Cameron
2026-08-21 13:09 ` Jean-Baptiste Maneyrol
2026-08-23 1:13 ` 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=aohQ7Y6m1j19vQWi@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Jean-Baptiste.Maneyrol@tdk.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.