devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: mmc: renesas,sdhi: add top-level constraints
@ 2024-08-18 17:29 Krzysztof Kozlowski
  2024-08-19 13:38 ` Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-18 17:29 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Magnus Damm, Wolfram Sang, linux-mmc,
	devicetree, linux-kernel, linux-renesas-soc
  Cc: Krzysztof Kozlowski

Properties with variable number of items per each device are expected to
have widest constraints in top-level "properties:" block and further
customized (narrowed) in "if:then:".  Add missing top-level constraints
for clocks.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml b/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
index 1155b1d79df5..6d4a1faa1c4b 100644
--- a/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
+++ b/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
@@ -77,9 +77,13 @@ properties:
     minItems: 1
     maxItems: 3
 
-  clocks: true
+  clocks:
+    minItems: 1
+    maxItems: 4
 
-  clock-names: true
+  clock-names:
+    minItems: 1
+    maxItems: 4
 
   dmas:
     minItems: 4
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] dt-bindings: mmc: renesas,sdhi: add top-level constraints
  2024-08-18 17:29 [PATCH] dt-bindings: mmc: renesas,sdhi: add top-level constraints Krzysztof Kozlowski
@ 2024-08-19 13:38 ` Geert Uytterhoeven
  2024-08-19 17:53   ` Rob Herring
  2024-08-19 17:54 ` Rob Herring (Arm)
  2024-08-20 11:50 ` Ulf Hansson
  2 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2024-08-19 13:38 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Magnus Damm, Wolfram Sang, linux-mmc, devicetree, linux-kernel,
	linux-renesas-soc

Hi Krzysztof,

On Sun, Aug 18, 2024 at 7:29 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
> Properties with variable number of items per each device are expected to
> have widest constraints in top-level "properties:" block and further
> customized (narrowed) in "if:then:".  Add missing top-level constraints
> for clocks.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Thanks for your patch!

> --- a/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
> +++ b/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
> @@ -77,9 +77,13 @@ properties:
>      minItems: 1
>      maxItems: 3
>
> -  clocks: true
> +  clocks:
> +    minItems: 1
> +    maxItems: 4
>
> -  clock-names: true
> +  clock-names:
> +    minItems: 1
> +    maxItems: 4
>
>    dmas:
>      minItems: 4

I am a bit puzzled by all these add-top-level-constraint patches.
E.g. this file already constrains all of them below.

To me, it feels the same as a patch for driver code that would do:

    +   if (param < 16 || param > 512)
    +           return -EINVAL;
    +
        if (hw_variant_a) {
                if (param < 16 || param > 256)
                        return -EINVAL;
                ...
        } else if (hw_variant_b) {
                if (param < 32 || param > 512)
                        return -EINVAL;
                ...
        } else /* hw_variant_c */ {
                if (param < 32 || param > 384)
                        return -EINVAL;
                ...
        }

What's the point?
Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dt-bindings: mmc: renesas,sdhi: add top-level constraints
  2024-08-19 13:38 ` Geert Uytterhoeven
@ 2024-08-19 17:53   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2024-08-19 17:53 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Krzysztof Kozlowski, Ulf Hansson, Krzysztof Kozlowski,
	Conor Dooley, Magnus Damm, Wolfram Sang, linux-mmc, devicetree,
	linux-kernel, linux-renesas-soc

On Mon, Aug 19, 2024 at 03:38:48PM +0200, Geert Uytterhoeven wrote:
> Hi Krzysztof,
> 
> On Sun, Aug 18, 2024 at 7:29 PM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
> > Properties with variable number of items per each device are expected to
> > have widest constraints in top-level "properties:" block and further
> > customized (narrowed) in "if:then:".  Add missing top-level constraints
> > for clocks.
> >
> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> Thanks for your patch!
> 
> > --- a/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
> > +++ b/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
> > @@ -77,9 +77,13 @@ properties:
> >      minItems: 1
> >      maxItems: 3
> >
> > -  clocks: true
> > +  clocks:
> > +    minItems: 1
> > +    maxItems: 4
> >
> > -  clock-names: true
> > +  clock-names:
> > +    minItems: 1
> > +    maxItems: 4
> >
> >    dmas:
> >      minItems: 4
> 
> I am a bit puzzled by all these add-top-level-constraint patches.
> E.g. this file already constrains all of them below.
> 
> To me, it feels the same as a patch for driver code that would do:
> 
>     +   if (param < 16 || param > 512)
>     +           return -EINVAL;
>     +
>         if (hw_variant_a) {
>                 if (param < 16 || param > 256)
>                         return -EINVAL;
>                 ...
>         } else if (hw_variant_b) {
>                 if (param < 32 || param > 512)
>                         return -EINVAL;
>                 ...
>         } else /* hw_variant_c */ {
>                 if (param < 32 || param > 384)
>                         return -EINVAL;
>                 ...
>         }
> 
> What's the point?

if/then schemas can be incomplete and we don't enforce they are missing 
constraints. We could change that, but we'd have to do that everywhere. 
It would make the schemas longer. 

If you have a new chip not yet documented, but matches the fallback 
compatible (as many Renesas bindings have), then you at least 
get constraints within the existing bounds.

The keywords didn't exist when we started out. It is somewhat academic 
because we know what the implementation supports, but it is entirely 
possible a json-schema implementation doesn't support if/then schemas. 
The spec says unknown keywords are ignored.

Rob

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dt-bindings: mmc: renesas,sdhi: add top-level constraints
  2024-08-18 17:29 [PATCH] dt-bindings: mmc: renesas,sdhi: add top-level constraints Krzysztof Kozlowski
  2024-08-19 13:38 ` Geert Uytterhoeven
@ 2024-08-19 17:54 ` Rob Herring (Arm)
  2024-08-20 11:50 ` Ulf Hansson
  2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring (Arm) @ 2024-08-19 17:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Wolfram Sang, Geert Uytterhoeven, Magnus Damm, Ulf Hansson,
	Conor Dooley, devicetree, linux-renesas-soc, linux-kernel,
	Krzysztof Kozlowski, linux-mmc


On Sun, 18 Aug 2024 19:29:23 +0200, Krzysztof Kozlowski wrote:
> Properties with variable number of items per each device are expected to
> have widest constraints in top-level "properties:" block and further
> customized (narrowed) in "if:then:".  Add missing top-level constraints
> for clocks.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dt-bindings: mmc: renesas,sdhi: add top-level constraints
  2024-08-18 17:29 [PATCH] dt-bindings: mmc: renesas,sdhi: add top-level constraints Krzysztof Kozlowski
  2024-08-19 13:38 ` Geert Uytterhoeven
  2024-08-19 17:54 ` Rob Herring (Arm)
@ 2024-08-20 11:50 ` Ulf Hansson
  2 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2024-08-20 11:50 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Geert Uytterhoeven, Magnus Damm, Wolfram Sang, linux-mmc,
	devicetree, linux-kernel, linux-renesas-soc

On Sun, 18 Aug 2024 at 19:29, Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> Properties with variable number of items per each device are expected to
> have widest constraints in top-level "properties:" block and further
> customized (narrowed) in "if:then:".  Add missing top-level constraints
> for clocks.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml b/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
> index 1155b1d79df5..6d4a1faa1c4b 100644
> --- a/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
> +++ b/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
> @@ -77,9 +77,13 @@ properties:
>      minItems: 1
>      maxItems: 3
>
> -  clocks: true
> +  clocks:
> +    minItems: 1
> +    maxItems: 4
>
> -  clock-names: true
> +  clock-names:
> +    minItems: 1
> +    maxItems: 4
>
>    dmas:
>      minItems: 4
> --
> 2.43.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-20 11:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-18 17:29 [PATCH] dt-bindings: mmc: renesas,sdhi: add top-level constraints Krzysztof Kozlowski
2024-08-19 13:38 ` Geert Uytterhoeven
2024-08-19 17:53   ` Rob Herring
2024-08-19 17:54 ` Rob Herring (Arm)
2024-08-20 11:50 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).