forked from Minki/linux
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
This commit is contained in:
commit
135c919758
90
scripts/coccinelle/misc/boolconv.cocci
Normal file
90
scripts/coccinelle/misc/boolconv.cocci
Normal file
@ -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)
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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 -)"
|
||||
|
Loading…
Reference in New Issue
Block a user