diff mbox series

[v3,net-next,05/10] dt-bindings: net: dsa: qca8k: utilize shared dsa.yaml

Message ID 20221127224734.885526-6-colin.foster@in-advantage.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series dt-binding preparation for ocelot switches | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 15 of 15 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Colin Foster Nov. 27, 2022, 10:47 p.m. UTC
The dsa.yaml binding contains duplicated bindings for address and size
cells, as well as the reference to dsa-port.yaml. Instead of duplicating
this information, remove the reference to dsa-port.yaml and include the
full reference to dsa.yaml.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Suggested-by: Vladimir Oltean <olteanv@gmail.com>
---

v2 -> v3
  * Remove #address-cells and #size-cells from v2. The examples were
    incorrect and fixed elsewhere.
  * Remove erroneous unevaluatedProperties: true under Ethernet Port.
  * Add back ref: dsa-port.yaml#.

v1 -> v2
  * Add #address-cells and #size-cells to the switch layer. They aren't
    part of dsa.yaml.
  * Add unevaluatedProperties: true to the ethernet-port layer so it can
    correctly read properties from dsa.yaml.

---
 Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Florian Fainelli Nov. 28, 2022, 8:42 p.m. UTC | #1
On 11/27/22 14:47, Colin Foster wrote:
> The dsa.yaml binding contains duplicated bindings for address and size
> cells, as well as the reference to dsa-port.yaml. Instead of duplicating
> this information, remove the reference to dsa-port.yaml and include the
> full reference to dsa.yaml.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> Suggested-by: Vladimir Oltean <olteanv@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Rob Herring Dec. 1, 2022, 10:42 p.m. UTC | #2
On Sun, Nov 27, 2022 at 02:47:29PM -0800, Colin Foster wrote:
> The dsa.yaml binding contains duplicated bindings for address and size
> cells, as well as the reference to dsa-port.yaml. Instead of duplicating
> this information, remove the reference to dsa-port.yaml and include the
> full reference to dsa.yaml.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> Suggested-by: Vladimir Oltean <olteanv@gmail.com>
> ---
> 
> v2 -> v3
>   * Remove #address-cells and #size-cells from v2. The examples were
>     incorrect and fixed elsewhere.
>   * Remove erroneous unevaluatedProperties: true under Ethernet Port.
>   * Add back ref: dsa-port.yaml#.
> 
> v1 -> v2
>   * Add #address-cells and #size-cells to the switch layer. They aren't
>     part of dsa.yaml.
>   * Add unevaluatedProperties: true to the ethernet-port layer so it can
>     correctly read properties from dsa.yaml.
> 
> ---
>  Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> index 6fc9bc985726..93a9ddebcac8 100644
> --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> @@ -66,20 +66,15 @@ properties:
>                   With the legacy mapping the reg corresponding to the internal
>                   mdio is the switch reg with an offset of -1.
>  
> +$ref: "dsa.yaml#"
> +
>  patternProperties:
>    "^(ethernet-)?ports$":
>      type: object
> -    properties:
> -      '#address-cells':
> -        const: 1
> -      '#size-cells':
> -        const: 0
> -
>      patternProperties:
>        "^(ethernet-)?port@[0-6]$":
>          type: object
>          description: Ethernet switch ports
> -
>          $ref: dsa-port.yaml#

So here you need 'unevaluatedProperties: false'.

unevaluatedProperties only applies to the properties defined in a single 
node level, and child nodes properties from 2 schemas can't 'see' each 
other. IOW, what dsa.yaml has in child nodes has no effect on this node. 

>  
>          properties:
> @@ -116,7 +111,7 @@ required:
>    - compatible
>    - reg
>  
> -additionalProperties: true
> +unevaluatedProperties: false

So this has no effect on anything within "^(ethernet-)?port@[0-6]$" and 
below.

Rob
Colin Foster Dec. 2, 2022, 7:31 p.m. UTC | #3
Hi Rob,

On Thu, Dec 01, 2022 at 04:42:40PM -0600, Rob Herring wrote:
> On Sun, Nov 27, 2022 at 02:47:29PM -0800, Colin Foster wrote:
> > The dsa.yaml binding contains duplicated bindings for address and size
> > cells, as well as the reference to dsa-port.yaml. Instead of duplicating
> > this information, remove the reference to dsa-port.yaml and include the
> > full reference to dsa.yaml.
> > 
> > Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> > Suggested-by: Vladimir Oltean <olteanv@gmail.com>
> > ---
> > 
> > v2 -> v3
> >   * Remove #address-cells and #size-cells from v2. The examples were
> >     incorrect and fixed elsewhere.
> >   * Remove erroneous unevaluatedProperties: true under Ethernet Port.
> >   * Add back ref: dsa-port.yaml#.
> > 
> > v1 -> v2
> >   * Add #address-cells and #size-cells to the switch layer. They aren't
> >     part of dsa.yaml.
> >   * Add unevaluatedProperties: true to the ethernet-port layer so it can
> >     correctly read properties from dsa.yaml.
> > 
> > ---
> >  Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 11 +++--------
> >  1 file changed, 3 insertions(+), 8 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> > index 6fc9bc985726..93a9ddebcac8 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> > @@ -66,20 +66,15 @@ properties:
> >                   With the legacy mapping the reg corresponding to the internal
> >                   mdio is the switch reg with an offset of -1.
> >  
> > +$ref: "dsa.yaml#"
> > +
> >  patternProperties:
> >    "^(ethernet-)?ports$":
> >      type: object
> > -    properties:
> > -      '#address-cells':
> > -        const: 1
> > -      '#size-cells':
> > -        const: 0
> > -
> >      patternProperties:
> >        "^(ethernet-)?port@[0-6]$":
> >          type: object
> >          description: Ethernet switch ports
> > -
> >          $ref: dsa-port.yaml#
> 
> So here you need 'unevaluatedProperties: false'.
> 
> unevaluatedProperties only applies to the properties defined in a single 
> node level, and child nodes properties from 2 schemas can't 'see' each 
> other. IOW, what dsa.yaml has in child nodes has no effect on this node. 

I'm buttoning up v4 right now and removing this line deletion.
unevaluatedProperties: false exists under the etherent-port node, just
at the end of the properties list.

Since the etherent-ports node in net/dsa/dsa.yaml has
unevaluatedProperties: false, I understand that isn't necessary here.

> 
> >  
> >          properties:
> > @@ -116,7 +111,7 @@ required:
> >    - compatible
> >    - reg
> >  
> > -additionalProperties: true
> > +unevaluatedProperties: false
> 
> So this has no effect on anything within "^(ethernet-)?port@[0-6]$" and 
> below.
> 
> Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
index 6fc9bc985726..93a9ddebcac8 100644
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
@@ -66,20 +66,15 @@  properties:
                  With the legacy mapping the reg corresponding to the internal
                  mdio is the switch reg with an offset of -1.
 
+$ref: "dsa.yaml#"
+
 patternProperties:
   "^(ethernet-)?ports$":
     type: object
-    properties:
-      '#address-cells':
-        const: 1
-      '#size-cells':
-        const: 0
-
     patternProperties:
       "^(ethernet-)?port@[0-6]$":
         type: object
         description: Ethernet switch ports
-
         $ref: dsa-port.yaml#
 
         properties:
@@ -116,7 +111,7 @@  required:
   - compatible
   - reg
 
-additionalProperties: true
+unevaluatedProperties: false
 
 examples:
   - |