From: Esben Haabendal <esben@geanix.com>
To: "Andy Shevchenko" <andriy.shevchenko@intel.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"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>,
"Christoph Muellner" <christoph.muellner@theobroma-systems.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 4/8] iio: accel: mma8452: Support interrupt sharing
Date: Fri, 04 Sep 2026 15:41:02 +0200 [thread overview]
Message-ID: <8733vpcexd.fsf@geanix.com> (raw)
In-Reply-To: <apZ7DpgQM6v7JbcS@ashevche-desk.local>
"Andy Shevchenko" <andriy.shevchenko@intel.com> writes:
> On Mon, Aug 31, 2026 at 05:43:06PM +0200, Esben Haabendal wrote:
>> "Andy Shevchenko" <andriy.shevchenko@intel.com> writes:
>> > On Mon, Aug 31, 2026 at 02:17:07PM +0200, Esben Haabendal wrote:
>
> ...
>
>> >> + WRITE_ONCE(data->suspended, false);
>> >> +
>> >> ret = mma8452_active(data);
>> >> if (ret < 0)
>> >> goto runtime_resume_failed;
>> >
>> >> return 0;
>> >>
>> >> runtime_resume_failed:
>> >> + WRITE_ONCE(data->suspended, true);
>> >> regulator_disable(data->vddio_reg);
>> >> regulator_disable(data->vdd_reg);
>> >
>> > But with this, what's the point in having WRITE_ONCE()? It can be read
>> > just in the middle as true and be immediately changed afterwards. It
>> > may be that I am missing something, but I think WRITE_ONCE() should be
>> > done once in this function.
>>
>> Yes, there does look like there is still a race condition after adding
>> this data->suspended flag. An irq handler could just have read
>> data->suspended, gotten false, and thereafter proceeeded with handling
>> the irq, and then we write data->suspended=true and the irq handler
>> would just continue with accessing the device, even though we are now
>> (if possible) powering down the device.
>>
>> I did go through all the pre-existing runtime pm and other race
>> condition issues raised by sashiko-bot during this review, and worked
>> through it all. The result is a quite a bit larger than what I would
>> like to add on top of this series. Among other things, it converts the
>> driver to use regmap for accessing the i2c registers, and after various
>> fixes the data->suspended flag is removed again.
>>
>> So I am a bit hesitant to pull all those changes into this series, the
>> combined series would blow up quite a bit. But if required, I guess I
>> can do that, although I fear that it will not make reviewing easier to
>> mix things more than maybe needed.
>
> Personally I would go with it, or as a compromise, publish somewhere in Git
> (like on GitHub) and share the link to the repo (in a format that one can run
> with `git fetch ...`).
Ok. Let me bite the bullet, and try to rebase the part of the next
series that relates to the data->suspended.
I will try and send a new version to this series with the minimal
changes to get rid the data->suspended handling, so we can avoid
introducing it just to throw it away the next day.
>> Could we find a way to merge this series first in some way, or should I
>> post a new version with all the other fixes added on top?
>
> It's a Q to Jonathan.
/Esben
next prev parent reply other threads:[~2026-09-04 13:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 12:17 [PATCH v7 0/8] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-31 12:17 ` [PATCH v7 1/8] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
2026-08-31 12:17 ` [PATCH v7 2/8] iio: accel: mma8452: Optimize struct mma8452_data member orders Esben Haabendal
2026-08-31 12:17 ` [PATCH v7 3/8] iio: accel: mma8452: Only apply trigger type when not set by firmware Esben Haabendal
2026-08-31 12:32 ` sashiko-bot
2026-08-31 12:17 ` [PATCH v7 4/8] iio: accel: mma8452: Support interrupt sharing Esben Haabendal
2026-08-31 12:30 ` sashiko-bot
2026-08-31 13:56 ` Andy Shevchenko
2026-08-31 15:43 ` Esben Haabendal
2026-09-01 7:13 ` Andy Shevchenko
2026-09-04 13:41 ` Esben Haabendal [this message]
2026-08-31 12:17 ` [PATCH v7 5/8] iio: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-31 12:32 ` sashiko-bot
2026-08-31 12:17 ` [PATCH v7 6/8] iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe() Esben Haabendal
2026-08-31 13:58 ` Andy Shevchenko
2026-08-31 12:17 ` [PATCH v7 7/8] iio: accel: mma8452: Fix use-after-free bug in error error path Esben Haabendal
2026-08-31 12:31 ` sashiko-bot
2026-08-31 13:09 ` Joshua Crofts
2026-08-31 14:00 ` Andy Shevchenko
2026-08-31 15:47 ` Esben Haabendal
2026-08-31 12:17 ` [PATCH v7 8/8] iio: accel: mma8452: Use proper error code when missing device model Esben Haabendal
2026-08-31 12:28 ` sashiko-bot
2026-08-31 15:48 ` Esben Haabendal
2026-08-31 13:59 ` Andy Shevchenko
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=8733vpcexd.fsf@geanix.com \
--to=esben@geanix.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=christoph.muellner@theobroma-systems.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--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