diff mbox series

[05/19] dt-bindings: bluetooth: realtek: Switch to unevaluatedProperties

Message ID 20210114113538.1233933-5-maxime@cerno.tech (mailing list archive)
State New, archived
Headers show
Series [01/19] dt-bindings: sunxi: Fix the pinecube compatible | expand

Commit Message

Maxime Ripard Jan. 14, 2021, 11:35 a.m. UTC
additionalProperties prevent any property not explicitly defined in the
binding to be used. Yet, some serial properties like max-speed are valid
and validated through the serial/serial.yaml binding.

Let's change additionalProperties to unevaluatedProperties to avoid
spurious warnings.

Cc: Alistair Francis <alistair@alistair23.me>
Cc: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 Documentation/devicetree/bindings/net/realtek-bluetooth.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jernej Škrabec Jan. 14, 2021, 8:14 p.m. UTC | #1
Dne četrtek, 14. januar 2021 ob 12:35:24 CET je Maxime Ripard napisal(a):
> additionalProperties prevent any property not explicitly defined in the
> binding to be used. Yet, some serial properties like max-speed are valid
> and validated through the serial/serial.yaml binding.
> 
> Let's change additionalProperties to unevaluatedProperties to avoid
> spurious warnings.
> 
> Cc: Alistair Francis <alistair@alistair23.me>
> Cc: Vasily Khoruzhick <anarsoul@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Jernej Skrabec <jernej.skrabec@siol.net>

Best regards,
Jernej
Rob Herring Jan. 14, 2021, 10:54 p.m. UTC | #2
On Thu, 14 Jan 2021 12:35:24 +0100, Maxime Ripard wrote:
> additionalProperties prevent any property not explicitly defined in the
> binding to be used. Yet, some serial properties like max-speed are valid
> and validated through the serial/serial.yaml binding.
> 
> Let's change additionalProperties to unevaluatedProperties to avoid
> spurious warnings.
> 
> Cc: Alistair Francis <alistair@alistair23.me>
> Cc: Vasily Khoruzhick <anarsoul@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  Documentation/devicetree/bindings/net/realtek-bluetooth.yaml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

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

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml: 'additionalProperties' is a required property
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml: ignoring, error in schema: 
warning: no schema found in file: ./Documentation/devicetree/bindings/net/realtek-bluetooth.yaml

See https://patchwork.ozlabs.org/patch/1426311

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

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.
Rob Herring Jan. 15, 2021, 1:37 a.m. UTC | #3
On Thu, Jan 14, 2021 at 12:35:24PM +0100, Maxime Ripard wrote:
> additionalProperties prevent any property not explicitly defined in the
> binding to be used. Yet, some serial properties like max-speed are valid
> and validated through the serial/serial.yaml binding.
> 
> Let's change additionalProperties to unevaluatedProperties to avoid
> spurious warnings.
> 
> Cc: Alistair Francis <alistair@alistair23.me>
> Cc: Vasily Khoruzhick <anarsoul@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  Documentation/devicetree/bindings/net/realtek-bluetooth.yaml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml b/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
> index 4f485df69ac3..f4d4969d87f4 100644
> --- a/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
> +++ b/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
> @@ -37,7 +37,7 @@ properties:
>  required:
>    - compatible
>  
> -additionalProperties: false
> +unevaluatedProperties: false

This would still fail because the serial schema is applied to the parent 
and this schema is applied to the child node. It's a common problem for 
how we've done bus schemas. We'd need to split them into 2 schemas and 
reference the child schema here. I'd rather not do that here because 
then we'd apply the schema twice assuming we keep bus schemas also 
applying the child schemas (which is good at least until we have schemas 
for *all* possible child devices).

We've handled this in other cases by just doing 'max-speed: true' here.

Rob
Maxime Ripard Jan. 18, 2021, 10:15 a.m. UTC | #4
Hi Rob,

On Thu, Jan 14, 2021 at 07:37:14PM -0600, Rob Herring wrote:
> On Thu, Jan 14, 2021 at 12:35:24PM +0100, Maxime Ripard wrote:
> > additionalProperties prevent any property not explicitly defined in the
> > binding to be used. Yet, some serial properties like max-speed are valid
> > and validated through the serial/serial.yaml binding.
> > 
> > Let's change additionalProperties to unevaluatedProperties to avoid
> > spurious warnings.
> > 
> > Cc: Alistair Francis <alistair@alistair23.me>
> > Cc: Vasily Khoruzhick <anarsoul@gmail.com>
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > ---
> >  Documentation/devicetree/bindings/net/realtek-bluetooth.yaml | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml b/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
> > index 4f485df69ac3..f4d4969d87f4 100644
> > --- a/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
> > +++ b/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
> > @@ -37,7 +37,7 @@ properties:
> >  required:
> >    - compatible
> >  
> > -additionalProperties: false
> > +unevaluatedProperties: false
> 
> This would still fail because the serial schema is applied to the parent 
> and this schema is applied to the child node. It's a common problem for 
> how we've done bus schemas. We'd need to split them into 2 schemas and 
> reference the child schema here. I'd rather not do that here because 
> then we'd apply the schema twice assuming we keep bus schemas also 
> applying the child schemas (which is good at least until we have schemas 
> for *all* possible child devices).

I couldn't find what requires additionalProperties in the meta-schemas,
could you point me to what enforces it?

> We've handled this in other cases by just doing 'max-speed: true' here.

I will do that then, thanks!
Maxime
Rob Herring Jan. 22, 2021, 2:40 p.m. UTC | #5
On Mon, Jan 18, 2021 at 4:15 AM Maxime Ripard <maxime@cerno.tech> wrote:
>
> Hi Rob,
>
> On Thu, Jan 14, 2021 at 07:37:14PM -0600, Rob Herring wrote:
> > On Thu, Jan 14, 2021 at 12:35:24PM +0100, Maxime Ripard wrote:
> > > additionalProperties prevent any property not explicitly defined in the
> > > binding to be used. Yet, some serial properties like max-speed are valid
> > > and validated through the serial/serial.yaml binding.
> > >
> > > Let's change additionalProperties to unevaluatedProperties to avoid
> > > spurious warnings.
> > >
> > > Cc: Alistair Francis <alistair@alistair23.me>
> > > Cc: Vasily Khoruzhick <anarsoul@gmail.com>
> > > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > > ---
> > >  Documentation/devicetree/bindings/net/realtek-bluetooth.yaml | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml b/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
> > > index 4f485df69ac3..f4d4969d87f4 100644
> > > --- a/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
> > > +++ b/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
> > > @@ -37,7 +37,7 @@ properties:
> > >  required:
> > >    - compatible
> > >
> > > -additionalProperties: false
> > > +unevaluatedProperties: false
> >
> > This would still fail because the serial schema is applied to the parent
> > and this schema is applied to the child node. It's a common problem for
> > how we've done bus schemas. We'd need to split them into 2 schemas and
> > reference the child schema here. I'd rather not do that here because
> > then we'd apply the schema twice assuming we keep bus schemas also
> > applying the child schemas (which is good at least until we have schemas
> > for *all* possible child devices).
>
> I couldn't find what requires additionalProperties in the meta-schemas,
> could you point me to what enforces it?

https://github.com/devicetree-org/dt-schema/commit/14db51af82b0ab52f4a69f9aaa86726087b3022a

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml b/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
index 4f485df69ac3..f4d4969d87f4 100644
--- a/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
+++ b/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml
@@ -37,7 +37,7 @@  properties:
 required:
   - compatible
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |