Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Stepan Ionichev <sozdayvek@gmail.com>
Cc: dlechner@baylibre.com, daniel.lezcano@linaro.org,
	nuno.sa@analog.com, andy@kernel.org, gregkh@linuxfoundation.org,
	hcazarim@yahoo.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: adc: nxp-sar-adc: harden buffer ISR against per-channel read failure
Date: Fri, 3 Jul 2026 23:59:02 +0100	[thread overview]
Message-ID: <20260703235902.73c841b2@jic23-huawei> (raw)
In-Reply-To: <20260518181138.1504-1-sozdayvek@gmail.com>

On Mon, 18 May 2026 23:11:38 +0500
Stepan Ionichev <sozdayvek@gmail.com> wrote:

> nxp_sar_adc_isr_buffer() bails on the first channel-read failure
> without calling iio_trigger_notify_done(), so the trigger use_count
> is left incremented and iio_trigger_poll_chained() drops subsequent
> dispatches until the device is rebound.
> 
> Reaching this path means a state machine has gone wrong (driver bug
> or the SAR ADC in an unexpected state) rather than a transient bus
> issue, so this is hardening rather than a bug fix. If the underlying
> condition persists the device is wedged and needs an unbind anyway.
> 
> Call iio_trigger_notify_done() on the error exit too, matching the
> success path. The nxp_sar_adc_read_notify() duplication is intentional
> and avoids a goto label for a two-line bail-out, as suggested by David.
> 
> Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Huh. Seems I picked this up a while ago but neither replied to this thread
nor marked it so in patchwork.

Anyhow, long applied.

Thanks,

Jonathan

> ---
> v2:
> - Drop Fixes: and Cc: stable@; this is a state-machine hardening, not
>   a user-visible bug fix (Jonathan)
> - Reframe the commit message and explain why the failure is not a bus
>   issue
> - Inline the iio_trigger_notify_done() in the error exit instead of a
>   goto label, accepting the small nxp_sar_adc_read_notify() duplication
>   (David)
> 
> v1: https://lore.kernel.org/all/20260517162346.189-1-sozdayvek@gmail.com/
> 
>  drivers/iio/adc/nxp-sar-adc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/adc/nxp-sar-adc.c b/drivers/iio/adc/nxp-sar-adc.c
> index 9d9f2c76b..1fc839a15 100644
> --- a/drivers/iio/adc/nxp-sar-adc.c
> +++ b/drivers/iio/adc/nxp-sar-adc.c
> @@ -341,6 +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);
> +			iio_trigger_notify_done(indio_dev->trig);
>  			return;
>  		}
>  


      reply	other threads:[~2026-07-03 22:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18 18:11 [PATCH v2] iio: adc: nxp-sar-adc: harden buffer ISR against per-channel read failure Stepan Ionichev
2026-07-03 22:59 ` Jonathan Cameron [this message]

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=20260703235902.73c841b2@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hcazarim@yahoo.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=sozdayvek@gmail.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