mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Sabau, Radu bogdan" <Radu.Sabau@analog.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Sa, Nuno" <Nuno.Sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Uwe Kleine König" <u.kleine-koenig@baylibre.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] iio: adc: ad_sigma_delta: fix clear_pending_event for registerless devices
Date: Wed, 20 May 2026 13:23:11 +0100	[thread overview]
Message-ID: <20260520132311.0f551943@jic23-huawei> (raw)
In-Reply-To: <LV9PR03MB84140C8048A51E50F241EA28F7032@LV9PR03MB8414.namprd03.prod.outlook.com>

On Mon, 18 May 2026 12:55:33 +0000
"Sabau, Radu bogdan" <Radu.Sabau@analog.com> wrote:

> Hi everyone, I am responding to Sashiko's review here:
> 
> > -----Original Message-----
> > From: Radu Sabau via B4 Relay <devnull+radu.sabau.analog.com@kernel.org>
> > Sent: Monday, May 18, 2026 12:59 PM  
> 
> ...
> 
> > +	} else if (sigma_delta->info->has_registers) {
> >  		unsigned int status_reg;
> > 
> >  		ret = ad_sd_read_reg(sigma_delta, AD_SD_REG_STATUS, 1,
> > &status_reg);
> > @@ -274,6 +279,8 @@ static int ad_sigma_delta_clear_pending_event(struct
> > ad_sigma_delta *sigma_delta
> >  			return ret;
> > 
> >  		pending_event = !(status_reg & AD_SD_REG_STATUS_RDY);
> > +	} else {
> > +		return 0;
> >  	}  
> 
> He is right about this one, the heap corruption may not be fully solved as a
> registerless device with num_resetclks = 0 confiugred with rdy-gpios could
> still have data_read_len = 0 further if GPIO indicates a pending event.
> 
> Perhaps I data_read_len == 0 should indeed be checked before attempting the
> dummy SPI transfer as suggested, right?
Indeed seems valid.   Make sure to leave some comments around on the
'why' of the extra check

> 
> > 
> >  	if (!pending_event)
> > @@ -578,6 +585,7 @@ static int ad_sd_buffer_postenable(struct iio_dev
> > *indio_dev)
> > 
> >  err_unlock:
> >  	sigma_delta->keep_cs_asserted = false;
> > +	ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE);  
> 
> Also right about this one, it belongs in previous patch...
> 
> >  	sigma_delta->bus_locked = false;
> >  	spi_bus_unlock(sigma_delta->spi->controller);
> >  	spi_unoptimize_message(&sigma_delta->sample_msg);
> > 
> > --
> > 2.43.0
> >   
> 


      reply	other threads:[~2026-05-20 12:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  9:59 [PATCH v3 0/2] iio: adc: ad_sigma_delta: fix CS assertion and registerless device handling Radu Sabau via B4 Relay
2026-05-18  9:59 ` [PATCH v3 1/2] iio: adc: ad_sigma_delta: fix CS held asserted and state leaks Radu Sabau via B4 Relay
2026-05-18  9:59 ` [PATCH v3 2/2] iio: adc: ad_sigma_delta: fix clear_pending_event for registerless devices Radu Sabau via B4 Relay
2026-05-18 12:55   ` Sabau, Radu bogdan
2026-05-20 12:23     ` 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=20260520132311.0f551943@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=Nuno.Sa@analog.com \
    --cc=Radu.Sabau@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.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

all inboxes | Powered by JetHome®