public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Rob Herring <robh@kernel.org>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: iio: temperature: ltc2983: Fix child node unevaluated properties
Date: Fri, 7 Apr 2023 18:49:28 +0100	[thread overview]
Message-ID: <20230407184928.43f6d730@jic23-huawei> (raw)
In-Reply-To: <20230404205014.644336-1-robh@kernel.org>

On Tue,  4 Apr 2023 15:50:13 -0500
Rob Herring <robh@kernel.org> wrote:

> The child node schemas are missing 'unevaluatedProperties' constraints,
> so any unknown properties are allowed. The current structure with
> multiple patternProperties schemas doesn't work for
> unevaluatedProperties as each sub-schema is evaluated independently. To
> fix this, move the sub-schema for all child nodes to a $defs entry and
> reference it from each named child node.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>

Nice. Series applied to the togreg branch of iio.git and pushed out as
testing so 0-day can poke at it.

Thanks,

Jonathan

> ---
>  .../bindings/iio/temperature/adi,ltc2983.yaml | 65 +++++++++++--------
>  1 file changed, 38 insertions(+), 27 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml b/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
> index f44fc32ce87e..e04f961ab92c 100644
> --- a/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
> +++ b/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
> @@ -18,6 +18,28 @@ description: |
>    https://www.analog.com/media/en/technical-documentation/data-sheets/29861fa.pdf
>    https://www.analog.com/media/en/technical-documentation/data-sheets/ltm2985.pdf
>  
> +$defs:
> +  sensor-node:
> +    type: object
> +    description: Sensor node common constraints
> +
> +    properties:
> +      reg:
> +        description:
> +          Channel number. Connects the sensor to the channel with this number
> +          of the device.
> +        minimum: 1
> +        maximum: 20
> +
> +      adi,sensor-type:
> +        description: Type of sensor connected to the device.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +
> +    required:
> +      - reg
> +      - adi,sensor-type
> +
> +
>  properties:
>    compatible:
>      oneOf:
> @@ -64,28 +86,10 @@ properties:
>      const: 0
>  
>  patternProperties:
> -  "@([0-9a-f]+)$":
> -    type: object
> -    description: Sensor.
> -
> -    properties:
> -      reg:
> -        description:
> -          Channel number. Connects the sensor to the channel with this number
> -          of the device.
> -        minimum: 1
> -        maximum: 20
> -
> -      adi,sensor-type:
> -        description: Type of sensor connected to the device.
> -        $ref: /schemas/types.yaml#/definitions/uint32
> -
> -    required:
> -      - reg
> -      - adi,sensor-type
> -
>    "^thermocouple@":
> -    type: object
> +    $ref: '#/$defs/sensor-node'
> +    unevaluatedProperties: false
> +
>      description: Thermocouple sensor.
>  
>      properties:
> @@ -141,7 +145,9 @@ patternProperties:
>              - adi,custom-thermocouple
>  
>    "^diode@":
> -    type: object
> +    $ref: '#/$defs/sensor-node'
> +    unevaluatedProperties: false
> +
>      description: Diode sensor.
>  
>      properties:
> @@ -184,7 +190,8 @@ patternProperties:
>          default: 0
>  
>    "^rtd@":
> -    type: object
> +    $ref: '#/$defs/sensor-node'
> +    unevaluatedProperties: false
>      description: RTD sensor.
>  
>      properties:
> @@ -282,7 +289,8 @@ patternProperties:
>              - adi,custom-rtd
>  
>    "^thermistor@":
> -    type: object
> +    $ref: '#/$defs/sensor-node'
> +    unevaluatedProperties: false
>      description: Thermistor sensor.
>  
>      properties:
> @@ -383,7 +391,8 @@ patternProperties:
>              - adi,custom-thermistor
>  
>    "^adc@":
> -    type: object
> +    $ref: '#/$defs/sensor-node'
> +    unevaluatedProperties: false
>      description: Direct ADC sensor.
>  
>      properties:
> @@ -397,7 +406,8 @@ patternProperties:
>          type: boolean
>  
>    "^temp@":
> -    type: object
> +    $ref: '#/$defs/sensor-node'
> +    unevaluatedProperties: false
>      description: Active analog temperature sensor.
>  
>      properties:
> @@ -426,7 +436,8 @@ patternProperties:
>        - adi,custom-temp
>  
>    "^rsense@":
> -    type: object
> +    $ref: '#/$defs/sensor-node'
> +    unevaluatedProperties: false
>      description: Sense resistor sensor.
>  
>      properties:


      parent reply	other threads:[~2023-04-07 17:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 20:50 [PATCH 1/2] dt-bindings: iio: temperature: ltc2983: Fix child node unevaluated properties Rob Herring
2023-04-04 20:50 ` [PATCH 2/2] dt-bindings: iio: temperature: ltc2983: Make 'adi,custom-thermocouple' signed Rob Herring
2023-04-07 17:49 ` Jonathan Cameron [this message]

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=20230407184928.43f6d730@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /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