Skip to contentSkip to conversation

dt-bindings: hwlock: Convert to dtschema

PATCH In review Siddharth Menon 3 participants 5 messages Feb 18, 2025 – Feb 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: hwlock: Convert to dtschema

From: BiscuitBobby <[email protected]>

Convert the generic hwspinlock bindings to DT schema.
---
This is my first time converting bindings to dt schema, please let me know if I have overlooked anything.

 .../devicetree/bindings/hwlock/hwlock.txt     | 59 -----------------
 .../devicetree/bindings/hwlock/hwlock.yaml    | 65 +++++++++++++++++++
 2 files changed, 65 insertions(+), 59 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.txt
 create mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.yaml
Documentation/devicetree/bindings/hwlock/hwlock.txt deleted +0 -59
deleted file mode 100644
index 085d1f5c916a..000000000000
@@ -1,59 +0,0 @@
-Generic hwlock bindings
-=======================
-
-Generic bindings that are common to all the hwlock platform specific driver
-implementations.
-
-Please also look through the individual platform specific hwlock binding
-documentations for identifying any additional properties specific to that
-platform.
-
-hwlock providers:
-=================
-
-Required properties:
-- #hwlock-cells:        Specifies the number of cells needed to represent a
-                        specific lock.
-
-hwlock users:
-=============
-
-Consumers that require specific hwlock(s) should specify them using the
-property "hwlocks", and an optional "hwlock-names" property.
-
-Required properties:
-- hwlocks:              List of phandle to a hwlock provider node and an
-                        associated hwlock args specifier as indicated by
-                        #hwlock-cells. The list can have just a single hwlock
-                        or multiple hwlocks, with each hwlock represented by
-                        a phandle and a corresponding args specifier.
-
-Optional properties:
-- hwlock-names:         List of hwlock name strings defined in the same order
-                        as the hwlocks, with one name per hwlock. Consumers can
-                        use the hwlock-names to match and get a specific hwlock.
-
-
-1. Example of a node using a single specific hwlock:
-
-The following example has a node requesting a hwlock in the bank defined by
-the node hwlock1. hwlock1 is a hwlock provider with an argument specifier
-of length 1.
-
-	node {
-		...
-		hwlocks = <&hwlock1 2>;
-		...
-	};
-
-2. Example of a node using multiple specific hwlocks:
-
-The following example has a node requesting two hwlocks, a hwlock within
-the hwlock device node 'hwlock1' with #hwlock-cells value of 1, and another
-hwlock within the hwlock device node 'hwlock2' with #hwlock-cells value of 2.
-
-	node {
-		...
-		hwlocks = <&hwlock1 2>, <&hwlock2 0 3>;
-		...
-	};
Documentation/devicetree/bindings/hwlock/hwlock.yaml new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.48.1
#1 lore raw
Quoted 3 lines · Siddharth Menon

From: BiscuitBobby <[email protected]>

Convert the generic hwspinlock bindings to DT schema.

Thank you for your patch. There is something to discuss/improve.

Please run scripts/checkpatch.pl and fix reported warnings. After that, run also scripts/checkpatch.pl --strict and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

Also you must use your full name, not nicknames.

Quoted 9 lines

---
This is my first time converting bindings to dt schema, please let me know if I have overlooked anything.

 .../devicetree/bindings/hwlock/hwlock.txt     | 59 -----------------
 .../devicetree/bindings/hwlock/hwlock.yaml    | 65 +++++++++++++++++++
 2 files changed, 65 insertions(+), 59 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.txt
 create mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.yaml

You leave now incorrect paths in the kernel.

If you decide to convert the generic subsystem binding, you must take extra care and change/fix/update/improve all bindings using it.

Quoted 16 lines
Documentation/devicetree/bindings/hwlock/hwlock.yaml new file +10 -0
new file mode 100644
index 000000000000..2492fdad3c6e
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwlock/hwlock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic Hardware Lock (hwlock)
+
+description: |
+  Generic bindings that are common to all the hwlock platform specific driver

Documentation/devicetree/bindings/hwlock/hwlock.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/hwlock/hwlock.yaml new file +10 -0
+  implementations.
+  Please also look through the individual platform specific hwlock binding
+  documentations for identifying any additional properties specific to that
+  platform.
+
+maintainers:
+  - Bjorn Andersson <[email protected]>
+  - Rob Herring <[email protected]>
+  - Krzysztof Kozlowski <[email protected]>
+  - Conor Dooley <[email protected]>

Subsystem maintainer only.

Documentation/devicetree/bindings/hwlock/hwlock.yaml line 24

Quoted 4 lines
Documentation/devicetree/bindings/hwlock/hwlock.yaml new file +4 -0
+
+properties:
+  $nodename:
+    pattern: "^hwlock(@.*)?"

Why .* in the pattern if you do not anchor it with $?

Documentation/devicetree/bindings/hwlock/hwlock.yaml line 32

Quoted 8 lines
Documentation/devicetree/bindings/hwlock/hwlock.yaml new file +8 -0
+
+  "#hwlock-cells":
+    description: |
+      Specifies the number of cells needed to represent a specific lock.
+    minimum: 1
+
+  hwlocks:
+    description: |

Do not need '|' unless you need to preserve formatting.

Documentation/devicetree/bindings/hwlock/hwlock.yaml line 36

Quoted 4 lines
Documentation/devicetree/bindings/hwlock/hwlock.yaml new file +4 -0
+      List of phandle to a hwlock provider node and an associated hwlock args
+      specifier as indicated by #hwlock-cells. The list can have just a single
+      hwlock or multiple hwlocks, with each hwlock represented by a phandle and
+      a corresponding args specifier.

Missing type, here and other places, unless this is already covered by dtschema? But then why this binding is needed?

Documentation/devicetree/bindings/hwlock/hwlock.yaml line 42

Quoted 6 lines
Documentation/devicetree/bindings/hwlock/hwlock.yaml new file +6 -0
+
+  hwlock-names:
+    description: |
+      List of hwlock name strings defined in the same order as the hwlocks,
+      with one name per hwlock. Consumers can use the hwlock-names to match
+      and get a specific hwlock.

Hm? I don't think you understood the binding. The provider does not have consumer properties. Read again original binding.

Documentation/devicetree/bindings/hwlock/hwlock.yaml line 47

Quoted 5 lines
Documentation/devicetree/bindings/hwlock/hwlock.yaml new file +5 -0
+
+patternProperties:
+  "^hwlock@[0-9a-f]+$":
+    type: object
+    description: Hardware lock provider node

This makes no sense. hwlock within hwlock?

Documentation/devicetree/bindings/hwlock/hwlock.yaml line 55

Quoted 8 lines
Documentation/devicetree/bindings/hwlock/hwlock.yaml new file +8 -0
+
+required:
+  - "#hwlock-cells"
+
+additionalProperties: true
+
+examples:
+  # Example 1: A node using a single specific hwlock

Drop all examples, not really useful.

Best regards,
Krzysztof

#2 lore raw
In reply to Siddharth Menon
Quoted 6 lines · Siddharth Menon

From: BiscuitBobby <[email protected]>

Convert the generic hwspinlock bindings to DT schema.
---
This is my first time converting bindings to dt schema, please let me know if I have overlooked anything.

Quoted 6 lines
 .../devicetree/bindings/hwlock/hwlock.txt     | 59 -----------------
 .../devicetree/bindings/hwlock/hwlock.yaml    | 65 +++++++++++++++++++
 2 files changed, 65 insertions(+), 59 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.txt
 create mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):
Warning: Documentation/devicetree/bindings/hwlock/ti,omap-hwspinlock.yaml references a file that doesn't exist: Documentation/devicetree/bindings/hwlock/hwlock.txt Documentation/devicetree/bindings/hwlock/ti,omap-hwspinlock.yaml: Documentation/devicetree/bindings/hwlock/hwlock.txt

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

maintainer
#3 lore raw
In reply to Siddharth Menon
Quoted 11 lines · Siddharth Menon

From: BiscuitBobby <[email protected]>

Convert the generic hwspinlock bindings to DT schema.
---
This is my first time converting bindings to dt schema, please let me know if I have overlooked anything.

 .../devicetree/bindings/hwlock/hwlock.txt     | 59 -----------------
 .../devicetree/bindings/hwlock/hwlock.yaml    | 65 +++++++++++++++++++
 2 files changed, 65 insertions(+), 59 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.txt
 create mode 100644 Documentation/devicetree/bindings/hwlock/hwlock.yaml

The consumer side lives in dtschema already. Please add the provider side there too. Patches to [email protected] or GH PR are fine.

For the descriptions, you'll need to relicense the text in hwlock.txt to dual GPL/BSD. You will need TI's permission for that.

Rob

#4 lore raw
Quoted 4 lines · Rob Herring

The consumer side lives in dtschema already. Please add the provider side there too. Patches to [email protected] or GH PR are fine.

Thank you and Krzysztof for the feedback, I shall address the issues in the next patch set.

Quoted 2 lines

For the descriptions, you'll need to relicense the text in hwlock.txt to dual GPL/BSD. You will need TI's permission for that.

Regarding the relicensing, should I first submit a patch to relicense the hwlock.txt
binding, then follow up with a patch to replace it with the YAML file and correct
incorrect paths?

Regards,
Siddharth Menon