public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: "Kurt Borja" <kuurtb@gmail.com>
To: "Jonathan Cameron" <jonathan.cameron@huawei.com>,
	"David Lechner" <dlechner@baylibre.com>
Cc: "Kurt Borja" <kuurtb@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Tobias Sperling" <tobias.sperling@softing.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 2/2] iio: adc: Add ti-ads1018 driver
Date: Tue, 16 Dec 2025 15:49:22 -0500	[thread overview]
Message-ID: <DEZXQS9JU593.3TJMIOOJXD1JL@gmail.com> (raw)
In-Reply-To: <20251216182106.000051c3@huawei.com>

On Tue Dec 16, 2025 at 1:21 PM -05, Jonathan Cameron wrote:
> On Mon, 15 Dec 2025 12:09:31 -0600
> David Lechner <dlechner@baylibre.com> wrote:
>
>> On 12/15/25 10:54 AM, Kurt Borja wrote:
>> > On Mon Dec 15, 2025 at 10:55 AM -05, David Lechner wrote:  
>> >> On 12/11/25 10:25 PM, Kurt Borja wrote:  
>> >>> Add ti-ads1018 driver for Texas Instruments ADS1018 and ADS1118 SPI
>> >>> analog-to-digital converters.
>> >>>  
>> 
>> ...
>> 
>> >>> +static irqreturn_t ads1018_trigger_handler(int irq, void *p)
>> >>> +{
>> >>> +	struct iio_poll_func *pf = p;
>> >>> +	struct iio_dev *indio_dev = pf->indio_dev;
>> >>> +	struct ads1018 *ads1018 = iio_priv(indio_dev);
>> >>> +	struct {
>> >>> +		__be16 conv;
>> >>> +		aligned_s64 ts;
>> >>> +	} scan = {};
>> >>> +	int ret;
>> >>> +  
>> >>
>> >>  
>> >>> +	if (iio_device_claim_buffer_mode(indio_dev))
>> >>> +		goto out_notify_done;  
>> >>
>> >> This should not be needed. It should not be possible to
>> >> exit buffer mode without triggers being stopped first.
>> >> (No other driver is doing this.)  
>> > 
>> > Previously I had my own lock here because ads1018_spi_read_exclusive()
>> > needs locking.  
>> 
>> What exactly are we protecting against here? I.e. give side-by-side
>> lists of possible concurrent function calls where there could be a
>> problem.
>> 
>> Any call to iio_device_claim_direct() will already fail without
>> calling iio_device_claim_buffer_mode() here. And since this is
>> an interrupt handler, we don't have to worry about reentrancy (it
>> can't be called again until the previous call returns). And nowhere
>> else in the driver is calling iio_device_claim_buffer_mode(). So
>> calling it here doesn't actually add any protection AFAICT.

You're right. I assumed threaded IRQs were reentrant, which doesn't seem
to be the case. Thanks for pointing it out!

>
> Agreed we shouldn't need this. Given these comment and my lazy nature,
> Kurt, would you mind spinning a patch on top of this series that I can
> squash with it on my tree?  That should be easier to review than
> a full v9.  If you prefer a v9 of the whole thing, that would be fine too.

Sure! I'll send a patch later today.

>
> Thanks,
>
> Jonathan

-- 
Thanks,
 ~ Kurt


  reply	other threads:[~2025-12-16 20:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-12  4:25 [PATCH v8 0/2] iio: Add support for TI ADS1X18 ADCs Kurt Borja
2025-12-12  4:25 ` [PATCH v8 1/2] dt-bindings: iio: adc: Add TI ADS1018/ADS1118 Kurt Borja
2025-12-12  4:25 ` [PATCH v8 2/2] iio: adc: Add ti-ads1018 driver Kurt Borja
2025-12-14 14:48   ` Jonathan Cameron
2025-12-14 23:53     ` Kurt Borja
2025-12-15 15:55   ` David Lechner
2025-12-15 16:54     ` Kurt Borja
2025-12-15 18:09       ` David Lechner
2025-12-16 18:21         ` Jonathan Cameron
2025-12-16 20:49           ` Kurt Borja [this message]
2025-12-12  8:40 ` [PATCH v8 0/2] iio: Add support for TI ADS1X18 ADCs Tomas Melin
2025-12-12 13:10   ` Kurt Borja
2025-12-12 13:50     ` Tomas Melin
2025-12-15 15:56 ` David Lechner
2025-12-15 16:57   ` Kurt Borja

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=DEZXQS9JU593.3TJMIOOJXD1JL@gmail.com \
    --to=kuurtb@gmail.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=tobias.sperling@softing.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