Re: [PATCH] dt-bindings: Drop redundant minItems/maxItems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH] dt-bindings: Drop redundant minItems/maxItems
- From: Rob Herring <robh@xxxxxxxxxx>
- Date: Tue, 22 Jun 2021 07:43:37 -0600
- Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" <devicetree@xxxxxxxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, "open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)" <linux-ide@xxxxxxxxxxxxxxx>, linux-clk <linux-clk@xxxxxxxxxxxxxxx>, Linux ARM <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, Linux Crypto Mailing List <linux-crypto@xxxxxxxxxxxxxxx>, DRI Development <dri-devel@xxxxxxxxxxxxxxxxxxxxx>, dmaengine <dmaengine@xxxxxxxxxxxxxxx>, Linux I2C <linux-i2c@xxxxxxxxxxxxxxx>, "open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@xxxxxxxxxxxxxxx>, ALSA Development Mailing List <alsa-devel@xxxxxxxxxxxxxxxx>, Linux IOMMU <iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx>, Linux Media Mailing List <linux-media@xxxxxxxxxxxxxxx>, Linux MMC List <linux-mmc@xxxxxxxxxxxxxxx>, netdev <netdev@xxxxxxxxxxxxxxx>, linux-can@xxxxxxxxxxxxxxx, linux-pci <linux-pci@xxxxxxxxxxxxxxx>, linux-phy@xxxxxxxxxxxxxxxxxxx, "open list:GPIO SUBSYSTEM" <linux-gpio@xxxxxxxxxxxxxxx>, Linux PWM List <linux-pwm@xxxxxxxxxxxxxxx>, "open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM" <linux-remoteproc@xxxxxxxxxxxxxxx>, linux-riscv <linux-riscv@xxxxxxxxxxxxxxxxxxx>, "open list:REAL TIME CLOCK (RTC) SUBSYSTEM" <linux-rtc@xxxxxxxxxxxxxxx>, "open list:SERIAL DRIVERS" <linux-serial@xxxxxxxxxxxxxxx>, linux-spi <linux-spi@xxxxxxxxxxxxxxx>, Linux PM list <linux-pm@xxxxxxxxxxxxxxx>, USB list <linux-usb@xxxxxxxxxxxxxxx>, Linux Watchdog Mailing List <linux-watchdog@xxxxxxxxxxxxxxx>, Jens Axboe <axboe@xxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>, Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, David Airlie <airlied@xxxxxxxx>, Daniel Vetter <daniel@xxxxxxxx>, Vinod Koul <vkoul@xxxxxxxxxx>, Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>, Kamal Dasu <kdasu.kdev@xxxxxxxxx>, Jonathan Cameron <jic23@xxxxxxxxxx>, Lars-Peter Clausen <lars@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Marc Zyngier <maz@xxxxxxxxxx>, Joerg Roedel <joro@xxxxxxxxxx>, Jassi Brar <jassisinghbrar@xxxxxxxxx>, Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>, Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Wolfgang Grandegger <wg@xxxxxxxxxxxxxx>, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>, Andrew Lunn <andrew@xxxxxxx>, Vivien Didelot <vivien.didelot@xxxxxxxxx>, Vladimir Oltean <olteanv@xxxxxxxxx>, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, Kishon Vijay Abraham I <kishon@xxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxx>, Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>, Lee Jones <lee.jones@xxxxxxxxxx>, Ohad Ben-Cohen <ohad@xxxxxxxxxx>, Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>, Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>, Paul Walmsley <paul.walmsley@xxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Albert Ou <aou@xxxxxxxxxxxxxxxxx>, Alessandro Zummo <a.zummo@xxxxxxxxxxxx>, Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Zhang Rui <rui.zhang@xxxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>, Wim Van Sebroeck <wim@xxxxxxxxxxxxxxxxxx>, Guenter Roeck <linux@xxxxxxxxxxxx>
- In-reply-to: <CAMuHMdUGXu8yj3JWKwM8mt7axkrzGMiowC1t0PHrbpxRCBME3w@mail.gmail.com>
- References: <20210615191543.1043414-1-robh@kernel.org> <CAMuHMdUGXu8yj3JWKwM8mt7axkrzGMiowC1t0PHrbpxRCBME3w@mail.gmail.com>
On Tue, Jun 22, 2021 at 2:17 AM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>
> Hi Rob,
>
> On Tue, Jun 15, 2021 at 9:16 PM Rob Herring <robh@xxxxxxxxxx> wrote:
> > 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.
>
> > Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
>
> > --- 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
[Index of Archives]
[Linux Kernel]
[Linux ARM (vger)]
[Linux ARM MSM]
[Linux Omap]
[Linux Arm]
[Linux Tegra]
[Fedora ARM]
[Linux for Samsung SOC]
[eCos]
[Linux Fastboot]
[Gcc Help]
[Git]
[DCCP]
[IETF Announce]
[Security]
[Linux MIPS]
[Yosemite Campsites]
|