Skip to content

Commit

Permalink
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
torvalds committed Dec 18, 2016
2 parents 37861ff + ff5b1ce commit 135c919
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 18 deletions.
90 changes: 90 additions & 0 deletions scripts/coccinelle/misc/boolconv.cocci
Original file line number Diff line number Diff line change
@@ -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)
52 changes: 36 additions & 16 deletions scripts/coccinelle/misc/irqf_oneshot.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// So pass the IRQF_ONESHOT flag in this case.
///
//
// Confidence: Good
// Confidence: Moderate
// Comments:
// Options: --no-includes

Expand All @@ -15,38 +15,48 @@ 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
)
, ...)
|
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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion scripts/package/builddeb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion scripts/package/mkspec
Original file line number Diff line number Diff line change
Expand Up @@ -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 -)"
Expand Down

0 comments on commit 135c919

Please sign in to comment.