From: sashiko-bot@kernel.org
To: "Cosmin Tanislav" <cosmin-gabriel.tanislav.xa@renesas.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
wsa+renesas@sang-engineering.com, conor+dt@kernel.org
Subject: Re: [PATCH 6/9] iio: adc: rzt2h: expose sampling frequency
Date: Fri, 28 Aug 2026 15:14:31 +0000 [thread overview]
Message-ID: <20260828151431.ACFC21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828145943.2077589-7-cosmin-gabriel.tanislav.xa@renesas.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Spurious -ETIMEDOUT on single reads due to extremely short 1-jiffy completion timeout
--
commit c401ad2e533dc2bc5a1b011d098327c8d7400f4f
Author: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
iio: adc: rzt2h: expose sampling frequency
This patch exposes the sampling frequency as a per-channel
IIO_CHAN_INFO_SAMP_FREQ attribute to allow userspace control over conversion
time. It derives the frequency from the ADCLK rate and programs the sample
time into ADSSTRn for each enabled channel.
> diff --git a/drivers/iio/adc/rzt2h_adc.c b/drivers/iio/adc/rzt2h_adc.c
> index d76226375f220..2e13f931a2e9a 100644
> --- a/drivers/iio/adc/rzt2h_adc.c
> +++ b/drivers/iio/adc/rzt2h_adc.c
[ ... ]
> @@ -124,6 +146,8 @@ static int rzt2h_adc_read_single(struct rzt2h_adc *adc, unsigned int ch, int *va
> /* Enable a single channel */
> writew(RZT2H_ADANSA0_CH_MASK(ch), adc->base + RZT2H_ADANSA0_REG);
>
> + rzt2h_adc_set_sst(adc, ch, adc->sst[ch]);
> +
> rzt2h_adc_start(adc, RZT2H_ADCSR_ADCS_SINGLE);
>
> /*
[Severity: High]
This is a pre-existing issue, but does the newly introduced configurable
sampling frequency exacerbate a spurious timeout bug here?
In rzt2h_adc_read_single(), right below this hunk, the code calls:
ret = wait_for_completion_timeout(&adc->completion, usecs_to_jiffies(1));
Because usecs_to_jiffies(1) evaluates to 1, the timeout is set to exactly
1 jiffy, which will expire at the very next timer tick.
If the tick fires immediately after the wait starts, it aborts almost
instantly (returning 0) before the hardware interrupt arrives, causing the
kernel to intermittently and incorrectly return -ETIMEDOUT to userspace
instead of the actual ADC reading.
Since the patch now allows increasing the hardware conversion delay (up to
268 cycles or ~5.36us at 50MHz ADCLK), does this widen the race window and
significantly increase the probability of this spurious timeout occurring?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260828145943.2077589-1-cosmin-gabriel.tanislav.xa@renesas.com?part=6
next prev parent 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 [this message]
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
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=20260828151431.ACFC21F000E9@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