From 152b695d74376bfe55cd2a6265ccc75b0d39dd19 Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Thu, 24 Nov 2016 02:27:03 +0100 Subject: builddeb: fix cross-building to arm64 producing host-arch debs Both Debian and kernel archs are "arm64" but UTS_MACHINE and gcc say "aarch64". Recognizing just the latter should be enough but let's accept both in case something regresses again or an user sets UTS_MACHINE=arm64. Regressed in cfa88c7: arm64: Set UTS_MACHINE in the Makefile. Signed-off-by: Adam Borowski Acked-by: Riku Voipio Signed-off-by: Michal Marek --- scripts/package/builddeb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 8ea9fd2b6573..3c575cd07888 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -51,7 +51,7 @@ set_debarch() { debarch=hppa ;; mips*) debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;; - arm64) + aarch64|arm64) debarch=arm64 ;; arm*) if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then -- cgit From 75238b9e6aadca6d9255d4b385e026385e78bb15 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Mon, 17 Oct 2016 11:52:24 -0500 Subject: Coccinelle: Add misc/boolconv.cocci Add a script to check for unneeded conversions to bool. Signed-off-by: Andrew F. Davis Acked-by: Julia Lawall Signed-off-by: Michal Marek --- scripts/coccinelle/misc/boolconv.cocci | 90 ++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 scripts/coccinelle/misc/boolconv.cocci (limited to 'scripts') diff --git a/scripts/coccinelle/misc/boolconv.cocci b/scripts/coccinelle/misc/boolconv.cocci new file mode 100644 index 000000000000..33c464d6bc71 --- /dev/null +++ b/scripts/coccinelle/misc/boolconv.cocci @@ -0,0 +1,90 @@ +/// Remove unneeded conversion to bool +/// +//# Relational and logical operators evaluate to bool, +//# explicit conversion is overly verbose and unneeded. +// +// Copyright: (C) 2016 Andrew F. Davis GPLv2. + +virtual patch +virtual context +virtual org +virtual report + +//---------------------------------------------------------- +// For patch mode +//---------------------------------------------------------- + +@depends on patch@ +expression A, B; +symbol true, false; +@@ + +( + A == B +| + A != B +| + A > B +| + A < B +| + A >= B +| + A <= B +| + A && B +| + A || B +) +- ? true : false + +//---------------------------------------------------------- +// For context mode +//---------------------------------------------------------- + +@r depends on !patch@ +expression A, B; +symbol true, false; +position p; +@@ + +( + A == B +| + A != B +| + A > B +| + A < B +| + A >= B +| + A <= B +| + A && B +| + A || B +) +* ? true : false@p + +//---------------------------------------------------------- +// For org mode +//---------------------------------------------------------- + +@script:python depends on r&&org@ +p << r.p; +@@ + +msg = "WARNING: conversion to bool not needed here" +coccilib.org.print_todo(p[0], msg) + +//---------------------------------------------------------- +// For report mode +//---------------------------------------------------------- + +@script:python depends on r&&report@ +p << r.p; +@@ + +msg = "WARNING: conversion to bool not needed here" +coccilib.report.print_report(p[0], msg) -- cgit From 51a5f81079bfbd146b7162580c2170289c7cb413 Mon Sep 17 00:00:00 2001 From: Anton Tikhomirov Date: Tue, 25 Oct 2016 18:00:44 +0900 Subject: kbuild/mkspec: avoid using brace expansion Brace expansion might not work properly if _buildshell RPM macro points to a shell other than bash. Particularly, with _bulidshell defined to /bin/dash it leads to broken build and source symlinks. Signed-off-by: Anton Tikhomirov Signed-off-by: Michal Marek --- scripts/package/mkspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 57673bae5597..bb43f153fd8e 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -116,7 +116,8 @@ echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" echo "%endif" if ! $PREBUILT; then -echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/{build,source}" +echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build" +echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source" echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude=firmware --exclude .config.old --exclude .missing-syscalls.d\"" echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)" -- cgit From dca24c4544d96989f521b5aa49fd44ae0ae5a5b6 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 23 Nov 2016 14:16:39 +0530 Subject: Coccinelle: misc: Improve the matching of rules Currently because of the left associativity of the operators, pattern IRQF_ONESHOT | flags does not match with the pattern when we have more than one flag after the disjunction. This eventually results in giving false positives by the script. This patch eliminates these FPs by improving the rule. Signed-off-by: Vaishali Thakkar Signed-off-by: Michal Marek --- scripts/coccinelle/misc/irqf_oneshot.cocci | 36 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci index b421150a2eff..cbe4ba8f293a 100644 --- a/scripts/coccinelle/misc/irqf_oneshot.cocci +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci @@ -15,16 +15,13 @@ virtual org virtual report @r1@ -expression dev; -expression irq; -expression thread_fn; -expression flags; +expression dev, irq, thread_fn; position p; @@ ( request_threaded_irq@p(irq, NULL, thread_fn, ( -flags | IRQF_ONESHOT +IRQF_ONESHOT | ... | IRQF_ONESHOT ) @@ -32,21 +29,34 @@ IRQF_ONESHOT | devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, ( -flags | IRQF_ONESHOT +IRQF_ONESHOT | ... | IRQF_ONESHOT ) , ...) ) -@depends on patch@ -expression dev; -expression irq; -expression thread_fn; -expression flags; +@r2@ +expression dev, irq, thread_fn, flags, e; position p != r1.p; @@ ( +flags = IRQF_ONESHOT | ... +| +flags |= IRQF_ONESHOT | ... +) +... when != flags = e +( +request_threaded_irq@p(irq, NULL, thread_fn, flags, ...); +| +devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, flags, ...); +) + +@depends on patch@ +expression dev, irq, thread_fn, flags; +position p != {r1.p,r2.p}; +@@ +( request_threaded_irq@p(irq, NULL, thread_fn, ( -0 @@ -69,13 +79,13 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, ) @depends on context@ -position p != r1.p; +position p != {r1.p,r2.p}; @@ *request_threaded_irq@p(...) @match depends on report || org@ expression irq; -position p != r1.p; +position p != {r1.p,r2.p}; @@ request_threaded_irq@p(irq, NULL, ...) -- cgit From 35b303ae361611a6b418e385fee06fa08732b2e6 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 23 Nov 2016 14:16:46 +0530 Subject: Coccinelle: misc: Improve the result given by context mode To eliminate false positives given by the context mode, add necessary arguments for the function request_threaded_irq. Signed-off-by: Vaishali Thakkar Acked-by: Julia Lawall Signed-off-by: Michal Marek --- scripts/coccinelle/misc/irqf_oneshot.cocci | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci index cbe4ba8f293a..37ede13cd517 100644 --- a/scripts/coccinelle/misc/irqf_oneshot.cocci +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci @@ -79,9 +79,10 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, ) @depends on context@ +expression irq; position p != {r1.p,r2.p}; @@ -*request_threaded_irq@p(...) +*request_threaded_irq@p(irq, NULL, ...) @match depends on report || org@ expression irq; -- cgit From d1e774f49f0305092c9975d9070aefe318f49872 Mon Sep 17 00:00:00 2001 From: Vaishali Thakkar Date: Wed, 23 Nov 2016 14:16:42 +0530 Subject: Coccinelle: misc: Add support for devm variant in all modes Add missing support for the devm_request_threaded_irq in the rules of context, report and org modes. Misc: ---- To be consistent with other scripts, change confidence level of the script to 'Moderate'. Signed-off-by: Vaishali Thakkar Acked-by: Julia Lawall Signed-off-by: Michal Marek --- scripts/coccinelle/misc/irqf_oneshot.cocci | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci index 37ede13cd517..f698d6d0f5d7 100644 --- a/scripts/coccinelle/misc/irqf_oneshot.cocci +++ b/scripts/coccinelle/misc/irqf_oneshot.cocci @@ -5,7 +5,7 @@ /// So pass the IRQF_ONESHOT flag in this case. /// // -// Confidence: Good +// Confidence: Moderate // Comments: // Options: --no-includes @@ -79,16 +79,25 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, ) @depends on context@ -expression irq; +expression dev, irq; position p != {r1.p,r2.p}; @@ +( *request_threaded_irq@p(irq, NULL, ...) +| +*devm_request_threaded_irq@p(dev, irq, NULL, ...) +) + @match depends on report || org@ -expression irq; +expression dev, irq; position p != {r1.p,r2.p}; @@ +( request_threaded_irq@p(irq, NULL, ...) +| +devm_request_threaded_irq@p(dev, irq, NULL, ...) +) @script:python depends on org@ p << match.p; -- cgit