Thread (15 messages) 15 messages, 13 authors, 2021-06-22

Re: [PATCH] dt-bindings: Drop redundant minItems/maxItems

From: Rob Herring <robh@kernel.org>
Date: 2021-06-22 13:43:59
Also in: alsa-devel, dmaengine, dri-devel, linux-can, linux-clk, linux-devicetree, linux-gpio, linux-i2c, linux-ide, linux-iio, linux-iommu, linux-media, linux-mmc, linux-pci, linux-phy, linux-pm, linux-pwm, linux-remoteproc, linux-riscv, linux-rtc, linux-serial, linux-spi, linux-usb, linux-watchdog, lkml, netdev

On Tue, Jun 22, 2021 at 2:17 AM Geert Uytterhoeven [off-list ref] wrote:
Hi Rob,

On Tue, Jun 15, 2021 at 9:16 PM Rob Herring [off-list ref] wrote:
quoted
If a property has an 'items' list, then a 'minItems' or 'maxItems' with the
same size as the list is redundant and can be dropped. Note that is DT
schema specific behavior and not standard json-schema behavior. The tooling
will fixup the final schema adding any unspecified minItems/maxItems.

This condition is partially checked with the meta-schema already, but
only if both 'minItems' and 'maxItems' are equal to the 'items' length.
An improved meta-schema is pending.
quoted
Signed-off-by: Rob Herring <robh@kernel.org>
quoted
--- a/Documentation/devicetree/bindings/net/stm32-dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/stm32-dwmac.yaml
@@ -46,7 +46,6 @@ properties:

   clocks:
     minItems: 3
-    maxItems: 5
     items:
       - description: GMAC main clock
       - description: MAC TX clock
While resolving the conflict with commit fea99822914039c6
("dt-bindings: net: document ptp_ref clk in dwmac") in soc/for-next,
I noticed the following construct for clock-names:

  clock-names:
    minItems: 3
    maxItems: 6
    contains:
      enum:
        - stmmaceth
        - mac-clk-tx
        - mac-clk-rx
        - ethstp
        - eth-ck
        - ptp_ref

Should this use items instead of enum, and drop maxItems, or is this
a valid construct to support specifying the clocks in random order?
If the latter, it does mean that the order of clock-names may not
match the order of the clock descriptions.
'contains' is true if one or more entries match the strings. So it is
really saying one of these is required. That's not really much of a
constraint. There's 'minContains' and 'maxContains' in newer
json-schema versions (not yet supported) that could add some
constraints if there has to be at least N entries from contains. An
'items' schema (as opposed to a list) would say all items have to
match one of the strings. I'm sure that's too strict.

TLDR: clocks for this binding are a mess and the above is probably all
we can do here.

Rob
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help