From: Esben Haabendal <esben@geanix.com>
To: "Jonathan Cameron" <jic23@kernel.org>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Martin Kepplinger" <martink@posteo.de>,
"Sean Nyekjaer" <sean@geanix.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Martin Kepplinger" <martin.kepplinger@theobroma-systems.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Joshua Crofts" <joshua.crofts1@gmail.com>,
"Andy Shevchenko" <andriy.shevchenko@intel.com>
Subject: Re: [PATCH v4 2/6] iio: accel: mma8452: Optimize struct mm8452_data member orders
Date: Mon, 17 Aug 2026 19:10:46 +0200 [thread overview]
Message-ID: <87tsosk6zt.fsf@geanix.com> (raw)
In-Reply-To: <20260815051356.4dac350e@jic23-huawei> (Jonathan Cameron's message of "Sat, 15 Aug 2026 05:13:56 +0100")
"Jonathan Cameron" <jic23@kernel.org> writes:
> On Wed, 12 Aug 2026 16:30:33 +0200
> Esben Haabendal <esben@geanix.com> wrote:
>
>> Reorder struct mma8452_data members to avoid holes.
> Trivial but sashiko pointed out mm[a]_8452 in the title.
> I'll tidy that up if nothing significant comes up.
>
> Interestingly Sashiko also thinks it found a deadlock.
> Given you are working with this driver if you have time could
> you take a look at that.
>
> https://sashiko.dev/#/patchset/20260812-mma8452-open-drain-v4-0-bfca15d02b59%40geanix.com
>
> I'm rather surprised to see the lock taken in the runtime
> pm suspend callback. It is probably there to close a race
> where the device is being suspended and the sampling
> frequency is being written. I'm not immediately sure what
> the best way to fix it is. One thing that would work is to
> do pm_runtime_get* to raise the reference counter and stop
> there being any chance of an autosuspend.
The mma8452_change_config() function is grabbing &data->lock, and is
forcing chip in stand mode while applying change. This needs to be
synchronized with mma8452_runtime_suspend() switching to standby mode,
to avoid a race condition where mma8452_change_config() would end up
undoing the change made by runtime PM, due to it keeping the old state
in is_active local variable. So far it makes sense.
But I don't see the reason for mma8452_read_raw(IIO_CHAN_INFO_RAW)
grabbing the lock for the call to mma8452_read(). And when
mma8452_trigger_handler() calls mma8452_read() it does so without
data->lock held.
So maybe we we can simply drop the &data->lock from mma8452_read_raw()?
/Esben
next prev parent reply other threads:[~2026-08-17 17:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 14:30 [PATCH v4 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-12 14:30 ` [PATCH v4 1/6] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
2026-08-12 14:30 ` [PATCH v4 2/6] iio: accel: mma8452: Optimize struct mm8452_data member orders Esben Haabendal
2026-08-15 4:13 ` Jonathan Cameron
2026-08-17 17:10 ` Esben Haabendal [this message]
2026-08-12 14:30 ` [PATCH v4 3/6] iio: accel: mma8452: Only apply trigger type when not set by firmware Esben Haabendal
2026-08-12 14:30 ` [PATCH v4 4/6] iio: accel: mma8452: Support interrupt sharing Esben Haabendal
2026-08-14 8:09 ` Andy Shevchenko
2026-08-15 19:33 ` Jonathan Cameron
2026-08-12 14:30 ` [PATCH v4 5/6] iio: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-12 14:30 ` [PATCH v4 6/6] iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe() Esben Haabendal
2026-08-14 8:07 ` Andy Shevchenko
2026-08-14 12:56 ` Esben Haabendal
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=87tsosk6zt.fsf@geanix.com \
--to=esben@geanix.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=joshua.crofts1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.kepplinger@theobroma-systems.com \
--cc=martink@posteo.de \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=sean@geanix.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