All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Antoniu Miclaus" <antoniu.miclaus@analog.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 3/4] iio: adc: ade9000: add support for ADE9078
Date: Mon, 20 Jul 2026 11:22:32 +0000	[thread overview]
Message-ID: <20260720112233.166E01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260720110754.7674-4-antoniu.miclaus@analog.com>

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

Pre-existing issues:
- [High] Duplicate and overlapping `scan_index` values assigned to phase B and C channels break the IIO buffer subsystem.
--

--- Patch [3]: [PATCH 3/4] iio: adc: ade9000: add support for ADE9078 ---
commit b9467a190f2a74b5ff3993276ef11d90860fe13b
Author: Antoniu Miclaus <antoniu.miclaus@analog.com>

iio: adc: ade9000: add support for ADE9078

This commit adds support for the ADE9078 polyphase energy metering device,
which is register-compatible with the ADE9000 but lacks dip/swell detection.
It introduces a dedicated channel table to omit those events and adds matching
chip_info for the full-scale codes.

> diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c
> index 52ad87ef05d0c..0d5aa26f6667b 100644
> --- a/drivers/iio/adc/ade9000.c
> +++ b/drivers/iio/adc/ade9000.c
[ ... ]
> +#define ADE9000_DECLARE_CHANNELS(_name, altvoltage_rms)			      \
> +	static const struct iio_chan_spec _name[] = {			      \
> +		/* Phase A channels */					      \
> +		ADE9000_CURRENT_CHANNEL(ADE9000_PHASE_A_NR),		      \
> +		ADE9000_VOLTAGE_CHANNEL(ADE9000_PHASE_A_NR),		      \
[ ... ]
> +		/* Phase B channels */					      \
> +		ADE9000_CURRENT_CHANNEL(ADE9000_PHASE_B_NR),		      \
> +		ADE9000_VOLTAGE_CHANNEL(ADE9000_PHASE_B_NR),		      \

[Severity: High]
This is a pre-existing issue, but does this channel declaration cause the
driver probe to fail during IIO device registration?

Looking at the channel macros in drivers/iio/adc/ade9000.c:

ADE9000_CURRENT_CHANNEL(num) sets .scan_index = num
ADE9000_VOLTAGE_CHANNEL(num) sets .scan_index = num + 1

With ADE9000_PHASE_A_NR (0) and ADE9000_PHASE_B_NR (1), Phase A's voltage
channel gets scan_index 1, which perfectly collides with Phase B's current
channel (also scan_index 1).

Since ade9000_probe() calls devm_iio_kfifo_buffer_setup(), the
INDIO_BUFFER_SOFTWARE mode flag is set. When devm_iio_device_register() is
called, the IIO core invokes iio_check_unique_scan_index(), detects the
duplicate scan_index, and unconditionally returns -EINVAL.

It looks like ade9000_waveform_buffer_config() expects Phase B Current to
map to BIT(2), so shouldn't these macros use num * 2 and num * 2 + 1
instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260720110754.7674-1-antoniu.miclaus@analog.com?part=3

  reply	other threads:[~2026-07-20 11:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 11:07 [PATCH 0/4] iio: adc: ade9000: add support for ADE9078 Antoniu Miclaus
2026-07-20 11:07 ` [PATCH 1/4] iio: adc: ade9000: introduce chip_info structure Antoniu Miclaus
2026-07-20 11:07 ` [PATCH 2/4] dt-bindings: iio: adc: adi,ade9000: add adi,ade9078 compatible Antoniu Miclaus
2026-07-20 11:07 ` [PATCH 3/4] iio: adc: ade9000: add support for ADE9078 Antoniu Miclaus
2026-07-20 11:22   ` sashiko-bot [this message]
2026-07-20 11:07 ` [PATCH 4/4] docs: iio: ade9000: document ADE9078 support Antoniu Miclaus

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=20260720112233.166E01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.