Message ID | 20231220145537.2163811-1-andre.draszik@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-7093-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2692520dyi; Wed, 20 Dec 2023 06:56:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEh5QI4NhfqcO+p93F5YqlCNTKRIdM2ABoWBEbcJWgBWzhDcUShmzHUpmPUt9quHQWxWbWc X-Received: by 2002:a50:d714:0:b0:554:3e0:3188 with SMTP id t20-20020a50d714000000b0055403e03188mr76665edi.41.1703084166528; Wed, 20 Dec 2023 06:56:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703084166; cv=none; d=google.com; s=arc-20160816; b=OAkWK5ax05UZDdzMrPMvmzNad102TJXILuUB2TcGn6NPSKKm7V833R7T4/+60id21B 8ACd82nOZL821G/alTOaFpup2nDKgTMldcJ6fylOgNl6FvhQHoKcVoiJcg6MrMEp9IUc knzAOvxBwukPJCKIbPtEdfRQvEy+4Mgjd5A+EWwDax+DnmyR+Bn7eyDbZrah2bfeKpi+ QMAiIrDGX3kgdDFFMYZA2Kp7VVeBs4SlQLZFO8r/oBbIpQ3K8o1s+bDLxLUfzOoQCNQ4 Fzp9Re556D5ygPugBdLC+hUSFrIWRFPmTIq2H1N0e7x/eGdf7W6W5wN6QN2nJyqdbB9E T9Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=CkImlzYfE+JGucnDuYdZCwAqWDnn1ZRuOvIb2guMhPs=; fh=jxLziTpnmmF8pV0bnuYJsmv4DXeJ7nJZDXhvmS+RTAs=; b=m2QJVeLvOideOdz0AOXE7RsZLrpezpko63NatVLxIXFCgBhigZn3dtfwa0MUdpKtQ1 tyc5aJO+v7lA4DEFpyaoj44ZhQziTfCdSixxeg6K8LCDJGdkcSjsCEgMqWdg0w0bY+Ct J8YwbombgYKbwCh/Og3UOtM7YrKM0WZLn9XaqK5oKphAveqqE5KPgrpjHZgO0hxgCz0f 1GrdbqdYpkraxEC3kmbf6GPL3c/NPyeM8nWHsJ3YA9gdpF5QUArg6lljDsZmDTjywsGq zySDiwlLWZpSEGs43g89I9sTeZYeflkh4dCnlzCcnKIM53/rPEZKLJ+hdE0I40X/53yL mzEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wTEIP8Gk; spf=pass (google.com: domain of linux-kernel+bounces-7093-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7093-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c39-20020a509faa000000b005530123b2f2si4016695edf.624.2023.12.20.06.56.06 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:56:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7093-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wTEIP8Gk; spf=pass (google.com: domain of linux-kernel+bounces-7093-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7093-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 45AF51F22487 for <ouuuleilei@gmail.com>; Wed, 20 Dec 2023 14:56:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1FDC3F8D2; Wed, 20 Dec 2023 14:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wTEIP8Gk" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6404C3D97F for <linux-kernel@vger.kernel.org>; Wed, 20 Dec 2023 14:55:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-54c79968ffbso6521346a12.3 for <linux-kernel@vger.kernel.org>; Wed, 20 Dec 2023 06:55:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703084139; x=1703688939; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=CkImlzYfE+JGucnDuYdZCwAqWDnn1ZRuOvIb2guMhPs=; b=wTEIP8GkRyeS6BThqr3qMMYRaUyri+NCJfJc0Boq4iLZ6NunyuEY8kr5+olN7oaJPt RDcHYK8PbvtHcPsXDPwzPLsjO4P1/RBqxC3/kYfT9a8tdXaK4x0BQ+WzfPr1zDQD1Ibn ZKZA8f9F3GRUoUwQ7TjjWBpRJEjBooc/WbwXZNObyyUkLCf6aAlIKniJYWKy8zn707Y+ 0ZRrb9Gk72YtAj6VHLGTN+SUVy/vRPtUhoyQOWaDbgBVJhqfqC5NVchmRI+2xjKopIsr kcVgIrExYvEgn0Ar34NZensAwfd2FgHkmCFsH6id1MGceHA/53QPppLja5qK1bVWf3Cg xUIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703084139; x=1703688939; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CkImlzYfE+JGucnDuYdZCwAqWDnn1ZRuOvIb2guMhPs=; b=fyT1KKym7Nt2K+8HBDA0cXCLidW7UcanR/2+PiCOT+CnPn7WNo4XCQGXTbMZFGSmWv dj6ceGebfK/kDStVxCQm1e9PlohwDDQEQbn3NJtmbHxyBSIk67VP53gxD8k/IlkZxK/S wyX622CUsGZGcNoYGsORGoiaeBzAbu2WzbEp++vuODk0b8TlBIdpx5iZrQKpeyqnf1fq LrUQHj6BPuy6KY55htkIxGctGfRUOyNmvuvHu2Q0725SZyy7Ddl/dpuXYjyZ24jVkpzP VLaLZ4ZjB07qKJJ2WcZHmSCoDPaAp5vexxesThws0HBpKkdSZmulZRakd45QOePaSTxg qXHw== X-Gm-Message-State: AOJu0Yy5pdOXSlx1BVqB7sBupNHcBsW94p4r7eqF0utM7MJdK8m9ySIe F5b2nhyBD8KEjZS3qE+96NcHZ6vMroTtmG4OqPAP62bW X-Received: by 2002:a17:907:ea5:b0:a26:854b:22ae with SMTP id ho37-20020a1709070ea500b00a26854b22aemr1777099ejc.64.1703084139470; Wed, 20 Dec 2023 06:55:39 -0800 (PST) Received: from puffmais.c.googlers.com.com (61.134.90.34.bc.googleusercontent.com. [34.90.134.61]) by smtp.gmail.com with ESMTPSA id ay10-20020a170907900a00b00a2699127f98sm437926ejc.87.2023.12.20.06.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:55:39 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@linaro.org> To: linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Mathieu Poirier <mathieu.poirier@linaro.org>, devicetree@vger.kernel.org Cc: Masahiro Yamada <masahiroy@kernel.org> Subject: [PATCH] dt-bindings: ignore paths outside kernel for DT_SCHEMA_FILES Date: Wed, 20 Dec 2023 14:55:37 +0000 Message-ID: <20231220145537.2163811-1-andre.draszik@linaro.org> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785813182700525875 X-GMAIL-MSGID: 1785813182700525875 |
Series |
dt-bindings: ignore paths outside kernel for DT_SCHEMA_FILES
|
|
Commit Message
André Draszik
Dec. 20, 2023, 2:55 p.m. UTC
If the location of the kernel sources contains the string that we're
filtering for using DT_SCHEMA_FILES, then all schemas will currently be
matched, returned and checked, not just the ones we actually expected.
As an example, if the kernel sources happen to be below a directory
'google', and DT_SCHEMA_FILES=google, everything is checked. More
common examples might be having the sources below people's home
directories that contain the string st or arm and then searching for
those. The list is endless.
Fix this by only matching for schemas below the kernel source's
bindings directory.
Note that I opted for the implementation here so as to not having to
deal with escaping DT_SCHEMA_FILES, which would have been the
alternative if the grep match itself had been updated.
Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
Documentation/devicetree/bindings/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, 20 Dec 2023 14:55:37 +0000, André Draszik wrote: > If the location of the kernel sources contains the string that we're > filtering for using DT_SCHEMA_FILES, then all schemas will currently be > matched, returned and checked, not just the ones we actually expected. > As an example, if the kernel sources happen to be below a directory > 'google', and DT_SCHEMA_FILES=google, everything is checked. More > common examples might be having the sources below people's home > directories that contain the string st or arm and then searching for > those. The list is endless. > > Fix this by only matching for schemas below the kernel source's > bindings directory. > > Note that I opted for the implementation here so as to not having to > deal with escaping DT_SCHEMA_FILES, which would have been the > alternative if the grep match itself had been updated. > > Cc: Masahiro Yamada <masahiroy@kernel.org> > Signed-off-by: André Draszik <andre.draszik@linaro.org> > --- > Documentation/devicetree/bindings/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Applied, thanks!
On 1/4/24 00:58, Rob Herring wrote: > > On Wed, 20 Dec 2023 14:55:37 +0000, André Draszik wrote: >> If the location of the kernel sources contains the string that we're >> filtering for using DT_SCHEMA_FILES, then all schemas will currently be >> matched, returned and checked, not just the ones we actually expected. >> As an example, if the kernel sources happen to be below a directory >> 'google', and DT_SCHEMA_FILES=google, everything is checked. More >> common examples might be having the sources below people's home >> directories that contain the string st or arm and then searching for >> those. The list is endless. >> >> Fix this by only matching for schemas below the kernel source's >> bindings directory. >> >> Note that I opted for the implementation here so as to not having to >> deal with escaping DT_SCHEMA_FILES, which would have been the >> alternative if the grep match itself had been updated. >> >> Cc: Masahiro Yamada <masahiroy@kernel.org> >> Signed-off-by: André Draszik <andre.draszik@linaro.org> >> --- >> Documentation/devicetree/bindings/Makefile | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> > > Applied, thanks! This patch is causing issue for me. Look at log below. I am running it directly on the latest linux-next/master. Thanks, Michal $ make DT_SCHEMA_FILES="Documentation/devicetree/bindings/arm/arm,cci-400.yaml" dt_binding_check HOSTCC scripts/basic/fixdep HOSTCC scripts/dtc/dtc.o HOSTCC scripts/dtc/flattree.o HOSTCC scripts/dtc/fstree.o HOSTCC scripts/dtc/data.o HOSTCC scripts/dtc/livetree.o HOSTCC scripts/dtc/treesource.o HOSTCC scripts/dtc/srcpos.o HOSTCC scripts/dtc/checks.o HOSTCC scripts/dtc/util.o LEX scripts/dtc/dtc-lexer.lex.c YACC scripts/dtc/dtc-parser.tab.[ch] HOSTCC scripts/dtc/dtc-lexer.lex.o HOSTCC scripts/dtc/dtc-parser.tab.o HOSTLD scripts/dtc/dtc HOSTCC scripts/dtc/libfdt/fdt.o HOSTCC scripts/dtc/libfdt/fdt_ro.o HOSTCC scripts/dtc/libfdt/fdt_wip.o HOSTCC scripts/dtc/libfdt/fdt_sw.o HOSTCC scripts/dtc/libfdt/fdt_rw.o HOSTCC scripts/dtc/libfdt/fdt_strerror.o HOSTCC scripts/dtc/libfdt/fdt_empty_tree.o HOSTCC scripts/dtc/libfdt/fdt_addresses.o HOSTCC scripts/dtc/libfdt/fdt_overlay.o HOSTCC scripts/dtc/fdtoverlay.o HOSTLD scripts/dtc/fdtoverlay LINT Documentation/devicetree/bindings usage: yamllint [-h] [-] [-c CONFIG_FILE | -d CONFIG_DATA] [--list-files] [-f {parsable,standard,colored,github,auto}] [-s] [--no-warnings] [-v] [FILE_OR_DIR ...] yamllint: error: one of the arguments FILE_OR_DIR - is required CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json
Hi, On Mon, 2024-01-15 at 10:20 +0100, Michal Simek wrote: > This patch is causing issue for me. Look at log below. > I am running it directly on the latest linux-next/master. > > Thanks, > Michal > > $ make DT_SCHEMA_FILES="Documentation/devicetree/bindings/arm/arm,cci-400.yaml" > dt_binding_check It'll work if you drop the 'Documentation/devicetree/bindings' part from the path, as it is implied since bindings can only be in that directory anyway: make DT_SCHEMA_FILES="arm/arm,cci-400.yaml" dt_binding_check make DT_SCHEMA_FILES="arm,cci-400.yaml" dt_binding_check both work. Cheers, Andre'
On Mon, Jan 15, 2024 at 09:40:37AM +0000, André Draszik wrote: > Hi, > > On Mon, 2024-01-15 at 10:20 +0100, Michal Simek wrote: > > This patch is causing issue for me. Look at log below. > > I am running it directly on the latest linux-next/master. > > > > Thanks, > > Michal > > > > $ make DT_SCHEMA_FILES="Documentation/devicetree/bindings/arm/arm,cci-400.yaml" > > dt_binding_check > > It'll work if you drop the 'Documentation/devicetree/bindings' part from the path, as > it is implied since bindings can only be in that directory anyway: > > make DT_SCHEMA_FILES="arm/arm,cci-400.yaml" dt_binding_check > make DT_SCHEMA_FILES="arm,cci-400.yaml" dt_binding_check > > both work. Requiring that is pretty user unfriendly though I think, passing the full path from the root directory of the kernel tree would be my assumption of the "default".
On 1/15/24 17:29, Conor Dooley wrote: > On Mon, Jan 15, 2024 at 09:40:37AM +0000, André Draszik wrote: >> Hi, >> >> On Mon, 2024-01-15 at 10:20 +0100, Michal Simek wrote: >>> This patch is causing issue for me. Look at log below. >>> I am running it directly on the latest linux-next/master. >>> >>> Thanks, >>> Michal >>> >>> $ make DT_SCHEMA_FILES="Documentation/devicetree/bindings/arm/arm,cci-400.yaml" >>> dt_binding_check >> >> It'll work if you drop the 'Documentation/devicetree/bindings' part from the path, as >> it is implied since bindings can only be in that directory anyway: >> >> make DT_SCHEMA_FILES="arm/arm,cci-400.yaml" dt_binding_check >> make DT_SCHEMA_FILES="arm,cci-400.yaml" dt_binding_check >> >> both work. > > Requiring that is pretty user unfriendly though I think, passing the > full path from the root directory of the kernel tree would be my > assumption of the "default". I am using full path like this for years. I can fix my scripts but would be good to consider correct path inside the kernel is something what this patch should also allow. Because path above is correct and it is not outside of the kernel that's why at least commit message should be massage a little bit. I will let Rob to decide. Thanks, Michal
On Mon, 2024-01-15 at 17:37 +0100, Michal Simek wrote: > > > On 1/15/24 17:29, Conor Dooley wrote: > > On Mon, Jan 15, 2024 at 09:40:37AM +0000, André Draszik wrote: > > > Hi, > > > > > > On Mon, 2024-01-15 at 10:20 +0100, Michal Simek wrote: > > > > This patch is causing issue for me. Look at log below. > > > > I am running it directly on the latest linux-next/master. > > > > > > > > Thanks, > > > > Michal > > > > > > > > $ make DT_SCHEMA_FILES="Documentation/devicetree/bindings/arm/arm,cci-400.yaml" > > > > dt_binding_check > > > > > > It'll work if you drop the 'Documentation/devicetree/bindings' part from the path, as > > > it is implied since bindings can only be in that directory anyway: > > > > > > make DT_SCHEMA_FILES="arm/arm,cci-400.yaml" dt_binding_check > > > make DT_SCHEMA_FILES="arm,cci-400.yaml" dt_binding_check > > > > > > both work. > > > > Requiring that is pretty user unfriendly though I think, passing the > > full path from the root directory of the kernel tree would be my > > assumption of the "default". > > I am using full path like this for years. I just just went by Documentation/devicetree/bindings/writing-schema.rst which doesn't suggest adding Documentation/devicetree/bindings/. In an attempt to make it more robust for anybody following this doc, I opted for the current implementation. > I can fix my scripts but would be good to consider correct path inside the > kernel is something what this patch should also allow. > Because path above is correct and it is not outside of the kernel that's why at > least commit message should be massage a little bit. I hear you, and I'll make a v2 to not imply the bindings directory. Cheers, A.
On Mon, Jan 15, 2024 at 10:57 AM André Draszik <andre.draszik@linaro.org> wrote: > > On Mon, 2024-01-15 at 17:37 +0100, Michal Simek wrote: > > > > > > On 1/15/24 17:29, Conor Dooley wrote: > > > On Mon, Jan 15, 2024 at 09:40:37AM +0000, André Draszik wrote: > > > > Hi, > > > > > > > > On Mon, 2024-01-15 at 10:20 +0100, Michal Simek wrote: > > > > > This patch is causing issue for me. Look at log below. > > > > > I am running it directly on the latest linux-next/master. > > > > > > > > > > Thanks, > > > > > Michal > > > > > > > > > > $ make DT_SCHEMA_FILES="Documentation/devicetree/bindings/arm/arm,cci-400.yaml" > > > > > dt_binding_check > > > > > > > > It'll work if you drop the 'Documentation/devicetree/bindings' part from the path, as > > > > it is implied since bindings can only be in that directory anyway: > > > > > > > > make DT_SCHEMA_FILES="arm/arm,cci-400.yaml" dt_binding_check > > > > make DT_SCHEMA_FILES="arm,cci-400.yaml" dt_binding_check > > > > > > > > both work. > > > > > > Requiring that is pretty user unfriendly though I think, passing the > > > full path from the root directory of the kernel tree would be my > > > assumption of the "default". > > > > I am using full path like this for years. > > I just just went by Documentation/devicetree/bindings/writing-schema.rst > which doesn't suggest adding Documentation/devicetree/bindings/. In an > attempt to make it more robust for anybody following this doc, I opted > for the current implementation. It originally worked only with the full tree path. It's now enhanced to take any substring for a match. As that is preferred (and shorter) that's what the documentation has. > > I can fix my scripts but would be good to consider correct path inside the > > kernel is something what this patch should also allow. > > Because path above is correct and it is not outside of the kernel that's why at > > least commit message should be massage a little bit. > > I hear you, and I'll make a v2 to not imply the bindings directory. A follow-up, not a v2 because v1 is already applied. Rob
diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile index 3e886194b043..2323fd5b7cda 100644 --- a/Documentation/devicetree/bindings/Makefile +++ b/Documentation/devicetree/bindings/Makefile @@ -28,7 +28,7 @@ $(obj)/%.example.dts: $(src)/%.yaml check_dtschema_version FORCE find_all_cmd = find $(srctree)/$(src) \( -name '*.yaml' ! \ -name 'processed-schema*' \) -find_cmd = $(find_all_cmd) | grep -F -e "$(subst :," -e ",$(DT_SCHEMA_FILES))" +find_cmd = $(find_all_cmd) | sed 's|^$(srctree)/$(src)/||' | grep -F -e "$(subst :," -e ",$(DT_SCHEMA_FILES))" | sed 's|^|$(srctree)/$(src)/|' CHK_DT_DOCS := $(shell $(find_cmd)) quiet_cmd_yamllint = LINT $(src)