Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Radu Sabau" <radu.sabau@analog.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 1/6] iio: imu: adis: Add optional self_test callback and fix custom reset dispatch
Date: Thu, 08 Oct 2026 08:45:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-163850@kernel.org> (raw)
In-Reply-To: <20261008-adis16607-v2-1-7c94df80878a@analog.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] iio: imu: adis: adis_reset() API bypasses custom reset operations
--

commit 94d1ab88cd933c9c52f4aca4a47015c8c3d32cd3
Author: Radu Sabau <radu.sabau@analog.com>

    iio: imu: adis: Add optional self_test callback and fix custom reset dispatch
    
    Add an optional self_test callback to struct adis_data, for devices
    whose self-test doesn't fit the generic mask-write/sleep/check-status
    sequence. Purely additive: defaults to NULL, no change for existing
    drivers.
    
    Also fix __adis_initial_startup()'s no-reset-gpio path: it called
    __adis_reset() directly instead of adis->ops->reset(), silently
    ignoring any driver's custom reset implementation. Invisible until now
    since adis_default_ops.reset is __adis_reset() itself. Dispatch
    through adis->ops->reset() instead, adding the settle-time sleep at
    the call site for custom ops (documented not to sleep internally)
    while skipping it for the default op (which already sleeps
    internally).

> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index a2bc1d14ed91d..306777526a118 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c

[ ... ]

> @@ -413,7 +422,20 @@ int __adis_initial_startup(struct adis *adis)
>  		gpiod_set_value_cansleep(gpio, 0);
>  		msleep(timeouts->reset_ms);
>  	} else {
> -		ret = __adis_reset(adis);
> +		ret = adis->ops->reset(adis);

[Severity: Low]
While this correctly fixes the dispatch here, does the public adis_reset()
API function in include/linux/iio/imu/adis.h also need to be updated?

It currently still bypasses the custom operations by hardcoding a direct call
to __adis_reset(adis):

include/linux/iio/imu/adis.h:adis_reset() {
	guard(mutex)(&adis->state_lock);
	return __adis_reset(adis);
}

If a driver utilizing a custom reset callback attempts to use adis_reset()
(e.g., during error recovery), it would still bypass the custom logic and
write directly to the default global command register.

For a device with a custom reset, like adis16550, this issues an 8-bit SPI
write (ADIS_GLOB_CMD_SW_RESET) which would fail because its custom SPI
transfer handler expects 16-bit or 32-bit transfers.

While it appears no in-tree drivers with custom operations currently invoke
this wrapper, it seems leaving it this way breaks the API contract established
by this patch.

> +		if (ret)
> +			return ret;
> +		/*
> +		 * The default reset op (__adis_reset()) already sleeps the
> +		 * settle time internally. Custom reset ops are documented
> +		 * (struct adis_ops::reset) not to, so sleep here for them.
> +		 */
> +		if (adis->ops != &adis_default_ops)
> +			msleep(timeouts->sw_reset_ms);
> +	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-adis16607-v2-0-7c94df80878a@analog.com?part=1

  reply	other threads:[~2026-10-08  8:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  8:31 [PATCH v2 0/6] iio: imu: Add support for the ADI ADIS16607 Radu Sabau via B4 Relay
2026-10-08  8:31 ` [PATCH v2 1/6] iio: imu: adis: Add optional self_test callback and fix custom reset dispatch Radu Sabau via B4 Relay
2026-10-08  8:45   ` sashiko-bot [this message]
2026-10-08  8:31 ` [PATCH v2 2/6] dt-bindings: iio: imu: Add bindings for ADI ADIS16607 Radu Sabau via B4 Relay
2026-10-08  8:37   ` sashiko-bot
2026-10-08 10:14   ` Conor Dooley
2026-10-08  8:31 ` [PATCH v2 3/6] iio: imu: Add driver for the " Radu Sabau via B4 Relay
2026-10-08  8:31 ` [PATCH v2 4/6] iio: imu: adis16607: Add FIFO-based buffered/triggered capture Radu Sabau via B4 Relay
2026-10-08  8:45   ` sashiko-bot
2026-10-08  8:31 ` [PATCH v2 5/6] iio: imu: adis16607: Add external clock sync support Radu Sabau via B4 Relay
2026-10-08  8:42   ` sashiko-bot
2026-10-08  8:31 ` [PATCH v2 6/6] iio: imu: adis16607: Add calibration bias support for gyro/accel Radu Sabau via B4 Relay
2026-10-08  8:43   ` sashiko-bot

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=sashiko-outbox-163850@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=radu.sabau@analog.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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