Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1105281rdb; Sat, 18 Nov 2023 03:26:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBD6ivVmEMH8DbBZuLbPaRvY11p1tLINnV6PVczrQDJzl2lPNEjASVibjgyIa8PW5eda4q X-Received: by 2002:a05:6602:b85:b0:798:312a:5403 with SMTP id fm5-20020a0566020b8500b00798312a5403mr2938458iob.19.1700306768293; Sat, 18 Nov 2023 03:26:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700306768; cv=none; d=google.com; s=arc-20160816; b=KcvisLMzIsDXYBqwGHJOLRi2yGg7rM4sIC0aN94lxul+fDulUjX/+K8w7aCPzk4z5W HICcO10aewjC+wKOycdBr7R1YqliA8w7t47Z/mFG59MG8+xW+bM/GKUtIeLRqqXPfdAR dvUPE2CK2GgVs62c484XIrMCycFsISSQfcXhHcumKoXgspBZ5gYtJLXjlKbBMWylhD3z a9dmEbjuLAIk27mu8w7om/gdsBGJ9cqe7Rp8/H0bmEvewquZYwLqZT5QhcGxLSVjv1X8 dMYl/EYa4RrPyRqgVJWqkGqO3MXGCYbGNiGHbDV+ZkeLTQTNnthaL0kQtXeHXz24xLxO Ms+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=+AazopWjLbQ0q2rV3efr2mjdFCOK/I0dt7IyYlHMoOA=; fh=tW97vlbaTDwRXYfju1tBwOSer7ZMBwx/hoATHThk2gQ=; b=DeHhW0ZGaOcuxdlKfOb/QYjfAs/z63XKvarPtE1Kxl7921DoiUBGZWOY+JesTWqfq9 aLsT3DrZn5eeo9GanyOkGIO0I9HZryKh5omVmom7SF/IXaABMHs+95hJ47XrJEmuUtGS kpEh9LK5gJyzby3HdxEmqbMGg/UjE0/q+JnIXer2hnw02AKiOEqOdfN+JalkVX78CwmJ JOJm4W0KgubAXjJd3t/HaPpdzsdNTGo8Xv/GK6bXyfR212/XXQ2IXLVlJ45cBKB8cD3k qMUjMLzrpnMClEWKUpg8PSodWf+/HsiMIcmXEWH0qPMxtOLDYClGfKeHi6oJbyVkSoCO YIgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id o3-20020a63e343000000b005be34495eedsi4063690pgj.118.2023.11.18.03.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 03:26:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 92924809AFD4; Sat, 18 Nov 2023 03:26:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229538AbjKRLZ5 convert rfc822-to-8bit (ORCPT + 99 others); Sat, 18 Nov 2023 06:25:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbjKRLZz (ORCPT ); Sat, 18 Nov 2023 06:25:55 -0500 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07539D71; Sat, 18 Nov 2023 03:25:52 -0800 (PST) Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-db048181cd3so2779125276.3; Sat, 18 Nov 2023 03:25:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700306751; x=1700911551; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eiuDqUTCUS6Y1KK2h70TEMMBLCqAZgtzwDLAEo8GjcA=; b=S4CIUpAeVYNDCmi5ABFuKT5Ni/nnWByDwAqcRusGdtEjF4Q5jr6pwzo5TEuq+PKlp5 O9AyX3mioaX/8X63DW17EbTgvD+VkMr5PY4ZY9karyKbT2Bs4+OYRS0eb+gs3QLgBOlp P58d9c/dH5r/RPVunuOydX/eRRb+i6+h8EtfzXTF+wmVMJUcv+0L6CZErz3HXxbHgT04 aAdyKwXy5KN1g+vz2xNIk/yUSJmD1msznvCu4IXROPsH8OV6jXwo3Dsk0d2DHKdLyp24 zO8B9EsNdl0qqSq2+4L0mCE8tr21moSswfGTqIkYTEa1eDXGJ9nPcTTU7PuPc90XSBLZ +F5Q== X-Gm-Message-State: AOJu0YxJNytnhjlzpnP+t4CnTpAx2FvKS8n3IA0I7fDnHBircTrnY+Vk 7WccVv5RuNyMzjoD6U98wdvHuwqpbyhfFQ== X-Received: by 2002:a5b:46:0:b0:daf:76da:fe2b with SMTP id e6-20020a5b0046000000b00daf76dafe2bmr1966062ybp.10.1700306750972; Sat, 18 Nov 2023 03:25:50 -0800 (PST) Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com. [209.85.128.170]) by smtp.gmail.com with ESMTPSA id x36-20020a25aca4000000b00d81bb7ef494sm907531ybi.19.2023.11.18.03.25.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Nov 2023 03:25:49 -0800 (PST) Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-5a82f176860so31137327b3.1; Sat, 18 Nov 2023 03:25:48 -0800 (PST) X-Received: by 2002:a81:d512:0:b0:5a7:d461:a2b7 with SMTP id i18-20020a81d512000000b005a7d461a2b7mr2347982ywj.43.1700306748519; Sat, 18 Nov 2023 03:25:48 -0800 (PST) MIME-Version: 1.0 References: <20231116181218.18886-1-krzysztof.kozlowski@linaro.org> <7592981.EvYhyI6sBW@phil> <2cb3f992-f214-4cdf-8443-9e14ab864a66@ti.com> <4289147.1BCLMh4Saa@diego> In-Reply-To: <4289147.1BCLMh4Saa@diego> From: Geert Uytterhoeven Date: Sat, 18 Nov 2023 12:25:37 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] docs: dt-bindings: add DTS Coding Style document To: =?UTF-8?Q?Heiko_St=C3=BCbner?= Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Andrew Davis , AngeloGioacchino Del Regno , Arnd Bergmann , Bjorn Andersson , Geert Uytterhoeven , Konrad Dybcio , Matthias Brugger , Michal Simek , Neil Armstrong , Nishanth Menon , Olof Johansson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 18 Nov 2023 03:26:05 -0800 (PST) Hi Heiko, On Fri, Nov 17, 2023 at 8:38 PM Heiko Stübner wrote: > Am Freitag, 17. November 2023, 15:03:38 CET schrieb Andrew Davis: > > On 11/16/23 2:33 PM, Heiko Stuebner wrote: > > > Am Donnerstag, 16. November 2023, 21:23:20 CET schrieb Krzysztof Kozlowski: > > >> On 16/11/2023 21:03, Heiko Stuebner wrote: > > > going with the vcc5v0_host regulator of the rk3588-quartzpro64 and > > > > > > +1. compatible > > > +2. reg > > > +3. ranges > > > +4. All properties with values > > > +5. Boolean properties > > > +6. status (if applicable) > > > +7. Child nodes > > > > > > we'd end up with > > > > > > vcc5v0_host: vcc5v0-host-regulator { > > > /* 1. */ compatible = "regulator-fixed"; > > > /* 4. */ gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; > > > pinctrl-names = "default"; > > > pinctrl-0 = <&vcc5v0_host_en>; > > > regulator-min-microvolt = <5000000>; > > > regulator-max-microvolt = <5000000>; > > > regulator-name = "vcc5v0_host"; > > > vin-supply = <&vcc5v0_usb>; > > > /* 5. */ enable-active-high; > > > regulator-always-on; > > > regulator-boot-on; > > > }; > > > > > > > How about grouping like properties (defined in the same schema), > > then sorting within that group. Would also allow for defining > > where to add spacing. > > > > 1. compatible > > 2. reg > > 3. ranges > > 4. All property groups > > 4.1 Properties with values > > 4.2 Boolean properties > > 4.3 Separating space > > 6. status (if applicable) > > 7. Child nodes > > > > Your node then would look like we expect: > > > > vcc5v0_host: vcc5v0-host-regulator { > > /* 1 */ compatible = "regulator-fixed"; > > > > /* 4.1 */ pinctrl-names = "default"; > > /* 4.1 */ pinctrl-0 = <&vcc5v0_host_en>; > > /* 4.3 */ > > /* 4.1 */ regulator-min-microvolt = <5000000>; > > /* 4.1 */ regulator-max-microvolt = <5000000>; > > /* 4.1 */ regulator-name = "vcc5v0_host"; > > /* 4.2 */ regulator-always-on; > > /* 4.2 */ regulator-boot-on; > > /* 4.2 */ enable-active-high; > > /* 4.3 */ > > /* 4.1 */ gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; > > ... > > }; > > I'm really not sure about adding big sets of rules. > In the above example you'd also need to define which schema has a higher > priority? ;-) > > > When I started with Rockchip stuff, I also had some fancy way of sorting > elements in mind that was really intuitive to myself :-) . > Over time I realized that it was quite complex - especially when I had to > explain it to people. Feel familiar. > There are definite advantages for having compatible + reg + status in > fixed positions, as it helps going over a whole dt to spot the huge > mistakes (accidentially disabled, wrong address), but for the rest a > simple alphabetical sorting is easiest to explain to people :-) . > > And alphabetic elements are also easier on my eyes. Alphabetical does break logical ordering and grouping. Apart from compatible/reg order, on Renesas SoCs we usually also have the clocks/resets/power-domains block. > I just think having a short clean set of rules like Krzysztof proposed, > is easier to follow and "enforce" and also most likely doesn't deter > people from contributing, if mainline work is not their main occupation. And in reality, most of this is created by copy-and-corrupt^Wmodify... 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