From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56A3CC433F5 for ; Wed, 19 Jan 2022 15:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242595AbiASP3R (ORCPT ); Wed, 19 Jan 2022 10:29:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239385AbiASP3Q (ORCPT ); Wed, 19 Jan 2022 10:29:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1756EC061574; Wed, 19 Jan 2022 07:29:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C9019B819A8; Wed, 19 Jan 2022 15:29:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4752AC340E1; Wed, 19 Jan 2022 15:29:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642606153; bh=eiP3xCZsCy88f8i33Qm5tHFJtlYCUAmvYn1cMS/h6LE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=a1WhpjxBW76ppWC5NPQu3gcXaPudaJQcMYu2CBoHZ0XQiZo/7ksRdpxkZb91tdu/w +nmtdV0f3zs9tqwtd8c50aA64/Ghdigk7DPTH3eWsqjgkDk6YNoqW70R1VqwNPf77P BxrASO6fJWADBfklho94SpUV+Ns3dcYvuMvy4eCWVkknJIXIyILdgA1+l6bEOq5BPM sPDrnZ0J/9ZK8VnsQjMahl6rC5G+rAdOASApyChfeuiQW7s8gusxthFDqzqSeSvO82 eulFdXsOtsCS+H6JFNGTDoU8tVkv5qEUuEiR6BZvxVRmZz+/nzsl3+8dBQulQ44ZKx 2dUxK8S+SUplw== Received: by mail-ed1-f42.google.com with SMTP id c24so11395914edy.4; Wed, 19 Jan 2022 07:29:13 -0800 (PST) X-Gm-Message-State: AOAM531beTrn6sMtXhlbguo8Oy7wLeyu7aIrn3R0voTzTgA6NoyXcXks d/JEEUPpBqsok1jSBhZdsjj0EX0pdkTavG3QQw== X-Google-Smtp-Source: ABdhPJyIYkyo1vqpmGZeQ86/fG6wkTZGxnD2kYhf8PsblQjCHqdJn557iPYrUwhbvXoPPN23Wd86PLfRtc/FtNJz2Yw= X-Received: by 2002:a17:906:7801:: with SMTP id u1mr8098133ejm.82.1642606151522; Wed, 19 Jan 2022 07:29:11 -0800 (PST) MIME-Version: 1.0 References: <20220119015038.2433585-1-robh@kernel.org> <20220119103542.el3yuqds6ihpkthn@skbuf> In-Reply-To: <20220119103542.el3yuqds6ihpkthn@skbuf> From: Rob Herring Date: Wed, 19 Jan 2022 09:28:59 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dt-bindings: Improve phandle-array schemas To: Vladimir Oltean Cc: devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Damien Le Moal , Herbert Xu , "David S. Miller" , Chun-Kuang Hu , Philipp Zabel , Laurent Pinchart , Kieran Bingham , Vinod Koul , Georgi Djakov , Thomas Gleixner , Marc Zyngier , Joerg Roedel , Lee Jones , Daniel Thompson , Jingoo Han , Pavel Machek , Mauro Carvalho Chehab , Krzysztof Kozlowski , Jakub Kicinski , Wolfgang Grandegger , Marc Kleine-Budde , Andrew Lunn , Vivien Didelot , Florian Fainelli , Kalle Valo , Viresh Kumar , Stephen Boyd , Kishon Vijay Abraham I , Linus Walleij , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Sebastian Reichel , Mark Brown , Mathieu Poirier , Daniel Lezcano , Zhang Rui , Greg Kroah-Hartman , Thierry Reding , Jonathan Hunter , Sudeep Holla , Geert Uytterhoeven , "open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)" , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , dri-devel , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , "open list:THERMAL" , Linux IOMMU , Linux LED Subsystem , Linux Media Mailing List , netdev , linux-can@vger.kernel.org, linux-wireless , "open list:GENERIC PHY FRAMEWORK" , "open list:GPIO SUBSYSTEM" , linux-riscv@lists.infradead.org, linux-remoteproc@vger.kernel.org, alsa-devel@alsa-project.org, linux-usb@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org On Wed, Jan 19, 2022 at 4:35 AM Vladimir Oltean wrote: > > On Tue, Jan 18, 2022 at 07:50:38PM -0600, Rob Herring wrote: > > The 'phandle-array' type is a bit ambiguous. It can be either just an > > array of phandles or an array of phandles plus args. Many schemas for > > phandle-array properties aren't clear in the schema which case applies > > though the description usually describes it. > > > > The array of phandles case boils down to needing: > > > > items: > > maxItems: 1 > > > > The phandle plus args cases should typically take this form: > > > > items: > > - items: > > - description: A phandle > > - description: 1st arg cell > > - description: 2nd arg cell > > > > With this change, some examples need updating so that the bracketing of > > property values matches the schema. > > --- > (...) > > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > index 702df848a71d..c504feeec6db 100644 > > --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > @@ -34,6 +34,8 @@ properties: > > full routing information must be given, not just the one hop > > routes to neighbouring switches > > $ref: /schemas/types.yaml#/definitions/phandle-array > > + items: > > + maxItems: 1 > > > > ethernet: > > description: > > For better or worse, the mainline cases of this property all take the > form of: > > arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts > link = <&switch1port9 &switch2port9>; > link = <&switch1port10 &switch0port10>; > arch/arm/boot/dts/vf610-zii-dev-rev-b.dts > link = <&switch1port6 > &switch2port9>; > link = <&switch1port5 > &switch0port5>; > arch/arm/boot/dts/vf610-zii-scu4-aib.dts > link = <&switch1port10 > &switch3port10 > &switch2port10>; > link = <&switch3port10 > &switch2port10>; > link = <&switch1port9 > &switch0port10>; > > So not really an array of phandles. Either form is an array. The DT yaml encoding maintains the bracketing, so how the schema is defined matters. To some extent the tools will process the schema to support both forms of bracketing, but this has turned out to be fragile and just doesn't work for phandle arrays. I'm working on further changes that will get rid of the yaml encoded DT format and validate DTB files directly. These obviously have no bracketing and needing the DTS source files to change goes away. However, to be able to construct the internal format for validation, I do need the schemas to have more information on what exactly the phandle-array contains. Rob From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84993C433F5 for ; Wed, 19 Jan 2022 15:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LBlOfDIqlOmubbqUGGJNu378uSgzeBmuj6SX+2X5E9g=; b=4eqDiyVQedWFYN bxcF7UIjY0L+6okhYAWw8Qj3yN1azeFXeTH9w09u1e3I4VzRZorjUp9O5nP2n2Y9zKpdl6yZyhzzX 8V8BeE52GNS2omEJJtd044c3Kgz2kjcd2lQDkGZVZfHoH6ja6dXYAVQBIoRDWKibQslbRro5l6Fsg Zj8VuVuWpgZTx0vjxr0/GZWX0ONlUkzDIuqa060MkC92AjLVsZwMJabZq/vi1AzCmJnYaeRHWw6on /xSDN0tU5DSL6UyHFTarPXZXUYt74MaoQju/RqfFQAvYyCjzwv0XD7e7h1vZYX3jaxwcEcrL3bFR+ 1ECcLcNmoAtGqb8Bo1yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nACtr-0069K3-JC; Wed, 19 Jan 2022 15:29:27 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nACtp-0069IN-3n; Wed, 19 Jan 2022 15:29:26 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF4CC6150E; Wed, 19 Jan 2022 15:29:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CB7AC340F5; Wed, 19 Jan 2022 15:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642606164; bh=eiP3xCZsCy88f8i33Qm5tHFJtlYCUAmvYn1cMS/h6LE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I1dPJN3TNsxi+GutnLfvLdAkrWaj+YTzuNOht44jN2mKf4fq/VkPg/jPsPShpheIN w60sca0yrzhrw+coRSJ3HgeB7dL4Ychtb88u293ZJQTXzrjtyODiFgDB4cXmqZt6xV AcWnpVHvAgN8zPYxE5Mku4TyInsZsNHWhAHgeTnCLSpuomcTJdzI+merY+u28R4kbp lA5zvYtpL5fMlJ72EaUW0GKDHa+8MhGWvomV5SCUqAS8IJvzymtE9RhCMTcXzPdioM OGRz+34yZg5gVhz37TdPybPlWPnLd2QB1HKIoGQ1bf4IAC//3aLt8oCkE4Rw27Uo5n z2G0zV2aggLyQ== Received: by mail-ed1-f42.google.com with SMTP id b13so14023357edn.0; Wed, 19 Jan 2022 07:29:23 -0800 (PST) X-Gm-Message-State: AOAM53394VaE1cCUJwMMQqg7NqKkcJdfcp3IZBgdu9KyqFhhahMPFrjW foDPsLOh2U68TE3O2DiS3MyDlVFPNvB/5fGWkQ== X-Google-Smtp-Source: ABdhPJyIYkyo1vqpmGZeQ86/fG6wkTZGxnD2kYhf8PsblQjCHqdJn557iPYrUwhbvXoPPN23Wd86PLfRtc/FtNJz2Yw= X-Received: by 2002:a17:906:7801:: with SMTP id u1mr8098133ejm.82.1642606151522; Wed, 19 Jan 2022 07:29:11 -0800 (PST) MIME-Version: 1.0 References: <20220119015038.2433585-1-robh@kernel.org> <20220119103542.el3yuqds6ihpkthn@skbuf> In-Reply-To: <20220119103542.el3yuqds6ihpkthn@skbuf> From: Rob Herring Date: Wed, 19 Jan 2022 09:28:59 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dt-bindings: Improve phandle-array schemas To: Vladimir Oltean Cc: devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Damien Le Moal , Herbert Xu , "David S. Miller" , Chun-Kuang Hu , Philipp Zabel , Laurent Pinchart , Kieran Bingham , Vinod Koul , Georgi Djakov , Thomas Gleixner , Marc Zyngier , Joerg Roedel , Lee Jones , Daniel Thompson , Jingoo Han , Pavel Machek , Mauro Carvalho Chehab , Krzysztof Kozlowski , Jakub Kicinski , Wolfgang Grandegger , Marc Kleine-Budde , Andrew Lunn , Vivien Didelot , Florian Fainelli , Kalle Valo , Viresh Kumar , Stephen Boyd , Kishon Vijay Abraham I , Linus Walleij , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Sebastian Reichel , Mark Brown , Mathieu Poirier , Daniel Lezcano , Zhang Rui , Greg Kroah-Hartman , Thierry Reding , Jonathan Hunter , Sudeep Holla , Geert Uytterhoeven , "open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)" , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , dri-devel , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , "open list:THERMAL" , Linux IOMMU , Linux LED Subsystem , Linux Media Mailing List , netdev , linux-can@vger.kernel.org, linux-wireless , "open list:GENERIC PHY FRAMEWORK" , "open list:GPIO SUBSYSTEM" , linux-riscv@lists.infradead.org, linux-remoteproc@vger.kernel.org, alsa-devel@alsa-project.org, linux-usb@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220119_072925_243528_71DB1C16 X-CRM114-Status: GOOD ( 27.61 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Wed, Jan 19, 2022 at 4:35 AM Vladimir Oltean wrote: > > On Tue, Jan 18, 2022 at 07:50:38PM -0600, Rob Herring wrote: > > The 'phandle-array' type is a bit ambiguous. It can be either just an > > array of phandles or an array of phandles plus args. Many schemas for > > phandle-array properties aren't clear in the schema which case applies > > though the description usually describes it. > > > > The array of phandles case boils down to needing: > > > > items: > > maxItems: 1 > > > > The phandle plus args cases should typically take this form: > > > > items: > > - items: > > - description: A phandle > > - description: 1st arg cell > > - description: 2nd arg cell > > > > With this change, some examples need updating so that the bracketing of > > property values matches the schema. > > --- > (...) > > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > index 702df848a71d..c504feeec6db 100644 > > --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > @@ -34,6 +34,8 @@ properties: > > full routing information must be given, not just the one hop > > routes to neighbouring switches > > $ref: /schemas/types.yaml#/definitions/phandle-array > > + items: > > + maxItems: 1 > > > > ethernet: > > description: > > For better or worse, the mainline cases of this property all take the > form of: > > arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts > link = <&switch1port9 &switch2port9>; > link = <&switch1port10 &switch0port10>; > arch/arm/boot/dts/vf610-zii-dev-rev-b.dts > link = <&switch1port6 > &switch2port9>; > link = <&switch1port5 > &switch0port5>; > arch/arm/boot/dts/vf610-zii-scu4-aib.dts > link = <&switch1port10 > &switch3port10 > &switch2port10>; > link = <&switch3port10 > &switch2port10>; > link = <&switch1port9 > &switch0port10>; > > So not really an array of phandles. Either form is an array. The DT yaml encoding maintains the bracketing, so how the schema is defined matters. To some extent the tools will process the schema to support both forms of bracketing, but this has turned out to be fragile and just doesn't work for phandle arrays. I'm working on further changes that will get rid of the yaml encoded DT format and validate DTB files directly. These obviously have no bracketing and needing the DTS source files to change goes away. However, to be able to construct the internal format for validation, I do need the schemas to have more information on what exactly the phandle-array contains. Rob _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 65D89C433EF for ; Wed, 19 Jan 2022 15:29:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D167260F1A; Wed, 19 Jan 2022 15:29:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s5tADhSB0xUD; Wed, 19 Jan 2022 15:29:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 994E860B28; Wed, 19 Jan 2022 15:29:28 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6AE9CC0039; Wed, 19 Jan 2022 15:29:28 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 31353C002F for ; Wed, 19 Jan 2022 15:29:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0F80C414C2 for ; Wed, 19 Jan 2022 15:29:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QwZE9nF9sQuB for ; Wed, 19 Jan 2022 15:29:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by smtp4.osuosl.org (Postfix) with ESMTPS id 43C9B408EA for ; Wed, 19 Jan 2022 15:29:26 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2062A614F4 for ; Wed, 19 Jan 2022 15:29:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FAB5C340F9 for ; Wed, 19 Jan 2022 15:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642606164; bh=eiP3xCZsCy88f8i33Qm5tHFJtlYCUAmvYn1cMS/h6LE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I1dPJN3TNsxi+GutnLfvLdAkrWaj+YTzuNOht44jN2mKf4fq/VkPg/jPsPShpheIN w60sca0yrzhrw+coRSJ3HgeB7dL4Ychtb88u293ZJQTXzrjtyODiFgDB4cXmqZt6xV AcWnpVHvAgN8zPYxE5Mku4TyInsZsNHWhAHgeTnCLSpuomcTJdzI+merY+u28R4kbp lA5zvYtpL5fMlJ72EaUW0GKDHa+8MhGWvomV5SCUqAS8IJvzymtE9RhCMTcXzPdioM OGRz+34yZg5gVhz37TdPybPlWPnLd2QB1HKIoGQ1bf4IAC//3aLt8oCkE4Rw27Uo5n z2G0zV2aggLyQ== Received: by mail-ed1-f41.google.com with SMTP id p12so13728810edq.9 for ; Wed, 19 Jan 2022 07:29:24 -0800 (PST) X-Gm-Message-State: AOAM532AUKiE4vzO6KPJDTWtKUoz2MAf3pzWO6QlLs7Ds3D1LH5aatMY 4pQC81Df/U3FtkN+dnZs95+mvvnT3ohlR9XEEQ== X-Google-Smtp-Source: ABdhPJyIYkyo1vqpmGZeQ86/fG6wkTZGxnD2kYhf8PsblQjCHqdJn557iPYrUwhbvXoPPN23Wd86PLfRtc/FtNJz2Yw= X-Received: by 2002:a17:906:7801:: with SMTP id u1mr8098133ejm.82.1642606151522; Wed, 19 Jan 2022 07:29:11 -0800 (PST) MIME-Version: 1.0 References: <20220119015038.2433585-1-robh@kernel.org> <20220119103542.el3yuqds6ihpkthn@skbuf> In-Reply-To: <20220119103542.el3yuqds6ihpkthn@skbuf> From: Rob Herring Date: Wed, 19 Jan 2022 09:28:59 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dt-bindings: Improve phandle-array schemas To: Vladimir Oltean Cc: Andrew Lunn , Ulf Hansson , Daniel Lezcano , Geert Uytterhoeven , Chun-Kuang Hu , Linus Walleij , linux-remoteproc@vger.kernel.org, alsa-devel@alsa-project.org, dri-devel , Sebastian Reichel , "open list:LIBATA SUBSYSTEM \(Serial and Parallel ATA drivers\)" , Thierry Reding , Laurent Pinchart , Pavel Machek , "open list:GENERIC PHY FRAMEWORK" , netdev , Jonathan Hunter , Lee Jones , linux-riscv@lists.infradead.org, Linux LED Subsystem , Daniel Thompson , Florian Fainelli , Herbert Xu , Krzysztof Kozlowski , Marc Zyngier , Damien Le Moal , "Rafael J. Wysocki" , Linux IOMMU , Kishon Vijay Abraham I , Jakub Kicinski , Zhang Rui , linux-usb@vger.kernel.org, Vivien Didelot , Wolfgang Grandegger , Linux Media Mailing List , devicetree@vger.kernel.org, "open list:THERMAL" , Kalle Valo , Sudeep Holla , linux-can@vger.kernel.org, "open list:GPIO SUBSYSTEM" , Greg Kroah-Hartman , Mark Brown , Marc Kleine-Budde , Thomas Gleixner , Mauro Carvalho Chehab , Mathieu Poirier , Stephen Boyd , Jingoo Han , Kevin Hilman , linux-wireless , "linux-kernel@vger.kernel.org" , Vinod Koul , Kieran Bingham , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Philipp Zabel , Viresh Kumar , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , "David S. Miller" X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Wed, Jan 19, 2022 at 4:35 AM Vladimir Oltean wrote: > > On Tue, Jan 18, 2022 at 07:50:38PM -0600, Rob Herring wrote: > > The 'phandle-array' type is a bit ambiguous. It can be either just an > > array of phandles or an array of phandles plus args. Many schemas for > > phandle-array properties aren't clear in the schema which case applies > > though the description usually describes it. > > > > The array of phandles case boils down to needing: > > > > items: > > maxItems: 1 > > > > The phandle plus args cases should typically take this form: > > > > items: > > - items: > > - description: A phandle > > - description: 1st arg cell > > - description: 2nd arg cell > > > > With this change, some examples need updating so that the bracketing of > > property values matches the schema. > > --- > (...) > > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > index 702df848a71d..c504feeec6db 100644 > > --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > @@ -34,6 +34,8 @@ properties: > > full routing information must be given, not just the one hop > > routes to neighbouring switches > > $ref: /schemas/types.yaml#/definitions/phandle-array > > + items: > > + maxItems: 1 > > > > ethernet: > > description: > > For better or worse, the mainline cases of this property all take the > form of: > > arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts > link = <&switch1port9 &switch2port9>; > link = <&switch1port10 &switch0port10>; > arch/arm/boot/dts/vf610-zii-dev-rev-b.dts > link = <&switch1port6 > &switch2port9>; > link = <&switch1port5 > &switch0port5>; > arch/arm/boot/dts/vf610-zii-scu4-aib.dts > link = <&switch1port10 > &switch3port10 > &switch2port10>; > link = <&switch3port10 > &switch2port10>; > link = <&switch1port9 > &switch0port10>; > > So not really an array of phandles. Either form is an array. The DT yaml encoding maintains the bracketing, so how the schema is defined matters. To some extent the tools will process the schema to support both forms of bracketing, but this has turned out to be fragile and just doesn't work for phandle arrays. I'm working on further changes that will get rid of the yaml encoded DT format and validate DTB files directly. These obviously have no bracketing and needing the DTS source files to change goes away. However, to be able to construct the internal format for validation, I do need the schemas to have more information on what exactly the phandle-array contains. Rob _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B56CC43217 for ; Wed, 19 Jan 2022 15:29:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 246A810E33D; Wed, 19 Jan 2022 15:29:28 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id F389C10E357 for ; Wed, 19 Jan 2022 15:29:26 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ACAA961509 for ; Wed, 19 Jan 2022 15:29:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7107C340E8 for ; Wed, 19 Jan 2022 15:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642606163; bh=eiP3xCZsCy88f8i33Qm5tHFJtlYCUAmvYn1cMS/h6LE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UdsEhsM5nH5E4BybYjnqQX7IU0BsZWZqIBVWz6afQhrqg39tF1cRs6hprujjFYS4z 28AbJH5CC8FTjKeCxIF8TCTw/fZN9E3aUBeAfGcRwsetjTrzuAFAwOg7xPwIP8wHFN asQlcoGQclaGvVGRZTujhEDY4k6AfJlL9EbpU5tGwZyxMncX3803dpDUIJrKorqwB7 7Ipwrh7Sk0wcGPOBPk5AUcOWVLZflZaE86LBRnRgQqsCKcwye8tWvSRWZO8siYcb8S Qb+2ck0stfRq9nUDwUUCizUKKm9W3YZzm+zyIO32APEloELRck5glsCyiHUXMQX2Mk jT0te0yzMkRjg== Received: by mail-ed1-f47.google.com with SMTP id j2so13722362edj.8 for ; Wed, 19 Jan 2022 07:29:23 -0800 (PST) X-Gm-Message-State: AOAM530pUaOyJzoKDzWhXpMUc1ywBOxvoAJf0gsQ/oiGOYGsFdPGuK/G uzNTj0pyQluc/f5fkZJz7XcbCxj9kQqTDNJaTw== X-Google-Smtp-Source: ABdhPJyIYkyo1vqpmGZeQ86/fG6wkTZGxnD2kYhf8PsblQjCHqdJn557iPYrUwhbvXoPPN23Wd86PLfRtc/FtNJz2Yw= X-Received: by 2002:a17:906:7801:: with SMTP id u1mr8098133ejm.82.1642606151522; Wed, 19 Jan 2022 07:29:11 -0800 (PST) MIME-Version: 1.0 References: <20220119015038.2433585-1-robh@kernel.org> <20220119103542.el3yuqds6ihpkthn@skbuf> In-Reply-To: <20220119103542.el3yuqds6ihpkthn@skbuf> From: Rob Herring Date: Wed, 19 Jan 2022 09:28:59 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dt-bindings: Improve phandle-array schemas To: Vladimir Oltean Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Ulf Hansson , Daniel Lezcano , Geert Uytterhoeven , Chun-Kuang Hu , linux-remoteproc@vger.kernel.org, alsa-devel@alsa-project.org, dri-devel , Sebastian Reichel , "open list:LIBATA SUBSYSTEM \(Serial and Parallel ATA drivers\)" , Thierry Reding , Laurent Pinchart , Pavel Machek , "open list:GENERIC PHY FRAMEWORK" , netdev , Jonathan Hunter , Lee Jones , linux-riscv@lists.infradead.org, Linux LED Subsystem , Daniel Thompson , Florian Fainelli , Herbert Xu , Krzysztof Kozlowski , Marc Zyngier , Damien Le Moal , "Rafael J. Wysocki" , Linux IOMMU , Kishon Vijay Abraham I , Jakub Kicinski , Zhang Rui , linux-usb@vger.kernel.org, Vivien Didelot , Wolfgang Grandegger , Linux Media Mailing List , devicetree@vger.kernel.org, "open list:THERMAL" , Kalle Valo , Sudeep Holla , linux-can@vger.kernel.org, "open list:GPIO SUBSYSTEM" , Greg Kroah-Hartman , Mark Brown , Marc Kleine-Budde , Thomas Gleixner , Mauro Carvalho Chehab , Mathieu Poirier , Stephen Boyd , Jingoo Han , Kevin Hilman , linux-wireless , "linux-kernel@vger.kernel.org" , Vinod Koul , Kieran Bingham , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Viresh Kumar , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , Georgi Djakov , "David S. Miller" , Joerg Roedel Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Jan 19, 2022 at 4:35 AM Vladimir Oltean wrote: > > On Tue, Jan 18, 2022 at 07:50:38PM -0600, Rob Herring wrote: > > The 'phandle-array' type is a bit ambiguous. It can be either just an > > array of phandles or an array of phandles plus args. Many schemas for > > phandle-array properties aren't clear in the schema which case applies > > though the description usually describes it. > > > > The array of phandles case boils down to needing: > > > > items: > > maxItems: 1 > > > > The phandle plus args cases should typically take this form: > > > > items: > > - items: > > - description: A phandle > > - description: 1st arg cell > > - description: 2nd arg cell > > > > With this change, some examples need updating so that the bracketing of > > property values matches the schema. > > --- > (...) > > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > index 702df848a71d..c504feeec6db 100644 > > --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > @@ -34,6 +34,8 @@ properties: > > full routing information must be given, not just the one hop > > routes to neighbouring switches > > $ref: /schemas/types.yaml#/definitions/phandle-array > > + items: > > + maxItems: 1 > > > > ethernet: > > description: > > For better or worse, the mainline cases of this property all take the > form of: > > arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts > link = <&switch1port9 &switch2port9>; > link = <&switch1port10 &switch0port10>; > arch/arm/boot/dts/vf610-zii-dev-rev-b.dts > link = <&switch1port6 > &switch2port9>; > link = <&switch1port5 > &switch0port5>; > arch/arm/boot/dts/vf610-zii-scu4-aib.dts > link = <&switch1port10 > &switch3port10 > &switch2port10>; > link = <&switch3port10 > &switch2port10>; > link = <&switch1port9 > &switch0port10>; > > So not really an array of phandles. Either form is an array. The DT yaml encoding maintains the bracketing, so how the schema is defined matters. To some extent the tools will process the schema to support both forms of bracketing, but this has turned out to be fragile and just doesn't work for phandle arrays. I'm working on further changes that will get rid of the yaml encoded DT format and validate DTB files directly. These obviously have no bracketing and needing the DTS source files to change goes away. However, to be able to construct the internal format for validation, I do need the schemas to have more information on what exactly the phandle-array contains. Rob From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC045C433EF for ; Wed, 19 Jan 2022 15:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fH9C6jrM7+Pi7/Pi6XwUfV2h2Z3UIdUFLRT0uz7AnX4=; b=HhCF4g8sKpZ+fI EZolgc+GO+NZCz6LVnOu/dabuONS8toQfqOG+rxpSz3Po5mrLiFC4XOZAuK3leDKEysxS1U2DBkKs EHMWod1veZi+dHE5cxMcfJnorvjrV1cNdf7oEK1BVYzTjzCMCBlLjt9FCr8WQd700ssb4ntQ10xaZ RTZWTA6hJVd8B2fq9HTjpNBD4Ju7FSOoypDvLV7TpEH2tYqNLHoMhtdw706piLCDMx11lpFPKfTXx 89CmTPo04une8iujFiqvekoypfPsqSUkiRC60TRzdXJevK+IBHkViAW3iPg4piNkCKs1jH+EWYAwi 6UTcN88/q913iwHzj56A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nACtr-0069Jw-DK; Wed, 19 Jan 2022 15:29:27 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nACtp-0069IN-3n; Wed, 19 Jan 2022 15:29:26 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF4CC6150E; Wed, 19 Jan 2022 15:29:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CB7AC340F5; Wed, 19 Jan 2022 15:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642606164; bh=eiP3xCZsCy88f8i33Qm5tHFJtlYCUAmvYn1cMS/h6LE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I1dPJN3TNsxi+GutnLfvLdAkrWaj+YTzuNOht44jN2mKf4fq/VkPg/jPsPShpheIN w60sca0yrzhrw+coRSJ3HgeB7dL4Ychtb88u293ZJQTXzrjtyODiFgDB4cXmqZt6xV AcWnpVHvAgN8zPYxE5Mku4TyInsZsNHWhAHgeTnCLSpuomcTJdzI+merY+u28R4kbp lA5zvYtpL5fMlJ72EaUW0GKDHa+8MhGWvomV5SCUqAS8IJvzymtE9RhCMTcXzPdioM OGRz+34yZg5gVhz37TdPybPlWPnLd2QB1HKIoGQ1bf4IAC//3aLt8oCkE4Rw27Uo5n z2G0zV2aggLyQ== Received: by mail-ed1-f42.google.com with SMTP id b13so14023357edn.0; Wed, 19 Jan 2022 07:29:23 -0800 (PST) X-Gm-Message-State: AOAM53394VaE1cCUJwMMQqg7NqKkcJdfcp3IZBgdu9KyqFhhahMPFrjW foDPsLOh2U68TE3O2DiS3MyDlVFPNvB/5fGWkQ== X-Google-Smtp-Source: ABdhPJyIYkyo1vqpmGZeQ86/fG6wkTZGxnD2kYhf8PsblQjCHqdJn557iPYrUwhbvXoPPN23Wd86PLfRtc/FtNJz2Yw= X-Received: by 2002:a17:906:7801:: with SMTP id u1mr8098133ejm.82.1642606151522; Wed, 19 Jan 2022 07:29:11 -0800 (PST) MIME-Version: 1.0 References: <20220119015038.2433585-1-robh@kernel.org> <20220119103542.el3yuqds6ihpkthn@skbuf> In-Reply-To: <20220119103542.el3yuqds6ihpkthn@skbuf> From: Rob Herring Date: Wed, 19 Jan 2022 09:28:59 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dt-bindings: Improve phandle-array schemas To: Vladimir Oltean Cc: devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Damien Le Moal , Herbert Xu , "David S. Miller" , Chun-Kuang Hu , Philipp Zabel , Laurent Pinchart , Kieran Bingham , Vinod Koul , Georgi Djakov , Thomas Gleixner , Marc Zyngier , Joerg Roedel , Lee Jones , Daniel Thompson , Jingoo Han , Pavel Machek , Mauro Carvalho Chehab , Krzysztof Kozlowski , Jakub Kicinski , Wolfgang Grandegger , Marc Kleine-Budde , Andrew Lunn , Vivien Didelot , Florian Fainelli , Kalle Valo , Viresh Kumar , Stephen Boyd , Kishon Vijay Abraham I , Linus Walleij , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Sebastian Reichel , Mark Brown , Mathieu Poirier , Daniel Lezcano , Zhang Rui , Greg Kroah-Hartman , Thierry Reding , Jonathan Hunter , Sudeep Holla , Geert Uytterhoeven , "open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)" , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , dri-devel , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , "open list:THERMAL" , Linux IOMMU , Linux LED Subsystem , Linux Media Mailing List , netdev , linux-can@vger.kernel.org, linux-wireless , "open list:GENERIC PHY FRAMEWORK" , "open list:GPIO SUBSYSTEM" , linux-riscv@lists.infradead.org, linux-remoteproc@vger.kernel.org, alsa-devel@alsa-project.org, linux-usb@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220119_072925_243528_71DB1C16 X-CRM114-Status: GOOD ( 27.61 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org On Wed, Jan 19, 2022 at 4:35 AM Vladimir Oltean wrote: > > On Tue, Jan 18, 2022 at 07:50:38PM -0600, Rob Herring wrote: > > The 'phandle-array' type is a bit ambiguous. It can be either just an > > array of phandles or an array of phandles plus args. Many schemas for > > phandle-array properties aren't clear in the schema which case applies > > though the description usually describes it. > > > > The array of phandles case boils down to needing: > > > > items: > > maxItems: 1 > > > > The phandle plus args cases should typically take this form: > > > > items: > > - items: > > - description: A phandle > > - description: 1st arg cell > > - description: 2nd arg cell > > > > With this change, some examples need updating so that the bracketing of > > property values matches the schema. > > --- > (...) > > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > index 702df848a71d..c504feeec6db 100644 > > --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > @@ -34,6 +34,8 @@ properties: > > full routing information must be given, not just the one hop > > routes to neighbouring switches > > $ref: /schemas/types.yaml#/definitions/phandle-array > > + items: > > + maxItems: 1 > > > > ethernet: > > description: > > For better or worse, the mainline cases of this property all take the > form of: > > arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts > link = <&switch1port9 &switch2port9>; > link = <&switch1port10 &switch0port10>; > arch/arm/boot/dts/vf610-zii-dev-rev-b.dts > link = <&switch1port6 > &switch2port9>; > link = <&switch1port5 > &switch0port5>; > arch/arm/boot/dts/vf610-zii-scu4-aib.dts > link = <&switch1port10 > &switch3port10 > &switch2port10>; > link = <&switch3port10 > &switch2port10>; > link = <&switch1port9 > &switch0port10>; > > So not really an array of phandles. Either form is an array. The DT yaml encoding maintains the bracketing, so how the schema is defined matters. To some extent the tools will process the schema to support both forms of bracketing, but this has turned out to be fragile and just doesn't work for phandle arrays. I'm working on further changes that will get rid of the yaml encoded DT format and validate DTB files directly. These obviously have no bracketing and needing the DTS source files to change goes away. However, to be able to construct the internal format for validation, I do need the schemas to have more information on what exactly the phandle-array contains. Rob -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CC51C433EF for ; Thu, 20 Jan 2022 07:13:59 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6865F3078; Thu, 20 Jan 2022 08:13:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6865F3078 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642662837; bh=eiP3xCZsCy88f8i33Qm5tHFJtlYCUAmvYn1cMS/h6LE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Tf3cFN2xxkMoyYa7MH/HlUJDF6M7WsTBDB/aFhkrkliXn39qPPT9W/lXQjHvemOTU lIx/atfDdbQqZe7iQj9Z1jBvaAR4/hdwHnoQIE9Svo5bn7J4Qwtkxh86Ca483jGc/m czr/thi5eWrM997wWQQVGOdAAiwfP3TYVGOGOo1M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4E370F805EE; Thu, 20 Jan 2022 08:03:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 857DBF801F7; Wed, 19 Jan 2022 16:29:31 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8E8A1F800F8 for ; Wed, 19 Jan 2022 16:29:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8E8A1F800F8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UdsEhsM5" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A2F461514 for ; Wed, 19 Jan 2022 15:29:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66FB0C340EC for ; Wed, 19 Jan 2022 15:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642606163; bh=eiP3xCZsCy88f8i33Qm5tHFJtlYCUAmvYn1cMS/h6LE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UdsEhsM5nH5E4BybYjnqQX7IU0BsZWZqIBVWz6afQhrqg39tF1cRs6hprujjFYS4z 28AbJH5CC8FTjKeCxIF8TCTw/fZN9E3aUBeAfGcRwsetjTrzuAFAwOg7xPwIP8wHFN asQlcoGQclaGvVGRZTujhEDY4k6AfJlL9EbpU5tGwZyxMncX3803dpDUIJrKorqwB7 7Ipwrh7Sk0wcGPOBPk5AUcOWVLZflZaE86LBRnRgQqsCKcwye8tWvSRWZO8siYcb8S Qb+2ck0stfRq9nUDwUUCizUKKm9W3YZzm+zyIO32APEloELRck5glsCyiHUXMQX2Mk jT0te0yzMkRjg== Received: by mail-ed1-f43.google.com with SMTP id b13so14023177edn.0 for ; Wed, 19 Jan 2022 07:29:23 -0800 (PST) X-Gm-Message-State: AOAM533ugcGLzDei9J5G0Xr3nx85ozJnR2NGJWLeiLjr/idkHcjJOmS5 ALrDpt0QUyfgiYJ65HqBw5SWOHaiyG6brtpJtw== X-Google-Smtp-Source: ABdhPJyIYkyo1vqpmGZeQ86/fG6wkTZGxnD2kYhf8PsblQjCHqdJn557iPYrUwhbvXoPPN23Wd86PLfRtc/FtNJz2Yw= X-Received: by 2002:a17:906:7801:: with SMTP id u1mr8098133ejm.82.1642606151522; Wed, 19 Jan 2022 07:29:11 -0800 (PST) MIME-Version: 1.0 References: <20220119015038.2433585-1-robh@kernel.org> <20220119103542.el3yuqds6ihpkthn@skbuf> In-Reply-To: <20220119103542.el3yuqds6ihpkthn@skbuf> From: Rob Herring Date: Wed, 19 Jan 2022 09:28:59 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dt-bindings: Improve phandle-array schemas To: Vladimir Oltean Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Thu, 20 Jan 2022 08:03:34 +0100 Cc: Andrew Lunn , Ulf Hansson , Daniel Lezcano , Geert Uytterhoeven , Chun-Kuang Hu , Linus Walleij , linux-remoteproc@vger.kernel.org, alsa-devel@alsa-project.org, dri-devel , Sebastian Reichel , "open list:LIBATA SUBSYSTEM \(Serial and Parallel ATA drivers\)" , Thierry Reding , Laurent Pinchart , Pavel Machek , "open list:GENERIC PHY FRAMEWORK" , netdev , Jonathan Hunter , Lee Jones , linux-riscv@lists.infradead.org, Linux LED Subsystem , Daniel Thompson , Florian Fainelli , Herbert Xu , Krzysztof Kozlowski , Marc Zyngier , Damien Le Moal , "Rafael J. Wysocki" , Linux IOMMU , Kishon Vijay Abraham I , Jakub Kicinski , Zhang Rui , linux-usb@vger.kernel.org, Vivien Didelot , Wolfgang Grandegger , Linux Media Mailing List , devicetree@vger.kernel.org, "open list:THERMAL" , Kalle Valo , Sudeep Holla , linux-can@vger.kernel.org, "open list:GPIO SUBSYSTEM" , Greg Kroah-Hartman , Mark Brown , Marc Kleine-Budde , Thomas Gleixner , Mauro Carvalho Chehab , Mathieu Poirier , Stephen Boyd , Jingoo Han , Kevin Hilman , linux-wireless , "linux-kernel@vger.kernel.org" , Vinod Koul , Kieran Bingham , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Philipp Zabel , Viresh Kumar , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , Georgi Djakov , "David S. Miller" , Joerg Roedel X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, Jan 19, 2022 at 4:35 AM Vladimir Oltean wrote: > > On Tue, Jan 18, 2022 at 07:50:38PM -0600, Rob Herring wrote: > > The 'phandle-array' type is a bit ambiguous. It can be either just an > > array of phandles or an array of phandles plus args. Many schemas for > > phandle-array properties aren't clear in the schema which case applies > > though the description usually describes it. > > > > The array of phandles case boils down to needing: > > > > items: > > maxItems: 1 > > > > The phandle plus args cases should typically take this form: > > > > items: > > - items: > > - description: A phandle > > - description: 1st arg cell > > - description: 2nd arg cell > > > > With this change, some examples need updating so that the bracketing of > > property values matches the schema. > > --- > (...) > > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > index 702df848a71d..c504feeec6db 100644 > > --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml > > @@ -34,6 +34,8 @@ properties: > > full routing information must be given, not just the one hop > > routes to neighbouring switches > > $ref: /schemas/types.yaml#/definitions/phandle-array > > + items: > > + maxItems: 1 > > > > ethernet: > > description: > > For better or worse, the mainline cases of this property all take the > form of: > > arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts > link = <&switch1port9 &switch2port9>; > link = <&switch1port10 &switch0port10>; > arch/arm/boot/dts/vf610-zii-dev-rev-b.dts > link = <&switch1port6 > &switch2port9>; > link = <&switch1port5 > &switch0port5>; > arch/arm/boot/dts/vf610-zii-scu4-aib.dts > link = <&switch1port10 > &switch3port10 > &switch2port10>; > link = <&switch3port10 > &switch2port10>; > link = <&switch1port9 > &switch0port10>; > > So not really an array of phandles. Either form is an array. The DT yaml encoding maintains the bracketing, so how the schema is defined matters. To some extent the tools will process the schema to support both forms of bracketing, but this has turned out to be fragile and just doesn't work for phandle arrays. I'm working on further changes that will get rid of the yaml encoded DT format and validate DTB files directly. These obviously have no bracketing and needing the DTS source files to change goes away. However, to be able to construct the internal format for validation, I do need the schemas to have more information on what exactly the phandle-array contains. Rob