Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cosmin Tanislav" <cosmin-gabriel.tanislav.xa@renesas.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH 7/9] dt-bindings: iio: adc: renesas,r9a09g077-adc: document DMA support
Date: Fri, 28 Aug 2026 15:14:57 +0000	[thread overview]
Message-ID: <20260828151457.8756F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828145943.2077589-8-cosmin-gabriel.tanislav.xa@renesas.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Medium] The `dma-names` property schema dictates `maxItems: 3` and `items: const: rx`, which inherently conflicts with dt-schema's `*-names` uniqueness constraint, making it impossible to pass validation for multiple DMA channels.

Pre-existing issues:
- [High] The consumer's software read pointer (`period_index`) permanently desynchronizes from the hardware DMA write position when periods are abandoned during a backlog break, causing permanent data corruption.
--

commit 0d72d8676d8ea20bbe7d6a24553312b902a516ce
Author: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>

dt-bindings: iio: adc: renesas,r9a09g077-adc: document DMA support

The ADC can transfer conversion results to memory over DMA. Allow up to three
DMA specifiers, as the ADC conversion DMA request can be routed to any of the
SoC's three DMA controllers.

> diff --git a/Documentation/devicetree/bindings/iio/adc/renesas,r9a09g077-adc.yaml b/Documentation/devicetree/bindings/iio/adc/renesas,r9a09g077-adc.yaml
> index dc0206b282315..4b5934ac296b8 100644
> --- a/Documentation/devicetree/bindings/iio/adc/renesas,r9a09g077-adc.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/renesas,r9a09g077-adc.yaml
> @@ -57,6 +57,18 @@ properties:
>        - const: adclk
>        - const: pclk
>  
> +  dmas:
> +    minItems: 1
> +    maxItems: 3
> +    description:
> +      Must contain a list of references to DMA RX specifiers.
> +
> +  dma-names:
> +    minItems: 1
> +    maxItems: 3
> +    items:
> +      const: rx

[Severity: Medium]
Will this unconditionally fail device tree validation when multiple DMA channels
are specified?

The core dt-schema strictly applies uniqueItems: true to all properties
ending in -names. A device tree specifying multiple DMA references as
intended by this binding (e.g., dma-names = "rx", "rx", "rx") will trigger
a validation error due to the duplicated "rx" items.

[Severity: High]
This is a pre-existing issue, but does the software read pointer permanently
desynchronize from the hardware DMA write position when periods are abandoned?

In drivers/iio/adc/rzt2h_adc.c:rzt2h_adc_dma_thread_loop():

	for (unsigned int i = 0; i < pending; i++) {
		unsigned int backlog = atomic_read(&adc->dma.pending_periods) +
				       pending - i;

		/*
		 * Bail if enough new periods have completed since reading the
		 * pending_periods that the next period about to be read is at
		 * risk of being overwritten.
		 */
		if (backlog >= RZT2H_ADC_DMA_PERIODS)
			break;

		...
		rzt2h_adc_advance_period_index(adc, 1);
	}

The thread extracts all pending periods before this loop. If a backlog
accumulates, the loop breaks, discarding the remaining periods from the
extracted pending count. However, it fails to invoke
rzt2h_adc_advance_period_index(adc, pending - i) for those discarded periods.

The next time the loop runs, won't it resume reading from the old,
unadvanced period_index, corrupting all future ADC data reads?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260828145943.2077589-1-cosmin-gabriel.tanislav.xa@renesas.com?part=7

  reply	other threads:[~2026-08-28 15:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 14:59 [PATCH 0/9] iio: adc: rzt2h: add DMA buffer support Cosmin Tanislav
2026-08-28 14:59 ` [PATCH 1/9] iio: adc: rzt2h: remove unused struct rzt2h_adc::max_channels Cosmin Tanislav
2026-08-28 14:59 ` [PATCH 2/9] iio: adc: rzt2h: store IRQ in private state Cosmin Tanislav
2026-08-28 14:59 ` [PATCH 3/9] iio: adc: rzt2h: store the physical address " Cosmin Tanislav
2026-08-28 14:59 ` [PATCH 4/9] iio: adc: rzt2h: claim direct mode on single reads Cosmin Tanislav
2026-08-28 15:15   ` sashiko-bot
2026-08-28 14:59 ` [PATCH 5/9] iio: adc: rzt2h: implement DMA buffer support Cosmin Tanislav
2026-08-28 15:13   ` sashiko-bot
2026-08-29  1:20   ` Jonathan Cameron
2026-08-29  1:24     ` Jonathan Cameron
2026-08-28 14:59 ` [PATCH 6/9] iio: adc: rzt2h: expose sampling frequency Cosmin Tanislav
2026-08-28 15:14   ` sashiko-bot
2026-08-28 14:59 ` [PATCH 7/9] dt-bindings: iio: adc: renesas,r9a09g077-adc: document DMA support Cosmin Tanislav
2026-08-28 15:14   ` sashiko-bot [this message]
2026-08-28 16:21   ` Conor Dooley
2026-08-28 17:17     ` Geert Uytterhoeven
2026-08-28 14:59 ` [PATCH 8/9] arm64: dts: renesas: r9a09g077: Wire up DMA support for ADC Cosmin Tanislav
2026-08-28 14:59 ` [PATCH 9/9] arm64: dts: renesas: r9a09g087: " Cosmin Tanislav

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=20260828151457.8756F1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cosmin-gabriel.tanislav.xa@renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.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