Re: [PATCH] dt-bindings: net: Add missing properties used in examples

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 7, 2021 at 2:33 AM Thierry Reding <thierry.reding@xxxxxxxxx> wrote:
>
> On Mon, Dec 06, 2021 at 11:41:52AM -0600, Rob Herring wrote:
> > With 'unevaluatedProperties' support implemented, the following warnings
> > are generated in the net bindings:
> >
> > Documentation/devicetree/bindings/net/actions,owl-emac.example.dt.yaml: ethernet@b0310000: Unevaluated properties are not allowed ('mdio' was unexpected)
> > Documentation/devicetree/bindings/net/intel,dwmac-plat.example.dt.yaml: ethernet@3a000000: Unevaluated properties are not allowed ('snps,pbl', 'mdio0' were unexpected)
> > Documentation/devicetree/bindings/net/qca,ar71xx.example.dt.yaml: ethernet@19000000: Unevaluated properties are not allowed ('qca,ethcfg' was unexpected)
> > Documentation/devicetree/bindings/net/qca,ar71xx.example.dt.yaml: ethernet@1a000000: Unevaluated properties are not allowed ('mdio' was unexpected)
> > Documentation/devicetree/bindings/net/stm32-dwmac.example.dt.yaml: ethernet@40028000: Unevaluated properties are not allowed ('reg-names', 'snps,pbl' were unexpected)
> > Documentation/devicetree/bindings/net/ti,cpsw-switch.example.dt.yaml: mdio@1000: Unevaluated properties are not allowed ('clocks', 'clock-names' were unexpected)
> > Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.example.dt.yaml: mdio@f00: Unevaluated properties are not allowed ('clocks', 'clock-names' were unexpected)
> >
> > Add the missing properties/nodes as necessary.
> >
> > Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
> > Cc: Jakub Kicinski <kuba@xxxxxxxxxx>
> > Cc: "Andreas Färber" <afaerber@xxxxxxx>
> > Cc: Manivannan Sadhasivam <mani@xxxxxxxxxx>
> > Cc: Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>
> > Cc: Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>
> > Cc: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@xxxxxxxxxxxxx>
> > Cc: Cristian Ciocaltea <cristian.ciocaltea@xxxxxxxxx>
> > Cc: "G. Jaya Kumaran" <vineetha.g.jaya.kumaran@xxxxxxxxx>
> > Cc: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> > Cc: Christophe Roullier <christophe.roullier@xxxxxxxxxxx>
> > Cc: Grygorii Strashko <grygorii.strashko@xxxxxx>
> > Cc: netdev@xxxxxxxxxxxxxxx
> > Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> > Cc: linux-actions@xxxxxxxxxxxxxxxxxxx
> > Cc: linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> > ---
> >  .../devicetree/bindings/net/actions,owl-emac.yaml          | 3 +++
> >  .../devicetree/bindings/net/intel,dwmac-plat.yaml          | 2 +-
> >  Documentation/devicetree/bindings/net/qca,ar71xx.yaml      | 5 ++++-
> >  Documentation/devicetree/bindings/net/stm32-dwmac.yaml     | 6 ++++++
> >  Documentation/devicetree/bindings/net/ti,davinci-mdio.yaml | 7 +++++++
> >  .../devicetree/bindings/net/toshiba,visconti-dwmac.yaml    | 5 ++++-
> >  6 files changed, 25 insertions(+), 3 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/net/actions,owl-emac.yaml b/Documentation/devicetree/bindings/net/actions,owl-emac.yaml
> > index 1626e0a821b0..e9c0d6360e74 100644
> > --- a/Documentation/devicetree/bindings/net/actions,owl-emac.yaml
> > +++ b/Documentation/devicetree/bindings/net/actions,owl-emac.yaml
> > @@ -51,6 +51,9 @@ properties:
> >      description:
> >        Phandle to the device containing custom config.
> >
> > +  mdio:
> > +    type: object
>
> In one of the conversions I've been working on, I've used this construct
> for the mdio node:
>
>         mdio:
>           $ref: mdio.yaml
>
> In the cases here this may not be necessary because we could also match
> on the compatible string, but for the example that I've been working on
> there is no compatible string for the MDIO bus, so that's not an option.

$nodename is also used to match if there's no compatible, so the above
is somewhat redundant (the schema will be applied twice). Matching on
the node name is useful where we don't have a specific schema in place
or if you want to validate DT files with just that schema, but that's
becoming less useful as we get schemas for everything.

Thinking about this some more, what we need for these is:

mdio:
  $ref: mdio.yaml
  unevaluatedProperties: false

Because mdio.yaml on its own is incomplete and allows for additional
properties. That ensures all the properties are documented and no
extra properties are present.

> On the other hand, it looks like the snps,dwmac-mdio that the examples
> here use don't end up including mdio.yaml, so no validation (or rather
> only very limited validation) will be performed on their properties and
> children.

There is more validation than you were thinking, but it also needs the
above added.

Rob




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux