From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Esben Haabendal <esben@geanix.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>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND v5 4/6] iio: accel: mma8452: Support interrupt sharing
Date: Wed, 19 Aug 2026 16:54:46 +0300 [thread overview]
Message-ID: <aoW1phh-elFZ5lU-@ashevche-desk.local> (raw)
In-Reply-To: <20260819-mma8452-open-drain-v5-4-d8aa590d7c36@geanix.com>
On Wed, Aug 19, 2026 at 10:15:31AM +0200, Esben Haabendal wrote:
> Adding handling of rutnime PM suspension in the interrupt handler allows
> sharing interrupt with other devices.
>
> Keep in mind that the device by default is using push-pull for the irq pin,
> which might require additional hardware design to allow interrupt sharing.
>
> The suspended flag is added together with synchronize_irq() in order to
> protect against race conditions when doing runtime suspend and device
> removal. This way we ensure that interrupt handler does not try to access
> the device while regulators are disabled.
...
> + pm_status = pm_runtime_get_if_active(&data->client->dev);
> + if (pm_status == 0 || READ_ONCE(data->suspended))
> + return IRQ_NONE; /* device is powered down or being removed */
This way it won't work (if pm_status != 0, you need to act accordingly).
You need to split this:
if (READ_ONCE(data->suspended))
return IRQ_NONE; /* device is being removed */
pm_status = pm_runtime_get_if_active(&data->client->dev);
if (pm_status == 0)
return IRQ_NONE; /* device is powered down */
But I'm not sure this will work as expected.
...
> +out:
out_runtime_put:
Hint: Always name labels as an answer to the Q:
'What will happen if I goto $LABEL?'.
> + if (pm_status > 0)
> + pm_runtime_put_autosuspend(&data->client->dev);
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-19 13:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 8:15 [PATCH RESEND v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-19 8:15 ` [PATCH RESEND v5 1/6] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
2026-08-19 8:15 ` [PATCH RESEND v5 2/6] iio: accel: mma8452: Optimize struct mma8452_data member orders Esben Haabendal
2026-08-19 8:27 ` sashiko-bot
2026-08-19 8:15 ` [PATCH RESEND v5 3/6] iio: accel: mma8452: Only apply trigger type when not set by firmware Esben Haabendal
2026-08-19 8:29 ` sashiko-bot
2026-08-19 8:15 ` [PATCH RESEND v5 4/6] iio: accel: mma8452: Support interrupt sharing Esben Haabendal
2026-08-19 8:25 ` sashiko-bot
2026-08-19 8:44 ` Esben Haabendal
2026-08-19 13:54 ` Andy Shevchenko [this message]
2026-08-19 8:15 ` [PATCH RESEND v5 5/6] iio: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-19 8:29 ` sashiko-bot
2026-08-19 8:15 ` [PATCH RESEND v5 6/6] iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe() Esben Haabendal
2026-08-19 8:25 ` Joshua Crofts
2026-08-19 8:28 ` sashiko-bot
2026-08-19 12:24 ` Esben Haabendal
2026-08-19 13:56 ` Andy Shevchenko
2026-08-23 0:29 ` [PATCH RESEND v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration 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=aoW1phh-elFZ5lU-@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=esben@geanix.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