Linux IIO development
 help / color / mirror / Atom feed
From: "Nuno Sá" <nuno.sa@analog.com>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Marcelo Schmitt <marcelo.schmitt@analog.com>,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 10/13] iio: adc: ad4134: Support SPI 4-wire mode
Date: Wed, 14 Oct 2026 17:57:15 +0100	[thread overview]
Message-ID: <as-0GfwuX6JyKuel@nsa> (raw)
In-Reply-To: <as6eYQaso8KQPn5T@debian-BULLSEYE-live-builder-AMD64>

On Tue, Oct 13, 2026 at 06:10:57PM -0300, Marcelo Schmitt wrote:
> On 10/06, sashiko-bot@kernel.org wrote:
> ...
> > [Severity: Medium]
> > If spi_setup() fails here, we return the error but st->spi->mode remains
> > modified. On subsequent calls, cur_mode != SPI_MODE_0 will evaluate to false
> > because the cached mode reflects the requested state.
> > 
> > Can this cause the driver to bypass spi_setup() on subsequent calls and
> > attempt to communicate with the device while the SPI hardware remains
> > incorrectly configured?
> 
> Seems to make sense. Will double check and fix if needed.
> 
> ...
> > [Severity: High]
> > Does this cause a deadlock during device probe in NO_CS mode?
> > 
> > Here the driver acquires and permanently selects the SDO multiplexer via
> > devm_mux_state_get_optional_selected(), which acquires the multiplexer's
> > non-recursive semaphore.
> > 
> > Immediately after, probe calls ad4134_min_io_mode_setup(), which writes to
> > device registers via regmap_update_bits(). This triggers the following call
> > chain:
> > 
> > ad4134_min_io_mode_setup()
> >   regmap_update_bits()
> >     ad4134_reg_write()
> >       ad4134_claim_reg_access()
> > 
> > ad4134_claim_reg_access() unconditionally calls mux_state_select(), which
> > will attempt to acquire the exact same semaphore already held by the current
> > task, causing a deadlock.
> > 
> > Furthermore, ad4134_release_reg_access() then unconditionally calls
> > mux_state_deselect(), which would prematurely release the probe-acquired
> > lock.
> 
> Seems plausible. Will double check and fix if needed.
> 
> 
> Other LLM comments don't seem to apply either because they are related to debug
> interface usage or marginal issues.

Hmm don't agree. Don't disregard debugfs claim just because it's a debug
interface. Looks like a real issue to me (very easy to trigger) that
needs fixing (same as the other patch).

- Nuno Sá


  reply	other threads:[~2026-10-14 16:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 18:15 [PATCH v4 00/13] iio: adc: ad4134: Enable greater sample rate data capture Marcelo Schmitt
2026-10-06 18:16 ` [PATCH v4 01/13] iio: adc: ad4134: Adjust register map range Marcelo Schmitt
2026-10-14 16:55   ` Nuno Sá
2026-10-06 18:16 ` [PATCH v4 02/13] iio: adc: ad4134: Sign extend sample data Marcelo Schmitt
     [not found]   ` <sashiko-outbox-162349@kernel.org>
2026-10-13 20:52     ` Marcelo Schmitt
2026-10-14 16:55   ` Nuno Sá
2026-10-06 18:16 ` [PATCH v4 03/13] iio: adc: ad4134: Update include list to comply with IWYU principles Marcelo Schmitt
2026-10-14 16:55   ` Nuno Sá
2026-10-06 18:17 ` [PATCH v4 04/13] iio: adc: ad4134: Serialize single-read operations Marcelo Schmitt
2026-10-14 16:55   ` Nuno Sá
2026-10-06 18:17 ` [PATCH v4 05/13] iio: adc: ad4134: Run shorter transfers when CRC is disabled Marcelo Schmitt
     [not found]   ` <sashiko-outbox-162348@kernel.org>
2026-10-13 20:56     ` Marcelo Schmitt
2026-10-14 16:00       ` Nuno Sá
2026-10-14 16:55   ` Nuno Sá
2026-10-06 18:17 ` [PATCH v4 06/13] iio: adc: ad4134: Add support for digital filter type selection Marcelo Schmitt
2026-10-14 16:55   ` Nuno Sá
2026-10-06 18:17 ` [PATCH v4 07/13] iio: adc: ad4134: Support buffered data read Marcelo Schmitt
2026-10-13  7:20   ` Andy Shevchenko
2026-10-13 21:14     ` Marcelo Schmitt
2026-10-14 16:55   ` Nuno Sá
2026-10-06 18:18 ` [PATCH v4 08/13] dt-bindings: iio: adc: adi,ad4134: Document SPI connection mode Marcelo Schmitt
2026-10-07 10:14   ` Conor Dooley
     [not found]   ` <sashiko-outbox-162344@kernel.org>
2026-10-13 21:06     ` Marcelo Schmitt
2026-10-06 18:18 ` [PATCH v4 09/13] dt-bindings: iio: adc: adi,ad4134: Document external multiplexer usage Marcelo Schmitt
2026-10-06 18:19 ` [PATCH v4 10/13] iio: adc: ad4134: Support SPI 4-wire mode Marcelo Schmitt
     [not found]   ` <sashiko-outbox-162354@kernel.org>
2026-10-13 21:10     ` Marcelo Schmitt
2026-10-14 16:57       ` Nuno Sá [this message]
2026-10-14 16:55   ` Nuno Sá
2026-10-06 18:19 ` [PATCH v4 11/13] dt-bindings: iio: adc: adi,ad4134: Document PWM usage Marcelo Schmitt
2026-10-06 18:19 ` [PATCH v4 12/13] iio: adc: ad4134: Support high-speed data capture Marcelo Schmitt
2026-10-06 18:19 ` [PATCH v4 13/13] Docs: iio: Add AD4134 Marcelo Schmitt

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=as-0GfwuX6JyKuel@nsa \
    --to=nuno.sa@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=robh@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