diff mbox series

[v2,14/15] ASoC: dt-bindings: renesas,rsnd.yaml: add common port-def

Message ID 87351wo921.wl-kuninori.morimoto.gx@renesas.com
State Accepted
Commit 289f6e3bdc3f3cf752794be3820b0e5c394b2733
Headers show
Series None | expand

Commit Message

Kuninori Morimoto July 10, 2023, 1:21 a.m. UTC
renesas,rsnd uses both "ports" has "port", and these are very similar.
To avoid duplicated definitions, this patch adds common port-def.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../bindings/sound/renesas,rsnd.yaml          | 38 ++++++++-----------
 1 file changed, 16 insertions(+), 22 deletions(-)

Comments

Rob Herring July 14, 2023, 2:42 p.m. UTC | #1
On Tue, Jul 11, 2023 at 09:00:18AM +0900, Kuninori Morimoto wrote:
> 
> Hi Rob
> 
> Thank you for reviewing
> 
> 
> > > diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
> > > index 8a821dec9526..d9808b130e8d 100644
> > > --- a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
> > > +++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
> > > @@ -9,6 +9,20 @@ title: Renesas R-Car Sound Driver
> > >  maintainers:
> > >    - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > >  
> > > +definitions:
> > 
> > $defs
> 
> Hmm... many drivers are using "definitions" ?

Patches welcome to change them. I don't think it's many (not counting 
types.yaml). Use of "definitions" or "$defs" is an exception.

> This kind of indication is very confusable...

"definitions" was common convention in early json-schema. "$defs" was 
added to the specification to standardize it.

> > >    port:
> > > -    $ref: audio-graph-port.yaml#/definitions/port-base
> > > -    unevaluatedProperties: false
> > > -    patternProperties:
> > > -      "^endpoint(@[0-9a-f]+)?":
> > > -        $ref: audio-graph-port.yaml#/definitions/endpoint-base
> > > -        properties:
> > > -          playback:
> > > -            $ref: /schemas/types.yaml#/definitions/phandle-array
> > > -          capture:
> > > -            $ref: /schemas/types.yaml#/definitions/phandle-array
> > > -        unevaluatedProperties: false
> > > +    $ref: "#/definitions/port-def"
> > 
> > It would be better if users just always used "ports { port {}; };" even 
> > in the single port case.
> 
> "ports" support is added, we can't modify past.

I don't understand. The graph APIs all work the same with or without 
'ports'. Changing the DT shouldn't affect the ABI.

Rob
Rob Herring Aug. 4, 2023, 5:56 p.m. UTC | #2
On Wed, Jul 19, 2023 at 5:36 PM Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
>
> Hi Rob, Mark
>
> > > > > diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
> > > > > index 8a821dec9526..d9808b130e8d 100644
> > > > > --- a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
> > > > > +++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
> > > > > @@ -9,6 +9,20 @@ title: Renesas R-Car Sound Driver
> > > > >  maintainers:
> > > > >    - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > > > >
> > > > > +definitions:
> > > >
> > > > $defs
> > >
> > > Hmm... many drivers are using "definitions" ?
> >
> > Patches welcome to change them. I don't think it's many (not counting
> > types.yaml). Use of "definitions" or "$defs" is an exception.
>
> I will get error if I used "$defs" instead of "definitions", like below.

Are you sure you used $defs?

> There is no error in "definitions" case.
>
> Mark
> Thus, I have no update for remainings (= [11/15] - [15/15]).
>
>
>         > pip3 list | grep jsonschema
>         jsonschema                     4.17.0
>         > pip3 list | grep dtschema
>         dtschema                       2023.6.1
>
>         > make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
>           LINT    Documentation/devicetree/bindings
>           CHKDT   Documentation/devicetree/bindings/processed-schema.json
>         /opt/disk_cd/morimoto/linux/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml:
>         Unresolvable JSON pointer: 'definitions/port-def'

Doesn't look like it. You have a ref to 'definitions/port-def'.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
index 8a821dec9526..d9808b130e8d 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml
@@ -9,6 +9,20 @@  title: Renesas R-Car Sound Driver
 maintainers:
   - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
 
+definitions:
+  port-def:
+    $ref: audio-graph-port.yaml#/definitions/port-base
+    unevaluatedProperties: false
+    patternProperties:
+      "^endpoint(@[0-9a-f]+)?":
+        $ref: audio-graph-port.yaml#/definitions/endpoint-base
+        properties:
+          playback:
+            $ref: /schemas/types.yaml#/definitions/phandle-array
+          capture:
+            $ref: /schemas/types.yaml#/definitions/phandle-array
+        unevaluatedProperties: false
+
 properties:
 
   compatible:
@@ -108,30 +122,10 @@  properties:
     unevaluatedProperties: false
     patternProperties:
       '^port(@[0-9a-f]+)?$':
-        $ref: audio-graph-port.yaml#/definitions/port-base
-        unevaluatedProperties: false
-        patternProperties:
-          "^endpoint(@[0-9a-f]+)?":
-            $ref: audio-graph-port.yaml#/definitions/endpoint-base
-            properties:
-              playback:
-                $ref: /schemas/types.yaml#/definitions/phandle-array
-              capture:
-                $ref: /schemas/types.yaml#/definitions/phandle-array
-            unevaluatedProperties: false
+        $ref: "#/definitions/port-def"
 
   port:
-    $ref: audio-graph-port.yaml#/definitions/port-base
-    unevaluatedProperties: false
-    patternProperties:
-      "^endpoint(@[0-9a-f]+)?":
-        $ref: audio-graph-port.yaml#/definitions/endpoint-base
-        properties:
-          playback:
-            $ref: /schemas/types.yaml#/definitions/phandle-array
-          capture:
-            $ref: /schemas/types.yaml#/definitions/phandle-array
-        unevaluatedProperties: false
+    $ref: "#/definitions/port-def"
 
   rcar_sound,dvc:
     description: DVC subnode.