All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Elliot Berman <quic_eberman@quicinc.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Satya Durga Srinivasu Prabhala <quic_satyap@quicinc.com>,
	Melody Olvera <quic_molvera@quicinc.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Florian Fainelli <florian.fainelli@broadcom.com>
Subject: Re: [PATCH 1/3] dt-bindings: power: reset: Convert mode-.* properties to array
Date: Mon, 20 Nov 2023 08:27:37 -0700	[thread overview]
Message-ID: <20231120152737.GA283159-robh@kernel.org> (raw)
In-Reply-To: <20231117-arm-psci-system_reset2-vendor-reboots-v1-1-03c4612153e2@quicinc.com>

On Fri, Nov 17, 2023 at 01:18:46PM -0800, Elliot Berman wrote:
> PSCI reboot mode will map a mode name to multiple magic values instead
> of just one. Convert the mode-.* property to an array with default
> number of items limited to 1.
> 
> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
> ---
>  Documentation/devicetree/bindings/power/reset/reboot-mode.yaml | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> index ad0a0b95cec1..2c786e783464 100644
> --- a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> @@ -28,13 +28,16 @@ description: |
>  
>  properties:
>    mode-normal:
> -    $ref: /schemas/types.yaml#/definitions/uint32
> +    $ref: "#/patternProperties/^mode-.*$"
>      description:
>        Default value to set on a reboot if no command was provided.
>  
>  patternProperties:
>    "^mode-.*$":
> -    $ref: /schemas/types.yaml#/definitions/uint32
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +    # Default to one value. Bindings that reference this schema could override.
> +    minItems: 1
> +    maxItems: 1

There are no overrides in json-schema, so this won't work. 

It happens to work though. It has to do with how we process the schemas 
because every integer property is decoded into a 2 dimensional array. So 
we process the schemas to convert schemas for scalars and arrays into 
a matrix. This hit a corner case where we bail on doing any fixup when 
maxItems is 1, but really it should be transformed into:

maxItems: 1
items:
  maxItems: 1

Which would then fail on your case with 2 entries. You need 'maxItems: 
1' everywhere just 1 entry is expected (e.g. mode-normal) and no 
constraints here. 

Rob


>  
>  additionalProperties: true
>  
> 
> -- 
> 2.41.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robh@kernel.org>
To: Elliot Berman <quic_eberman@quicinc.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Satya Durga Srinivasu Prabhala <quic_satyap@quicinc.com>,
	Melody Olvera <quic_molvera@quicinc.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Florian Fainelli <florian.fainelli@broadcom.com>
Subject: Re: [PATCH 1/3] dt-bindings: power: reset: Convert mode-.* properties to array
Date: Mon, 20 Nov 2023 08:27:37 -0700	[thread overview]
Message-ID: <20231120152737.GA283159-robh@kernel.org> (raw)
In-Reply-To: <20231117-arm-psci-system_reset2-vendor-reboots-v1-1-03c4612153e2@quicinc.com>

On Fri, Nov 17, 2023 at 01:18:46PM -0800, Elliot Berman wrote:
> PSCI reboot mode will map a mode name to multiple magic values instead
> of just one. Convert the mode-.* property to an array with default
> number of items limited to 1.
> 
> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
> ---
>  Documentation/devicetree/bindings/power/reset/reboot-mode.yaml | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> index ad0a0b95cec1..2c786e783464 100644
> --- a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> @@ -28,13 +28,16 @@ description: |
>  
>  properties:
>    mode-normal:
> -    $ref: /schemas/types.yaml#/definitions/uint32
> +    $ref: "#/patternProperties/^mode-.*$"
>      description:
>        Default value to set on a reboot if no command was provided.
>  
>  patternProperties:
>    "^mode-.*$":
> -    $ref: /schemas/types.yaml#/definitions/uint32
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +    # Default to one value. Bindings that reference this schema could override.
> +    minItems: 1
> +    maxItems: 1

There are no overrides in json-schema, so this won't work. 

It happens to work though. It has to do with how we process the schemas 
because every integer property is decoded into a 2 dimensional array. So 
we process the schemas to convert schemas for scalars and arrays into 
a matrix. This hit a corner case where we bail on doing any fixup when 
maxItems is 1, but really it should be transformed into:

maxItems: 1
items:
  maxItems: 1

Which would then fail on your case with 2 entries. You need 'maxItems: 
1' everywhere just 1 entry is expected (e.g. mode-normal) and no 
constraints here. 

Rob


>  
>  additionalProperties: true
>  
> 
> -- 
> 2.41.0
> 

  parent reply	other threads:[~2023-11-20 15:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 21:18 [PATCH 0/3] Implement vendor resets for PSCI SYSTEM_RESET2 Elliot Berman
2023-11-17 21:18 ` Elliot Berman
2023-11-17 21:18 ` [PATCH 1/3] dt-bindings: power: reset: Convert mode-.* properties to array Elliot Berman
2023-11-17 21:18   ` Elliot Berman
2023-11-20 10:52   ` Krzysztof Kozlowski
2023-11-20 10:52     ` Krzysztof Kozlowski
2023-11-20 15:58     ` Elliot Berman
2023-11-20 15:58       ` Elliot Berman
2023-11-20 15:27   ` Rob Herring [this message]
2023-11-20 15:27     ` Rob Herring
2023-11-17 21:18 ` [PATCH 2/3] dt-bindings: arm: Document reboot mode magic Elliot Berman
2023-11-17 21:18   ` Elliot Berman
2023-11-20 10:56   ` Krzysztof Kozlowski
2023-11-20 10:56     ` Krzysztof Kozlowski
2023-11-20 15:45     ` Elliot Berman
2023-11-20 15:45       ` Elliot Berman
2023-11-20 16:41       ` Krzysztof Kozlowski
2023-11-20 16:41         ` Krzysztof Kozlowski
2023-11-20 17:09         ` Elliot Berman
2023-11-20 17:09           ` Elliot Berman
2023-11-17 21:18 ` [PATCH 3/3] firmware: psci: Read and use vendor reset types Elliot Berman
2023-11-17 21:18   ` Elliot Berman
2023-11-20 10:55 ` [PATCH 0/3] Implement vendor resets for PSCI SYSTEM_RESET2 Krzysztof Kozlowski
2023-11-20 10:55   ` Krzysztof Kozlowski
2023-11-20 16:03   ` Elliot Berman
2023-11-20 16:03     ` Elliot Berman
2023-11-20 17:27     ` Krzysztof Kozlowski
2023-11-20 17:27       ` Krzysztof Kozlowski

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=20231120152737.GA283159-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=quic_eberman@quicinc.com \
    --cc=quic_molvera@quicinc.com \
    --cc=quic_satyap@quicinc.com \
    /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.