From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Stepan Ionichev <sozdayvek@gmail.com>,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] iio: pressure: rohm-bm1390: notify trigger on all error paths
Date: Fri, 22 May 2026 15:38:55 +0300 [thread overview]
Message-ID: <0d58842a-aa5c-4d12-9435-3264070038cc@gmail.com> (raw)
In-Reply-To: <20260520120822.351aa58f@jic23-huawei>
On 20/05/2026 14:08, Jonathan Cameron wrote:
> On Tue, 19 May 2026 08:48:13 +0300
> Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>
>> Thanks Jonathan,
>>
>> Your post give me something to think about ;)
>
> This is a can of worms. More below.
>
> I'm unconcerned as long as (and ideally someone should check it)
> we can get of being stuck by unbind/rebind of driver. Anything
> else is best effort.
>
>
>>
>> On 18/05/2026 18:15, Jonathan Cameron wrote:
>>> On Mon, 18 May 2026 14:42:38 +0500
>>> Stepan Ionichev <sozdayvek@gmail.com> wrote:
>>>
>>>> bm1390_trigger_handler() returns from three error paths without
>>>> calling iio_trigger_notify_done(). The success path at the end
>>>> does, so on a single transient regmap or read failure the trigger
>>>> use_count is never decremented, and the !atomic_read(&trig->use_count)
>>>> guard in iio_trigger_poll_chained() drops every subsequent dispatch.
>>>> The buffered-data flow stays wedged until the trigger is detached.
>>>>
>>>> Funnel all returns through a single done label that calls
>>>> iio_trigger_notify_done() and reports the outcome via IRQ_RETVAL().
>>>>
>>>> Fixes: 81ca5979b6ed ("iio: pressure: Support ROHM BU1390")
>>>> Cc: stable@vger.kernel.org
>>>> Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
>>>
>>> These error path 'fixes' are fixes for hardware failure - so if anything
>>> they are hardending against a possible error condition. I don't mind
>>> that bit it's not a bug to not do this so fixes tag an stable are not
>>> appropriate for any of these.
>>>
>>> Note however that hardening against these conditions is not this simple.
>>> It takes careful analysis of exactly how the hardware behaves and what
>>> each error condition 'might' mean. Whilst they are probably harmless
>>> I'm also very dubious about taking them without comprehensive testing
>>> on the particular device.
>>>
>>>> ---
//snip
>>>>
>>>> @@ -639,7 +642,8 @@ static irqreturn_t bm1390_trigger_handler(int irq, void *p)
>>>> ret = bm1390_pressure_read(data, &data->buf.pressure);
>>>> if (ret) {
>>>> dev_warn(data->dev, "sample read failed %d\n", ret);
>>>> - return IRQ_NONE;
>>>> + handled = false;
>>>> + goto done;
>>>
>>> Hopefully all this stuff is unrelated to the trigger. For these it is fair to
>>> ack the trigger and the interrupt. Curiously the driver does it partly for the
>>> next one (IRQ_HANDLED).
>>
>> I would keep the IRQ_NONE here because, if we keep constantly failing
>> the reads, then the bus is likely to be unerliable - and disabling the
>> useless IRQ is probably very sane thing to do. It should help debugging.
>> What comes to acking the trigger - I am starting to agree with Stepan,
>> we should probably ack the trigger in any case. If we don't ack the
>> trigger, then the IRQ_NONE does not serve the purpose it is intended for.
>
> The interrupt that we'd get spurious detection on here would not be the device
> one it would be the software emulated one deep in the iio trigger stuff.
>
> Might still be useful for debug. Anyone fancy hacking an error in and reporting
> back what we actually get from the debug hardware? (with that trigger acked
> as you suggest?)
No promises but I'll see if I can try out something next week...
Yours,
-- Matti
--
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
next prev parent reply other threads:[~2026-05-22 12:38 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 16:08 [PATCH] " Stepan Ionichev
2026-05-17 17:12 ` David Lechner
2026-05-17 17:18 ` Stepan Ionichev
2026-05-18 5:21 ` Matti Vaittinen
2026-05-18 6:59 ` Andy Shevchenko
2026-05-18 7:35 ` Matti Vaittinen
2026-05-18 14:55 ` Jonathan Cameron
2026-05-18 18:31 ` Andy Shevchenko
2026-05-20 10:39 ` Jonathan Cameron
2026-05-18 14:50 ` Jonathan Cameron
2026-05-18 6:54 ` Andy Shevchenko
2026-05-18 9:42 ` [PATCH v2] " Stepan Ionichev
2026-05-18 10:42 ` Andy Shevchenko
2026-05-18 13:06 ` Matti Vaittinen
2026-05-18 15:15 ` Jonathan Cameron
2026-05-19 5:48 ` Matti Vaittinen
2026-05-20 11:08 ` Jonathan Cameron
2026-05-22 12:38 ` Matti Vaittinen [this message]
2026-05-29 8:21 ` Matti Vaittinen
2026-06-01 18:36 ` Andy Shevchenko
2026-06-04 6:10 ` Matti Vaittinen
2026-06-03 17:26 ` Jonathan Cameron
2026-06-04 6:05 ` Matti Vaittinen
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=0d58842a-aa5c-4d12-9435-3264070038cc@gmail.com \
--to=mazziesaccount@gmail.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=sozdayvek@gmail.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
all inboxes | Powered by JetHome®