All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ariana Lazar" <ariana.lazar@microchip.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 1/2] dt-bindings: iio: adc: add support for PAC1711
Date: Tue, 28 Jul 2026 12:14:38 +0000	[thread overview]
Message-ID: <20260728121439.0D2851F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260728-pac1711-v2-1-609bc026093c@microchip.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Incomplete array constraint for `interrupt-names` restricts the property to a single item.
- [Medium] The `pattern` keyword is used directly on the `compatible` property array, causing the conditional blocks to always evaluate to true.
--

--- Patch [1]: [PATCH v2 1/2] dt-bindings: iio: adc: add support for PAC1711 ---
commit 77f3bdc33ee2d8c631ae6a4bc6e945119e803da5
Author: Ariana Lazar <ariana.lazar@microchip.com>

dt-bindings: iio: adc: add support for PAC1711

This is the device tree schema for Microchip PAC1711, PAC1721, PAC1811 and
PAC1821 single-channel power monitor with accumulator. The devices use
12-bit or 16-bit resolution for voltage and current measurements.

> diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,pac1711.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,pac1711.yaml
> new file mode 100644
> index 0000000000000..846e7801a1667
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/adc/microchip,pac1711.yaml

[ ... ]

> +  interrupts:
> +    description:
> +      Could be triggered by overvoltage, undervoltage, overcurrent, overpower,
> +      undercurrent, step limit, accumulator overflow and accumulator count
> +      overflow.
> +    minItems: 1
> +
> +  interrupt-names:
> +    items:
> +      - enum: [alert0, alert1]

[Severity: Medium]
Does this constraint restrict the interrupt-names property to a single item?

In JSON Schema and dt-schema, providing a list to items defines a tuple,
which implicitly bounds the maximum array length to 1. Since the hardware
supports two independent alert lines, this prevents device trees from
configuring the hardware with both of its supported interrupt alert lines
(alert0 and alert1).

Could this be defined with minItems: 1, maxItems: 2, and an unnested
items: enum: [alert0, alert1] to allow valid configurations using both
lines?

[ ... ]

> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          pattern: "^microchip,pac1[78]11$"

[Severity: Medium]
Will this condition always evaluate to true?

In Device Tree schemas, compatible is an array of strings. The JSON Schema
pattern keyword only applies to strings, so when the instance is an array,
pattern is ignored and evaluates to true.

To correctly match array elements, should the condition use contains, such
as contains: pattern: "^microchip,pac1[78]11$"?

> +    then:
> +      properties:
> +        microchip,vbus-input-range-microvolt:

[ ... ]

> +  - if:
> +      properties:
> +        compatible:
> +          pattern: "^microchip,pac1[78]21$"

[Severity: Medium]
Does this block suffer from the same pattern matching issue on the
compatible array?

Since both if conditions evaluate to true, the schema will enforce mutually
exclusive oneOf constraints for microchip,vbus-input-range-microvolt
(max 42V vs 9V). Validation will always fail for any device tree using this
property.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260728-pac1711-v2-0-609bc026093c@microchip.com?part=1

  reply	other threads:[~2026-07-28 12:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 12:03 [PATCH v2 0/2] add support for Microchip PAC1711 Power Monitor Ariana Lazar
2026-07-28 12:03 ` [PATCH v2 1/2] dt-bindings: iio: adc: add support for PAC1711 Ariana Lazar
2026-07-28 12:14   ` sashiko-bot [this message]
2026-07-28 12:03 ` [PATCH v2 2/2] " Ariana Lazar
2026-07-28 12:18   ` 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=20260728121439.0D2851F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ariana.lazar@microchip.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.