From e400edb141d74aa2f04d0071aadb47fdb8f7ae55 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Thu, 12 Sep 2019 15:18:20 +0100 Subject: checkpatch: Warn if DT bindings are not in schema format DT bindings are moving to using a json-schema based schema format instead of freeform text. Add a checkpatch.pl check to encourage using the schema for new bindings. It's not yet a requirement, but is progressively being required by some maintainers. Cc: Andy Whitcroft Cc: Joe Perches Signed-off-by: Rob Herring --- scripts/checkpatch.pl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 6fcc66afb088..375c1e17562c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2826,6 +2826,14 @@ sub process { "added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr); } +# Check for adding new DT bindings not in schema format + if (!$in_commit_log && + ($line =~ /^new file mode\s*\d+\s*$/) && + ($realfile =~ m@^Documentation/devicetree/bindings/.*\.txt$@)) { + WARN("DT_SCHEMA_BINDING_PATCH", + "DT bindings should be in DT schema format. See: Documentation/devicetree/writing-schema.rst\n"); + } + # Check for wrappage within a valid hunk of the file if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) { ERROR("CORRUPTED_PATCH", -- cgit v1.2.3-59-g8ed1b From 1ee1ffe1f0fb77fd3e86cb23acb0f81976e5dc3c Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Fri, 25 Oct 2019 11:22:15 +0200 Subject: scripts/dtc: dtx_diff - add color output support Add new -c/--color options, to enhance the diff output with color, and improve the user's experience. Signed-off-by: Geert Uytterhoeven Reviewed-by: Frank Rowand Tested-by: Frank Rowand Signed-off-by: Rob Herring --- scripts/dtc/dtx_diff | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff index 00fd4738a587..541c432e7d19 100755 --- a/scripts/dtc/dtx_diff +++ b/scripts/dtc/dtx_diff @@ -20,6 +20,8 @@ Usage: --annotate synonym for -T + --color synonym for -c (requires diff with --color support) + -c enable colored output -f print full dts in diff (--unified=99999) -h synonym for --help -help synonym for --help @@ -177,6 +179,7 @@ compile_to_dts() { annotate="" cmd_diff=0 diff_flags="-u" +diff_color="" dtx_file_1="" dtx_file_2="" dtc_sort="-s" @@ -188,6 +191,13 @@ while [ $# -gt 0 ] ; do case $1 in + -c | --color ) + if diff --color /dev/null /dev/null 2>/dev/null ; then + diff_color="--color=always" + fi + shift + ;; + -f ) diff_flags="--unified=999999" shift @@ -343,7 +353,7 @@ DTC="\ if (( ${cmd_diff} )) ; then - diff ${diff_flags} --label "${dtx_file_1}" --label "${dtx_file_2}" \ + diff ${diff_flags} ${diff_color} --label "${dtx_file_1}" --label "${dtx_file_2}" \ <(compile_to_dts "${dtx_file_1}" "${dtx_path_1_dtc_include}") \ <(compile_to_dts "${dtx_file_2}" "${dtx_path_2_dtc_include}") -- cgit v1.2.3-59-g8ed1b From 067c650c456e758f933aaf87a202f841d34be269 Mon Sep 17 00:00:00 2001 From: Pavel Modilaynen Date: Fri, 12 Jul 2019 13:52:19 +0200 Subject: dtc: Use pkg-config to locate libyaml Using Makefile's wildcard with absolute path to detect the presence of libyaml results in false-positive detection when cross-compiling e.g. in yocto environment. The latter results in build error: | scripts/dtc/yamltree.o: In function `yaml_propval_int': | yamltree.c: undefined reference to `yaml_sequence_start_event_initialize' | yamltree.c: undefined reference to `yaml_emitter_emit' | yamltree.c: undefined reference to `yaml_scalar_event_initialize' ... Use pkg-config to locate libyaml to address this scenario. Signed-off-by: Pavel Modilaynen [robh: silence stderr] Signed-off-by: Rob Herring --- scripts/dtc/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile index 82160808765c..b5a5b1c548c9 100644 --- a/scripts/dtc/Makefile +++ b/scripts/dtc/Makefile @@ -11,7 +11,7 @@ dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o # Source files need to get at the userspace version of libfdt_env.h to compile HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt -ifeq ($(wildcard /usr/include/yaml.h),) +ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),) ifneq ($(CHECK_DTBS),) $(error dtc needs libyaml for DT schema validation support. \ Install the necessary libyaml development package.) @@ -19,7 +19,7 @@ endif HOST_EXTRACFLAGS += -DNO_YAML else dtc-objs += yamltree.o -HOSTLDLIBS_dtc := -lyaml +HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs) endif # Generated files need one more search path to include headers in source tree -- cgit v1.2.3-59-g8ed1b