aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-01-14 14:09:49 -0500
committerGrant Likely <grant.likely@secretlab.ca>2011-01-14 14:09:49 -0500
commit42a9fa9957e369240936891c9a521ab671eed4e7 (patch)
tree7a9367594a367085c6a4a4433f687ec5c8dac8b7 /scripts
parent5f35765d836befebdfabf745fdbf2e070c887fac (diff)
parentc289ef41431144a538b5fb5f94fc83c81b3020e2 (diff)
Merge branch 'devicetree/next' into spi/next
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib28
-rwxr-xr-xscripts/checkpatch.pl19
-rw-r--r--scripts/gen_initramfs_list.sh2
-rwxr-xr-xscripts/get_maintainer.pl45
-rw-r--r--scripts/mod/modpost.c2
-rw-r--r--scripts/xz_wrap.sh23
6 files changed, 112 insertions, 7 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 396da16aabf8..1c702ca8aac8 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -262,6 +262,34 @@ cmd_lzo = (cat $(filter-out FORCE,$^) | \
262 lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ 262 lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
263 (rm -f $@ ; false) 263 (rm -f $@ ; false)
264 264
265# XZ
266# ---------------------------------------------------------------------------
267# Use xzkern to compress the kernel image and xzmisc to compress other things.
268#
269# xzkern uses a big LZMA2 dictionary since it doesn't increase memory usage
270# of the kernel decompressor. A BCJ filter is used if it is available for
271# the target architecture. xzkern also appends uncompressed size of the data
272# using size_append. The .xz format has the size information available at
273# the end of the file too, but it's in more complex format and it's good to
274# avoid changing the part of the boot code that reads the uncompressed size.
275# Note that the bytes added by size_append will make the xz tool think that
276# the file is corrupt. This is expected.
277#
278# xzmisc doesn't use size_append, so it can be used to create normal .xz
279# files. xzmisc uses smaller LZMA2 dictionary than xzkern, because a very
280# big dictionary would increase the memory usage too much in the multi-call
281# decompression mode. A BCJ filter isn't used either.
282quiet_cmd_xzkern = XZKERN $@
283cmd_xzkern = (cat $(filter-out FORCE,$^) | \
284 sh $(srctree)/scripts/xz_wrap.sh && \
285 $(call size_append, $(filter-out FORCE,$^))) > $@ || \
286 (rm -f $@ ; false)
287
288quiet_cmd_xzmisc = XZMISC $@
289cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
290 xz --check=crc32 --lzma2=dict=1MiB) > $@ || \
291 (rm -f $@ ; false)
292
265# misc stuff 293# misc stuff
266# --------------------------------------------------------------------------- 294# ---------------------------------------------------------------------------
267quote:=" 295quote:="
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3c7fc0dca38..4c0383da1c9a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -859,7 +859,7 @@ sub annotate_values {
859 $av_preprocessor = 0; 859 $av_preprocessor = 0;
860 } 860 }
861 861
862 } elsif ($cur =~ /^(\(\s*$Type\s*)\)/) { 862 } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') {
863 print "CAST($1)\n" if ($dbg_values > 1); 863 print "CAST($1)\n" if ($dbg_values > 1);
864 push(@av_paren_type, $type); 864 push(@av_paren_type, $type);
865 $type = 'C'; 865 $type = 'C';
@@ -2743,6 +2743,11 @@ sub process {
2743 WARN("plain inline is preferred over $1\n" . $herecurr); 2743 WARN("plain inline is preferred over $1\n" . $herecurr);
2744 } 2744 }
2745 2745
2746# Check for __attribute__ packed, prefer __packed
2747 if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
2748 WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr);
2749 }
2750
2746# check for sizeof(&) 2751# check for sizeof(&)
2747 if ($line =~ /\bsizeof\s*\(\s*\&/) { 2752 if ($line =~ /\bsizeof\s*\(\s*\&/) {
2748 WARN("sizeof(& should be avoided\n" . $herecurr); 2753 WARN("sizeof(& should be avoided\n" . $herecurr);
@@ -2785,10 +2790,15 @@ sub process {
2785 } 2790 }
2786 2791
2787# check for pointless casting of kmalloc return 2792# check for pointless casting of kmalloc return
2788 if ($line =~ /\*\s*\)\s*k[czm]alloc\b/) { 2793 if ($line =~ /\*\s*\)\s*[kv][czm]alloc(_node){0,1}\b/) {
2789 WARN("unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); 2794 WARN("unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
2790 } 2795 }
2791 2796
2797# check for multiple semicolons
2798 if ($line =~ /;\s*;\s*$/) {
2799 WARN("Statements terminations use 1 semicolon\n" . $herecurr);
2800 }
2801
2792# check for gcc specific __FUNCTION__ 2802# check for gcc specific __FUNCTION__
2793 if ($line =~ /__FUNCTION__/) { 2803 if ($line =~ /__FUNCTION__/) {
2794 WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); 2804 WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
@@ -2892,6 +2902,11 @@ sub process {
2892 ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr); 2902 ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr);
2893 } 2903 }
2894 } 2904 }
2905
2906 if ($line =~ /debugfs_create_file.*S_IWUGO/ ||
2907 $line =~ /DEVICE_ATTR.*S_IWUGO/ ) {
2908 WARN("Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
2909 }
2895 } 2910 }
2896 2911
2897 # If we have no input at all, then there is nothing to report on 2912 # If we have no input at all, then there is nothing to report on
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 5958fffb2114..55caecdad995 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -243,6 +243,8 @@ case "$arg" in
243 echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f" 243 echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f"
244 echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f" 244 echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f"
245 echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f" 245 echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f"
246 echo "$output_file" | grep -q "\.xz$" && \
247 compr="xz --check=crc32 --lzma2=dict=1MiB"
246 echo "$output_file" | grep -q "\.lzo$" && compr="lzop -9 -f" 248 echo "$output_file" | grep -q "\.lzo$" && compr="lzop -9 -f"
247 echo "$output_file" | grep -q "\.cpio$" && compr="cat" 249 echo "$output_file" | grep -q "\.cpio$" && compr="cat"
248 shift 250 shift
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index d21ec3a89603..139e0fff8e31 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -13,7 +13,7 @@
13use strict; 13use strict;
14 14
15my $P = $0; 15my $P = $0;
16my $V = '0.26-beta6'; 16my $V = '0.26';
17 17
18use Getopt::Long qw(:config no_auto_abbrev); 18use Getopt::Long qw(:config no_auto_abbrev);
19 19
@@ -40,7 +40,7 @@ my $email_use_mailmap = 1;
40my $output_multiline = 1; 40my $output_multiline = 1;
41my $output_separator = ", "; 41my $output_separator = ", ";
42my $output_roles = 0; 42my $output_roles = 0;
43my $output_rolestats = 0; 43my $output_rolestats = 1;
44my $scm = 0; 44my $scm = 0;
45my $web = 0; 45my $web = 0;
46my $subsystem = 0; 46my $subsystem = 0;
@@ -494,6 +494,40 @@ if ($web) {
494 494
495exit($exit); 495exit($exit);
496 496
497sub range_is_maintained {
498 my ($start, $end) = @_;
499
500 for (my $i = $start; $i < $end; $i++) {
501 my $line = $typevalue[$i];
502 if ($line =~ m/^(\C):\s*(.*)/) {
503 my $type = $1;
504 my $value = $2;
505 if ($type eq 'S') {
506 if ($value =~ /(maintain|support)/i) {
507 return 1;
508 }
509 }
510 }
511 }
512 return 0;
513}
514
515sub range_has_maintainer {
516 my ($start, $end) = @_;
517
518 for (my $i = $start; $i < $end; $i++) {
519 my $line = $typevalue[$i];
520 if ($line =~ m/^(\C):\s*(.*)/) {
521 my $type = $1;
522 my $value = $2;
523 if ($type eq 'M') {
524 return 1;
525 }
526 }
527 }
528 return 0;
529}
530
497sub get_maintainers { 531sub get_maintainers {
498 %email_hash_name = (); 532 %email_hash_name = ();
499 %email_hash_address = (); 533 %email_hash_address = ();
@@ -556,7 +590,9 @@ sub get_maintainers {
556 my $file_pd = ($file =~ tr@/@@); 590 my $file_pd = ($file =~ tr@/@@);
557 $value_pd++ if (substr($value,-1,1) ne "/"); 591 $value_pd++ if (substr($value,-1,1) ne "/");
558 $value_pd = -1 if ($value =~ /^\.\*/); 592 $value_pd = -1 if ($value =~ /^\.\*/);
559 if ($value_pd >= $file_pd) { 593 if ($value_pd >= $file_pd &&
594 range_is_maintained($start, $end) &&
595 range_has_maintainer($start, $end)) {
560 $exact_pattern_match_hash{$file} = 1; 596 $exact_pattern_match_hash{$file} = 1;
561 } 597 }
562 if ($pattern_depth == 0 || 598 if ($pattern_depth == 0 ||
@@ -720,7 +756,8 @@ Other options:
720 --help => show this help information 756 --help => show this help information
721 757
722Default options: 758Default options:
723 [--email --git --m --n --l --multiline --pattern-depth=0 --remove-duplicates] 759 [--email --nogit --git-fallback --m --n --l --multiline -pattern-depth=0
760 --remove-duplicates --rolestats]
724 761
725Notes: 762Notes:
726 Using "-f directory" may give unexpected results: 763 Using "-f directory" may give unexpected results:
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 97d2259ae999..e8fba959fffb 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1615,7 +1615,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
1615 * A module includes a number of sections that are discarded 1615 * A module includes a number of sections that are discarded
1616 * either when loaded or when used as built-in. 1616 * either when loaded or when used as built-in.
1617 * For loaded modules all functions marked __init and all data 1617 * For loaded modules all functions marked __init and all data
1618 * marked __initdata will be discarded when the module has been intialized. 1618 * marked __initdata will be discarded when the module has been initialized.
1619 * Likewise for modules used built-in the sections marked __exit 1619 * Likewise for modules used built-in the sections marked __exit
1620 * are discarded because __exit marked function are supposed to be called 1620 * are discarded because __exit marked function are supposed to be called
1621 * only when a module is unloaded which never happens for built-in modules. 1621 * only when a module is unloaded which never happens for built-in modules.
diff --git a/scripts/xz_wrap.sh b/scripts/xz_wrap.sh
new file mode 100644
index 000000000000..17a5798c29da
--- /dev/null
+++ b/scripts/xz_wrap.sh
@@ -0,0 +1,23 @@
1#!/bin/sh
2#
3# This is a wrapper for xz to compress the kernel image using appropriate
4# compression options depending on the architecture.
5#
6# Author: Lasse Collin <lasse.collin@tukaani.org>
7#
8# This file has been put into the public domain.
9# You can do whatever you want with this file.
10#
11
12BCJ=
13LZMA2OPTS=
14
15case $ARCH in
16 x86|x86_64) BCJ=--x86 ;;
17 powerpc) BCJ=--powerpc ;;
18 ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;;
19 arm) BCJ=--arm ;;
20 sparc) BCJ=--sparc ;;
21esac
22
23exec xz --check=crc32 $BCJ --lzma2=$LZMA2OPTS,dict=32MiB