Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta-schemas: Allow '#' anywhere in required DT property names #116

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

l1k
Copy link

@l1k l1k commented Nov 18, 2023

Commit 0e28a44 ("meta-schemas: Allow '#' anywhere is DT property names") amended the propertyNames regex to allow names such as marvell,#interrupts.

Make the same amendment to the required regex for consistency to avoid errors like:

  Documentation/devicetree/bindings/security/tpm/ibm,vtpm.yaml: required:4: 'ibm,#dma-address-cells' does not match '^([a-zA-Z#][a-zA-Z0-9,+\\-._@]{0,63}|\\$nodename)$'
  hint: 'required' must be valid DT property or node names
  from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#

l1k added 2 commits November 18, 2023 19:50
Commit 0e28a44 ("meta-schemas: Allow '#' anywhere is DT property
names") amended the 'propertyNames' regex to allow names such as
'marvell,#interrupts'.

Make the same amendment to the 'required' regex for consistency to avoid
errors like:

  Documentation/devicetree/bindings/security/tpm/ibm,vtpm.yaml: required:4: 'ibm,#dma-address-cells' does not match '^([a-zA-Z#][a-zA-Z0-9,+\\-._@]{0,63}|\\$nodename)$'
  hint: 'required' must be valid DT property or node names
  from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#

Signed-off-by: Lukas Wunner <[email protected]>
Commit 0e28a44 ("meta-schemas: Allow '#' anywhere is DT property
names") amended the 'propertyNames' regex to allow names such as
'marvell,#interrupts'.

Make the same amendment to the allowed patternProperties for consistency
to avoid errors like:

  Documentation/devicetree/bindings/tpm/ibm,vtpm.example.dtb: vtpm@30000003: 'ibm,#dma-address-cells', 'ibm,#dma-size-cells' do not match any of the regexes: '.*-names$', '.*-supply$', '^#.*-cells$', '^#[a-zA-Z0-9,+\\-._]{0,63}$', '^[a-zA-Z0-9][a-zA-Z0-9,+\\-._]{0,63}$', '^[a-zA-Z0-9][a-zA-Z0-9,+\\-._]{0,63}@[0-9a-fA-F]+(,[0-9a-fA-F]+)*$', '^__.*__$', 'pinctrl-[0-9]+'
  from schema $id: http://devicetree.org/schemas/dt-core.yaml#

Signed-off-by: Lukas Wunner <[email protected]>
@@ -74,7 +74,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}$":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think '#' is allowed in node names. Or if it is, I don't think there are any cases of it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the code comment says, the regex applies both to property as well as node names.

In this case, the change is required for property names, not node names. As the commit message explains, I'm having to deal with ibm,#dma-address-cells and ibm,#dma-size-cells properties which the regex currently doesn't allow. Those properties are defined in Documentation/devicetree/bindings/security/tpm/ibmvtpm.txt. I am converting that file to DT schema per your request, see here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, you are right.

@robherring robherring merged commit 6780665 into devicetree-org:main Nov 21, 2023
6 checks passed
@l1k l1k deleted the required-with-hash branch November 21, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants