From: Melbin K Mathew <mlbnkm1@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] iio: accel: bmc150: free irq before teardown
Date: Sun, 5 Jul 2026 08:33:54 +0100 [thread overview]
Message-ID: <8cba0a18-6cd7-48a9-9beb-83218148de6a@gmail.com> (raw)
In-Reply-To: <akn_hlxkSDRG389t@ashevche-desk.local>
Thanks for the review.
I double checked the remove path. The remaining hardware accesses after
freeing the IRQ are synchronous regmap accesses and do not rely on the
IRQ being enabled.
In particular, iio_device_unregister() may disable the buffer path,
which can call into the buffer predisable path and synchronously disable
the FIFO interrupt, flush the FIFO and update the FIFO mode. Later
remove explicitly puts the device into deep suspend via
bmc150_accel_set_mode(). These paths do not wait for an interrupt or
use the threaded IRQ handler for completion.
The IRQ handler itself is only used for asynchronous trigger polling,
FIFO/event handling and interrupt latch acknowledgement, so freeing it
before the rest of teardown should not remove anything that the remove
path depends on.
On 05/07/2026 07:53, Andy Shevchenko wrote:
> On Sun, Jul 05, 2026 at 06:27:31AM +0200, Melbin K Mathew wrote:
>> bmc150_accel_core_probe() requests the interrupt with
>> devm_request_threaded_irq(). The managed IRQ is released only after the
>> driver remove callback has returned unless it is freed explicitly.
>>
>> bmc150_accel_core_remove() currently unregisters the IIO device and
>> triggers, cleans up the triggered buffer, suspends the chip and disables
>> the regulators while the IRQ action is still registered. A late
>> interrupt can therefore run the hard or threaded handler while the IIO
>> trigger state is being torn down or after the device has been put into
>> deep suspend.
>>
>> Free the IRQ at the start of remove so that no handler is running while
>> the rest of the driver state and hardware resources are dismantled.
>
> In general this is correct fix, but have you checked the rest of remove if it
> has any communication with HW and if that communication relies on IRQ to be on?
>
> (*yes, this is very unlikely, but please double check as rarely we have some HW
> that might need that, and in such a case the fix might be different)
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
>
next prev parent reply other threads:[~2026-07-05 7:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 4:27 [PATCH] iio: accel: bmc150: free irq before teardown Melbin K Mathew
2026-07-05 6:53 ` Andy Shevchenko
2026-07-05 7:33 ` Melbin K Mathew [this message]
2026-07-05 23:02 ` Jonathan Cameron
2026-07-06 6:11 ` 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=8cba0a18-6cd7-48a9-9beb-83218148de6a@gmail.com \
--to=mlbnkm1@gmail.com \
--cc=andriy.shevchenko@intel.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 \
--cc=stable@vger.kernel.org \
/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