[v2] dt-bindings: usb: connector: disallow additional properties
Commit Message
USB connector bindings is complete, thus no additional properties should
be allowed. Add missing 'reg' property and change additionalProperties
to false, so the schema will check for anything not unexpected. This
also allows to drop the 'reg' from other bindings referencing the
usb-connector.yaml and make it required.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
Changes in v2:
1. Make usb-connector.yaml additionalProperties:false (Rob)
v1:
https://lore.kernel.org/all/20230723071105.40157-1-krzysztof.kozlowski@linaro.org/
---
.../devicetree/bindings/chrome/google,cros-ec-typec.yaml | 6 ++----
.../devicetree/bindings/connector/usb-connector.yaml | 5 ++++-
.../devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml | 6 ------
Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml | 6 ++----
4 files changed, 8 insertions(+), 15 deletions(-)
Comments
On 25/07/2023 12:23, Krzysztof Kozlowski wrote:
> USB connector bindings is complete, thus no additional properties should
> be allowed. Add missing 'reg' property and change additionalProperties
> to false, so the schema will check for anything not unexpected. This
An MIT linguistics professor was lecturing his class the other day. "In
English," he said, "a double negative forms a positive. However, in some
languages, such as Polish, a double negative remains a negative. But
there isn't a single language, not one, in which a double positive can
express a negative."
A voice from the back of the room piped up, "Yeah, right."
Obviously:
"... will check for anything unexpected".
> also allows to drop the 'reg' from other bindings referencing the
> usb-connector.yaml and make it required.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
Best regards,
Krzysztof
On Tue, 25 Jul 2023 12:23:25 +0200, Krzysztof Kozlowski wrote:
> USB connector bindings is complete, thus no additional properties should
> be allowed. Add missing 'reg' property and change additionalProperties
> to false, so the schema will check for anything not unexpected. This
> also allows to drop the 'reg' from other bindings referencing the
> usb-connector.yaml and make it required.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> ---
>
> Changes in v2:
> 1. Make usb-connector.yaml additionalProperties:false (Rob)
>
> v1:
> https://lore.kernel.org/all/20230723071105.40157-1-krzysztof.kozlowski@linaro.org/
> ---
> .../devicetree/bindings/chrome/google,cros-ec-typec.yaml | 6 ++----
> .../devicetree/bindings/connector/usb-connector.yaml | 5 ++++-
> .../devicetree/bindings/soc/qcom/qcom,pmic-glink.yaml | 6 ------
> Documentation/devicetree/bindings/usb/cypress,cypd4226.yaml | 6 ++----
> 4 files changed, 8 insertions(+), 15 deletions(-)
>
I didn't not fix the double negative and applied, thanks! ;)
@@ -29,10 +29,8 @@ properties:
patternProperties:
'^connector@[0-9a-f]+$':
$ref: /schemas/connector/usb-connector.yaml#
- unevaluatedProperties: false
- properties:
- reg:
- maxItems: 1
+ required:
+ - reg
required:
- compatible
@@ -30,6 +30,9 @@ properties:
- const: samsung,usb-connector-11pin
- const: usb-b-connector
+ reg:
+ maxItems: 1
+
label:
description: Symbolic name for the connector.
@@ -264,7 +267,7 @@ anyOf:
- typec-power-opmode
- new-source-frs-typec-current
-additionalProperties: true
+additionalProperties: false
examples:
# Micro-USB connector with HS lines routed via controller (MUIC).
@@ -38,15 +38,9 @@ properties:
patternProperties:
'^connector@\d$':
$ref: /schemas/connector/usb-connector.yaml#
-
- properties:
- reg: true
-
required:
- reg
- unevaluatedProperties: false
-
required:
- compatible
@@ -43,10 +43,8 @@ properties:
patternProperties:
'^connector@[01]$':
$ref: /schemas/connector/usb-connector.yaml#
- unevaluatedProperties: false
- properties:
- reg:
- maxItems: 1
+ required:
+ - reg
required:
- compatible