Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Binbin Zhou" <zhoubinbin@loongson.cn>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	mfd@lists.linux.dev, lee@kernel.org
Subject: Re: [PATCH v2 3/4] dt-bindings: thermal: loongson,ls2k-thermal: Add compatible for Loongson-2K0300
Date: Tue, 21 Jul 2026 12:35:42 +0000	[thread overview]
Message-ID: <20260721123542.7EF591F000E9@smtp.kernel.org> (raw)
In-Reply-To: <a87ca6afc11399dbc8c5d99d979aa6ed815b8542.1784619512.git.zhoubinbin@loongson.cn>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The `reg` property loses its strict size constraints for different variants because the explicit `minItems` and `maxItems` bounds were replaced by `items` descriptions inside the `if/then` blocks without restricting the array length.
- [Medium] The compatible string added to the syscon schema contains a typo (`cphipid` instead of `chipid`).
--

--- Patch [3]: [PATCH v2 3/4] dt-bindings: thermal: loongson,ls2k-thermal: Add compatible for Loongson-2K0300 ---
commit 685d641d1fef4db6e1df5ead93f5d8354f9d319d
Author: Binbin Zhou <zhoubinbin@loongson.cn>

dt-bindings: thermal: loongson,ls2k-thermal: Add compatible for Loongson-2K0300

This commit adds a new compatible string loongson,ls2k0300-thermal for the
thermal sensor on the Loongson-2K0300 SoC. It updates the binding to make
loongson,chipid required for this new compatible and restructures the register
region constraints for each variant.

> diff --git a/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml b/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
> index 79e691b08341c..d312e27737a20 100644
> --- a/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml
> +++ b/Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml

[ ... ]

> @@ -34,28 +32,56 @@ properties:
>    '#thermal-sensor-cells':
>      const: 1
>  
> +  loongson,chipid:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to the syscon with the Loongson-2K0300 CHIP ID.
> +

[Severity: Medium]
It appears the compatible string added to the syscon schema for this device
contains a typo: loongson,ls2k0300-cphipid-syscon instead of chipid.

Documentation/devicetree/bindings/mfd/syscon.yaml:
          - loongson,ls1b-syscon
          - loongson,ls1c-syscon
          - loongson,ls2k0300-cphipid-syscon

Given the loongson,chipid property name here and the commit message referencing 
the chip id, was the cphipid spelling in syscon.yaml unintended?

>  required:
>    - compatible
>    - reg
>    - interrupts
>  
> -if:
> -  properties:
> -    compatible:
> -      contains:
> -        enum:
> -          - loongson,ls2k2000-thermal
> +allOf:
> +  - $ref: /schemas/thermal/thermal-sensor.yaml#
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: loongson,ls2k0300-thermal
> +    then:
> +      properties:
> +        reg:
> +          items:
> +            - description: Thermal base register region

[Severity: Medium]
Does removing the explicit maxItems: 1 constraint here cause a regression where
the reg property loses its strict size limits?

In JSON Schema and dt-schema, specifying items inside an if/then/properties
block does not restrict the maximum array length unless maxItems is explicitly
defined. Since the root level allows reg: maxItems: 2, will this configuration
mistakenly accept up to two register regions for loongson,ls2k0300-thermal?

> +      required:
> +        - loongson,chipid
>  
> -then:
> -  properties:
> -    reg:
> -      minItems: 2
> -      maxItems: 2
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: loongson,ls2k1000-thermal
> +    then:
> +      properties:
> +        loongson,chipid: false
> +        reg:
> +          items:
> +            - description: Thermal base register region

[Severity: Medium]
Similarly, does this block also need maxItems: 1 to prevent
loongson,ls2k1000-thermal from accepting two register regions?

>  
> -else:
> -  properties:
> -    reg:
> -      maxItems: 1
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: loongson,ls2k2000-thermal
> +    then:
> +      properties:
> +        loongson,chipid: false
> +        reg:
> +          items:
> +            - description: Thermal base register region
> +            - description: Thermal data output register region

[Severity: Medium]
The previous schema explicitly enforced lengths for loongson,ls2k2000-thermal
by stating minItems: 2 and maxItems: 2.

Without minItems: 2 here, will dt-schema now accept an incomplete single
register region for loongson,ls2k2000-thermal?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784619512.git.zhoubinbin@loongson.cn?part=3

  reply	other threads:[~2026-07-21 12:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 12:24 [PATCH v2 0/4] thermal: loongson2: Add support for Loongson-2K0300 SoC Binbin Zhou
2026-07-21 12:24 ` [PATCH v2 1/4] thermal/drivers/loongson2: Correct thermal sensor registration loop Binbin Zhou
2026-07-21 12:36   ` sashiko-bot
2026-07-21 12:24 ` [PATCH v2 2/4] dt-bindings: mfd: syscon: Allow syscon compatible for Loongson-2K0300 chip id Binbin Zhou
2026-07-21 12:30   ` sashiko-bot
2026-07-21 15:39   ` Conor Dooley
2026-07-21 12:26 ` [PATCH v2 3/4] dt-bindings: thermal: loongson,ls2k-thermal: Add compatible for Loongson-2K0300 Binbin Zhou
2026-07-21 12:35   ` sashiko-bot [this message]
2026-07-21 15:39   ` Conor Dooley
2026-07-21 12:26 ` [PATCH v2 4/4] thermal/drivers/loongson2: Add support " Binbin Zhou
2026-07-21 12:33   ` 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=20260721123542.7EF591F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhoubinbin@loongson.cn \
    /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