Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matti Vaittinen" <matti.vaittinen@linux.dev>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: iio: Support ROHM BD79111
Date: Wed, 18 Nov 2026 14:34:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-221220@kernel.org> (raw)
In-Reply-To: <f69b996cc07fad1712871fb8b0436c71abd435b9.1795009599.git.mazziesaccount@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] dt-bindings: iio: adc: decimal instead of hex regex for
  channel nodes
- [Low] dt-bindings: iio: adc: duplicate channel patternProperties
  inside allOf
--

commit 1d2b4969234a59de95b2a054fda32ad7ef3510e0
Author: Matti Vaittinen <mazziesaccount@gmail.com>

dt-bindings: iio: Support ROHM BD79111

This commit adds device tree binding support for the 16-channel ROHM
BD79111 ADC/GPIO alongside the 32-channel BD79112.

> diff --git a/Documentation/devicetree/bindings/iio/adc/rohm,bd79112.yaml b/Documentation/devicetree/bindings/iio/adc/rohm,bd79112.yaml
> index aa8b07c3fac10..4f105124ee6f6 100644
> --- a/Documentation/devicetree/bindings/iio/adc/rohm,bd79112.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/rohm,bd79112.yaml

[ ... ]

> @@ -37,23 +40,6 @@ properties:
>    "#size-cells":
>      const: 0
>  
> -patternProperties:
> -  "^channel@([0-9]|[12][0-9]|3[01])$":
> -    type: object
> -    $ref: /schemas/iio/adc/adc.yaml#
> -    description: Represents ADC channel. Omitted channels' inputs are GPIOs.
> -
> -    properties:
> -      reg:
> -        description: AIN pin number
> -        minimum: 0
> -        maximum: 31
> -
> -    required:
> -      - reg
> -
> -    additionalProperties: false
> -
>  required:
>    - compatible
>    - reg
> @@ -62,7 +48,49 @@ required:
>    - spi-cpha
>    - spi-cpol
>  
> -additionalProperties: false
> +unevaluatedProperties: false
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: rohm,bd79112
> +    then:
> +      patternProperties:
> +        "^channel@([0-9]|[12][0-9]|3[01])$":
> +          type: object
> +          $ref: /schemas/iio/adc/adc.yaml#
> +          description: Represents ADC channel. Omitted channels' inputs are GPIOs.
> +
> +          properties:
> +            reg:
> +              description: AIN pin number
> +              minimum: 0
> +              maximum: 31
> +
> +          required:
> +            - reg
> +
> +          additionalProperties: false
> +    else:
> +      # BD79111 has only 16 channels
> +      patternProperties:
> +        "^channel@([0-9]|1[0-5])$":

[Severity: Medium]
Should the channel unit-address regexes match hexadecimal rather than
decimal ranges?

Devicetree unit addresses and adc.yaml use lowercase hex without leading
zeros, so "^channel@([0-9]|1[0-5])$" rejects valid nodes channel@a through
channel@f on rohm,bd79111 while accepting out-of-range channel@10 through
channel@15.  Likewise, the 32-channel pattern rejects channel@a through
channel@f and channel@1a through channel@1f while accepting channel@20
through channel@31; hex ranges would be "^channel@[0-9a-f]$" and
"^channel@1?[0-9a-f]$".

> +          type: object
> +          $ref: /schemas/iio/adc/adc.yaml#
> +          description: Represents ADC channel. Omitted channels' inputs are GPIOs.
> +
> +          properties:
> +            reg:
> +              description: AIN pin number
> +              minimum: 0
> +              maximum: 15
> +
> +          required:
> +            - reg
> +
> +          additionalProperties: false

[Severity: Low]
Could patternProperties stay at the top level with the 32-channel
definition, and have the allOf if/then block for rohm,bd79111 only narrow
reg maximum to 15 and disallow the upper 16 channel patterns?

That avoids duplicating the entire channel sub-schema across both branches
and allows keeping additionalProperties: false at the root level, matching
Documentation/devicetree/bindings/writing-schema.rst.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795009599.git.mazziesaccount@gmail.com?part=1

  reply	other threads:[~2026-11-18 14:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 14:18 [PATCH 0/2] Support ROHM BD79111 ADC/GPIO Matti Vaittinen
2026-11-18 14:19 ` [PATCH 1/2] dt-bindings: iio: Support ROHM BD79111 Matti Vaittinen
2026-11-18 14:34   ` sashiko-bot [this message]
2026-11-18 14:19 ` [PATCH 2/2] iio: adc: rohm-bd79112: " Matti Vaittinen

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-221220@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=matti.vaittinen@linux.dev \
    --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