Re: [PATCH net-next v4 1/7] dt-bindings: net: dsa: Require ports or ethernet-ports
From: Conor Dooley
Date: Thu Oct 19 2023 - 08:33:15 EST
On Thu, Oct 19, 2023 at 01:28:27PM +0100, Russell King (Oracle) wrote:
> On Thu, Oct 19, 2023 at 01:03:41PM +0100, Conor Dooley wrote:
> > On Wed, Oct 18, 2023 at 05:32:48AM -0500, Rob Herring wrote:
> > >
> > > On Wed, 18 Oct 2023 11:03:40 +0200, Linus Walleij wrote:
> > > > Bindings using dsa.yaml#/$defs/ethernet-ports specify that
> > > > a DSA switch node need to have a ports or ethernet-ports
> > > > subnode, and that is actually required, so add requirements
> > > > using oneOf.
> > > >
> > > > Suggested-by: Rob Herring <robh@xxxxxxxxxx>
> > > > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> > > > ---
> > > > Documentation/devicetree/bindings/net/dsa/dsa.yaml | 6 ++++++
> > > > 1 file changed, 6 insertions(+)
> > > >
> > >
> > > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> > >
> > > yamllint warnings/errors:
> > > ./Documentation/devicetree/bindings/net/dsa/dsa.yaml:60:7: [warning] wrong indentation: expected 8 but found 6 (indentation)
> > > ./Documentation/devicetree/bindings/net/dsa/dsa.yaml:62:7: [warning] wrong indentation: expected 8 but found 6 (indentation)
> > >
> > > dtschema/dtc warnings/errors:
> > > Traceback (most recent call last):
> > > File "/usr/local/bin/dt-doc-validate", line 64, in <module>
> > > ret |= check_doc(f)
> > > ^^^^^^^^^^^^
> > > File "/usr/local/bin/dt-doc-validate", line 32, in check_doc
> > > for error in sorted(dtsch.iter_errors(), key=lambda e: e.linecol):
> > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > File "/usr/local/lib/python3.11/dist-packages/dtschema/schema.py", line 125, in iter_errors
> > > self.annotate_error(scherr, meta_schema, scherr.schema_path)
> > > File "/usr/local/lib/python3.11/dist-packages/dtschema/schema.py", line 104, in annotate_error
> > > schema = schema[p]
> > > ~~~~~~^^^
> > > KeyError: 'type'
> >
> > Locally, on an older version of dt-schema, I see
> > /stuff/linux-dt/Documentation/devicetree/bindings/net/dsa/dsa.yaml: $defs: 'oneOf' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
> > hint: A json-schema keyword was found in $defs key.
> > from schema $id: http://devicetree.org/meta-schemas/core.yaml#
> > /stuff/linux-dt/Documentation/devicetree/bindings/net/dsa/dsa.yaml: $defs:oneOf: [{'required': ['ports']}, {'required': ['ethernet-ports']}] is not of type 'object'
> > hint: $defs entries must contain schemas
> > from schema $id: http://devicetree.org/meta-schemas/core.yaml#
> > SCHEMA Documentation/devicetree/bindings/processed-schema.json
> >
> > On the latest version I see the error from the bot.
> >
> > Doing
> > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > index bd6948e4fd9e..25e5950d51ae 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > @@ -55,10 +55,10 @@ $defs:
> > $ref: dsa-port.yaml#
> > unevaluatedProperties: false
> >
> > - oneOf:
> > - - required:
> > - - ports
> > - - required:
> > - - ethernet-ports
> > +oneOf:
> > + - required:
> > + - ports
> > + - required:
> > + - ethernet-ports
> >
> > ...
> >
> > resolves both issues, but the older version of dt-schema definitely had
> > better error reporting in this case!
>
> And now I'm even more confused... your example in your other reply had
> six spaces before "- ports" and "- ethernet-ports" but here you're
> using four spaces.
Sorry! I thought it would be less confusing to provide a diff that
resolved one issue only.
Attachment:
signature.asc
Description: PGP signature