mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild misc changes from Michal Marek: "This is the non-critical part of kbuild - scripts/kernel-doc requires a "Return:" section for non-void functions - ARCH=arm SUBARCH=... support for make tags - COMPILED_SOURCE=1 support for make tags (only indexes .c files for which a .o exists) - New coccinelle check - Option parsing fix for scripts/config" * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: scripts/config: Fix wrong "shift" for --keep-case scripts/tags.sh: Support compiled source scripts/tags.sh: Support subarch for ARM scripts/coccinelle/misc/warn.cocci: use WARN scripts/kernel-doc: check that non-void fcts describe their return value Kernel-doc: Convention: Use a "Return" section to describe return values
This commit is contained in:
commit
af487e4209
3 changed files with 158 additions and 9 deletions
109
scripts/coccinelle/misc/warn.cocci
Normal file
109
scripts/coccinelle/misc/warn.cocci
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
/// Use WARN(1,...) rather than printk followed by WARN_ON(1)
|
||||||
|
///
|
||||||
|
// Confidence: High
|
||||||
|
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
|
||||||
|
// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
|
||||||
|
// URL: http://coccinelle.lip6.fr/
|
||||||
|
// Comments:
|
||||||
|
// Options: -no_includes -include_headers
|
||||||
|
|
||||||
|
virtual patch
|
||||||
|
virtual context
|
||||||
|
virtual org
|
||||||
|
virtual report
|
||||||
|
|
||||||
|
@bad1@
|
||||||
|
position p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
printk(...);
|
||||||
|
printk@p(...);
|
||||||
|
WARN_ON(1);
|
||||||
|
|
||||||
|
@r1 depends on context || report || org@
|
||||||
|
position p != bad1.p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
printk@p(...);
|
||||||
|
*WARN_ON(1);
|
||||||
|
|
||||||
|
@script:python depends on org@
|
||||||
|
p << r1.p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
cocci.print_main("printk + WARN_ON can be just WARN",p)
|
||||||
|
|
||||||
|
@script:python depends on report@
|
||||||
|
p << r1.p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
msg = "SUGGESTION: printk + WARN_ON can be just WARN"
|
||||||
|
coccilib.report.print_report(p[0],msg)
|
||||||
|
|
||||||
|
@ok1 depends on patch@
|
||||||
|
expression list es;
|
||||||
|
position p != bad1.p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
-printk@p(
|
||||||
|
+WARN(1,
|
||||||
|
es);
|
||||||
|
-WARN_ON(1);
|
||||||
|
|
||||||
|
@depends on patch@
|
||||||
|
expression list ok1.es;
|
||||||
|
@@
|
||||||
|
|
||||||
|
if (...)
|
||||||
|
- {
|
||||||
|
WARN(1,es);
|
||||||
|
- }
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
@bad2@
|
||||||
|
position p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
printk(...);
|
||||||
|
printk@p(...);
|
||||||
|
WARN_ON_ONCE(1);
|
||||||
|
|
||||||
|
@r2 depends on context || report || org@
|
||||||
|
position p != bad1.p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
printk@p(...);
|
||||||
|
*WARN_ON_ONCE(1);
|
||||||
|
|
||||||
|
@script:python depends on org@
|
||||||
|
p << r2.p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
cocci.print_main("printk + WARN_ON_ONCE can be just WARN_ONCE",p)
|
||||||
|
|
||||||
|
@script:python depends on report@
|
||||||
|
p << r2.p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
msg = "SUGGESTION: printk + WARN_ON_ONCE can be just WARN_ONCE"
|
||||||
|
coccilib.report.print_report(p[0],msg)
|
||||||
|
|
||||||
|
@ok2 depends on patch@
|
||||||
|
expression list es;
|
||||||
|
position p != bad2.p;
|
||||||
|
@@
|
||||||
|
|
||||||
|
-printk@p(
|
||||||
|
+WARN_ONCE(1,
|
||||||
|
es);
|
||||||
|
-WARN_ON_ONCE(1);
|
||||||
|
|
||||||
|
@depends on patch@
|
||||||
|
expression list ok2.es;
|
||||||
|
@@
|
||||||
|
|
||||||
|
if (...)
|
||||||
|
- {
|
||||||
|
WARN_ONCE(1,es);
|
||||||
|
- }
|
|
@ -101,7 +101,6 @@ while [ "$1" != "" ] ; do
|
||||||
case "$CMD" in
|
case "$CMD" in
|
||||||
--keep-case|-k)
|
--keep-case|-k)
|
||||||
MUNGE_CASE=no
|
MUNGE_CASE=no
|
||||||
shift
|
|
||||||
continue
|
continue
|
||||||
;;
|
;;
|
||||||
--refresh)
|
--refresh)
|
||||||
|
|
|
@ -48,13 +48,14 @@ find_arch_sources()
|
||||||
for i in $archincludedir; do
|
for i in $archincludedir; do
|
||||||
prune="$prune -wholename $i -prune -o"
|
prune="$prune -wholename $i -prune -o"
|
||||||
done
|
done
|
||||||
find ${tree}arch/$1 $ignore $prune -name "$2" -print;
|
find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" -print;
|
||||||
}
|
}
|
||||||
|
|
||||||
# find sources in arch/$1/include
|
# find sources in arch/$1/include
|
||||||
find_arch_include_sources()
|
find_arch_include_sources()
|
||||||
{
|
{
|
||||||
include=$(find ${tree}arch/$1/ -name include -type d);
|
include=$(find ${tree}arch/$1/ $subarchprune \
|
||||||
|
-name include -type d -print);
|
||||||
if [ -n "$include" ]; then
|
if [ -n "$include" ]; then
|
||||||
archincludedir="$archincludedir $include"
|
archincludedir="$archincludedir $include"
|
||||||
find $include $ignore -name "$2" -print;
|
find $include $ignore -name "$2" -print;
|
||||||
|
@ -95,6 +96,32 @@ all_sources()
|
||||||
find_other_sources '*.[chS]'
|
find_other_sources '*.[chS]'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
all_compiled_sources()
|
||||||
|
{
|
||||||
|
for i in $(all_sources); do
|
||||||
|
case "$i" in
|
||||||
|
*.[cS])
|
||||||
|
j=${i/\.[cS]/\.o}
|
||||||
|
if [ -e $j ]; then
|
||||||
|
echo $i
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $i
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
all_target_sources()
|
||||||
|
{
|
||||||
|
if [ -n "$COMPILED_SOURCE" ]; then
|
||||||
|
all_compiled_sources
|
||||||
|
else
|
||||||
|
all_sources
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
all_kconfigs()
|
all_kconfigs()
|
||||||
{
|
{
|
||||||
for arch in $ALLSOURCE_ARCHS; do
|
for arch in $ALLSOURCE_ARCHS; do
|
||||||
|
@ -110,18 +137,18 @@ all_defconfigs()
|
||||||
|
|
||||||
docscope()
|
docscope()
|
||||||
{
|
{
|
||||||
(echo \-k; echo \-q; all_sources) > cscope.files
|
(echo \-k; echo \-q; all_target_sources) > cscope.files
|
||||||
cscope -b -f cscope.out
|
cscope -b -f cscope.out
|
||||||
}
|
}
|
||||||
|
|
||||||
dogtags()
|
dogtags()
|
||||||
{
|
{
|
||||||
all_sources | gtags -i -f -
|
all_target_sources | gtags -i -f -
|
||||||
}
|
}
|
||||||
|
|
||||||
exuberant()
|
exuberant()
|
||||||
{
|
{
|
||||||
all_sources | xargs $1 -a \
|
all_target_sources | xargs $1 -a \
|
||||||
-I __initdata,__exitdata,__acquires,__releases \
|
-I __initdata,__exitdata,__acquires,__releases \
|
||||||
-I __read_mostly,____cacheline_aligned \
|
-I __read_mostly,____cacheline_aligned \
|
||||||
-I ____cacheline_aligned_in_smp \
|
-I ____cacheline_aligned_in_smp \
|
||||||
|
@ -173,7 +200,7 @@ exuberant()
|
||||||
|
|
||||||
emacs()
|
emacs()
|
||||||
{
|
{
|
||||||
all_sources | xargs $1 -a \
|
all_target_sources | xargs $1 -a \
|
||||||
--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \
|
--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \
|
||||||
--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
|
--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \
|
||||||
--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
|
--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \
|
||||||
|
@ -220,11 +247,10 @@ xtags()
|
||||||
elif $1 --version 2>&1 | grep -iq emacs; then
|
elif $1 --version 2>&1 | grep -iq emacs; then
|
||||||
emacs $1
|
emacs $1
|
||||||
else
|
else
|
||||||
all_sources | xargs $1 -a
|
all_target_sources | xargs $1 -a
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Support um (which uses SUBARCH)
|
# Support um (which uses SUBARCH)
|
||||||
if [ "${ARCH}" = "um" ]; then
|
if [ "${ARCH}" = "um" ]; then
|
||||||
if [ "$SUBARCH" = "i386" ]; then
|
if [ "$SUBARCH" = "i386" ]; then
|
||||||
|
@ -234,6 +260,21 @@ if [ "${ARCH}" = "um" ]; then
|
||||||
else
|
else
|
||||||
archinclude=${SUBARCH}
|
archinclude=${SUBARCH}
|
||||||
fi
|
fi
|
||||||
|
elif [ "${SRCARCH}" = "arm" -a "${SUBARCH}" != "" ]; then
|
||||||
|
subarchdir=$(find ${tree}arch/$SRCARCH/ -name "mach-*" -type d -o \
|
||||||
|
-name "plat-*" -type d);
|
||||||
|
for i in $subarchdir; do
|
||||||
|
case "$i" in
|
||||||
|
*"mach-"${SUBARCH})
|
||||||
|
;;
|
||||||
|
*"plat-"${SUBARCH})
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
subarchprune="$subarchprune \
|
||||||
|
-wholename $i -prune -o"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
remove_structs=
|
remove_structs=
|
||||||
|
|
Loading…
Reference in a new issue