aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib4
-rwxr-xr-xscripts/checkpatch.pl31
-rw-r--r--scripts/gen_initramfs_list.sh1
-rwxr-xr-xscripts/get_maintainer.pl66
-rw-r--r--scripts/kconfig/util.c2
-rw-r--r--scripts/mod/file2alias.c57
-rwxr-xr-xscripts/package/mkspec2
-rw-r--r--scripts/selinux/genheaders/genheaders.c2
8 files changed, 152 insertions, 13 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index f9bdf264473d..cbcd654215e6 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -245,3 +245,7 @@ quiet_cmd_lzo = LZO $@
245cmd_lzo = (cat $(filter-out FORCE,$^) | \ 245cmd_lzo = (cat $(filter-out FORCE,$^) | \
246 lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ 246 lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
247 (rm -f $@ ; false) 247 (rm -f $@ ; false)
248
249# misc stuff
250# ---------------------------------------------------------------------------
251quote:="
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a4d74344d805..bd88f11b0953 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1382,6 +1382,21 @@ sub process {
1382 ERROR("trailing whitespace\n" . $herevet); 1382 ERROR("trailing whitespace\n" . $herevet);
1383 } 1383 }
1384 1384
1385# check for Kconfig help text having a real description
1386 if ($realfile =~ /Kconfig/ &&
1387 $line =~ /\+?\s*(---)?help(---)?$/) {
1388 my $length = 0;
1389 for (my $l = $linenr; defined($lines[$l]); $l++) {
1390 my $f = $lines[$l];
1391 $f =~ s/#.*//;
1392 $f =~ s/^\s+//;
1393 next if ($f =~ /^$/);
1394 last if ($f =~ /^\s*config\s/);
1395 $length++;
1396 }
1397 WARN("please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($length < 4);
1398 }
1399
1385# check we are in a valid source file if not then ignore this hunk 1400# check we are in a valid source file if not then ignore this hunk
1386 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); 1401 next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
1387 1402
@@ -2586,6 +2601,11 @@ sub process {
2586 CHK("architecture specific defines should be avoided\n" . $herecurr); 2601 CHK("architecture specific defines should be avoided\n" . $herecurr);
2587 } 2602 }
2588 2603
2604# Check that the storage class is at the beginning of a declaration
2605 if ($line =~ /\b$Storage\b/ && $line !~ /^.\s*$Storage\b/) {
2606 WARN("storage class should be at the beginning of the declaration\n" . $herecurr)
2607 }
2608
2589# check the location of the inline attribute, that it is between 2609# check the location of the inline attribute, that it is between
2590# storage class and type. 2610# storage class and type.
2591 if ($line =~ /\b$Type\s+$Inline\b/ || 2611 if ($line =~ /\b$Type\s+$Inline\b/ ||
@@ -2656,6 +2676,7 @@ sub process {
2656# check for semaphores used as mutexes 2676# check for semaphores used as mutexes
2657 if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) { 2677 if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) {
2658 WARN("consider using a completion\n" . $herecurr); 2678 WARN("consider using a completion\n" . $herecurr);
2679
2659 } 2680 }
2660# recommend strict_strto* over simple_strto* 2681# recommend strict_strto* over simple_strto*
2661 if ($line =~ /\bsimple_(strto.*?)\s*\(/) { 2682 if ($line =~ /\bsimple_(strto.*?)\s*\(/) {
@@ -2740,6 +2761,16 @@ sub process {
2740 WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); 2761 WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr);
2741 } 2762 }
2742 } 2763 }
2764
2765# check for lockdep_set_novalidate_class
2766 if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
2767 $line =~ /__lockdep_no_validate__\s*\)/ ) {
2768 if ($realfile !~ m@^kernel/lockdep@ &&
2769 $realfile !~ m@^include/linux/lockdep@ &&
2770 $realfile !~ m@^drivers/base/core@) {
2771 ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr);
2772 }
2773 }
2743 } 2774 }
2744 2775
2745 # If we have no input at all, then there is nothing to report on 2776 # 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 76af5f9623e3..a932ae52f921 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -242,6 +242,7 @@ case "$arg" in
242 echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f" 242 echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f"
243 echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f" 243 echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f"
244 echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f" 244 echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f"
245 echo "$output_file" | grep -q "\.lzo$" && compr="lzop -9 -f"
245 echo "$output_file" | grep -q "\.cpio$" && compr="cat" 246 echo "$output_file" | grep -q "\.cpio$" && compr="cat"
246 shift 247 shift
247 ;; 248 ;;
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 6f97a13bcee4..b2281982f52f 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.23'; 16my $V = '0.24';
17 17
18use Getopt::Long qw(:config no_auto_abbrev); 18use Getopt::Long qw(:config no_auto_abbrev);
19 19
@@ -25,6 +25,7 @@ my $email_list = 1;
25my $email_subscriber_list = 0; 25my $email_subscriber_list = 0;
26my $email_git_penguin_chiefs = 0; 26my $email_git_penguin_chiefs = 0;
27my $email_git = 1; 27my $email_git = 1;
28my $email_git_all_signature_types = 0;
28my $email_git_blame = 0; 29my $email_git_blame = 0;
29my $email_git_min_signatures = 1; 30my $email_git_min_signatures = 1;
30my $email_git_max_maintainers = 5; 31my $email_git_max_maintainers = 5;
@@ -51,9 +52,9 @@ my $help = 0;
51my $exit = 0; 52my $exit = 0;
52 53
53my @penguin_chief = (); 54my @penguin_chief = ();
54push(@penguin_chief,"Linus Torvalds:torvalds\@linux-foundation.org"); 55push(@penguin_chief, "Linus Torvalds:torvalds\@linux-foundation.org");
55#Andrew wants in on most everything - 2009/01/14 56#Andrew wants in on most everything - 2009/01/14
56#push(@penguin_chief,"Andrew Morton:akpm\@linux-foundation.org"); 57#push(@penguin_chief, "Andrew Morton:akpm\@linux-foundation.org");
57 58
58my @penguin_chief_names = (); 59my @penguin_chief_names = ();
59foreach my $chief (@penguin_chief) { 60foreach my $chief (@penguin_chief) {
@@ -63,7 +64,16 @@ foreach my $chief (@penguin_chief) {
63 push(@penguin_chief_names, $chief_name); 64 push(@penguin_chief_names, $chief_name);
64 } 65 }
65} 66}
66my $penguin_chiefs = "\(" . join("|",@penguin_chief_names) . "\)"; 67my $penguin_chiefs = "\(" . join("|", @penguin_chief_names) . "\)";
68
69# Signature types of people who are either
70# a) responsible for the code in question, or
71# b) familiar enough with it to give relevant feedback
72my @signature_tags = ();
73push(@signature_tags, "Signed-off-by:");
74push(@signature_tags, "Reviewed-by:");
75push(@signature_tags, "Acked-by:");
76my $signaturePattern = "\(" . join("|", @signature_tags) . "\)";
67 77
68# rfc822 email address - preloaded methods go here. 78# rfc822 email address - preloaded methods go here.
69my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])"; 79my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])";
@@ -97,9 +107,34 @@ my %VCS_cmds_hg = (
97 "blame_commit_pattern" => "^([0-9a-f]+):" 107 "blame_commit_pattern" => "^([0-9a-f]+):"
98); 108);
99 109
110if (-f "${lk_path}.get_maintainer.conf") {
111 my @conf_args;
112 open(my $conffile, '<', "${lk_path}.get_maintainer.conf")
113 or warn "$P: Can't open .get_maintainer.conf: $!\n";
114 while (<$conffile>) {
115 my $line = $_;
116
117 $line =~ s/\s*\n?$//g;
118 $line =~ s/^\s*//g;
119 $line =~ s/\s+/ /g;
120
121 next if ($line =~ m/^\s*#/);
122 next if ($line =~ m/^\s*$/);
123
124 my @words = split(" ", $line);
125 foreach my $word (@words) {
126 last if ($word =~ m/^#/);
127 push (@conf_args, $word);
128 }
129 }
130 close($conffile);
131 unshift(@ARGV, @conf_args) if @conf_args;
132}
133
100if (!GetOptions( 134if (!GetOptions(
101 'email!' => \$email, 135 'email!' => \$email,
102 'git!' => \$email_git, 136 'git!' => \$email_git,
137 'git-all-signature-types!' => \$email_git_all_signature_types,
103 'git-blame!' => \$email_git_blame, 138 'git-blame!' => \$email_git_blame,
104 'git-chief-penguins!' => \$email_git_penguin_chiefs, 139 'git-chief-penguins!' => \$email_git_penguin_chiefs,
105 'git-min-signatures=i' => \$email_git_min_signatures, 140 'git-min-signatures=i' => \$email_git_min_signatures,
@@ -180,6 +215,10 @@ if (!top_of_kernel_tree($lk_path)) {
180 . "a linux kernel source tree.\n"; 215 . "a linux kernel source tree.\n";
181} 216}
182 217
218if ($email_git_all_signature_types) {
219 $signaturePattern = "(.+?)[Bb][Yy]:";
220}
221
183## Read MAINTAINERS for type/value pairs 222## Read MAINTAINERS for type/value pairs
184 223
185my @typevalue = (); 224my @typevalue = ();
@@ -497,13 +536,15 @@ version: $V
497MAINTAINER field selection options: 536MAINTAINER field selection options:
498 --email => print email address(es) if any 537 --email => print email address(es) if any
499 --git => include recent git \*-by: signers 538 --git => include recent git \*-by: signers
539 --git-all-signature-types => include signers regardless of signature type
540 or use only ${signaturePattern} signers (default: $email_git_all_signature_types)
500 --git-chief-penguins => include ${penguin_chiefs} 541 --git-chief-penguins => include ${penguin_chiefs}
501 --git-min-signatures => number of signatures required (default: 1) 542 --git-min-signatures => number of signatures required (default: $email_git_min_signatures)
502 --git-max-maintainers => maximum maintainers to add (default: 5) 543 --git-max-maintainers => maximum maintainers to add (default: $email_git_max_maintainers)
503 --git-min-percent => minimum percentage of commits required (default: 5) 544 --git-min-percent => minimum percentage of commits required (default: $email_git_min_percent)
504 --git-blame => use git blame to find modified commits for patch or file 545 --git-blame => use git blame to find modified commits for patch or file
505 --git-since => git history to use (default: 1-year-ago) 546 --git-since => git history to use (default: $email_git_since)
506 --hg-since => hg history to use (default: -365) 547 --hg-since => hg history to use (default: $email_hg_since)
507 --m => include maintainer(s) if any 548 --m => include maintainer(s) if any
508 --n => include name 'Full Name <addr\@domain.tld>' 549 --n => include name 'Full Name <addr\@domain.tld>'
509 --l => include list(s) if any 550 --l => include list(s) if any
@@ -556,6 +597,11 @@ Notes:
556 --git-min-signatures, --git-max-maintainers, --git-min-percent, and 597 --git-min-signatures, --git-max-maintainers, --git-min-percent, and
557 --git-blame 598 --git-blame
558 Use --hg-since not --git-since to control date selection 599 Use --hg-since not --git-since to control date selection
600 File ".get_maintainer.conf", if it exists in the linux kernel source root
601 directory, can change whatever get_maintainer defaults are desired.
602 Entries in this file can be any command line argument.
603 This file is prepended to any additional command line arguments.
604 Multiple lines and # comments are allowed.
559EOT 605EOT
560} 606}
561 607
@@ -964,7 +1010,7 @@ sub vcs_find_signers {
964 1010
965 $commits = grep(/$pattern/, @lines); # of commits 1011 $commits = grep(/$pattern/, @lines); # of commits
966 1012
967 @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); 1013 @lines = grep(/^[ \t]*${signaturePattern}.*\@.*$/, @lines);
968 if (!$email_git_penguin_chiefs) { 1014 if (!$email_git_penguin_chiefs) {
969 @lines = grep(!/${penguin_chiefs}/i, @lines); 1015 @lines = grep(!/${penguin_chiefs}/i, @lines);
970 } 1016 }
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index b6b2a46af14c..25d1ec4ca28a 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -72,7 +72,7 @@ int file_write_dep(const char *name)
72} 72}
73 73
74 74
75/* Allocate initial growable sting */ 75/* Allocate initial growable string */
76struct gstr str_new(void) 76struct gstr str_new(void)
77{ 77{
78 struct gstr gs; 78 struct gstr gs;
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 220213e603db..5758aab0d8bb 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -796,6 +796,51 @@ static int do_platform_entry(const char *filename,
796 return 1; 796 return 1;
797} 797}
798 798
799static int do_mdio_entry(const char *filename,
800 struct mdio_device_id *id, char *alias)
801{
802 int i;
803
804 alias += sprintf(alias, MDIO_MODULE_PREFIX);
805
806 for (i = 0; i < 32; i++) {
807 if (!((id->phy_id_mask >> (31-i)) & 1))
808 *(alias++) = '?';
809 else if ((id->phy_id >> (31-i)) & 1)
810 *(alias++) = '1';
811 else
812 *(alias++) = '0';
813 }
814
815 /* Terminate the string */
816 *alias = 0;
817
818 return 1;
819}
820
821/* Looks like: zorro:iN. */
822static int do_zorro_entry(const char *filename, struct zorro_device_id *id,
823 char *alias)
824{
825 id->id = TO_NATIVE(id->id);
826 strcpy(alias, "zorro:");
827 ADD(alias, "i", id->id != ZORRO_WILDCARD, id->id);
828 return 1;
829}
830
831/* looks like: "pnp:dD" */
832static int do_isapnp_entry(const char *filename,
833 struct isapnp_device_id *id, char *alias)
834{
835 sprintf(alias, "pnp:d%c%c%c%x%x%x%x*",
836 'A' + ((id->vendor >> 2) & 0x3f) - 1,
837 'A' + (((id->vendor & 3) << 3) | ((id->vendor >> 13) & 7)) - 1,
838 'A' + ((id->vendor >> 8) & 0x1f) - 1,
839 (id->function >> 4) & 0x0f, id->function & 0x0f,
840 (id->function >> 12) & 0x0f, (id->function >> 8) & 0x0f);
841 return 1;
842}
843
799/* Ignore any prefix, eg. some architectures prepend _ */ 844/* Ignore any prefix, eg. some architectures prepend _ */
800static inline int sym_is(const char *symbol, const char *name) 845static inline int sym_is(const char *symbol, const char *name)
801{ 846{
@@ -943,6 +988,18 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
943 do_table(symval, sym->st_size, 988 do_table(symval, sym->st_size,
944 sizeof(struct platform_device_id), "platform", 989 sizeof(struct platform_device_id), "platform",
945 do_platform_entry, mod); 990 do_platform_entry, mod);
991 else if (sym_is(symname, "__mod_mdio_device_table"))
992 do_table(symval, sym->st_size,
993 sizeof(struct mdio_device_id), "mdio",
994 do_mdio_entry, mod);
995 else if (sym_is(symname, "__mod_zorro_device_table"))
996 do_table(symval, sym->st_size,
997 sizeof(struct zorro_device_id), "zorro",
998 do_zorro_entry, mod);
999 else if (sym_is(symname, "__mod_isapnp_device_table"))
1000 do_table(symval, sym->st_size,
1001 sizeof(struct isapnp_device_id), "isa",
1002 do_isapnp_entry, mod);
946 free(zeros); 1003 free(zeros);
947} 1004}
948 1005
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 47bdd2f99b78..fa27f3dac769 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# Output a simple RPM spec file that uses no fancy features requring 3# Output a simple RPM spec file that uses no fancy features requiring
4# RPM v4. This is intended to work with any RPM distro. 4# RPM v4. This is intended to work with any RPM distro.
5# 5#
6# The only gothic bit here is redefining install_post to avoid 6# The only gothic bit here is redefining install_post to avoid
diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c
index 24626968055d..58a12c278706 100644
--- a/scripts/selinux/genheaders/genheaders.c
+++ b/scripts/selinux/genheaders/genheaders.c
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
81 fprintf(fout, "\n"); 81 fprintf(fout, "\n");
82 82
83 for (i = 1; i < isids_len; i++) { 83 for (i = 1; i < isids_len; i++) {
84 char *s = initial_sid_to_string[i]; 84 const char *s = initial_sid_to_string[i];
85 fprintf(fout, "#define SECINITSID_%s", s); 85 fprintf(fout, "#define SECINITSID_%s", s);
86 for (j = 0; j < max(1, 40 - strlen(s)); j++) 86 for (j = 0; j < max(1, 40 - strlen(s)); j++)
87 fprintf(fout, " "); 87 fprintf(fout, " ");