Property names regex
Hi Rob
I'm slowly converting some of the Marvell binding documents to YAML.
I've got a problem with one of the interrupt controllers. Documentation/devicetree/bindings/interrupt-controller/marvell,orion-intc.txt includes:
Optional properties:
- marvell,#interrupts: number of interrupts provided by bridge interrupt controller, defaults to 32 if not set
I converted this to YAML as:
'marvell,#interrupts':
description:
number of interrupts provided by bridge interrupt controller
$ref: /schemas/types.yaml#/definitions/uint32
default: 32
but when i run dt_binding_check, i get:
home/andrew/linux/Documentation/devicetree/bindings/interrupt-controller/marvell,orion-bridge-intc.yaml: properties: 'marvell,#interrupts' does not match '^[#$a-zA-Z][a-zA-Z0-9,+\\-._@]{0,63}$'
hint: Expected a valid DT property name
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
As far as i can see from:
https://devicetree-specification.readthedocs.io/en/v0.3/devicetree-basics.html#properties
A property name is allowed a # anywhere in it, not just at the start.
How do i get this regex changed?
Thanks
Andrew
Quoted 6 lines · Andrew Lunn
Hi Rob
I'm slowly converting some of the Marvell binding documents to YAML.
I've got a problem with one of the interrupt controllers.
[email protected] is less of a firehose and better for asking questions.
Quoted 22 lines
Documentation/devicetree/bindings/interrupt-controller/marvell,orion-intc.txtincludes:Optional properties:
- marvell,#interrupts: number of interrupts provided by bridge interrupt controller, defaults to 32 if not setI converted this to YAML as:
'marvell,#interrupts':
description:
number of interrupts provided by bridge interrupt controller
$ref: /schemas/types.yaml#/definitions/uint32
default: 32but when i run
dt_binding_check, i get:
home/andrew/linux/Documentation/devicetree/bindings/interrupt-controller/marvell,orion-bridge-intc.yaml: properties: 'marvell,#interrupts' does not match '^[#$a-zA-Z][a-zA-Z0-9,+\\-._@]{0,63}$'
hint: Expected a valid DT property name
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
Quoted 5 lines
As far as i can see from:
https://devicetree-specification.readthedocs.io/en/v0.3/devicetree-basics.html#properties
A property name is allowed a # anywhere in it, not just at the start.
Yes, the schemas are a bit more restrictive for modern DTs than the spec.
Quoted 1 line
How do i get this regex changed?
I committed a fix to relax this[1].
Rob
[1] https://github.com/devicetree-org/dt-schema/commit/0e28a44059a6e33314784cfaf7b45d48afd10527
Quoted 7 lines
Quoted 1 line
A property name is allowed a # anywhere in it, not just at the start.
Yes, the schemas are a bit more restrictive for modern DTs than the spec.
Quoted 1 line
How do i get this regex changed?
I committed a fix to relax this[1].
Thanks. I now have a fix for this in my tree. I've just not posted it yet. I needed another change to make it really work. Here is my patch:
Author: Andrew Lunn <[email protected]> Date: Fri Aug 5 18:20:40 2022 -0500
{meta-}scheme: keywords: Allow # in properties
Version 0.3 of the DT specification makes no restriction of where a # can appear in a property name. The Marvell interrupt controller has the property:
'marvell,#interrupts':
description:
number of interrupts provided by bridge interrupt controller
$ref: /schemas/types.yaml#/definitions/uint32
default: 32
which the scheme reports as invalid. Add the # to the regex to allow it.
dtschema/meta-schemas/keywords.yaml +1 -1
@@ -169,7 +169,7 @@ properties: description: A json-schema keyword was found instead of a DT property name. propertyNames: description: Expected a valid DT property name - pattern: "^[#$a-zA-Z][a-zA-Z0-9,+\\-._@]{0,63}$" + pattern: "^[#$a-zA-Z][#a-zA-Z0-9,+\\-._@]{0,63}$" additionalProperties: $ref: "#/definitions/sub-schemas" required:
dtschema/schemas/dt-core.yaml +1 -1
@@ -72,7 +72,7 @@ patternProperties: $ref: "types.yaml#/definitions/phandle" # property and node namespace overlaps. Catch both here - "^[a-zA-Z0-9][a-zA-Z0-9,+\\-._]{0,63}$": + "^[a-zA-Z0-9][#a-zA-Z0-9,+\\-._]{0,63}$": type: [object, array, boolean, 'null'] # Anything with a '@' is definitely a node