summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-18 03:32:27 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-18 03:32:27 +0300
commit135c919758b019599c9ea7730f7ceb063f19c7b7 (patch)
treee08c7bd51fc7c53ce580f91b5af086435f9b00aa /scripts
parent37861ffa8c28e6c479cf04a70b7d6cc33d23c2a8 (diff)
parentff5b1ce6b22080379fd1ae9076ff2f5ca6519861 (diff)
downloadlinux-135c919758b019599c9ea7730f7ceb063f19c7b7.tar.xz
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild misc updates from Michal Marek: - one new coccinelle check and improvements to irqf_oneshot.cocci - 'make rpm' POSIX compatibility fix - 'make deb-pkg' arm64 cross-compiling fix. I forgot to send this one during the v4.9 rc-phase, therefor the pull request is based on -rc6 and not -rc1 * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: Coccinelle: misc: Add support for devm variant in all modes Coccinelle: misc: Improve the result given by context mode Coccinelle: misc: Improve the matching of rules kbuild/mkspec: avoid using brace expansion Coccinelle: Add misc/boolconv.cocci builddeb: fix cross-building to arm64 producing host-arch debs
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/misc/boolconv.cocci90
-rw-r--r--scripts/coccinelle/misc/irqf_oneshot.cocci52
-rwxr-xr-xscripts/package/builddeb2
-rwxr-xr-xscripts/package/mkspec3
4 files changed, 129 insertions, 18 deletions
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 <afd@ti.com> 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)
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
index b421150a2eff..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
@@ -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,15 +79,25 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
)
@depends on context@
-position p != r1.p;
+expression dev, irq;
+position p != {r1.p,r2.p};
@@
-*request_threaded_irq@p(...)
+(
+*request_threaded_irq@p(irq, NULL, ...)
+|
+*devm_request_threaded_irq@p(dev, irq, NULL, ...)
+)
+
@match depends on report || org@
-expression irq;
-position p != r1.p;
+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;
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
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 -)"