From 3005286ee366dac5b75b8f17d4072f433ccbfa4a Mon Sep 17 00:00:00 2001 From: Jianyu Zhan Date: Wed, 16 Apr 2014 23:13:34 +0800 Subject: scripts/tags.sh: add pattern for DEFINE_HASHTABLE Signed-off-by: Jianyu Zhan Signed-off-by: Michal Marek --- scripts/tags.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/tags.sh b/scripts/tags.sh index f2c5b006a3d..c1f64893efe 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -201,7 +201,8 @@ exuberant() --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \ --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' \ --regex-c='/(^\s)OFFSET\((\w*)/\2/v/' \ - --regex-c='/(^\s)DEFINE\((\w*)/\2/v/' + --regex-c='/(^\s)DEFINE\((\w*)/\2/v/' \ + --regex-c='/DEFINE_HASHTABLE\((\w*)/\1/v/' all_kconfigs | xargs $1 -a \ --langdef=kconfig --language-force=kconfig \ @@ -246,7 +247,8 @@ emacs() --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \ --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \ --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \ - --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/' + --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\ + --regex='/DEFINE_HASHTABLE\((\w*)/\1/v/' all_kconfigs | xargs $1 -a \ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' -- cgit v1.2.3-70-g09d2 From 8c38a5328af8080bc69a25b3e4e144b03eeea95e Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov Date: Mon, 21 Apr 2014 12:03:08 +0400 Subject: scripts/tags.sh: ignore code of user space tools User space code in tools/ often reuses names of kernel constructions, this confuses navigation in the normal kernel code. Let's fix this mess. Signed-off-by: Konstantin Khlebnikov Signed-off-by: Michal Marek --- scripts/tags.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/tags.sh b/scripts/tags.sh index c1f64893efe..6db551e0749 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -25,6 +25,9 @@ else tree=${srctree}/ fi +# ignore userspace tools +ignore="$ignore ( -path ${tree}tools ) -prune -o" + # Find all available archs find_all_archs() { -- cgit v1.2.3-70-g09d2 From 6b4a144a92ab81a1f45fb9b12aebaaaee0d08120 Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Sat, 12 Apr 2014 13:13:24 +0300 Subject: builddeb: use $OBJCOPY variable instead of objcopy In cross-build environment, we expect to use the cross-compiler objcopy instead of the host objcopy. It fixes following build failures: objcopy --only-keep-debug lib/modules/3.14/kernel/net/ipv6/xfrm6_mode_tunnel.ko /srv/build/linux/debian/dbgtmp/usr/lib/debug/lib/modules/3.14/kernel/net/ipv6/xfrm6_mode_tunnel.ko objcopy: Unable to recognise the format of the input file `lib/modules/3.14/kernel/net/ipv6/xfrm6_mode_tunnel.ko' Signed-off-by: Fathi Boudra Cc: stable # 3.12+ Fixes: 810e843746b7 ('deb-pkg: split debug symbols in their own package') Reviewed-by: Ben Hutchings Signed-off-by: Michal Marek --- scripts/package/builddeb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index f46e4dd0558..152d4d25ab7 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -155,11 +155,11 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then for module in $(find lib/modules/ -name *.ko); do mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module) # only keep debug symbols in the debug file - objcopy --only-keep-debug $module $dbg_dir/usr/lib/debug/$module + $OBJCOPY --only-keep-debug $module $dbg_dir/usr/lib/debug/$module # strip original module from debug symbols - objcopy --strip-debug $module + $OBJCOPY --strip-debug $module # then add a link to those - objcopy --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module + $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module done ) fi -- cgit v1.2.3-70-g09d2 From a8d9c9f1f12978eb597fa4d75f412b34825941e7 Mon Sep 17 00:00:00 2001 From: Fathi Boudra Date: Sat, 12 Apr 2014 15:53:06 +0300 Subject: builddeb: add arm64 in the supported architectures Signed-off-by: Fathi Boudra Reviewed-by: Ben Hutchings Signed-off-by: Michal Marek --- scripts/package/builddeb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 152d4d25ab7..ae7e607dc28 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -42,6 +42,8 @@ create_package() { debarch=hppa ;; mips*) debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;; + arm64) + debarch=arm64 ;; arm*) debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;; *) -- cgit v1.2.3-70-g09d2 From 79c704a87834164259b7aa7469d426d6ba351eec Mon Sep 17 00:00:00 2001 From: Jianyu Zhan Date: Tue, 13 May 2014 21:26:53 +0800 Subject: scripts/tags.sh: add regular expression replacement pattern for memcg Currently, while using ctags to read code, we would get stumbled on PageCgroup* symbols: no definition found. And it is quite dull to manually dig it out. This patch adds regular expression replacement pattern for such symbols, like what have done for the PageXXX flag. It will teach ctags to find out the definition for us. Signed-off-by: Jianyu Zhan Signed-off-by: Michal Marek --- scripts/tags.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts') diff --git a/scripts/tags.sh b/scripts/tags.sh index 6db551e0749..1c50de82028 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -190,6 +190,10 @@ exuberant() --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ + --regex-c++='/TESTPCGFLAG\(([^,)]*).*/PageCgroup\1/' \ + --regex-c++='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ + --regex-c++='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ + --regex-c++='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \ --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \ --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \ @@ -248,6 +252,10 @@ emacs() --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \ --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \ --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \ + --regex='/TESTPCGFLAG\(([^,)]*).*/PageCgroup\1/' \ + --regex='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ + --regex='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ + --regex='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \ --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \ --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\ -- cgit v1.2.3-70-g09d2 From 9b24a15d81f4b7cd50c3cf13c0e753c865e345df Mon Sep 17 00:00:00 2001 From: Yann Droneaud Date: Wed, 21 May 2014 15:32:17 +0200 Subject: scripts/tags.sh: ignore symlink'ed source files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit 22d651dcef536c75f75537290bf3da5038e68b6b ('selftests/powerpc: Import Anton's memcpy / copy_tofrom_user tests'), some source files in the tree appear as symlink. Until commit 8c38a5328af8080bc69a25b3e4e144b03eeea95e ('scripts/tags.sh: ignore code of user space tools'), those symlinks made cscope report some warnings: $ make ALLSOURCE_ARCHS=all O=./obj-cscope/ cscope GEN cscope cscope: cannot find file .../tools/testing/selftests/powerpc/copyloops/copyuser_power7.S cscope: cannot find file .../tools/testing/selftests/powerpc/copyloops/memcpy_64.S cscope: cannot find file .../tools/testing/selftests/powerpc/copyloops/memcpy_power7.S cscope: cannot find file .../tools/testing/selftests/powerpc/copyloops/copyuser_64.S In order to prevent the same kind of warnings to be triggered by future addition of symlinks, the best option is to ignore all symlinks when building the file list to be processed by cscope (and other tools supported by scripts/tags.sh). Ignoring symlinks won't hide source files from cscope (and others) as the target of these symlinks already appear somewhere else in the tree, and, as such, should be processed by cscope (or others). Note that, cscope, when used with -R option to make it find the files to process by itself, already skip symlinks: it's not expected that cscope access source files through symlink. On top of commit 8c38a5328af8080bc69a25b3e4e144b03eeea95e ('scripts/tags.sh: ignore code of user space tools'), scripts/tags.sh output from "make cscope tags TAGS" is the same with and without this patch: it doesn't seems to introduce any regression (on Fedora 20). Link: http://lkml.kernel.org/r/1396530975.4361.28.camel@localhost.localdomain Link: http://mid.gmane.org/534312F8.5090609@t-online.de Cc: Michael Ellerman Cc: Anton Blanchard Cc: Benjamin Herrenschmidt Cc: Hans-Bernhard Bröker , Cc: Hans-Bernhard Broeker , Cc: Neil Horman Cc: Neil Horman Cc: Gerhard Sittig Cc: Konstantin Khlebnikov Signed-off-by: Yann Droneaud Signed-off-by: Michal Marek --- scripts/tags.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/tags.sh b/scripts/tags.sh index 1c50de82028..4c425d25173 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -50,7 +50,8 @@ find_arch_sources() for i in $archincludedir; do prune="$prune -wholename $i -prune -o" done - find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" -print; + find ${tree}arch/$1 $ignore $subarchprune $prune -name "$2" \ + -not -type l -print; } # find sources in arch/$1/include @@ -60,14 +61,15 @@ find_arch_include_sources() -name include -type d -print); if [ -n "$include" ]; then archincludedir="$archincludedir $include" - find $include $ignore -name "$2" -print; + find $include $ignore -name "$2" -not -type l -print; fi } # find sources in include/ find_include_sources() { - find ${tree}include $ignore -name config -prune -o -name "$1" -print; + find ${tree}include $ignore -name config -prune -o -name "$1" \ + -not -type l -print; } # find sources in rest of tree @@ -76,7 +78,7 @@ find_other_sources() { find ${tree}* $ignore \ \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \ - -name "$1" -print; + -name "$1" -not -type l -print; } find_sources() -- cgit v1.2.3-70-g09d2 From 2d5c5dbb48253f1729dc09f266a98bd2d7e694cb Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Tue, 3 Jun 2014 20:25:27 +0200 Subject: coccinelle: Check for missing NULL terminators in of_device_id tables Failure to terminate an of_device_id table can lead to confusing failures depending on where the compiler places the array. Add a check to make sure these tables are terminated. Thanks to Mitchel Humpherys for coming up with the pattern initially. Cc: Mitchel Humpherys Cc: Gilles Muller Cc: Nicolas Palix Cc: Rob Herring Cc: devicetree@vger.kernel.org Signed-off-by: Stephen Boyd Acked-by: Grant Likely Signed-off-by: Julia Lawall Signed-off-by: Michal Marek --- scripts/coccinelle/misc/of_table.cocci | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 scripts/coccinelle/misc/of_table.cocci (limited to 'scripts') diff --git a/scripts/coccinelle/misc/of_table.cocci b/scripts/coccinelle/misc/of_table.cocci new file mode 100644 index 00000000000..3c934046a06 --- /dev/null +++ b/scripts/coccinelle/misc/of_table.cocci @@ -0,0 +1,62 @@ +/// Make sure of_device_id tables are NULL terminated +// +// Keywords: of_table +// Confidence: Medium +// Options: --include-headers + +virtual patch +virtual context +virtual org +virtual report + +@depends on context@ +identifier var, arr; +expression E; +@@ +struct of_device_id arr[] = { + ..., + { + .var = E, +* } +}; + +@depends on patch@ +identifier var, arr; +expression E; +@@ +struct of_device_id arr[] = { + ..., + { + .var = E, +- } ++ }, ++ { } +}; + +@r depends on org || report@ +position p1; +identifier var, arr; +expression E; +@@ +struct of_device_id arr[] = { + ..., + { + .var = E, + } + @p1 +}; + +@script:python depends on org@ +p1 << r.p1; +arr << r.arr; +@@ + +cocci.print_main(arr,p1) + +@script:python depends on report@ +p1 << r.p1; +arr << r.arr; +@@ + +msg = "%s is not NULL terminated at line %s" % (arr, p1[0].line) +coccilib.report.print_report(p1[0],msg) -- cgit v1.2.3-70-g09d2 From 7eb6e340526adf14ed7cf7dfde8b9c6fc0741cfc Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 29 May 2014 14:12:29 +0900 Subject: kbuild: trivial - remove trailing empty lines Signed-off-by: Masahiro Yamada --- scripts/Makefile.asm-generic | 1 - scripts/Makefile.host | 1 - scripts/checkstack.pl | 1 - scripts/config | 1 - scripts/dtc/.gitignore | 1 - scripts/dtc/fstree.c | 1 - scripts/dtc/libfdt/fdt_empty_tree.c | 1 - scripts/dtc/treesource.c | 1 - scripts/headers.sh | 2 -- scripts/kconfig/Makefile | 1 - scripts/kconfig/check.sh | 1 - scripts/kconfig/mconf.c | 1 - scripts/kconfig/nconf.c | 1 - scripts/kconfig/util.c | 2 -- scripts/markup_oops.pl | 1 - scripts/mksysmap | 1 - scripts/mod/.gitignore | 1 - scripts/mod/mk_elfconfig.c | 1 - scripts/package/Makefile | 1 - scripts/package/buildtar | 1 - scripts/pnmtologo.c | 1 - scripts/recordmcount.c | 2 -- scripts/rt-tester/check-all.sh | 1 - scripts/rt-tester/rt-tester.py | 2 -- scripts/selinux/install_policy.sh | 1 - scripts/show_delta | 1 - 26 files changed, 30 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic index d17e0ea911e..045e0098e96 100644 --- a/scripts/Makefile.asm-generic +++ b/scripts/Makefile.asm-generic @@ -21,4 +21,3 @@ all: $(patsubst %, $(obj)/%, $(generic-y)) $(obj)/%.h: $(call cmd,wrap) - diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 1ac414fd503..b0ec4be6767 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -167,4 +167,3 @@ $(host-cshlib): $(obj)/%: $(host-cshobjs) FORCE targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) - diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index 544aa56b620..c05d586b1fe 100755 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl @@ -173,4 +173,3 @@ while (my $line = ) { # Sort output by size (last field) print sort { ($b =~ /:\t*(\d+)$/)[0] <=> ($a =~ /:\t*(\d+)$/)[0] } @stack; - diff --git a/scripts/config b/scripts/config index 68041793698..026aeb4f32e 100755 --- a/scripts/config +++ b/scripts/config @@ -223,4 +223,3 @@ while [ "$1" != "" ] ; do ;; esac done - diff --git a/scripts/dtc/.gitignore b/scripts/dtc/.gitignore index 095acb49a37..cdabdc95a6e 100644 --- a/scripts/dtc/.gitignore +++ b/scripts/dtc/.gitignore @@ -2,4 +2,3 @@ dtc dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h - diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c index f3774530170..e464727c880 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c @@ -88,4 +88,3 @@ struct boot_info *dt_from_fs(const char *dirname) return build_boot_info(NULL, tree, guess_boot_cpuid(tree)); } - diff --git a/scripts/dtc/libfdt/fdt_empty_tree.c b/scripts/dtc/libfdt/fdt_empty_tree.c index f72d13b1d19..f2ae9b77c28 100644 --- a/scripts/dtc/libfdt/fdt_empty_tree.c +++ b/scripts/dtc/libfdt/fdt_empty_tree.c @@ -81,4 +81,3 @@ int fdt_create_empty_tree(void *buf, int bufsize) return fdt_open_into(buf, buf, bufsize); } - diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c index 33eeba55fb4..5740e6992d3 100644 --- a/scripts/dtc/treesource.c +++ b/scripts/dtc/treesource.c @@ -281,4 +281,3 @@ void dt_to_source(FILE *f, struct boot_info *bi) write_tree_source_node(f, bi->dt, 0); } - diff --git a/scripts/headers.sh b/scripts/headers.sh index 978b42b3acd..95ece06599a 100755 --- a/scripts/headers.sh +++ b/scripts/headers.sh @@ -28,5 +28,3 @@ for arch in ${archs}; do ;; esac done - - diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 844bc9da08d..e57478aa66f 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -319,4 +319,3 @@ $(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck $(obj)/gconf.glade.h: $(obj)/gconf.glade $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ $(obj)/gconf.glade - diff --git a/scripts/kconfig/check.sh b/scripts/kconfig/check.sh index 854d9c7c675..55b79ba1ba2 100755 --- a/scripts/kconfig/check.sh +++ b/scripts/kconfig/check.sh @@ -11,4 +11,3 @@ EOF if [ ! "$?" -eq "0" ]; then echo -DKBUILD_NO_NLS; fi - diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 59184bb41ef..0cc37b5c402 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -1034,4 +1034,3 @@ int main(int ac, char **av) return res; } - diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 4fbecd2473b..984489ef2b4 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -1554,4 +1554,3 @@ int main(int ac, char **av) endwin(); return 0; } - diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 6e7fbf19680..94f9c83e324 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c @@ -155,5 +155,3 @@ void *xcalloc(size_t nmemb, size_t size) fprintf(stderr, "Out of memory.\n"); exit(1); } - - diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index 827896f5650..c21d16328d3 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl @@ -367,4 +367,3 @@ OPTION: EOT exit; } - diff --git a/scripts/mksysmap b/scripts/mksysmap index c1b6191ef87..7ada35a0f47 100644 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -42,4 +42,3 @@ # (At least sparc64 has __crc_ in the middle). $NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2 - diff --git a/scripts/mod/.gitignore b/scripts/mod/.gitignore index 33bae0df4de..3bd11b60317 100644 --- a/scripts/mod/.gitignore +++ b/scripts/mod/.gitignore @@ -2,4 +2,3 @@ elfconfig.h mk_elfconfig modpost devicetable-offsets.h - diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c index 639bca7ba55..a4fd71d71d6 100644 --- a/scripts/mod/mk_elfconfig.c +++ b/scripts/mod/mk_elfconfig.c @@ -54,4 +54,3 @@ main(int argc, char **argv) return 0; } - diff --git a/scripts/package/Makefile b/scripts/package/Makefile index c5d47339381..99ca6e76eb0 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -143,4 +143,3 @@ help: FORCE @echo ' perf-targz-src-pkg - Build $(perf-tar).tar.gz source tarball' @echo ' perf-tarbz2-src-pkg - Build $(perf-tar).tar.bz2 source tarball' @echo ' perf-tarxz-src-pkg - Build $(perf-tar).tar.xz source tarball' - diff --git a/scripts/package/buildtar b/scripts/package/buildtar index aa22f9447dd..995c1eafaff 100644 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -136,4 +136,3 @@ esac echo "Tarball successfully created in ${tarball}${file_ext}" exit 0 - diff --git a/scripts/pnmtologo.c b/scripts/pnmtologo.c index 68bb4efc5af..4718d7895f0 100644 --- a/scripts/pnmtologo.c +++ b/scripts/pnmtologo.c @@ -512,4 +512,3 @@ int main(int argc, char *argv[]) } exit(0); } - diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index 9c22317778e..c0853063fcb 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c @@ -480,5 +480,3 @@ main(int argc, char *argv[]) } return !!n_error; } - - diff --git a/scripts/rt-tester/check-all.sh b/scripts/rt-tester/check-all.sh index 43098afe743..6b5c83baf14 100644 --- a/scripts/rt-tester/check-all.sh +++ b/scripts/rt-tester/check-all.sh @@ -19,4 +19,3 @@ testit t3-l2-pi.tst testit t4-l2-pi-deboost.tst testit t5-l4-pi-boost-deboost.tst testit t5-l4-pi-boost-deboost-setsched.tst - diff --git a/scripts/rt-tester/rt-tester.py b/scripts/rt-tester/rt-tester.py index 34186cac1d2..6d916c2a45a 100644 --- a/scripts/rt-tester/rt-tester.py +++ b/scripts/rt-tester/rt-tester.py @@ -216,5 +216,3 @@ while 1: # Normal exit pass print "Pass" sys.exit(0) - - diff --git a/scripts/selinux/install_policy.sh b/scripts/selinux/install_policy.sh index 7b9ccf61f8f..f6a0ce71015 100644 --- a/scripts/selinux/install_policy.sh +++ b/scripts/selinux/install_policy.sh @@ -66,4 +66,3 @@ if [ "eq$dodev" != "eq" ]; then $SF file_contexts /dev mount --move /mnt /dev fi - diff --git a/scripts/show_delta b/scripts/show_delta index e25732b5d70..5b365009e6a 100755 --- a/scripts/show_delta +++ b/scripts/show_delta @@ -126,4 +126,3 @@ def main(): print (convert_line(line, base_time),) main() - -- cgit v1.2.3-70-g09d2 From bb66fc67192bbd406fe9c22033f1bbbf3e7ec621 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 10 Jun 2014 19:08:13 +0900 Subject: kbuild: trivial - use tabs for code indent where possible Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- scripts/basic/fixdep.c | 8 +++--- scripts/docproc.c | 56 ++++++++++++++++++------------------ scripts/kallsyms.c | 2 +- scripts/kconfig/conf.c | 2 +- scripts/kconfig/gconf.c | 2 +- scripts/kconfig/lxdialog/checklist.c | 4 +-- scripts/kconfig/lxdialog/inputbox.c | 2 +- scripts/kconfig/lxdialog/menubox.c | 4 +-- scripts/kconfig/lxdialog/util.c | 2 +- scripts/kconfig/mconf.c | 2 +- scripts/kconfig/menu.c | 6 ++-- scripts/kconfig/zconf.l | 4 +-- scripts/kconfig/zconf.lex.c_shipped | 4 +-- scripts/kconfig/zconf.tab.c_shipped | 2 +- scripts/kconfig/zconf.y | 2 +- scripts/mod/file2alias.c | 42 +++++++++++++-------------- scripts/mod/modpost.c | 30 +++++++++---------- scripts/mod/sumversion.c | 4 +-- scripts/tags.sh | 2 +- 19 files changed, 89 insertions(+), 91 deletions(-) (limited to 'scripts') diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 078fe1d64e7..b30406860b7 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -409,10 +409,10 @@ static void print_deps(void) exit(2); } if (fstat(fd, &st) < 0) { - fprintf(stderr, "fixdep: error fstat'ing depfile: "); - perror(depfile); - exit(2); - } + fprintf(stderr, "fixdep: error fstat'ing depfile: "); + perror(depfile); + exit(2); + } if (st.st_size == 0) { fprintf(stderr,"fixdep: %s is empty\n",depfile); close(fd); diff --git a/scripts/docproc.c b/scripts/docproc.c index 2b69eaf5b64..e267e621431 100644 --- a/scripts/docproc.c +++ b/scripts/docproc.c @@ -154,7 +154,7 @@ int symfilecnt = 0; static void add_new_symbol(struct symfile *sym, char * symname) { sym->symbollist = - realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); + realloc(sym->symbollist, (sym->symbolcnt + 1) * sizeof(char *)); sym->symbollist[sym->symbolcnt++].name = strdup(symname); } @@ -215,7 +215,7 @@ static void find_export_symbols(char * filename) char *p; char *e; if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != NULL) || - ((p = strstr(line, "EXPORT_SYMBOL")) != NULL)) { + ((p = strstr(line, "EXPORT_SYMBOL")) != NULL)) { /* Skip EXPORT_SYMBOL{_GPL} */ while (isalnum(*p) || *p == '_') p++; @@ -291,28 +291,28 @@ static void extfunc(char * filename) { docfunctions(filename, FUNCTION); } static void singfunc(char * filename, char * line) { char *vec[200]; /* Enough for specific functions */ - int i, idx = 0; - int startofsym = 1; + int i, idx = 0; + int startofsym = 1; vec[idx++] = KERNELDOC; vec[idx++] = DOCBOOK; vec[idx++] = SHOWNOTFOUND; - /* Split line up in individual parameters preceded by FUNCTION */ - for (i=0; line[i]; i++) { - if (isspace(line[i])) { - line[i] = '\0'; - startofsym = 1; - continue; - } - if (startofsym) { - startofsym = 0; - vec[idx++] = FUNCTION; - vec[idx++] = &line[i]; - } - } + /* Split line up in individual parameters preceded by FUNCTION */ + for (i=0; line[i]; i++) { + if (isspace(line[i])) { + line[i] = '\0'; + startofsym = 1; + continue; + } + if (startofsym) { + startofsym = 0; + vec[idx++] = FUNCTION; + vec[idx++] = &line[i]; + } + } for (i = 0; i < idx; i++) { - if (strcmp(vec[i], FUNCTION)) - continue; + if (strcmp(vec[i], FUNCTION)) + continue; consume_symbol(vec[i + 1]); } vec[idx++] = filename; @@ -460,14 +460,14 @@ static void parse_file(FILE *infile) break; case 'D': while (*s && !isspace(*s)) s++; - *s = '\0'; - symbolsonly(line+2); - break; + *s = '\0'; + symbolsonly(line+2); + break; case 'F': /* filename */ while (*s && !isspace(*s)) s++; *s++ = '\0'; - /* function names */ + /* function names */ while (isspace(*s)) s++; singlefunctions(line +2, s); @@ -515,11 +515,11 @@ int main(int argc, char *argv[]) } /* Open file, exit on error */ infile = fopen(argv[2], "r"); - if (infile == NULL) { - fprintf(stderr, "docproc: "); - perror(argv[2]); - exit(2); - } + if (infile == NULL) { + fprintf(stderr, "docproc: "); + perror(argv[2]); + exit(2); + } if (strcmp("doc", argv[1]) == 0) { /* Need to do this in two passes. diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 1237dd7fb4c..dc7aa45e80c 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -123,7 +123,7 @@ static int read_symbol(FILE *in, struct sym_entry *s) } if (strlen(str) > KSYM_NAME_LEN) { fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n" - "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", + "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", str, strlen(str), KSYM_NAME_LEN); return -1; } diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index d19944f9c3a..fef75fc756f 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -696,7 +696,7 @@ int main(int ac, char **av) } else if (input_mode == savedefconfig) { if (conf_write_defconfig(defconfig_file)) { fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"), - defconfig_file); + defconfig_file); return 1; } } else if (input_mode != listnewconfig) { diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index f2bee70e26f..d0a35b21f30 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -1404,7 +1404,7 @@ static void display_tree(struct menu *menu) && (tree == tree2)) continue; /* - if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) + if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) || (view_mode == FULL_VIEW) || (view_mode == SPLIT_VIEW))*/ diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c index 3b15c08ec1f..8d016faa28d 100644 --- a/scripts/kconfig/lxdialog/checklist.c +++ b/scripts/kconfig/lxdialog/checklist.c @@ -168,13 +168,13 @@ do_resize: /* create new window for the list */ list = subwin(dialog, list_height, list_width, y + box_y + 1, - x + box_x + 1); + x + box_x + 1); keypad(list, TRUE); /* draw a box around the list items */ draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, - dlg.menubox_border.atr, dlg.menubox.atr); + dlg.menubox_border.atr, dlg.menubox.atr); /* Find length of longest item in order to center checklist */ check_x = 0; diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c index 447a582198c..d58de1dc536 100644 --- a/scripts/kconfig/lxdialog/inputbox.c +++ b/scripts/kconfig/lxdialog/inputbox.c @@ -42,7 +42,7 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) * Display a dialog box for inputing a string */ int dialog_inputbox(const char *title, const char *prompt, int height, int width, - const char *init) + const char *init) { int i, x, y, box_y, box_x, box_width; int input_x = 0, key = 0, button = -1; diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index c93de0b2fac..11ae9ad7ac7 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c @@ -64,7 +64,7 @@ static int menu_width, item_x; * Print menu item */ static void do_print_item(WINDOW * win, const char *item, int line_y, - int selected, int hotkey) + int selected, int hotkey) { int j; char *menu_item = malloc(menu_width + 1); @@ -182,7 +182,7 @@ static void do_scroll(WINDOW *win, int *scroll, int n) * Display a menu for choosing among a number of options */ int dialog_menu(const char *title, const char *prompt, - const void *selected, int *s_scroll) + const void *selected, int *s_scroll) { int i, j, x, y, box_x, box_y; int height, width, menu_height; diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index 58a8289dd65..f7abdeb92af 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c @@ -623,7 +623,7 @@ void item_make(const char *fmt, ...) void item_add_str(const char *fmt, ...) { va_list ap; - size_t avail; + size_t avail; avail = sizeof(item_cur->node.str) - strlen(item_cur->node.str); diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 0cc37b5c402..14cea7463a6 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -299,7 +299,7 @@ static void set_config_filename(const char *config_filename) int size; size = snprintf(menu_backtitle, sizeof(menu_backtitle), - "%s - %s", config_filename, rootmenu.prompt->text); + "%s - %s", config_filename, rootmenu.prompt->text); if (size >= sizeof(menu_backtitle)) menu_backtitle[sizeof(menu_backtitle)-1] = '\0'; set_dialog_backtitle(menu_backtitle); diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 3ac2c9c6e28..a26cc5d2a9b 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -258,8 +258,8 @@ static void sym_check_prop(struct symbol *sym) "config symbol '%s' uses select, but is " "not boolean or tristate", sym->name); else if (sym2->type != S_UNKNOWN && - sym2->type != S_BOOLEAN && - sym2->type != S_TRISTATE) + sym2->type != S_BOOLEAN && + sym2->type != S_TRISTATE) prop_warn(prop, "'%s' has wrong type. 'select' only " "accept arguments of boolean and " @@ -268,7 +268,7 @@ static void sym_check_prop(struct symbol *sym) case P_RANGE: if (sym->type != S_INT && sym->type != S_HEX) prop_warn(prop, "range is only allowed " - "for int or hex symbols"); + "for int or hex symbols"); if (!menu_validate_number(sym, prop->expr->left.sym) || !menu_validate_number(sym, prop->expr->right.sym)) prop_warn(prop, "range is invalid"); diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 1a9f53e535c..6c62d93b4ff 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -27,8 +27,8 @@ static char *text; static int text_size, text_asize; struct buffer { - struct buffer *parent; - YY_BUFFER_STATE state; + struct buffer *parent; + YY_BUFFER_STATE state; }; struct buffer *current_buf; diff --git a/scripts/kconfig/zconf.lex.c_shipped b/scripts/kconfig/zconf.lex.c_shipped index a0521aa5974..349a7f24315 100644 --- a/scripts/kconfig/zconf.lex.c_shipped +++ b/scripts/kconfig/zconf.lex.c_shipped @@ -789,8 +789,8 @@ static char *text; static int text_size, text_asize; struct buffer { - struct buffer *parent; - YY_BUFFER_STATE state; + struct buffer *parent; + YY_BUFFER_STATE state; }; struct buffer *current_buf; diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index 25ae16ac75c..de5e84ed3f9 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped @@ -2314,7 +2314,7 @@ void conf_parse(const char *name) for_all_symbols(i, sym) { if (sym_check_deps(sym)) zconfnerrs++; - } + } if (zconfnerrs) exit(1); sym_set_change_count(1); diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 0653886fac4..0f683cfa53e 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -510,7 +510,7 @@ void conf_parse(const char *name) for_all_symbols(i, sym) { if (sym_check_deps(sym)) zconfnerrs++; - } + } if (zconfnerrs) exit(1); sym_set_change_count(1); diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 1924990a737..e614ef689ee 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -644,28 +644,26 @@ ADD_TO_DEVTABLE("pcmcia", pcmcia_device_id, do_pcmcia_entry); static int do_of_entry (const char *filename, void *symval, char *alias) { - int len; - char *tmp; - DEF_FIELD_ADDR(symval, of_device_id, name); - DEF_FIELD_ADDR(symval, of_device_id, type); - DEF_FIELD_ADDR(symval, of_device_id, compatible); - - len = sprintf (alias, "of:N%sT%s", - (*name)[0] ? *name : "*", - (*type)[0] ? *type : "*"); - - if (compatible[0]) - sprintf (&alias[len], "%sC%s", - (*type)[0] ? "*" : "", - *compatible); - - /* Replace all whitespace with underscores */ - for (tmp = alias; tmp && *tmp; tmp++) - if (isspace (*tmp)) - *tmp = '_'; - - add_wildcard(alias); - return 1; + int len; + char *tmp; + DEF_FIELD_ADDR(symval, of_device_id, name); + DEF_FIELD_ADDR(symval, of_device_id, type); + DEF_FIELD_ADDR(symval, of_device_id, compatible); + + len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*", + (*type)[0] ? *type : "*"); + + if (compatible[0]) + sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "", + *compatible); + + /* Replace all whitespace with underscores */ + for (tmp = alias; tmp && *tmp; tmp++) + if (isspace (*tmp)) + *tmp = '_'; + + add_wildcard(alias); + return 1; } ADD_TO_DEVTABLE("of", of_device_id, do_of_entry); diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 06635567393..cd766877871 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -862,7 +862,7 @@ static const char *section_white_list[] = * without "ax" / "aw". */ static void check_section(const char *modname, struct elf_info *elf, - Elf_Shdr *sechdr) + Elf_Shdr *sechdr) { const char *sec = sech_name(elf, sechdr); @@ -1296,12 +1296,12 @@ static void print_section_list(const char * const list[20]) */ static void report_sec_mismatch(const char *modname, const struct sectioncheck *mismatch, - const char *fromsec, - unsigned long long fromaddr, - const char *fromsym, - int from_is_func, - const char *tosec, const char *tosym, - int to_is_func) + const char *fromsec, + unsigned long long fromaddr, + const char *fromsym, + int from_is_func, + const char *tosec, const char *tosym, + int to_is_func) { const char *from, *from_p; const char *to, *to_p; @@ -1441,7 +1441,7 @@ static void report_sec_mismatch(const char *modname, } static void check_section_mismatch(const char *modname, struct elf_info *elf, - Elf_Rela *r, Elf_Sym *sym, const char *fromsec) + Elf_Rela *r, Elf_Sym *sym, const char *fromsec) { const char *tosec; const struct sectioncheck *mismatch; @@ -1528,7 +1528,7 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) case R_ARM_ABS32: /* From ARM ABI: (S + A) | T */ r->r_addend = (int)(long) - (elf->symtab_start + ELF_R_SYM(r->r_info)); + (elf->symtab_start + ELF_R_SYM(r->r_info)); break; case R_ARM_PC24: case R_ARM_CALL: @@ -1538,8 +1538,8 @@ static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) case R_ARM_THM_JUMP19: /* From ARM ABI: ((S + A) | T) - P */ r->r_addend = (int)(long)(elf->hdr + - sechdr->sh_offset + - (r->r_offset - sechdr->sh_addr)); + sechdr->sh_offset + + (r->r_offset - sechdr->sh_addr)); break; default: return 1; @@ -1571,7 +1571,7 @@ static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) } static void section_rela(const char *modname, struct elf_info *elf, - Elf_Shdr *sechdr) + Elf_Shdr *sechdr) { Elf_Sym *sym; Elf_Rela *rela; @@ -1615,7 +1615,7 @@ static void section_rela(const char *modname, struct elf_info *elf, } static void section_rel(const char *modname, struct elf_info *elf, - Elf_Shdr *sechdr) + Elf_Shdr *sechdr) { Elf_Sym *sym; Elf_Rel *rel; @@ -1685,7 +1685,7 @@ static void section_rel(const char *modname, struct elf_info *elf, * be discarded and warns about it. **/ static void check_sec_ref(struct module *mod, const char *modname, - struct elf_info *elf) + struct elf_info *elf) { int i; Elf_Shdr *sechdrs = elf->sechdrs; @@ -1945,7 +1945,7 @@ static int add_versions(struct buffer *b, struct module *mod) s->name, mod->name); } else { merror("\"%s\" [%s.ko] undefined!\n", - s->name, mod->name); + s->name, mod->name); err = 1; } } diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index deb2994b04c..944418da9fe 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -214,7 +214,7 @@ static void md4_final_ascii(struct md4_ctx *mctx, char *out, unsigned int len) mctx->block[14] = mctx->byte_count << 3; mctx->block[15] = mctx->byte_count >> 29; le32_to_cpu_array(mctx->block, (sizeof(mctx->block) - - sizeof(uint64_t)) / sizeof(uint32_t)); + sizeof(uint64_t)) / sizeof(uint32_t)); md4_transform(mctx->hash, mctx->block); cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(uint32_t)); @@ -367,7 +367,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) break; /* Terminate line at first space, to get rid of final ' \' */ while (*p) { - if (isspace(*p)) { + if (isspace(*p)) { *p = '\0'; break; } diff --git a/scripts/tags.sh b/scripts/tags.sh index 4c425d25173..e6b011fe1d0 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -281,7 +281,7 @@ xtags() emacs $1 else all_target_sources | xargs $1 -a - fi + fi } # Support um (which uses SUBARCH) -- cgit v1.2.3-70-g09d2 From 90829adb4a8ea3b007bd8c63f5b54fddb7972bec Mon Sep 17 00:00:00 2001 From: Peter Senna Tschudin Date: Sun, 1 Jun 2014 15:12:31 -0300 Subject: coccicheck: Add unneeded return variable test This semantic patch looks for variables that are initialized with a constant, are never updated, and are only used as parameter of return. Return the constant instead of using a variable. Signed-off-by: Peter Senna Tschudin Signed-off-by: Michal Marek --- scripts/coccinelle/misc/returnvar.cocci | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 scripts/coccinelle/misc/returnvar.cocci (limited to 'scripts') diff --git a/scripts/coccinelle/misc/returnvar.cocci b/scripts/coccinelle/misc/returnvar.cocci new file mode 100644 index 00000000000..605955a91c4 --- /dev/null +++ b/scripts/coccinelle/misc/returnvar.cocci @@ -0,0 +1,66 @@ +/// +/// Removes unneeded variable used to store return value. +/// +// Confidence: Moderate +// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. GPLv2. +// URL: http://coccinelle.lip6.fr/ +// Comments: Comments on code can be deleted if near code that is removed. +// "when strict" can be removed to get more hits, but adds false +// positives +// Options: --no-includes --include-headers + +virtual patch +virtual report +virtual context +virtual org + +@depends on patch@ +type T; +constant C; +identifier ret; +@@ +- T ret = C; +... when != ret + when strict +return +- ret ++ C +; + +@depends on context@ +type T; +constant C; +identifier ret; +@@ +* T ret = C; +... when != ret + when strict +* return ret; + +@r1 depends on report || org@ +type T; +constant C; +identifier ret; +position p1, p2; +@@ +T ret@p1 = C; +... when != ret + when strict +return ret@p2; + +@script:python depends on report@ +p1 << r1.p1; +p2 << r1.p2; +C << r1.C; +ret << r1.ret; +@@ +coccilib.report.print_report(p1[0], "Unneeded variable: \"" + ret + "\". Return \"" + C + "\" on line " + p2[0].line) + +@script:python depends on org@ +p1 << r1.p1; +p2 << r1.p2; +C << r1.C; +ret << r1.ret; +@@ +cocci.print_main("unneeded \"" + ret + "\" variable", p1) +cocci.print_sec("return " + C + " here", p2) -- cgit v1.2.3-70-g09d2 From a1323fd16350da0d3431926cfafda296f8ffd596 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 9 Jun 2014 01:24:22 +0100 Subject: deb-pkg: Add automatic support for s390x architecture The Debian s390x architecture has 64-bit userland whereas s390 has 32-bit userland. A 64-bit kernel can be used with either. Now that Debian supports multiarch and officially supports s390x, it makes more sense to assign a 64-bit kernel package to s390x. Reported-by: Stephen Powell References: https://bugs.debian.org/750925 Signed-off-by: Ben Hutchings 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 ae7e607dc28..c8e04b33b06 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -35,7 +35,7 @@ create_package() { sparc*) debarch=sparc ;; s390*) - debarch=s390 ;; + debarch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;; ppc*) debarch=powerpc ;; parisc*) -- cgit v1.2.3-70-g09d2 From fd6e12423311697860f30d10398a0f9eb91977d2 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 9 Jun 2014 11:16:34 +0900 Subject: scripts: objdiff: get the path to .tmp_objdiff more simply This commit is a minor refactoring. Temporary files for objdiff are stored in .tmp_objdiff directory which is located at the top directory. To get the path to this directory, SRCTREE=`git rev-parse --show-toplevel` TMPD=$SRCTREE/.tmp_objdiff seems easier to understand than GIT_DIR=`git rev-parse --git-dir` TMPD=${GIT_DIR%git}tmp_objdiff Besides, it is not always necessary to create .tmp_objdiff dicrectory. It should be created only for "record" command. Signed-off-by: Masahiro Yamada Acked-by: Jason Cooper Signed-off-by: Michal Marek --- scripts/objdiff | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/objdiff b/scripts/objdiff index b3e4f10bfc3..b8f7fc60563 100755 --- a/scripts/objdiff +++ b/scripts/objdiff @@ -25,17 +25,15 @@ # # Note: 'make mrproper' will also remove .tmp_objdiff -GIT_DIR="`git rev-parse --git-dir`" +SRCTREE=$(git rev-parse --show-toplevel 2>/dev/null) -if [ -d "$GIT_DIR" ]; then - TMPD="${GIT_DIR%git}tmp_objdiff" - - [ -d "$TMPD" ] || mkdir "$TMPD" -else - echo "ERROR: git directory not found." +if [ -z "$SRCTREE" ]; then + echo "ERROR: Not a git repository." exit 1 fi +TMPD=$SRCTREE/.tmp_objdiff + usage() { echo "Usage: $0 " echo " record " -- cgit v1.2.3-70-g09d2 From 5ab370e91af70d5f1b1dbaec78798a2ff236a2d5 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 9 Jun 2014 11:16:35 +0900 Subject: scripts: objdiff: direct error messages to stderr Signed-off-by: Masahiro Yamada Acked-by: Jason Cooper Signed-off-by: Michal Marek --- scripts/objdiff | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/objdiff b/scripts/objdiff index b8f7fc60563..cc673655395 100755 --- a/scripts/objdiff +++ b/scripts/objdiff @@ -28,17 +28,17 @@ SRCTREE=$(git rev-parse --show-toplevel 2>/dev/null) if [ -z "$SRCTREE" ]; then - echo "ERROR: Not a git repository." + echo >&2 "ERROR: Not a git repository." exit 1 fi TMPD=$SRCTREE/.tmp_objdiff usage() { - echo "Usage: $0 " - echo " record " - echo " diff " - echo " clean all | " + echo >&2 "Usage: $0 " + echo >&2 " record " + echo >&2 " diff " + echo >&2 " clean all | " exit 1 } @@ -88,12 +88,12 @@ dodiff() { DSTD="$TMPD/$DST" if [ ! -d "$SRCD" ]; then - echo "ERROR: $SRCD doesn't exist" + echo >&2 "ERROR: $SRCD doesn't exist" exit 1 fi if [ ! -d "$DSTD" ]; then - echo "ERROR: $DSTD doesn't exist" + echo >&2 "ERROR: $DSTD doesn't exist" exit 1 fi @@ -112,7 +112,7 @@ doclean() { if [ -d "$TMPD/$CMT" ]; then rm -rf $TMPD/$CMT else - echo "$CMT not found" + echo >&2 "$CMT not found" fi fi } @@ -133,7 +133,7 @@ case "$1" in doclean $* ;; *) - echo "Unrecognized command '$1'" + echo >&2 "Unrecognized command '$1'" exit 1 ;; esac -- cgit v1.2.3-70-g09d2 From 1ecc8e489abfdaa6d8d1689f7ff62fdf1adda30c Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 9 Jun 2014 11:16:36 +0900 Subject: scripts: objdiff: remove unnecessary code The directories for objdump is created by the code a few lines below: [ ! -d "$OBJDIFFD/$dn" ] && mkdir -p "$OBJDIFFD/$dn" Signed-off-by: Masahiro Yamada Acked-by: Jason Cooper Signed-off-by: Michal Marek --- scripts/objdiff | 2 -- 1 file changed, 2 deletions(-) (limited to 'scripts') diff --git a/scripts/objdiff b/scripts/objdiff index cc673655395..6e72f964598 100755 --- a/scripts/objdiff +++ b/scripts/objdiff @@ -52,8 +52,6 @@ dorecord() { OBJDUMP="${CROSS_COMPILE}objdump" OBJDIFFD="$TMPD/$CMT" - [ ! -d "$OBJDIFFD" ] && mkdir -p "$OBJDIFFD" - for f in $FILES; do dn="${f%/*}" bn="${f##*/}" -- cgit v1.2.3-70-g09d2 From 18165efa8203a34d82f60a1831ea290e7304c654 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 9 Jun 2014 11:16:37 +0900 Subject: scripts: objdiff: improve path flexibility for record command Prior to this commit, scripts/objdiff expected to be run at the top directory and only the relative path of objects. This commit provides more flexibility in terms of object path: [1] scripts/objdiff can be run in any directory For example, $ scripts/objdiff record init/main.o and $ cd init; ../scripts/objdiff record main.o produce the same result. [2] Support absolute path for objects $ scripts/objdiff record /home/foo/bar/linux/init/main.o work as well. Signed-off-by: Masahiro Yamada Acked-by: Jason Cooper Signed-off-by: Michal Marek --- scripts/objdiff | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/objdiff b/scripts/objdiff index 6e72f964598..499eb4bc1e8 100755 --- a/scripts/objdiff +++ b/scripts/objdiff @@ -25,7 +25,7 @@ # # Note: 'make mrproper' will also remove .tmp_objdiff -SRCTREE=$(git rev-parse --show-toplevel 2>/dev/null) +SRCTREE=$(cd $(git rev-parse --show-toplevel 2>/dev/null); pwd) if [ -z "$SRCTREE" ]; then echo >&2 "ERROR: Not a git repository." @@ -42,6 +42,18 @@ usage() { exit 1 } +get_output_dir() { + dir=${1%/*} + + if [ "$dir" = "$1" ]; then + dir=. + fi + + dir=$(cd $dir; pwd) + + echo $TMPD/$CMT${dir#$SRCTREE} +} + dorecord() { [ $# -eq 0 ] && usage @@ -50,18 +62,16 @@ dorecord() { CMT="`git rev-parse --short HEAD`" OBJDUMP="${CROSS_COMPILE}objdump" - OBJDIFFD="$TMPD/$CMT" for f in $FILES; do - dn="${f%/*}" + dir=$(get_output_dir $f) bn="${f##*/}" - [ ! -d "$OBJDIFFD/$dn" ] && mkdir -p "$OBJDIFFD/$dn" + [ ! -d "$dir" ] && mkdir -p $dir # remove addresses for a more clear diff # http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and - $OBJDUMP -D "$f" | sed "s/^[[:space:]]\+[0-9a-f]\+//" \ - >"$OBJDIFFD/$dn/$bn" + $OBJDUMP -D $f | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dir/$bn done } -- cgit v1.2.3-70-g09d2 From 8b5d0f20d64f00ffd5685879f8eb3659379f5aaa Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 9 Jun 2014 11:16:38 +0900 Subject: scripts: objdiff: change the extension of disassembly from .o to .dis Prior to this commit, the command "scripts/objdiff record path/to/*.o" disassembled the given object into ".tmp_objdiff/path/to/*.o" file. The problem here is that recorded disassemblies are lost if we run "make clean" because it removes all the *.o files. Disassembled code should be dumped into *.dis instead of *.o files. Signed-off-by: Masahiro Yamada Acked-by: Jason Cooper Signed-off-by: Michal Marek --- scripts/objdiff | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/objdiff b/scripts/objdiff index 499eb4bc1e8..c997e44e4b5 100755 --- a/scripts/objdiff +++ b/scripts/objdiff @@ -65,13 +65,14 @@ dorecord() { for f in $FILES; do dir=$(get_output_dir $f) - bn="${f##*/}" + base=${f##*/} + dis=$dir/${base%.o}.dis [ ! -d "$dir" ] && mkdir -p $dir # remove addresses for a more clear diff # http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and - $OBJDUMP -D $f | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dir/$bn + $OBJDUMP -D $f | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis done } -- cgit v1.2.3-70-g09d2 From 8ac28bee76eec006aac5ba5c418878a607d53a9b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 9 Jun 2014 11:16:39 +0900 Subject: scripts: objdiff: fix a comment Signed-off-by: Masahiro Yamada Acked-by: Jason Cooper Signed-off-by: Michal Marek --- scripts/objdiff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/objdiff b/scripts/objdiff index c997e44e4b5..0644898d5fa 100755 --- a/scripts/objdiff +++ b/scripts/objdiff @@ -70,7 +70,7 @@ dorecord() { [ ! -d "$dir" ] && mkdir -p $dir - # remove addresses for a more clear diff + # remove addresses for a cleaner diff # http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and $OBJDUMP -D $f | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis done -- cgit v1.2.3-70-g09d2 From 7fa0e6db3cedc9b70d68a4170f1352e2b1aa0f90 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 9 Jun 2014 11:16:40 +0900 Subject: scripts: objdiff: support directories for the augument of record command For example, $ scripts/objdiff record init drivers/usb disassembles all the objects under init and drivers/usb directories. This feature would be useful when we change various files under the specific directory. Signed-off-by: Masahiro Yamada Acked-by: Jason Cooper Signed-off-by: Michal Marek --- scripts/objdiff | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/objdiff b/scripts/objdiff index 0644898d5fa..62e51dae213 100755 --- a/scripts/objdiff +++ b/scripts/objdiff @@ -36,7 +36,7 @@ TMPD=$SRCTREE/.tmp_objdiff usage() { echo >&2 "Usage: $0 " - echo >&2 " record " + echo >&2 " record " echo >&2 " diff " echo >&2 " clean all | " exit 1 @@ -54,6 +54,18 @@ get_output_dir() { echo $TMPD/$CMT${dir#$SRCTREE} } +do_objdump() { + dir=$(get_output_dir $1) + base=${1##*/} + dis=$dir/${base%.o}.dis + + [ ! -d "$dir" ] && mkdir -p $dir + + # remove addresses for a cleaner diff + # http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and + $OBJDUMP -D $1 | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis +} + dorecord() { [ $# -eq 0 ] && usage @@ -63,16 +75,15 @@ dorecord() { OBJDUMP="${CROSS_COMPILE}objdump" - for f in $FILES; do - dir=$(get_output_dir $f) - base=${f##*/} - dis=$dir/${base%.o}.dis - - [ ! -d "$dir" ] && mkdir -p $dir - - # remove addresses for a cleaner diff - # http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and - $OBJDUMP -D $f | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis + for d in $FILES; do + if [ -d "$d" ]; then + for f in $(find $d -name '*.o') + do + do_objdump $f + done + else + do_objdump $d + fi done } -- cgit v1.2.3-70-g09d2