* [PATCH] iio: adc: nxp-sar-adc: notify trigger on channel read error in buffer ISR
@ 2026-05-17 16:23 Stepan Ionichev
2026-05-17 17:07 ` David Lechner
0 siblings, 1 reply; 5+ messages in thread
From: Stepan Ionichev @ 2026-05-17 16:23 UTC (permalink / raw)
To: jic23
Cc: daniel.lezcano, dlechner, nuno.sa, andy, gregkh, hcazarim,
linux-iio, linux-kernel, stable, sozdayvek
nxp_sar_adc_isr_buffer() bails on the first channel-read failure
without calling iio_trigger_notify_done(), so a single I/O error
leaves the trigger's use_count stuck and the buffer flow wedged
until rebind.
Route the error exit through a 'done:' label that always calls
iio_trigger_notify_done().
Fixes: 4434072a893e ("iio: adc: Add the NXP SAR ADC support for the s32g2/3 platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
---
drivers/iio/adc/nxp-sar-adc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c
index 9d9f2c76b..ed004812c 100644
--- a/drivers/iio/adc/nxp-sar-adc.c
+++ b/drivers/iio/adc/nxp-sar-adc.c
@@ -341,7 +341,7 @@ static void nxp_sar_adc_isr_buffer(struct iio_dev *indio_dev)
ret = nxp_sar_adc_read_data(info, info->buffered_chan[i]);
if (ret < 0) {
nxp_sar_adc_read_notify(info);
- return;
+ goto done;
}
info->buffer[i] = ret;
@@ -352,6 +352,7 @@ static void nxp_sar_adc_isr_buffer(struct iio_dev *indio_dev)
iio_push_to_buffers_with_ts(indio_dev, info->buffer, sizeof(info->buffer),
iio_get_time_ns(indio_dev));
+done:
iio_trigger_notify_done(indio_dev->trig);
}
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: adc: nxp-sar-adc: notify trigger on channel read error in buffer ISR
2026-05-17 16:23 [PATCH] iio: adc: nxp-sar-adc: notify trigger on channel read error in buffer ISR Stepan Ionichev
@ 2026-05-17 17:07 ` David Lechner
2026-05-18 15:19 ` Jonathan Cameron
0 siblings, 1 reply; 5+ messages in thread
From: David Lechner @ 2026-05-17 17:07 UTC (permalink / raw)
To: Stepan Ionichev, jic23
Cc: daniel.lezcano, nuno.sa, andy, gregkh, hcazarim, linux-iio,
linux-kernel, stable
On 5/17/26 11:23 AM, Stepan Ionichev wrote:
> nxp_sar_adc_isr_buffer() bails on the first channel-read failure
> without calling iio_trigger_notify_done(), so a single I/O error
> leaves the trigger's use_count stuck and the buffer flow wedged
> until rebind.
>
> Route the error exit through a 'done:' label that always calls
> iio_trigger_notify_done().
>
> Fixes: 4434072a893e ("iio: adc: Add the NXP SAR ADC support for the s32g2/3 platforms")
> Cc: stable@vger.kernel.org
> Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
> ---
> drivers/iio/adc/nxp-sar-adc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c
> index 9d9f2c76b..ed004812c 100644
> --- a/drivers/iio/adc/nxp-sar-adc.c
> +++ b/drivers/iio/adc/nxp-sar-adc.c
> @@ -341,7 +341,7 @@ static void nxp_sar_adc_isr_buffer(struct iio_dev *indio_dev)
> ret = nxp_sar_adc_read_data(info, info->buffered_chan[i]);
> if (ret < 0) {
> nxp_sar_adc_read_notify(info);
> - return;
> + goto done;
> }
>
> info->buffer[i] = ret;
> @@ -352,6 +352,7 @@ static void nxp_sar_adc_isr_buffer(struct iio_dev *indio_dev)
> iio_push_to_buffers_with_ts(indio_dev, info->buffer, sizeof(info->buffer),
> iio_get_time_ns(indio_dev));
>
> +done:
> iio_trigger_notify_done(indio_dev->trig);
> }
>
This is fine. Although we are already duplicating the call to
nxp_sar_adc_read_notify(). So could be OK to just call
iio_trigger_notify_done() and return too. Let's see if anyone
else has an opinion.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: adc: nxp-sar-adc: notify trigger on channel read error in buffer ISR
2026-05-17 17:07 ` David Lechner
@ 2026-05-18 15:19 ` Jonathan Cameron
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-05-18 15:19 UTC (permalink / raw)
To: David Lechner
Cc: Stepan Ionichev, daniel.lezcano, nuno.sa, andy, gregkh, hcazarim,
linux-iio, linux-kernel, stable
On Sun, 17 May 2026 12:07:33 -0500
David Lechner <dlechner@baylibre.com> wrote:
> On 5/17/26 11:23 AM, Stepan Ionichev wrote:
> > nxp_sar_adc_isr_buffer() bails on the first channel-read failure
> > without calling iio_trigger_notify_done(), so a single I/O error
> > leaves the trigger's use_count stuck and the buffer flow wedged
> > until rebind.
> >
> > Route the error exit through a 'done:' label that always calls
> > iio_trigger_notify_done().
> >
> > Fixes: 4434072a893e ("iio: adc: Add the NXP SAR ADC support for the s32g2/3 platforms")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
> > ---
> > drivers/iio/adc/nxp-sar-adc.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c
> > index 9d9f2c76b..ed004812c 100644
> > --- a/drivers/iio/adc/nxp-sar-adc.c
> > +++ b/drivers/iio/adc/nxp-sar-adc.c
> > @@ -341,7 +341,7 @@ static void nxp_sar_adc_isr_buffer(struct iio_dev *indio_dev)
> > ret = nxp_sar_adc_read_data(info, info->buffered_chan[i]);
> > if (ret < 0) {
> > nxp_sar_adc_read_notify(info);
> > - return;
> > + goto done;
> > }
> >
> > info->buffer[i] = ret;
> > @@ -352,6 +352,7 @@ static void nxp_sar_adc_isr_buffer(struct iio_dev *indio_dev)
> > iio_push_to_buffers_with_ts(indio_dev, info->buffer, sizeof(info->buffer),
> > iio_get_time_ns(indio_dev));
> >
> > +done:
> > iio_trigger_notify_done(indio_dev->trig);
> > }
> >
>
> This is fine. Although we are already duplicating the call to
> nxp_sar_adc_read_notify(). So could be OK to just call
> iio_trigger_notify_done() and return too. Let's see if anyone
> else has an opinion.
Similar questions arise for this one to the rohm one I just reviewed
- does this actually help us? What is the trigger, and is it going to
be in a state where it will ever refire if an error occurs in here?
Here we aren't dealing in bus issues, it's a state machine issue
(either software bug or hardware in wrong state) if we hit these
error paths.
That info needs to be in the commit description and again to me this
is a hardening change rather than a fix (with need to backport etc).
Jonathan
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iio: adc: nxp-sar-adc: notify trigger on channel read error in buffer ISR
2026-05-17 16:31 Stepan Ionichev
@ 2026-05-17 16:33 ` Stepan Ionichev
0 siblings, 0 replies; 5+ messages in thread
From: Stepan Ionichev @ 2026-05-17 16:33 UTC (permalink / raw)
To: jic23
Cc: daniel.lezcano, dlechner, nuno.sa, andy, gregkh, hcazarim,
linux-iio, linux-kernel, Stepan Ionichev
Sorry, sent twice by accident. Please use the earlier copy
(Message-Id: <20260517162346.189-1-sozdayvek@gmail.com>) and
ignore this one.
Stepan
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] iio: adc: nxp-sar-adc: notify trigger on channel read error in buffer ISR
@ 2026-05-17 16:31 Stepan Ionichev
2026-05-17 16:33 ` Stepan Ionichev
0 siblings, 1 reply; 5+ messages in thread
From: Stepan Ionichev @ 2026-05-17 16:31 UTC (permalink / raw)
To: jic23
Cc: daniel.lezcano, dlechner, nuno.sa, andy, gregkh, hcazarim,
linux-iio, linux-kernel, stable, sozdayvek
nxp_sar_adc_isr_buffer() bails on the first channel-read failure
without calling iio_trigger_notify_done(), so a single I/O error
leaves the trigger's use_count stuck and the buffer flow wedged
until rebind.
Route the error exit through a 'done:' label that always calls
iio_trigger_notify_done().
Fixes: 4434072a893e ("iio: adc: Add the NXP SAR ADC support for the s32g2/3 platforms")
Cc: stable@vger.kernel.org
Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
---
drivers/iio/adc/nxp-sar-adc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c
index 9d9f2c76b..ed004812c 100644
--- a/drivers/iio/adc/nxp-sar-adc.c
+++ b/drivers/iio/adc/nxp-sar-adc.c
@@ -341,7 +341,7 @@ static void nxp_sar_adc_isr_buffer(struct iio_dev *indio_dev)
ret = nxp_sar_adc_read_data(info, info->buffered_chan[i]);
if (ret < 0) {
nxp_sar_adc_read_notify(info);
- return;
+ goto done;
}
info->buffer[i] = ret;
@@ -352,6 +352,7 @@ static void nxp_sar_adc_isr_buffer(struct iio_dev *indio_dev)
iio_push_to_buffers_with_ts(indio_dev, info->buffer, sizeof(info->buffer),
iio_get_time_ns(indio_dev));
+done:
iio_trigger_notify_done(indio_dev->trig);
}
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-18 15:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-17 16:23 [PATCH] iio: adc: nxp-sar-adc: notify trigger on channel read error in buffer ISR Stepan Ionichev
2026-05-17 17:07 ` David Lechner
2026-05-18 15:19 ` Jonathan Cameron
2026-05-17 16:31 Stepan Ionichev
2026-05-17 16:33 ` Stepan Ionichev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome