From 405d967dc70002991f8fc35c20e0d3cbc7614f63 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 24 Jun 2009 15:13:38 +0900 Subject: linker script: throw away .discard section x86 throws away .discard section but no other archs do. Also, .discard is not thrown away while linking modules. Make every arch and module linking throw it away. This will be used to define dummy variables for percpu declarations and definitions. This patch is based on Ivan Kokshaysky's alpha percpu patch. [ Impact: always throw away everything in .discard ] Signed-off-by: Tejun Heo Cc: Ivan Kokshaysky Cc: Richard Henderson Cc: Russell King Cc: Haavard Skinnemoen Cc: Bryan Wu Cc: Mikael Starvik Cc: Jesper Nilsson Cc: David Howells Cc: Yoshinori Sato Cc: Tony Luck Cc: Hirokazu Takata Cc: Geert Uytterhoeven Cc: Michal Simek Cc: Ralf Baechle Cc: Kyle McMartin Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: Paul Mundt Cc: David S. Miller Cc: Jeff Dike Cc: Chris Zankel Cc: Rusty Russell Cc: Ingo Molnar --- scripts/module-common.lds | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 scripts/module-common.lds (limited to 'scripts') diff --git a/scripts/module-common.lds b/scripts/module-common.lds new file mode 100644 index 00000000000..47a1f9ae0ed --- /dev/null +++ b/scripts/module-common.lds @@ -0,0 +1,8 @@ +/* + * Common module linker script, always used when linking a module. + * Archs are free to supply their own linker scripts. ld will + * combine them automatically. + */ +SECTIONS { + /DISCARD/ : { *(.discard) } +} -- cgit v1.2.3 From 1ab18486e4e8bf9554d8439207b97422d7466d77 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 26 Jun 2009 20:04:36 +0200 Subject: kbuild: deb-pkg ship changelog In the series for 2.6.31 it was noticed to ship the copyright, but the generated changelog got lost somehow. As bonus the generated linux-image deb packages are Lenny lintian clean. Cc: Frans Pop Cc: Andres Salomon Signed-off-by: maximilian attems Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 01c2d13dd02..b19f1f4962e 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -16,6 +16,8 @@ create_package() { local pname="$1" pdir="$2" cp debian/copyright "$pdir/usr/share/doc/$pname/" + cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian" + gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian" # Fix ownership and permissions chown -R root:root "$pdir" -- cgit v1.2.3 From c512d2544c688ff1fab18a530860a9c7440a71b7 Mon Sep 17 00:00:00 2001 From: Jaswinder Singh Rajput Date: Sat, 20 Jun 2009 18:25:25 +0530 Subject: gitignore: ignore scripts/ihex2fw scripts/ihex2fw is a generated binary and should be ignored Signed-off-by: Jaswinder Singh Rajput Signed-off-by: Sam Ravnborg --- scripts/.gitignore | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/.gitignore b/scripts/.gitignore index b939fbd0119..52cab46ae35 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -7,3 +7,4 @@ pnmtologo bin2c unifdef binoffset +ihex2fw -- cgit v1.2.3 From 15e3252464432a29c5461325cb5243471bd2a219 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Tue, 30 Jun 2009 11:41:15 -0700 Subject: fbdev: work around old compiler bug When building with a 4.1.x compiler on powerpc64 (at least) we get this error: drivers/video/logo/logo_linux_mono.c:81: error: logo_linux_mono causes a section type conflict This was introduced by commit ae52bb2384f721562f15f719de1acb8e934733cb ("fbdev: move logo externs to header file"). This is a partial revert of that commit sufficient to not hit the compiler bug. Also convert _clut arrays from __initconst to __initdata. Sam said: Al analysed this some time ago. When we say something is const then _sometimes_ gcc annotate the section as const(?) - sometimes not. So if we have two variables/functions annotated __*const and gcc decides to annotate the section const only in one case we get a section type conflict. Signed-off-by: Stephen Rothwell Cc: Sam Ravnborg Cc: Krzysztof Helt Cc: Geert Uytterhoeven Cc: Kyle McMartin Cc: Al Viro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/pnmtologo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/pnmtologo.c b/scripts/pnmtologo.c index 64f5ddb09ea..5c113123ed9 100644 --- a/scripts/pnmtologo.c +++ b/scripts/pnmtologo.c @@ -237,7 +237,7 @@ static void write_header(void) fprintf(out, " * Linux logo %s\n", logoname); fputs(" */\n\n", out); fputs("#include \n\n", out); - fprintf(out, "static const unsigned char %s_data[] __initconst = {\n", + fprintf(out, "static unsigned char %s_data[] __initdata = {\n", logoname); } @@ -374,7 +374,7 @@ static void write_logo_clut224(void) fputs("\n};\n\n", out); /* write logo clut */ - fprintf(out, "static const unsigned char %s_clut[] __initconst = {\n", + fprintf(out, "static unsigned char %s_clut[] __initdata = {\n", logoname); write_hex_cnt = 0; for (i = 0; i < logo_clutsize; i++) { -- cgit v1.2.3 From d960eea974f5e500c0dcb95a934239cc1f481cfd Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 29 Jun 2009 14:54:11 -0700 Subject: kernel-doc: move ignoring kmemcheck Somehow I managed to generate a diff that put these 2 lines into the wrong function: should have been in dump_struct() instead of in dump_enum(). Signed-off-by: Randy Dunlap Signed-off-by: Linus Torvalds --- scripts/kernel-doc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/kernel-doc b/scripts/kernel-doc index ed591e9b7d1..b52d340d759 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1426,6 +1426,8 @@ sub dump_struct($$) { # strip comments: $members =~ s/\/\*.*?\*\///gos; $nested =~ s/\/\*.*?\*\///gos; + # strip kmemcheck_bitfield_{begin,end}.*; + $members =~ s/kmemcheck_bitfield_.*?;//gos; create_parameterlist($members, ';', $file); check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); @@ -1468,8 +1470,6 @@ sub dump_enum($$) { } } - # strip kmemcheck_bitfield_{begin,end}.*; - $members =~ s/kmemcheck_bitfield_.*?;//gos; output_declaration($declaration_name, 'enum', -- cgit v1.2.3 From 241ad11f2d2542723136ffa81cd5db61d590156c Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sun, 5 Jul 2009 20:17:34 +0200 Subject: kbuild, deb-pkg: fix install scripts for posix sh bash versus dash and posh disagree on expanding $@ within double quotes: export x="$@" see http://bugs.debian.org/381091 for details just use the arglist with $*. dpkg: error processing linux-image-2.6.31-rc1_2.6.31-rc1-18_i386.deb (--install): subprocess pre-installation script returned error exit status 2 export: 6: 2.6.31-rc1-18: bad variable name fixes http://bugzilla.kernel.org/show_bug.cgi?id=13567 seen on Ubuntu as there dash is the default sh, versus bash on Debian. Reported-by: Pauli Cc: Frans Pop Signed-off-by: maximilian attems Acked-By: Andres Salomon --- 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 b19f1f4962e..8b357b0bd25 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -89,7 +89,7 @@ for script in postinst postrm preinst prerm ; do set -e # Pass maintainer script parameters to hook scripts -export DEB_MAINT_PARAMS="\$@" +export DEB_MAINT_PARAMS="\$*" test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d exit 0 -- cgit v1.2.3 From 668cdedfdb2eb00d8efe127618bead4d46d9e942 Mon Sep 17 00:00:00 2001 From: Arnaud Lacombe Date: Mon, 6 Jul 2009 00:07:14 -0400 Subject: kconfig: variable argument lists needs `stdarg.h' Fix build on non GNU based platforms. Cc: Roman Zippel Signed-off-by: Sam Ravnborg --- scripts/kconfig/lxdialog/util.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index 86d95cca46a..f2375ad7ebc 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c @@ -19,6 +19,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include + #include "dialog.h" struct dialog_info dlg; -- cgit v1.2.3 From d0e1e09568507ac771072d97f0781af82c935b3e Mon Sep 17 00:00:00 2001 From: Arnaud Lacombe Date: Mon, 6 Jul 2009 00:07:28 -0400 Subject: kconfig: initialize the screen before using curses(3) functions This is needed on non ncurses based implementation to get a properly initialized `stdscr' in main(). Cc: Roman Zippel Signed-off-by: Sam Ravnborg --- scripts/kconfig/mconf.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 3bcacb4bfd3..25b60bc117f 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -888,6 +888,8 @@ int main(int ac, char **av) single_menu_mode = 1; } + initscr(); + getyx(stdscr, saved_y, saved_x); if (init_dialog(NULL)) { fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); -- cgit v1.2.3 From d34a4debef933061924ee17c2ede33f5c44925fb Mon Sep 17 00:00:00 2001 From: "jolsa@redhat.com" Date: Thu, 16 Jul 2009 21:44:28 +0200 Subject: tracing: Remove .globl in the scripts/recordmcount.pl doc I was reading throught the recordmcount.pl starting comment, and spotted a tiny discrepancy. The second example is about my_func not being global, but the example code has the ".globl my_func" statement just moved. Signed-off-by: Jiri Olsa Cc: rostedt@goodmis.org LKML-Reference: <1247773468-11594-4-git-send-email-jolsa@redhat.com> Signed-off-by: Ingo Molnar --- scripts/recordmcount.pl | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 7109e2b5bc0..db4ebe1b996 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -57,7 +57,6 @@ # call mcount (offset: 0x5) # [...] # ret -# .globl my_func # other_func: # [...] # call mcount (offset: 0x1b) -- cgit v1.2.3 From fc4c73554c9d93b3e495f2f7acae1323b0d5db84 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Thu, 23 Jul 2009 17:16:14 +0100 Subject: ftrace: Fix the conditional that updates $ref_func Fix the conditional that checks if we already have a $ref_func and that the new function is weak. The code as previously checking whether either condition was false, and we really need to only update $ref_func is both cconditions are false. Signed-off-by: Matt Fleming LKML-Reference: <1248365775-25196-1-git-send-email-matt@console-pimps.org> Signed-off-by: Steven Rostedt --- scripts/recordmcount.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 7109e2b5bc0..16c5563b412 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -414,7 +414,7 @@ while () { $read_function = 0; } else { # if we already have a function, and this is weak, skip it - if (!defined($ref_func) || !defined($weak{$text})) { + if (!defined($ref_func) && !defined($weak{$text})) { $ref_func = $text; } } -- cgit v1.2.3 From bd171d5ffc5cb2ba471e8205c679ee9d12b90116 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Thu, 23 Jul 2009 17:16:15 +0100 Subject: ftrace: Only update $offset when we update $ref_func The value of $offset should be the offset of $ref_func from the beginning of the object file. Therefore, we should set both variables together. This fixes a bug I was hitting on sh where $offset (which is used to calcualte the addends for the __mcount_loc entries) was being set multiple times and didn't correspond to $ref_func's offset in the object file. The addends in __mcount_loc were calculated incorrectly, resulting in ftrace dynamically modifying addresses that weren't mcount call sites. Signed-off-by: Matt Fleming LKML-Reference: <1248365775-25196-2-git-send-email-matt@console-pimps.org> Signed-off-by: Steven Rostedt --- scripts/recordmcount.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 16c5563b412..d29baa2e063 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -403,7 +403,6 @@ while () { # section found, now is this a start of a function? } elsif ($read_function && /$function_regex/) { $text_found = 1; - $offset = hex $1; $text = $2; # if this is either a local function or a weak function @@ -412,10 +411,12 @@ while () { if (!defined($locals{$text}) && !defined($weak{$text})) { $ref_func = $text; $read_function = 0; + $offset = hex $1; } else { # if we already have a function, and this is weak, skip it if (!defined($ref_func) && !defined($weak{$text})) { $ref_func = $text; + $offset = hex $1; } } } elsif ($read_headers && /$mcount_section/) { -- cgit v1.2.3 From 51fbb4bab6c8710eb897ab3fb06efbbc921f3a8d Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Wed, 29 Jul 2009 15:02:03 -0700 Subject: markup_oops: fix it with 32-bit userspace on a 64-bit kernel A 32-bit perl can't handle 64-bit addresses without using the BigInt package. Signed-off-by: Matthew Wilcox Acked-by: Arjan van de Ven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/markup_oops.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index 528492bcba5..89774011965 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl use File::Basename; +use Math::BigInt; # Copyright 2008, Intel Corporation # @@ -172,8 +173,8 @@ while () { parse_x86_regs($line); } -my $decodestart = hex($target) - hex($func_offset); -my $decodestop = hex($target) + 8192; +my $decodestart = Math::BigInt->from_hex("0x$target") - Math::BigInt->from_hex("0x$func_offset"); +my $decodestop = Math::BigInt->from_hex("0x$target") + 8192; if ($target eq "0") { print "No oops found!\n"; print "Usage: \n"; -- cgit v1.2.3 From 870020f93af2323a81f179091a0780dc1d5b916b Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 29 Jul 2009 15:04:28 -0700 Subject: scripts/get_maintainer.pl: Add -f directory use Don't require a specific file in a directory to be tested. Also Arnd Bergmann pointed out that the MAINTAINERS pattern requirement that directory patterns have a trailing slash was unnecessary and was likely to be error prone. Removed that requirement. Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 3e733146cd5..7fc09fc91e8 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -13,7 +13,7 @@ use strict; my $P = $0; -my $V = '0.16'; +my $V = '0.17'; use Getopt::Long qw(:config no_auto_abbrev); @@ -132,6 +132,10 @@ while () { $value =~ s@\.@\\\.@g; ##Convert . to \. $value =~ s/\*/\.\*/g; ##Convert * to .* $value =~ s/\?/\./g; ##Convert ? to . + ##if pattern is a directory and it lacks a trailing slash, add one + if ((-d $value)) { + $value =~ s@([^/])$@$1/@; + } } push(@typevalue, "$type:$value"); } elsif (!/^(\s)*$/) { @@ -146,8 +150,10 @@ close(MAINT); my @files = (); foreach my $file (@ARGV) { - next if ((-d $file)); - if (!(-f $file)) { + ##if $file is a directory and it lacks a trailing slash, add one + if ((-d $file)) { + $file =~ s@([^/])$@$1/@; + } elsif (!(-f $file)) { die "$P: file '${file}' not found\n"; } if ($from_filename) { @@ -292,7 +298,7 @@ sub file_match_pattern { sub usage { print < show version --help => show this help information +Notes: + Using "-f directory" may give unexpected results: + + Used with "--git", git signators for _all_ files in and below + directory are examined as git recurses directories. + Any specified X: (exclude) pattern matches are _not_ ignored. + Used with "--nogit", directory is used as a pattern match, + no individual file within the directory or subdirectory + is matched. EOT } -- cgit v1.2.3 From afa81ee13033de791c41c1d9333853504653939b Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 29 Jul 2009 15:04:28 -0700 Subject: get_maintainer.pl: Add git-min-percent option Allow an option to control the minimum percentage of sign-offs required before being considered a maintainer. git-min-percent has a default value of 5 Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 7fc09fc91e8..61ef27564ed 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -27,6 +27,7 @@ my $email_git = 1; my $email_git_penguin_chiefs = 0; my $email_git_min_signatures = 1; my $email_git_max_maintainers = 5; +my $email_git_min_percent = 5; my $email_git_since = "1-year-ago"; my $output_multiline = 1; my $output_separator = ", "; @@ -65,6 +66,7 @@ if (!GetOptions( 'git-chief-penguins!' => \$email_git_penguin_chiefs, 'git-min-signatures=i' => \$email_git_min_signatures, 'git-max-maintainers=i' => \$email_git_max_maintainers, + 'git-min-percent=i' => \$email_git_min_percent, 'git-since=s' => \$email_git_since, 'm!' => \$email_maintainer, 'n!' => \$email_usename, @@ -307,6 +309,7 @@ MAINTAINER field selection options: --git-chief-penguins => include ${penguin_chiefs} --git-min-signatures => number of signatures required (default: 1) --git-max-maintainers => maximum maintainers to add (default: 5) + --git-min-percent => minimum percentage of commits required (default: 0) --git-since => git history to use (default: 1-year-ago) --m => include maintainer(s) if any --n => include name 'Full Name ' @@ -497,6 +500,7 @@ sub recent_git_signoffs { my $output = ""; my $count = 0; my @lines = (); + my $total_sign_offs; if (which("git") eq "") { warn("$P: git not found. Add --nogit to options?\n"); @@ -520,17 +524,26 @@ sub recent_git_signoffs { $output =~ s/^\s*//gm; @lines = split("\n", $output); + + $total_sign_offs = 0; + foreach my $line (@lines) { + if ($line =~ m/([0-9]+)\s+(.*)/) { + $total_sign_offs += $1; + } else { + die("$P: Unexpected git output: ${line}\n"); + } + } + foreach my $line (@lines) { if ($line =~ m/([0-9]+)\s+(.*)/) { my $sign_offs = $1; $line = $2; $count++; if ($sign_offs < $email_git_min_signatures || - $count > $email_git_max_maintainers) { + $count > $email_git_max_maintainers || + $sign_offs * 100 / $total_sign_offs < $email_git_min_percent) { last; } - } else { - die("$P: Unexpected git output: ${line}\n"); } if ($line =~ m/(.+)<(.+)>/) { my $git_name = $1; -- cgit v1.2.3 From 3d202aeb7b7b33d5a5b2040ee5af5b309782941c Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 29 Jul 2009 15:04:29 -0700 Subject: get_maintainerpl-add-git-min-percent-option-fix Allow an option to control the minimum percentage of sign-offs required before being considered a maintainer. git-min-percent has a default value of 5 Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 61ef27564ed..278a45bd45a 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -309,7 +309,7 @@ MAINTAINER field selection options: --git-chief-penguins => include ${penguin_chiefs} --git-min-signatures => number of signatures required (default: 1) --git-max-maintainers => maximum maintainers to add (default: 5) - --git-min-percent => minimum percentage of commits required (default: 0) + --git-min-percent => minimum percentage of commits required (default: 5) --git-since => git history to use (default: 1-year-ago) --m => include maintainer(s) if any --n => include name 'Full Name ' -- cgit v1.2.3 From 3f6e968ef4e1d8d93d8a8505461b0e50a9e97ad8 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Wed, 5 Aug 2009 22:00:14 -0400 Subject: tracing: do not use functions starting with .L in recordmcount.pl On Wed, 5 Aug 2009, Ingo Molnar wrote: > * Dave Airlie wrote: > > > Hey, > > > > So I spent 3-4 hrs today (I'm stupid yes) tracking down a .o > > breakage by blaming rawhide gcc/binutils as I was using make > > V=1and seeing only the compiler chain running, > > Hm, is this that powerpc related build bug you just reported? Well we tracked it down and it is powerpc64 specific. Seems that in drivers/hwmon/lm93.c there's a function called: LM93_IN_FROM_REG() But PPC64 has function descriptors and the real function names (the ones you see in objdump) start with a '.'. Thus this in objdump you have: Disassembly of section .text: 0000000000000000 <.LM93_IN_FROM_REG>: 0: 7c 08 02 a6 mflr r0 4: fb 81 ff e0 std r28,-32(r1) The function name used is .LM93_IN_FROM_REG. But gcc considers symbols that start with ".L" as a special symbol that is used inside the assembly stage. The nm passed into recordmcount uses the --synthetic option which shows the ".L" symbols (my runs outside of the build did not include the --synthetic option, so my older patch worked). We see the function as a local. Now to capture all the locations that use "mcount" we need to have a reference to link into the object file a list of mcount callers. We need a reference that will not disappear. We try to use a global function and if that does not work, we use a local function as a reference. But to relink the section back into the object, we need to make it global. In this case, we run objcopy using --globalize-symbol and --localize-symbol to convert the symbol into a global symbol, link the mcount list, then convert it back to a local symbol. This works great except for this case. .L* symbols can not be converted into a global symbol, and the mcount section referencing it will remain unresolved. Reported-by: Dave Airlie LKML-Reference: Signed-off-by: Steven Rostedt --- scripts/recordmcount.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index d29baa2e063..4889c44d71b 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -414,7 +414,10 @@ while () { $offset = hex $1; } else { # if we already have a function, and this is weak, skip it - if (!defined($ref_func) && !defined($weak{$text})) { + if (!defined($ref_func) && !defined($weak{$text}) && + # PPC64 can have symbols that start with .L and + # gcc considers these special. Don't use them! + $text !~ /^\.L/) { $ref_func = $text; $offset = hex $1; } -- cgit v1.2.3 From 7dbdee2e9a2ac42ea5135801bcc9d1a8e3f672aa Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 6 Aug 2009 19:53:18 -0400 Subject: tracing: Fix recordmcount.pl to handle sections with only weak functions Roland Dreier found that a section that contained only a weak function in one of the staging drivers and this caused recordmcount.pl to spit out a warning and fail. Although it is strange that a driver would have a weak function, and this function only be used in one place, it should not be something to make recordmcount.pl fail. This patch fixes the issue in a simple manner: if only weak functions exist in a section, then that section will not be recorded. Reported-by: Roland Dreier Signed-off-by: Steven Rostedt Signed-off-by: Ingo Molnar --- scripts/recordmcount.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 4889c44d71b..911ba7ffab8 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -393,7 +393,7 @@ while () { $read_function = 0; } # print out any recorded offsets - update_funcs() if ($text_found); + update_funcs() if (defined($ref_func)); # reset all markers and arrays $text_found = 0; @@ -444,7 +444,7 @@ while () { } # dump out anymore offsets that may have been found -update_funcs() if ($text_found); +update_funcs() if (defined($ref_func)); # If we did not find any mcount callers, we are done (do nothing). if (!$opened) { -- cgit v1.2.3 From dcc60243e726978576cb02b74c84440629c69c87 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Wed, 29 Apr 2009 22:52:21 -0400 Subject: kconfig: add streamline_config.pl to scripts streamline_config.pl is a very powerful tool. For those that install a kernel to a new box using the config file from the distribution know that it can take forever to compile the kernel. Making a custom config file that will still boot your box, but bring down the compile time of the kernel can be quit painful, and to ask someone that reported a bug to do this can be a large burdon since that person may not even know how to build a kernel. This script will perform "lsmod" to find all the modules loaded on the current running system. It will read all the Makefiles to map which CONFIG enables a module. It will read the Kconfig files to find the dependencies and selects that may be needed to support a CONFIG. Finally, it reads the .config file and removes any module "=m" that is not needed to enable the currently loaded modules. The output goes to standard out. Here's a way to run the script. From the Linux directory that holds a distribution .config. $ scripts/kconfig/streamline_config.pl arch/x86/Kconfig > config-sl $ mv .config config-save $ mv config-sl .config $ make oldconfig Now you have a .config that will still build all your modules, but also take much less time to build the kernel. Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 291 +++++++++++++++++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 scripts/kconfig/streamline_config.pl (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl new file mode 100644 index 00000000000..79d85573ee0 --- /dev/null +++ b/scripts/kconfig/streamline_config.pl @@ -0,0 +1,291 @@ +#!/usr/bin/perl -w +# +# Copywrite 2005-2009 - Steven Rostedt +# Licensed under the terms of the GNU GPL License version 2 +# +# It's simple enough to figure out how this works. +# If not, then you can ask me at stripconfig@goodmis.org +# +# What it does? +# +# If you have installed a Linux kernel from a distribution +# that turns on way too many modules than you need, and +# you only want the modules you use, then this program +# is perfect for you. +# +# It gives you the ability to turn off all the modules that are +# not loaded on your system. +# +# Howto: +# +# 1. Boot up the kernel that you want to stream line the config on. +# 2. Change directory to the directory holding the source of the +# kernel that you just booted. +# 3. Copy the configuraton file to this directory as .config +# 4. Have all your devices that you need modules for connected and +# operational (make sure that their corresponding modules are loaded) +# 5. Run this script redirecting the output to some other file +# like config_strip. +# 6. Back up your old config (if you want too). +# 7. copy the config_strip file to .config +# 8. Run "make oldconfig" +# +# Now your kernel is ready to be built with only the modules that +# are loaded. +# +# Here's what I did with my Debian distribution. +# +# cd /usr/src/linux-2.6.10 +# cp /boot/config-2.6.10-1-686-smp .config +# ~/bin/streamline_config > config_strip +# mv .config config_sav +# mv config_strip .config +# make oldconfig +# +my $config = ".config"; +my $linuxpath = "."; + +open(CIN,$config) || die "Can't open current config file: $config"; +my @makefiles = `find $linuxpath -name Makefile`; +my %depends; +my %selects; +my %prompts; +my %objects; +my $var; +my $cont = 0; + +# Get the top level Kconfig file (passed in) +my $kconfig = $ARGV[0]; + +# prevent recursion +my %read_kconfigs; + +sub read_kconfig { + my ($kconfig) = @_; + + my $state = "NONE"; + my $config; + my @kconfigs; + + open(KIN, $kconfig) || die "Can't open $kconfig"; + while () { + chomp; + + # collect any Kconfig sources + if (/^source\s*"(.*)"/) { + $kconfigs[$#kconfigs+1] = $1; + } + + # configs found + if (/^\s*config\s+(\S+)\s*$/) { + $state = "NEW"; + $config = $1; + + # collect the depends for the config + } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { + $state = "DEP"; + $depends{$config} = $1; + } elsif ($state eq "DEP" && /^\s*depends\s+on\s+(.*)$/) { + $depends{$config} .= " " . $1; + + # Get the configs that select this config + } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) { + if (defined($selects{$1})) { + $selects{$1} .= " " . $config; + } else { + $selects{$1} = $config; + } + + # configs without prompts must be selected + } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { + # note if the config has a prompt + $prompt{$config} = 1; + + # stop on "help" + } elsif (/^\s*help\s*$/) { + $state = "NONE"; + } + } + close(KIN); + + # read in any configs that were found. + foreach $kconfig (@kconfigs) { + if (!defined($read_kconfigs{$kconfig})) { + $read_kconfigs{$kconfig} = 1; + read_kconfig($kconfig); + } + } +} + +if ($kconfig) { + read_kconfig($kconfig); +} + +# Read all Makefiles to map the configs to the objects +foreach my $makefile (@makefiles) { + chomp $makefile; + + open(MIN,$makefile) || die "Can't open $makefile"; + while () { + my $objs; + + # is this a line after a line with a backslash? + if ($cont && /(\S.*)$/) { + $objs = $1; + } + $cont = 0; + + # collect objects after obj-$(CONFIG_FOO_BAR) + if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { + $var = $1; + $objs = $2; + } + if (defined($objs)) { + # test if the line ends with a backslash + if ($objs =~ m,(.*)\\$,) { + $objs = $1; + $cont = 1; + } + + foreach my $obj (split /\s+/,$objs) { + $obj =~ s/-/_/g; + if ($obj =~ /(.*)\.o$/) { + # Objects may bes enabled by more than one config. + # Store configs in an array. + my @arr; + + if (defined($objects{$1})) { + @arr = @{$objects{$1}}; + } + + $arr[$#arr+1] = $var; + + # The objects have a hash mapping to a reference + # of an array of configs. + $objects{$1} = \@arr; + } + } + } + } + close(MIN); +} + +my %modules; + +# see what modules are loaded on this system +open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; +while () { + next if (/^Module/); # Skip the first line. + if (/^(\S+)/) { + $modules{$1} = 1; + } +} +close (LIN); + +# add to the configs hash all configs that are needed to enable +# a loaded module. +my %configs; +foreach my $module (keys(%modules)) { + if (defined($objects{$module})) { + @arr = @{$objects{$module}}; + foreach my $conf (@arr) { + $configs{$conf} = $module; + } + } else { + # Most likely, someone has a custom (binary?) module loaded. + print STDERR "$module config not found!!\n"; + } +} + +my $valid = "A-Za-z_0-9"; +my $repeat = 1; + +# +# Note, we do not care about operands (like: &&, ||, !) we want to add any +# config that is in the depend list of another config. This script does +# not enable configs that are not already enabled. If we come across a +# config A that depends on !B, we can still add B to the list of depends +# to keep on. If A was on in the original config, B would not have been +# and B would not be turned on by this script. +# +sub parse_config_dep_select +{ + my ($p) = @_; + + while ($p =~ /[$valid]/) { + + if ($p =~ /^[^$valid]*([$valid]+)/) { + my $conf = "CONFIG_" . $1; + + $p =~ s/^[^$valid]*[$valid]+//; + + if (!defined($configs{$conf})) { + # We must make sure that this config has its + # dependencies met. + $repeat = 1; # do again + $configs{$conf} = 1; + } + } else { + die "this should never happen"; + } + } +} + +while ($repeat) { + $repeat = 0; + + foreach my $config (keys %configs) { + $config =~ s/^CONFIG_//; + + if (!defined($depends{$config})) { + next; + } + + # This config has dependencies. Make sure they are also included + parse_config_dep_select $depends{$config}; + + if (defined($prompt{$config}) || !defined($selects{$config})) { + next; + } + + # config has no prompt and must be selected. + parse_config_dep_select $selects{$config}; + } +} + +my %setconfigs; + +# Finally, read the .config file and turn off any module enabled that +# we could not find a reason to keep enabled. +while() { + if (/^(CONFIG.*)=m/) { + if (defined($configs{$1})) { + $setconfigs{$1} = 1; + print; + } else { + print "# $1 is not set\n"; + } + } else { + print; + } +} +close(CIN); + +# Integrity check, make sure all modules that we want enabled do +# indeed have their configs set. +loop: +foreach my $module (keys(%modules)) { + if (defined($objects{$module})) { + my @arr = @{$objects{$module}}; + foreach my $conf (@arr) { + if (defined($setconfigs{$conf})) { + next loop; + } + } + print STDERR "module $module did not have configs"; + foreach my $conf (@arr) { + print STDERR " " , $conf; + } + print STDERR "\n"; + } +} -- cgit v1.2.3 From 03fa25da8335a942161a8070b3298cfd4edf9b6a Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Wed, 29 Apr 2009 22:52:22 -0400 Subject: kconfig: make localmodconfig to run streamline_config.pl Running the streamline_config.pl script manually can still be confusing for some users. This patch adds the localmodconfig option. This will automatically run streamline_config.pl on the current .config and then run "make silentoldconfig" to fix any wholes that might have been created. $ make localmodconfig This will remove any module configurations in .config that are not needed to compile the modules that are loaded. Signed-off-by: Steven Rostedt --- scripts/kconfig/Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5ddf8becd7a..e4d8394ff75 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -2,7 +2,8 @@ # Kernel configuration targets # These targets are used from top-level makefile -PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config +PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ + localmodconfig ifdef KBUILD_KCONFIG Kconfig := $(KBUILD_KCONFIG) @@ -28,6 +29,15 @@ oldconfig: $(obj)/conf silentoldconfig: $(obj)/conf $< -s $(Kconfig) +localmodconfig: $(obj)/streamline_config.pl $(obj)/conf + $(Q)perl $< $(Kconfig) > .tmp.config + $(Q)cmp -s .tmp.config .config || \ + (mv -f .config .config.old.1; \ + mv -f .tmp.config .config; \ + $(obj)/conf -s $(Kconfig); \ + mv -f .config.old.1 .config.old) + $(Q)rm -f .tmp.config + # Create new linux.pot file # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files # The symlink is used to repair a deficiency in arch/um @@ -83,6 +93,7 @@ help: @echo ' xconfig - Update current config utilising a QT based front-end' @echo ' gconfig - Update current config utilising a GTK based front-end' @echo ' oldconfig - Update current config utilising a provided .config as base' + @echo ' localmodconfig - Update current config disabling modules not loaded' @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' @echo ' randconfig - New config with random answer to all options' @echo ' defconfig - New config with default answer to all options' -- cgit v1.2.3 From 281c9dadc31ffd9f3cf637553134fefe75e849da Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Wed, 29 Apr 2009 22:52:23 -0400 Subject: kconfig: add make localyesconfig option This adds the option localyesconfig to make. This is similar to localmodconfig, but after it removes unnecessary modules it runs sed -i s/=m/=y/ on the .config file. It then runs "make silentoldconfig" to fix any wholes that were created by the conversion of modules to core. Signed-off-by: Steven Rostedt --- scripts/kconfig/Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index e4d8394ff75..12a4d9e2cad 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -3,7 +3,7 @@ # These targets are used from top-level makefile PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ - localmodconfig + localmodconfig localyesconfig ifdef KBUILD_KCONFIG Kconfig := $(KBUILD_KCONFIG) @@ -38,6 +38,16 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf mv -f .config.old.1 .config.old) $(Q)rm -f .tmp.config +localyesconfig: $(obj)/streamline_config.pl + $(Q)perl $< $(Kconfig) > .tmp.config + $(Q)sed -i s/=m/=y/ .tmp.config + $(Q)cmp -s .tmp.config .config || \ + (mv -f .config .config.old.1; \ + mv -f .tmp.config .config; \ + $(obj)/conf -s $(Kconfig); \ + mv -f .config.old.1 .config.old) + $(Q)rm -f .tmp.config + # Create new linux.pot file # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files # The symlink is used to repair a deficiency in arch/um @@ -94,6 +104,7 @@ help: @echo ' gconfig - Update current config utilising a GTK based front-end' @echo ' oldconfig - Update current config utilising a provided .config as base' @echo ' localmodconfig - Update current config disabling modules not loaded' + @echo ' localyesconfig - Update current config converting local mods to core' @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' @echo ' randconfig - New config with random answer to all options' @echo ' defconfig - New config with default answer to all options' -- cgit v1.2.3 From 74398d3224c0942c479bef76de542e95c202a478 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 30 Apr 2009 10:17:51 -0400 Subject: kconfig: streamline_config.pl do not stop with no depends If a config does not have a prompt, it must be selected. streamline_config.pl keeps track of all configs that select other configs. If a config that does not have a prompt needs to be set to enable a current module, it will include all configs that select it. Note, streamline_config.pl does not enable modules that are not already enabled. It only keeps enabled those that were enabled and might be needed to compile the current modules. The code to find the selects of a config is after the code that adds the depends. But if a config needed selects but had no dependencies, it would not be set. Because the code would stop before getting to the select. Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 79d85573ee0..177490540fe 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -237,13 +237,11 @@ while ($repeat) { foreach my $config (keys %configs) { $config =~ s/^CONFIG_//; - if (!defined($depends{$config})) { - next; + if (defined($depends{$config})) { + # This config has dependencies. Make sure they are also included + parse_config_dep_select $depends{$config}; } - # This config has dependencies. Make sure they are also included - parse_config_dep_select $depends{$config}; - if (defined($prompt{$config}) || !defined($selects{$config})) { next; } -- cgit v1.2.3 From ea2c1894b66301bce565471d6914d49ce91ee015 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 30 Apr 2009 10:59:08 -0400 Subject: kconfig: do not warn about modules built in The streamline_config.pl finds all the configs that are needed to compile the currently loaded modules. After it creates the .config file, it tests to make sure all the configs that are needed were set. It only looks at the configs that are modules, it does not look at the builtin configs. This causes unnecessary warnings about modules not being covered. Reported-by: Ingo Molnar Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 177490540fe..caac952212e 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -256,12 +256,14 @@ my %setconfigs; # Finally, read the .config file and turn off any module enabled that # we could not find a reason to keep enabled. while() { - if (/^(CONFIG.*)=m/) { + if (/^(CONFIG.*)=(m|y)/) { if (defined($configs{$1})) { - $setconfigs{$1} = 1; + $setconfigs{$1} = $2; print; - } else { + } elsif ($2 eq "m") { print "# $1 is not set\n"; + } else { + print; } } else { print; -- cgit v1.2.3 From 744ffcbe867b81e9f467503c85bc5e4f9a586294 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 30 Apr 2009 12:15:10 -0400 Subject: kconfig: enable CONFIG_IKCONFIG from streamline_config.pl Ingo Molnar suggested that the streamline_config.pl should enable CONFIG_IKCONFIG to keep the current config in the kernel. Then we can use scripts/extract-ikconfig to find the current modules. This patch changes streamline_config.pl to check if CONFIG_IKCONFIG is not set, and if it is not, it enables it to be a module. [ Impact: make current config options easier to find ] Reported-by: Ingo Molnar Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index caac952212e..233464185a9 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -256,18 +256,31 @@ my %setconfigs; # Finally, read the .config file and turn off any module enabled that # we could not find a reason to keep enabled. while() { - if (/^(CONFIG.*)=(m|y)/) { - if (defined($configs{$1})) { - $setconfigs{$1} = $2; - print; - } elsif ($2 eq "m") { - print "# $1 is not set\n"; - } else { - print; - } + + if (/CONFIG_IKCONFIG/) { + if (/# CONFIG_IKCONFIG is not set/) { + # enable IKCONFIG at least as a module + print "CONFIG_IKCONFIG=m\n"; + # don't ask about PROC + print "# CONFIG_IKCONFIG is not set\n"; + } else { + print; + } + next; + } + + if (/^(CONFIG.*)=(m|y)/) { + if (defined($configs{$1})) { + $setconfigs{$1} = $2; + print; + } elsif ($2 eq "m") { + print "# $1 is not set\n"; } else { - print; + print; } + } else { + print; + } } close(CIN); -- cgit v1.2.3 From fd3132d5815bf72aeec7d5ad87161b4831f8e48c Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 30 Apr 2009 12:19:56 -0400 Subject: kconfig: add check if end exists in extract-ikconfig Both start and end should be tested for existence before continuing to parse the config.gz file. Signed-off-by: Steven Rostedt --- scripts/extract-ikconfig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index 72997c353cb..42d6bcefb40 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig @@ -17,6 +17,10 @@ dump_config() { return fi end=`$binoffset $file $IKCFG_ED 2>/dev/null` + [ "$?" != "0" ] && end="-1" + if [ "$end" -eq "-1" ]; then + return + fi start=`expr $start + 8` size=`expr $end - $start` -- cgit v1.2.3 From 6be51ffc1791b72d11cef9bb0a578fe8c5d64c6a Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 30 Apr 2009 12:22:20 -0400 Subject: kconfig: have extract-ikconfig read ELF files It would be nice to use extract-ikconfig to find the congfig.gz in either vmlinux (not vmlinuz) or configs.ko. This patch changes the script to also be able to read ELF files directly. [ Impact: find config.gz in vmlinux and configs.ko ] Signed-off-by: Steven Rostedt --- scripts/extract-ikconfig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scripts') diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index 42d6bcefb40..de233ff43c1 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig @@ -59,6 +59,8 @@ dump_config "$image" GZHDR1="0x1f 0x8b 0x08 0x00" GZHDR2="0x1f 0x8b 0x08 0x08" +ELFHDR="0x7f 0x45 0x4c 0x46" + # vmlinux.gz: Check for a compressed images off=`$binoffset "$image" $GZHDR1 2>/dev/null` [ "$?" != "0" ] && off="-1" @@ -73,6 +75,14 @@ elif [ "$off" -ne "-1" ]; then (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \ zcat >"$TMPFILE" dump_config "$TMPFILE" + +# check if this is simply an ELF file +else + off=`$binoffset "$image" $ELFHDR 2>/dev/null` + [ "$?" != "0" ] && off="-1" + if [ "$off" -eq "0" ]; then + dump_config "$image" + fi fi echo "ERROR: Unable to extract kernel configuration information." -- cgit v1.2.3 From cdfc47950a531199a553cebab0ac481aa7062948 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 30 Apr 2009 14:39:48 -0400 Subject: kconfig: search for a config to base the local(mod|yes)config on Instead of using the .config in the local directory. This patch changes streamline_config.pl to search various locations for a config. Here's the list and order of search: /proc/config.gz /boot/vmlinuz-`uname -r` vmlinux # local to the directory /lib/modules/`uname -r`/kernel/kernel/configs.ko kernel/configs.ko kernel/configs.o .config Once it finds a file that contains a config (it checks if the binary objects have configs first) it then uses it to create the .config with minimum modules needed. Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 63 +++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 233464185a9..9fa3f81b1ed 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -45,7 +45,68 @@ my $config = ".config"; my $linuxpath = "."; -open(CIN,$config) || die "Can't open current config file: $config"; +my $uname = `uname -r`; +chomp $uname; + +my @searchconfigs = ( + { + "file" => "/proc/config.gz", + "exec" => "zcat", + }, + { + "file" => "/boot/vmlinuz-$uname", + "exec" => "scripts/extract-ikconfig", + "test" => "scripts/extract-ikconfig", + }, + { + "file" => "vmlinux", + "exec" => "scripts/extract-ikconfig", + "test" => "scripts/extract-ikconfig", + }, + { + "file" => "/lib/modules/$uname/kernel/kernel/configs.ko", + "exec" => "scripts/extract-ikconfig", + "test" => "scripts/extract-ikconfig", + }, + { + "file" => "kernel/configs.ko", + "exec" => "scripts/extract-ikconfig", + "test" => "scripts/extract-ikconfig", + }, + { + "file" => "kernel/configs.o", + "exec" => "scripts/extract-ikconfig", + "test" => "scripts/extract-ikconfig", + }, + { + "file" => ".config", + "exec" => "cat", + }, +); + +sub find_config { + foreach my $conf (@searchconfigs) { + my $file = $conf->{"file"}; + + next if ( ! -f "$file"); + + if (defined($conf->{"test"})) { + `$conf->{"test"} $conf->{"file"} 2>/dev/null`; + next if ($?); + } + + my $exec = $conf->{"exec"}; + + print STDERR "using config: '$file'\n"; + + open(CIN, "$exec $file |") || die "Failed to run $exec $file"; + return; + } + die "No config file found"; +} + +find_config; + my @makefiles = `find $linuxpath -name Makefile`; my %depends; my %selects; -- cgit v1.2.3 From d08ca2771e3aabddc7922d800a386f187c51f8a4 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 30 Apr 2009 19:24:00 -0400 Subject: kconfig: unset IKCONFIG_PROC and clean up nesting Due to cut and paste error IKCONFIG was both set and cleared. It was suppose to be IKCONFIG_PROC to be cleared. Also cleaned up if nesting. Reported-by: Alan Jenkins Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 9fa3f81b1ed..69b7c3f6a2f 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -323,7 +323,7 @@ while() { # enable IKCONFIG at least as a module print "CONFIG_IKCONFIG=m\n"; # don't ask about PROC - print "# CONFIG_IKCONFIG is not set\n"; + print "# CONFIG_IKCONFIG_PROC is not set\n"; } else { print; } @@ -333,15 +333,12 @@ while() { if (/^(CONFIG.*)=(m|y)/) { if (defined($configs{$1})) { $setconfigs{$1} = $2; - print; } elsif ($2 eq "m") { print "# $1 is not set\n"; - } else { - print; + next; } - } else { - print; } + print; } close(CIN); -- cgit v1.2.3 From 810b2be65610af13d60f1e16c0a0f93cbc1f9d06 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 30 Apr 2009 19:30:04 -0400 Subject: kconfig: test for /boot/config-uname after /proc/config.gz in localconfig Many distros put their config in /boot/config-`uname -r`, add a check for that right after /proc/config.gz Reported-by: Alan Jenkins Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 69b7c3f6a2f..46ca62d4ffa 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -53,6 +53,10 @@ my @searchconfigs = ( "file" => "/proc/config.gz", "exec" => "zcat", }, + { + "file" => "/boot/config-$uname", + "exec" => "cat", + }, { "file" => "/boot/vmlinuz-$uname", "exec" => "scripts/extract-ikconfig", -- cgit v1.2.3 From a9024838d029ecd9a6d1389bec798b7296278d6b Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 7 May 2009 11:01:34 -0400 Subject: kconfig: make local .config default for streamline_config As Andi Kleen pointed out, most people would expect that the local .config file to be based for a streamline config. This patch changes the order of searching for a config file to consider the .config in the local directory first. Reported-by: Andi Kleen Signed-off-by: Steven Rostedt --- scripts/kconfig/streamline_config.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 46ca62d4ffa..95984db8e1e 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -49,6 +49,10 @@ my $uname = `uname -r`; chomp $uname; my @searchconfigs = ( + { + "file" => ".config", + "exec" => "cat", + }, { "file" => "/proc/config.gz", "exec" => "zcat", @@ -82,10 +86,6 @@ my @searchconfigs = ( "exec" => "scripts/extract-ikconfig", "test" => "scripts/extract-ikconfig", }, - { - "file" => ".config", - "exec" => "cat", - }, ); sub find_config { -- cgit v1.2.3 From a7c02602a85a0d3f34331ff34d54de7416085985 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Thu, 7 May 2009 11:09:55 -0400 Subject: kconfig: test if a .config already exists If one were to run localmodconfig or localyesconfig without having a .config already in the file, then the end of the process would give a warning when it tries to move the old .config to .config.old. This patch adds a test to check if .config exists and avoid the moves if it does not. [ Impact: remove warning after make localmodconfig ] Signed-off-by: Steven Rostedt --- scripts/kconfig/Makefile | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 12a4d9e2cad..915a39a0329 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -31,21 +31,31 @@ silentoldconfig: $(obj)/conf localmodconfig: $(obj)/streamline_config.pl $(obj)/conf $(Q)perl $< $(Kconfig) > .tmp.config - $(Q)cmp -s .tmp.config .config || \ - (mv -f .config .config.old.1; \ - mv -f .tmp.config .config; \ - $(obj)/conf -s $(Kconfig); \ - mv -f .config.old.1 .config.old) + $(Q)if [ -f .config ]; then \ + cmp -s .tmp.config .config || \ + (mv -f .config .config.old.1; \ + mv -f .tmp.config .config; \ + $(obj)/conf -s $(Kconfig); \ + mv -f .config.old.1 .config.old) \ + else \ + mv -f .tmp.config .config; \ + $(obj)/conf -s $(Kconfig); \ + fi $(Q)rm -f .tmp.config localyesconfig: $(obj)/streamline_config.pl $(Q)perl $< $(Kconfig) > .tmp.config $(Q)sed -i s/=m/=y/ .tmp.config - $(Q)cmp -s .tmp.config .config || \ - (mv -f .config .config.old.1; \ - mv -f .tmp.config .config; \ - $(obj)/conf -s $(Kconfig); \ - mv -f .config.old.1 .config.old) + $(Q)if [ -f .config ]; then \ + cmp -s .tmp.config .config || \ + (mv -f .config .config.old.1; \ + mv -f .tmp.config .config; \ + $(obj)/conf -s $(Kconfig); \ + mv -f .config.old.1 .config.old) \ + else \ + mv -f .tmp.config .config; \ + $(obj)/conf -s $(Kconfig); \ + fi $(Q)rm -f .tmp.config # Create new linux.pot file -- cgit v1.2.3 From 48586218b6515b9bd70694e3cd8c901a6a6ee69c Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Fri, 21 Aug 2009 12:42:20 -0400 Subject: kconfig: add missing dependency of conf to localyesconfig There's a dependency missing. $ make localyesconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/docproc HOSTCC scripts/basic/hash using config: '/boot/config-2.6.27.25-78.2.56.fc9.x86_64' /bin/sh: line 8: scripts/kconfig/conf: No such file or directory make[1]: *** [localyesconfig] Error 127 make: *** [localyesconfig] Error 2 Thus the script failed to run. But the sed command that converts the '=m' to '=y' still ran. This gives us a distro config with all modules converted to built in! The missing dependency was for conf for localyesconfig. This dependency was already set for localmodconfig. Reported-by: Ingo Molnar Signed-off-by: Steven Rostedt --- scripts/kconfig/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 915a39a0329..6d69c7ccdcc 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -43,7 +43,7 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf fi $(Q)rm -f .tmp.config -localyesconfig: $(obj)/streamline_config.pl +localyesconfig: $(obj)/streamline_config.pl $(obj)/conf $(Q)perl $< $(Kconfig) > .tmp.config $(Q)sed -i s/=m/=y/ .tmp.config $(Q)if [ -f .config ]; then \ -- cgit v1.2.3 From 09d3f3f0e02c8a900d076c302c5c02227f33572d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 15 Sep 2009 17:04:38 -0700 Subject: sparc: Kill PROM console driver. Many years ago when this driver was written, it had a use, but these days it's nothing but trouble and distributions should not enable it in any situation. Pretty much every console device a sparc machine could see has a bonafide real driver, making the PROM console hack unnecessary. If any new device shows up, we should write a driver instead of depending upon this crutch to save us. We've been able to take care of this even when no chip documentation exists (sunxvr500, sunxvr2500) so there are no excuses. Signed-off-by: David S. Miller --- scripts/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Makefile b/scripts/Makefile index 9dd5b25a1d5..842dbc2d5ae 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -10,7 +10,6 @@ hostprogs-$(CONFIG_KALLSYMS) += kallsyms hostprogs-$(CONFIG_LOGO) += pnmtologo hostprogs-$(CONFIG_VT) += conmakehash -hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash hostprogs-$(CONFIG_IKCONFIG) += bin2c always := $(hostprogs-y) $(hostprogs-m) -- cgit v1.2.3 From 6423133bdee0e07d1c2f8411cb3fe676c207ba33 Mon Sep 17 00:00:00 2001 From: Johannes Weiner Date: Thu, 17 Sep 2009 19:26:53 -0700 Subject: kernel-doc: allow multi-line declaration purpose descriptions Allow the short description after symbol name and dash in a kernel-doc comment to span multiple lines, e.g. like this: /** * unmap_mapping_range - unmap the portion of all mmaps in the * specified address_space corresponding to the specified * page range in the underlying file. * @mapping: the address space containing mmaps to be unmapped. * ... */ The short description ends with a parameter description, an empty line or the end of the comment block. Signed-off-by: Johannes Weiner Signed-off-by: Randy Dunlap Signed-off-by: Linus Torvalds --- scripts/kernel-doc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/kernel-doc b/scripts/kernel-doc index b52d340d759..ea9f8a58678 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1995,6 +1995,7 @@ sub process_file($) { my $identifier; my $func; my $descr; + my $in_purpose = 0; my $initial_section_counter = $section_counter; if (defined($ENV{'SRCTREE'})) { @@ -2044,6 +2045,7 @@ sub process_file($) { $descr =~ s/\s*$//; $descr =~ s/\s+/ /; $declaration_purpose = xml_escape($descr); + $in_purpose = 1; } else { $declaration_purpose = ""; } @@ -2090,6 +2092,7 @@ sub process_file($) { } $in_doc_sect = 1; + $in_purpose = 0; $contents = $newcontents; if ($contents ne "") { while ((substr($contents, 0, 1) eq " ") || @@ -2119,11 +2122,19 @@ sub process_file($) { } elsif (/$doc_content/) { # miguel-style comment kludge, look for blank lines after # @parameter line to signify start of description - if ($1 eq "" && - ($section =~ m/^@/ || $section eq $section_context)) { - dump_section($file, $section, xml_escape($contents)); - $section = $section_default; - $contents = ""; + if ($1 eq "") { + if ($section =~ m/^@/ || $section eq $section_context) { + dump_section($file, $section, xml_escape($contents)); + $section = $section_default; + $contents = ""; + } else { + $contents .= "\n"; + } + $in_purpose = 0; + } elsif ($in_purpose == 1) { + # Continued declaration purpose + chomp($declaration_purpose); + $declaration_purpose .= " " . xml_escape($1); } else { $contents .= $1 . "\n"; } -- cgit v1.2.3 From fc5377668c3d808e1d53c4aee152c836f55c3490 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 17 Sep 2009 19:35:28 +0200 Subject: tracing: Remove markers Now that the last users of markers have migrated to the event tracer we can kill off the (now orphan) support code. Signed-off-by: Christoph Hellwig Acked-by: Mathieu Desnoyers Cc: Steven Rostedt Cc: Frederic Weisbecker LKML-Reference: <20090917173527.GA1699@lst.de> Signed-off-by: Ingo Molnar --- scripts/Makefile.modpost | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index f4053dc7b5d..8f14c81abbc 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -13,7 +13,6 @@ # 2) modpost is then used to # 3) create one .mod.c file pr. module # 4) create one Module.symvers file with CRC for all exported symbols -# 4a) [CONFIG_MARKERS] create one Module.markers file listing defined markers # 5) compile all .mod.c files # 6) final link of the module to a file @@ -59,10 +58,6 @@ include scripts/Makefile.lib kernelsymfile := $(objtree)/Module.symvers modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers -kernelmarkersfile := $(objtree)/Module.markers -modulemarkersfile := $(firstword $(KBUILD_EXTMOD))/Module.markers - -markersfile = $(if $(KBUILD_EXTMOD),$(modulemarkersfile),$(kernelmarkersfile)) # Step 1), find all modules listed in $(MODVERDIR)/ __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) @@ -85,8 +80,6 @@ modpost = scripts/mod/modpost \ $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ - $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ - $(if $(CONFIG_MARKERS),-M $(markersfile)) \ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \ $(if $(cross_build),-c) @@ -101,17 +94,12 @@ quiet_cmd_kernel-mod = MODPOST $@ cmd_kernel-mod = $(modpost) $@ vmlinux.o: FORCE - @rm -fr $(kernelmarkersfile) $(call cmd,kernel-mod) # Declare generated files as targets for modpost $(symverfile): __modpost ; $(modules:.ko=.mod.c): __modpost ; -ifdef CONFIG_MARKERS -$(markersfile): __modpost ; -endif - # Step 5), compile all *.mod.c files -- cgit v1.2.3 From 6161352142d5fed4cd753b32e5ccde66e705b14e Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Thu, 17 Sep 2009 16:11:28 +0200 Subject: tracing, perf: Convert the power tracer into an event tracer This patch converts the existing power tracer into an event tracer, so that power events (C states and frequency changes) can be tracked via "perf". This also removes the perl script that was used to demo the tracer; its functionality is being replaced entirely with timechart. Signed-off-by: Arjan van de Ven Acked-by: Peter Zijlstra Cc: Paul Mackerras Cc: Frederic Weisbecker LKML-Reference: <20090912130542.6d314860@infradead.org> Signed-off-by: Ingo Molnar --- scripts/tracing/power.pl | 108 ----------------------------------------------- 1 file changed, 108 deletions(-) delete mode 100644 scripts/tracing/power.pl (limited to 'scripts') diff --git a/scripts/tracing/power.pl b/scripts/tracing/power.pl deleted file mode 100644 index 4f729b3501e..00000000000 --- a/scripts/tracing/power.pl +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2008, Intel Corporation -# -# This file is part of the Linux kernel -# -# This program file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program in a file named COPYING; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Authors: -# Arjan van de Ven - - -# -# This script turns a cstate ftrace output into a SVG graphic that shows -# historic C-state information -# -# -# cat /sys/kernel/debug/tracing/trace | perl power.pl > out.svg -# - -my @styles; -my $base = 0; - -my @pstate_last; -my @pstate_level; - -$styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; -$styles[1] = "fill:rgb(0,255,0);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; -$styles[2] = "fill:rgb(255,0,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; -$styles[3] = "fill:rgb(255,255,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; -$styles[4] = "fill:rgb(255,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; -$styles[5] = "fill:rgb(0,255,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; -$styles[6] = "fill:rgb(0,128,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; -$styles[7] = "fill:rgb(0,255,128);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; -$styles[8] = "fill:rgb(0,25,20);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)"; - - -print " \n"; -print "\n"; - -my $scale = 30000.0; -while (<>) { - my $line = $_; - if ($line =~ /([0-9\.]+)\] CSTATE: Going to C([0-9]) on cpu ([0-9]+) for ([0-9\.]+)/) { - if ($base == 0) { - $base = $1; - } - my $time = $1 - $base; - $time = $time * $scale; - my $C = $2; - my $cpu = $3; - my $y = 400 * $cpu; - my $duration = $4 * $scale; - my $msec = int($4 * 100000)/100.0; - my $height = $C * 20; - $style = $styles[$C]; - - $y = $y + 140 - $height; - - $x2 = $time + 4; - $y2 = $y + 4; - - - print "\n"; - print "C$C $msec\n"; - } - if ($line =~ /([0-9\.]+)\] PSTATE: Going to P([0-9]) on cpu ([0-9]+)/) { - my $time = $1 - $base; - my $state = $2; - my $cpu = $3; - - if (defined($pstate_last[$cpu])) { - my $from = $pstate_last[$cpu]; - my $oldstate = $pstate_state[$cpu]; - my $duration = ($time-$from) * $scale; - - $from = $from * $scale; - my $to = $from + $duration; - my $height = 140 - ($oldstate * (140/8)); - - my $y = 400 * $cpu + 200 + $height; - my $y2 = $y+4; - my $style = $styles[8]; - - print "\n"; - print "P$oldstate (cpu $cpu)\n"; - }; - - $pstate_last[$cpu] = $time; - $pstate_state[$cpu] = $state; - } -} - - -print "\n"; -- cgit v1.2.3 From 7d3392e54653171bd13467bf37f1182e83fadd08 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Fri, 12 Jun 2009 01:02:35 +0200 Subject: trivial: remove references to non-existent include/linux/config.h Ignore drivers/staging/ since it is very likely that new drivers introduce it again. Signed-off-by: Markus Heidelberg Signed-off-by: Jiri Kosina --- scripts/basic/fixdep.c | 3 +-- scripts/mod/sumversion.c | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 72c15205bb2..f9c1e540831 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -16,8 +16,7 @@ * tells make when to remake a file. * * To use this list as-is however has the drawback that virtually - * every file in the kernel includes which then again - * includes + * every file in the kernel includes . * * If the user re-runs make *config, linux/autoconf.h will be * regenerated. make notices that and will rebuild every file which diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index aadc5223dcd..ecf9c7dc182 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -334,8 +334,6 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) deps_drivers/net/dummy.o := \ drivers/net/dummy.c \ $(wildcard include/config/net/fastroute.h) \ - include/linux/config.h \ - $(wildcard include/config/h.h) \ include/linux/module.h \ Sum all files in the same dir or subdirs. -- cgit v1.2.3 From f0a75770bde5cb5f9596bd0256d8ec3649720525 Mon Sep 17 00:00:00 2001 From: Trevor Keith Date: Fri, 24 Jul 2009 11:29:29 -0700 Subject: trivial: kbuild: remove extraneous blank line after declaration of usage() Signed-off-by: Trevor Keith Signed-off-by: Jiri Kosina --- scripts/basic/fixdep.c | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index f9c1e540831..8ab44861168 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -125,7 +125,6 @@ char *depfile; char *cmdline; void usage(void) - { fprintf(stderr, "Usage: fixdep \n"); exit(1); -- cgit v1.2.3 From f5492666a3b62344de9026a960c11888160362c9 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 21 Sep 2009 17:04:13 -0700 Subject: scripts/get_maintainer.pl: add --git-blame Julia Lawall suggested that get_maintainers.pl should have the ability to include signatories of commits that are modified by a particular patch. Vegard Nossum did something similar once. http://lkml.org/lkml/2008/5/29/449 The modified script looks the commits for all lines in the patch, and includes the "-by:" signatories for those commits. It uses the same git-min-percent, git-max-maintainers, and git-min-signatures options. git-since is ignored. It can be used independently from the --git default, so ./scripts/get_maintainers.pl --nogit --git-blame or ./scripts/get_maintainers.pl --nogit --git-blame -f is acceptable. If used with -f , all lines/commits for the file are checked. --git-blame can be slow if used with -f --git-blame does not work with -f Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 138 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 109 insertions(+), 29 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 278a45bd45a..35781e0d43e 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -13,7 +13,7 @@ use strict; my $P = $0; -my $V = '0.17'; +my $V = '0.18beta2'; use Getopt::Long qw(:config no_auto_abbrev); @@ -29,6 +29,7 @@ my $email_git_min_signatures = 1; my $email_git_max_maintainers = 5; my $email_git_min_percent = 5; my $email_git_since = "1-year-ago"; +my $email_git_blame = 0; my $output_multiline = 1; my $output_separator = ", "; my $scm = 0; @@ -68,6 +69,7 @@ if (!GetOptions( 'git-max-maintainers=i' => \$email_git_max_maintainers, 'git-min-percent=i' => \$email_git_min_percent, 'git-since=s' => \$email_git_since, + 'git-blame!' => \$email_git_blame, 'm!' => \$email_maintainer, 'n!' => \$email_usename, 'l!' => \$email_list, @@ -107,8 +109,9 @@ if ($selections == 0) { die "$P: Missing required option: email, scm, status, subsystem or web\n"; } -if ($email && ($email_maintainer + $email_list + $email_subscriber_list - + $email_git + $email_git_penguin_chiefs) == 0) { +if ($email && + ($email_maintainer + $email_list + $email_subscriber_list + + $email_git + $email_git_penguin_chiefs + $email_git_blame) == 0) { usage(); die "$P: Please select at least 1 email option\n"; } @@ -150,6 +153,7 @@ close(MAINT); ## use the filenames on the command line or find the filenames in the patchfiles my @files = (); +my @range = (); foreach my $file (@ARGV) { ##if $file is a directory and it lacks a trailing slash, add one @@ -162,13 +166,19 @@ foreach my $file (@ARGV) { push(@files, $file); } else { my $file_cnt = @files; + my $lastfile; open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; while () { if (m/^\+\+\+\s+(\S+)/) { my $filename = $1; $filename =~ s@^[^/]*/@@; $filename =~ s@\n@@; + $lastfile = $filename; push(@files, $filename); + } elsif (m/^\@\@ -(\d+),(\d+)/) { + if ($email_git_blame) { + push(@range, "$lastfile:$1:$2"); + } } } close(PATCH); @@ -226,6 +236,9 @@ foreach my $file (@files) { recent_git_signoffs($file); } + if ($email && $email_git_blame) { + git_assign_blame($file); + } } if ($email) { @@ -311,6 +324,7 @@ MAINTAINER field selection options: --git-max-maintainers => maximum maintainers to add (default: 5) --git-min-percent => minimum percentage of commits required (default: 5) --git-since => git history to use (default: 1-year-ago) + --git-blame => use git blame to find modified commits for patch or file --m => include maintainer(s) if any --n => include name 'Full Name ' --l => include list(s) if any @@ -333,13 +347,15 @@ Other options: Notes: Using "-f directory" may give unexpected results: - - Used with "--git", git signators for _all_ files in and below - directory are examined as git recurses directories. - Any specified X: (exclude) pattern matches are _not_ ignored. - Used with "--nogit", directory is used as a pattern match, - no individual file within the directory or subdirectory - is matched. + Used with "--git", git signators for _all_ files in and below + directory are examined as git recurses directories. + Any specified X: (exclude) pattern matches are _not_ ignored. + Used with "--nogit", directory is used as a pattern match, + no individual file within the directory or subdirectory + is matched. + Used with "--git-blame", does not iterate all files in directory + Using "--git-blame" is slow and may add old committers and authors + that are no longer active maintainers to the output. EOT } @@ -449,14 +465,19 @@ sub push_email_address { my ($email_address) = @_; my $email_name = ""; - if ($email_address =~ m/([^<]+)<(.*\@.*)>$/) { - $email_name = $1; - $email_address = $2; - } if ($email_maintainer) { - if ($email_usename && $email_name) { - push(@email_to, format_email($email_name, $email_address)); + if ($email_address =~ m/([^<]+)<(.*\@.*)>$/) { + $email_name = $1; + $email_address = $2; + if ($email_usename) { + push(@email_to, format_email($email_name, $email_address)); + } else { + push(@email_to, $email_address); + } + } elsif ($email_address =~ m/<(.+)>/) { + $email_address = $1; + push(@email_to, $email_address); } else { push(@email_to, $email_address); } @@ -545,20 +566,79 @@ sub recent_git_signoffs { last; } } - if ($line =~ m/(.+)<(.+)>/) { - my $git_name = $1; - my $git_addr = $2; - if ($email_usename) { - push(@email_to, format_email($git_name, $git_addr)); - } else { - push(@email_to, $git_addr); - } - } elsif ($line =~ m/<(.+)>/) { - my $git_addr = $1; - push(@email_to, $git_addr); - } else { - push(@email_to, $line); + push_email_address($line); + } +} + +sub save_commits { + my ($cmd, @commits) = @_; + my $output; + my @lines = (); + + $output = `${cmd}`; + + @lines = split("\n", $output); + foreach my $line (@lines) { + if ($line =~ m/^(\w+) /) { + push (@commits, $1); + } + } + return @commits; +} + +sub git_assign_blame { + my ($file) = @_; + + my @lines = (); + my @commits = (); + my $cmd; + my $output; + my %hash; + my $total_sign_offs; + my $count; + + if (@range) { + foreach my $file_range_diff (@range) { + next if (!($file_range_diff =~ m/(.+):(.+):(.+)/)); + my $diff_file = $1; + my $diff_start = $2; + my $diff_length = $3; + next if (!("$file" eq "$diff_file")); + $cmd = "git blame -l -L $diff_start,+$diff_length $file\n"; + @commits = save_commits($cmd, @commits); } + } else { + if (-f $file) { + $cmd = "git blame -l $file\n"; + @commits = save_commits($cmd, @commits); + } + } + + $total_sign_offs = 0; + @commits = uniq(@commits); + foreach my $commit (@commits) { + $cmd = "git log -1 ${commit}"; + $cmd .= " | grep -Ei \"^[-_ a-z]+by:.*\\\@.*\$\""; + if (!$email_git_penguin_chiefs) { + $cmd .= " | grep -Ev \"${penguin_chiefs}\""; + } + $cmd .= " | cut -f2- -d\":\""; + + $output = `${cmd}`; + $output =~ s/^\s*//gm; + @lines = split("\n", $output); + $hash{$_}++ for @lines; + $total_sign_offs += @lines; + } + + $count = 0; + foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { + my $sign_offs = $hash{$line}; + $count++; + last if ($sign_offs < $email_git_min_signatures || + $count > $email_git_max_maintainers || + $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); + push_email_address($line); } } -- cgit v1.2.3 From 1d606b4e0bf8fe45e3f88543dfce83207ae0027d Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 21 Sep 2009 17:04:14 -0700 Subject: scripts/get_maintainer.pl: add sections in pattern match depth order Before this change, matched sections were added in the order of appearance in the normally alphabetic section order of the MAINTAINERS file. For instance, finding the maintainer for drivers/scsi/wd7000.c would first find "SCSI SUBSYSTEM", then "WD7000 SCSI SUBSYSTEM", then "THE REST". before patch: $ ./scripts/get_maintainer.pl --nogit -f drivers/scsi/wd7000.c James E.J. Bottomley Miroslav Zagorac linux-scsi@vger.kernel.org linux-kernel@vger.kernel.org get_maintainer.pl now selects matched sections by longest pattern match. Longest is the number of "/"s and any specific file pattern. This changes the example output order of MAINTAINERS to whatever is selected in "WD7000 SUBSYSTEM", then "SCSI SYSTEM", then "THE REST". after patch: $ ./scripts/get_maintainer.pl --nogit -f drivers/scsi/wd7000.c Miroslav Zagorac James E.J. Bottomley linux-scsi@vger.kernel.org linux-kernel@vger.kernel.org Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 35781e0d43e..fb446e0f8bb 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -211,6 +211,7 @@ foreach my $file (@files) { if ($type eq 'X') { if (file_match_pattern($file, $value)) { $exclude = 1; + last; } } } @@ -218,18 +219,24 @@ foreach my $file (@files) { if (!$exclude) { my $tvi = 0; + my %hash; foreach my $line (@typevalue) { if ($line =~ m/^(\C):\s*(.*)/) { my $type = $1; my $value = $2; if ($type eq 'F') { if (file_match_pattern($file, $value)) { - add_categories($tvi); + my $pattern_depth = ($value =~ tr@/@@); + $pattern_depth++ if (!(substr($value,-1,1) eq "/")); + $hash{$tvi} = $pattern_depth; } } } $tvi++; } + foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { + add_categories($line); + } } if ($email && $email_git) { -- cgit v1.2.3 From 3fb55652b9f754990e286723f209ce3c07c96d69 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 21 Sep 2009 17:04:17 -0700 Subject: scripts/get_maintainer.pl: add --pattern-depth --pattern-depth is used to control how many levels of directory traversal should be performed to find maintainers. default is 0 (all directory levels). For instance: MAINTAINERS currently has multiple M: and F: entries that match net/netfilter/ipvs/ip_vs_app.c IPVS M: Wensong Zhang M: Simon Horman M: Julian Anastasov [...] F: net/netfilter/ipvs/ NETFILTER/IPTABLES/IPCHAINS [...] M: Patrick McHardy [...] F: net/netfilter/ NETWORKING [GENERAL] M: "David S. Miller" [...] F: net/ THE REST M: Linus Torvalds [...] F: */ Using this command will return all of those maintainers: (except Linus unless --git-chief-maintainers is specified) $ ./scripts/get_maintainer.pl --nogit -nol \ -f net/netfilter/ipvs/ip_vs_app.c Julian Anastasov Simon Horman Wensong Zhang Patrick McHardy David S. Miller Adding --pattern-depth=1 will match at the deepest level $ ./scripts/get_maintainer.pl --nogit -nol --pattern-depth=1 \ -f net/netfilter/ipvs/ip_vs_app.c Julian Anastasov Simon Horman Wensong Zhang Adding --pattern-depth=2 will match at the deepest level and 1 higher $ ./scripts/get_maintainer.pl --nogit -nol --pattern-depth=2 \ -f net/netfilter/ipvs/ip_vs_app.c Julian Anastasov Simon Horman Wensong Zhang Patrick McHardy and so on. Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index fb446e0f8bb..5132949500c 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -13,7 +13,7 @@ use strict; my $P = $0; -my $V = '0.18beta2'; +my $V = '0.19'; use Getopt::Long qw(:config no_auto_abbrev); @@ -37,6 +37,7 @@ my $web = 0; my $subsystem = 0; my $status = 0; my $from_filename = 0; +my $pattern_depth = 0; my $version = 0; my $help = 0; @@ -80,6 +81,7 @@ if (!GetOptions( 'status!' => \$status, 'scm!' => \$scm, 'web!' => \$web, + 'pattern-depth=i' => \$pattern_depth, 'f|file' => \$from_filename, 'v|version' => \$version, 'h|help' => \$help, @@ -226,9 +228,13 @@ foreach my $file (@files) { my $value = $2; if ($type eq 'F') { if (file_match_pattern($file, $value)) { - my $pattern_depth = ($value =~ tr@/@@); - $pattern_depth++ if (!(substr($value,-1,1) eq "/")); - $hash{$tvi} = $pattern_depth; + my $value_pd = ($value =~ tr@/@@); + my $file_pd = ($file =~ tr@/@@); + $value_pd++ if (substr($value,-1,1) ne "/"); + if ($pattern_depth == 0 || + (($file_pd - $value_pd) < $pattern_depth)) { + $hash{$tvi} = $value_pd; + } } } } @@ -345,13 +351,14 @@ Output type options: --separator [, ] => separator for multiple entries on 1 line --multiline => print 1 entry per line -Default options: - [--email --git --m --n --l --multiline] - Other options: + --pattern-depth => Number of pattern directory traversals (default: 0 (all)) --version => show version --help => show this help information +Default options: + [--email --git --m --n --l --multiline --pattern-depth=0] + Notes: Using "-f directory" may give unexpected results: Used with "--git", git signators for _all_ files in and below -- cgit v1.2.3 From 0e70e83dfd40cac47e1fc3e2f1c7b893ea0cd2f8 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 21 Sep 2009 17:04:20 -0700 Subject: scripts/get_maintainer.pl: better email routines, use perl not shell where possible Added format_email and parse_email routines to reduce inline use. Added email_address_inuse to eliminate multiple maintainer entries for the same email address, the first name encountered is used. Used internal perl equivalents of shell cmd use of grep|cut|sort|uniq Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 152 +++++++++++++++++++++++++++++----------------- 1 file changed, 96 insertions(+), 56 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 5132949500c..1200d724e73 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -13,7 +13,7 @@ use strict; my $P = $0; -my $V = '0.19'; +my $V = '0.20'; use Getopt::Long qw(:config no_auto_abbrev); @@ -258,11 +258,8 @@ if ($email) { foreach my $chief (@penguin_chief) { if ($chief =~ m/^(.*):(.*)/) { my $email_address; - if ($email_usename) { - $email_address = format_email($1, $2); - } else { - $email_address = $2; - } + + $email_address = format_email($1, $2); if ($email_git_penguin_chiefs) { push(@email_to, $email_address); } else { @@ -400,21 +397,57 @@ sub top_of_kernel_tree { return 0; } -sub format_email { - my ($name, $email) = @_; +sub parse_email { + my ($formatted_email) = @_; + + my $name = ""; + my $address = ""; + + if ($formatted_email =~ /^([^<]+)<(.*\@.*)>$/) { + $name = $1; + $address = $2; + } elsif ($formatted_email =~ /^<(.*\@.*)>$/) { + $address = $1; + } elsif ($formatted_email =~ /^(.*\@.*)$/) { + $address = $1; + } $name =~ s/^\s+|\s+$//g; $name =~ s/^\"|\"$//g; - $email =~ s/^\s+|\s+$//g; + $address =~ s/^\s+|\s+$//g; - my $formatted_email = ""; + if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars + $name =~ s/(?"; + $name = "\"$name\""; + } + + if ($email_usename) { + if ("$name" eq "") { + $formatted_email = "$address"; + } else { + $formatted_email = "$name <${address}>"; + } } else { - $formatted_email = "${name} \<${email}\>"; + $formatted_email = $address; } + return $formatted_email; } @@ -444,19 +477,18 @@ sub add_categories { } } } elsif ($ptype eq "M") { - my $p_used = 0; - if ($index >= 0) { - my $tv = $typevalue[$index - 1]; - if ($tv =~ m/^(\C):\s*(.*)/) { - if ($1 eq "P") { - if ($email_usename) { - push_email_address(format_email($2, $pvalue)); - $p_used = 1; + my ($name, $address) = parse_email($pvalue); + if ($name eq "") { + if ($index >= 0) { + my $tv = $typevalue[$index - 1]; + if ($tv =~ m/^(\C):\s*(.*)/) { + if ($1 eq "P") { + $name = $2; } } } } - if (!$p_used) { + if ($email_maintainer) { push_email_addresses($pvalue); } } elsif ($ptype eq "T") { @@ -475,26 +507,24 @@ sub add_categories { } } +sub email_address_inuse { + my ($test_address) = @_; + + foreach my $line (@email_to) { + my ($name, $address) = parse_email($line); + + return 1 if ($address eq $test_address); + } + return 0; +} + sub push_email_address { - my ($email_address) = @_; + my ($line) = @_; - my $email_name = ""; + my ($name, $address) = parse_email($line); - if ($email_maintainer) { - if ($email_address =~ m/([^<]+)<(.*\@.*)>$/) { - $email_name = $1; - $email_address = $2; - if ($email_usename) { - push(@email_to, format_email($email_name, $email_address)); - } else { - push(@email_to, $email_address); - } - } elsif ($email_address =~ m/<(.+)>/) { - $email_address = $1; - push(@email_to, $email_address); - } else { - push(@email_to, $email_address); - } + if (!email_address_inuse($address)) { + push(@email_to, format_email($name, $address)); } } @@ -535,6 +565,7 @@ sub recent_git_signoffs { my $output = ""; my $count = 0; my @lines = (); + my %hash; my $total_sign_offs; if (which("git") eq "") { @@ -548,25 +579,31 @@ sub recent_git_signoffs { } $cmd = "git log --since=${email_git_since} -- ${file}"; - $cmd .= " | grep -Ei \"^[-_ a-z]+by:.*\\\@.*\$\""; - if (!$email_git_penguin_chiefs) { - $cmd .= " | grep -Ev \"${penguin_chiefs}\""; - } - $cmd .= " | cut -f2- -d\":\""; - $cmd .= " | sort | uniq -c | sort -rn"; $output = `${cmd}`; $output =~ s/^\s*//gm; @lines = split("\n", $output); - $total_sign_offs = 0; + @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); + if (!$email_git_penguin_chiefs) { + @lines = grep(!/${penguin_chiefs}/i, @lines); + } + # cut -f2- -d":" + s/.*:\s*(.+)\s*/$1/ for (@lines); + + @lines = mailmap(@lines); + + $total_sign_offs = @lines; + @lines = sort(@lines); + # uniq -c foreach my $line (@lines) { - if ($line =~ m/([0-9]+)\s+(.*)/) { - $total_sign_offs += $1; - } else { - die("$P: Unexpected git output: ${line}\n"); - } + $hash{$line}++; + } + # sort -rn + @lines = (); + foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { + push(@lines,"$hash{$line} $line"); } foreach my $line (@lines) { @@ -579,8 +616,8 @@ sub recent_git_signoffs { $sign_offs * 100 / $total_sign_offs < $email_git_min_percent) { last; } + push_email_address($line); } - push_email_address($line); } } @@ -632,15 +669,18 @@ sub git_assign_blame { @commits = uniq(@commits); foreach my $commit (@commits) { $cmd = "git log -1 ${commit}"; - $cmd .= " | grep -Ei \"^[-_ a-z]+by:.*\\\@.*\$\""; - if (!$email_git_penguin_chiefs) { - $cmd .= " | grep -Ev \"${penguin_chiefs}\""; - } - $cmd .= " | cut -f2- -d\":\""; $output = `${cmd}`; $output =~ s/^\s*//gm; @lines = split("\n", $output); + + @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); + if (!$email_git_penguin_chiefs) { + @lines = grep(!/${penguin_chiefs}/i, @lines); + } + # cut -f2- -d":" + s/.*:\s*(.+)\s*/$1/ for (@lines); + $hash{$_}++ for @lines; $total_sign_offs += @lines; } -- cgit v1.2.3 From 8cbb3a77e1a91073fb279a495a11d5093461dfe5 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 21 Sep 2009 17:04:21 -0700 Subject: scripts/get_maintainer.pl: add .mailmap use, shell and email cleanups Add reading and using .mailmap file if it exists Convert address entries in .mailmap to first encountered address Don't terminate shell commands with \n Strip characters found after sign-offs by: name
[stripped] Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 72 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 1200d724e73..8b80b5abb86 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -152,6 +152,36 @@ while () { } close(MAINT); +my %mailmap; + +open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; +while () { + my $line = $_; + + next if ($line =~ m/^\s*#/); + next if ($line =~ m/^\s*$/); + + my ($name, $address) = parse_email($line); + $line = format_email($name, $address); + + next if ($line =~ m/^\s*$/); + + if (exists($mailmap{$name})) { + my $obj = $mailmap{$name}; + push(@$obj, $address); + } else { + my @arr = ($address); + $mailmap{$name} = \@arr; + } +} +close(MAILMAP); + +foreach my $name (sort {$mailmap{$a} <=> $mailmap{$b}} keys %mailmap) { + my $obj = $mailmap{$name}; + foreach my $address (@$obj) { + } +} + ## use the filenames on the command line or find the filenames in the patchfiles my @files = (); @@ -403,12 +433,12 @@ sub parse_email { my $name = ""; my $address = ""; - if ($formatted_email =~ /^([^<]+)<(.*\@.*)>$/) { + if ($formatted_email =~ /^([^<]+)<(.*\@.*)>.*$/) { $name = $1; $address = $2; - } elsif ($formatted_email =~ /^<(.*\@.*)>$/) { + } elsif ($formatted_email =~ /^\s*<(.*\@.*)>.*$/) { $address = $1; - } elsif ($formatted_email =~ /^(.*\@.*)$/) { + } elsif ($formatted_email =~ /^\s*(.*\@.*)$/) { $address = $1; } @@ -557,6 +587,29 @@ sub which { return ""; } +sub mailmap { + my @lines = @_; + my %hash; + + foreach my $line (@lines) { + my ($name, $address) = parse_email($line); + if (!exists($hash{$name})) { + $hash{$name} = $address; + } + if (exists($mailmap{$name})) { + my $obj = $mailmap{$name}; + foreach my $map_address (@$obj) { + if (($map_address eq $address) && + ($map_address ne $hash{$name})) { + $line = format_email($name, $hash{$name}); + } + } + } + } + + return @lines; +} + sub recent_git_signoffs { my ($file) = @_; @@ -592,9 +645,10 @@ sub recent_git_signoffs { # cut -f2- -d":" s/.*:\s*(.+)\s*/$1/ for (@lines); + $total_sign_offs = @lines; + @lines = mailmap(@lines); - $total_sign_offs = @lines; @lines = sort(@lines); # uniq -c foreach my $line (@lines) { @@ -655,12 +709,12 @@ sub git_assign_blame { my $diff_start = $2; my $diff_length = $3; next if (!("$file" eq "$diff_file")); - $cmd = "git blame -l -L $diff_start,+$diff_length $file\n"; + $cmd = "git blame -l -L $diff_start,+$diff_length $file"; @commits = save_commits($cmd, @commits); } } else { if (-f $file) { - $cmd = "git blame -l $file\n"; + $cmd = "git blame -l $file"; @commits = save_commits($cmd, @commits); } } @@ -678,11 +732,15 @@ sub git_assign_blame { if (!$email_git_penguin_chiefs) { @lines = grep(!/${penguin_chiefs}/i, @lines); } + # cut -f2- -d":" s/.*:\s*(.+)\s*/$1/ for (@lines); - $hash{$_}++ for @lines; $total_sign_offs += @lines; + + @lines = mailmap(@lines); + + $hash{$_}++ for @lines; } $count = 0; -- cgit v1.2.3 From 42498316132e89ca2835b977a7cfb32a83e97b35 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 21 Sep 2009 17:04:21 -0700 Subject: scripts/get_maintainer.pl: using --separator implies --nomultiline If a person sets a separator, it's only used if --nomultiline is set. Don't make the command line also include --nomultiline in that case. Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 8b80b5abb86..446803efe62 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -105,6 +105,10 @@ if ($#ARGV < 0) { die "$P: argument missing: patchfile or -f file please\n"; } +if ($output_separator ne ", ") { + $output_multiline = 0; +} + my $selections = $email + $scm + $status + $subsystem + $web; if ($selections == 0) { usage(); @@ -376,6 +380,7 @@ MAINTAINER field selection options: Output type options: --separator [, ] => separator for multiple entries on 1 line + using --separator also sets --nomultiline if --separator is not [, ] --multiline => print 1 entry per line Other options: -- cgit v1.2.3 From 11ecf53c97863a0609db3816d82f1d0ddf3d2bc2 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 21 Sep 2009 17:04:22 -0700 Subject: scripts/get_maintainer.pl: add --remove-duplicates Allow control over the elimination of duplicate email names and addresses --remove-duplicates will use the first email name or address presented --noremove-duplicates will emit all names and addresses --remove-duplicates is enabled by default For instance: $ ./scripts/get_maintainer.pl -f drivers/char/tty_ioctl.c Greg Kroah-Hartman Alan Cox Mike Frysinger Alexey Dobriyan linux-kernel@vger.kernel.org $ ./scripts/get_maintainer.pl -f --noremove-duplicates drivers/char/tty_ioctl.c Greg Kroah-Hartman Alan Cox Alan Cox Alan Cox Mike Frysinger Alexey Dobriyan linux-kernel@vger.kernel.org Using --remove-duplicates could eliminate multiple maintainers that share the same name but not the same email address. Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 108 +++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 53 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 446803efe62..473b6741d55 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -30,6 +30,7 @@ my $email_git_max_maintainers = 5; my $email_git_min_percent = 5; my $email_git_since = "1-year-ago"; my $email_git_blame = 0; +my $email_remove_duplicates = 1; my $output_multiline = 1; my $output_separator = ", "; my $scm = 0; @@ -71,6 +72,7 @@ if (!GetOptions( 'git-min-percent=i' => \$email_git_min_percent, 'git-since=s' => \$email_git_since, 'git-blame!' => \$email_git_blame, + 'remove-duplicates!' => \$email_remove_duplicates, 'm!' => \$email_maintainer, 'n!' => \$email_usename, 'l!' => \$email_list, @@ -158,32 +160,28 @@ close(MAINT); my %mailmap; -open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; -while () { - my $line = $_; +if ($email_remove_duplicates) { + open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; + while () { + my $line = $_; - next if ($line =~ m/^\s*#/); - next if ($line =~ m/^\s*$/); + next if ($line =~ m/^\s*#/); + next if ($line =~ m/^\s*$/); - my ($name, $address) = parse_email($line); - $line = format_email($name, $address); + my ($name, $address) = parse_email($line); + $line = format_email($name, $address); - next if ($line =~ m/^\s*$/); + next if ($line =~ m/^\s*$/); - if (exists($mailmap{$name})) { - my $obj = $mailmap{$name}; - push(@$obj, $address); - } else { - my @arr = ($address); - $mailmap{$name} = \@arr; - } -} -close(MAILMAP); - -foreach my $name (sort {$mailmap{$a} <=> $mailmap{$b}} keys %mailmap) { - my $obj = $mailmap{$name}; - foreach my $address (@$obj) { + if (exists($mailmap{$name})) { + my $obj = $mailmap{$name}; + push(@$obj, $address); + } else { + my @arr = ($address); + $mailmap{$name} = \@arr; + } } + close(MAILMAP); } ## use the filenames on the command line or find the filenames in the patchfiles @@ -373,6 +371,7 @@ MAINTAINER field selection options: --n => include name 'Full Name ' --l => include list(s) if any --s => include subscriber only list(s) if any + --remove-duplicates => minimize duplicate email names/addresses --scm => print SCM tree(s) if any --status => print status if any --subsystem => print subsystem name if any @@ -389,7 +388,7 @@ Other options: --help => show this help information Default options: - [--email --git --m --n --l --multiline --pattern-depth=0] + [--email --git --m --n --l --multiline --pattern-depth=0 --remove-duplicates] Notes: Using "-f directory" may give unexpected results: @@ -438,12 +437,12 @@ sub parse_email { my $name = ""; my $address = ""; - if ($formatted_email =~ /^([^<]+)<(.*\@.*)>.*$/) { + if ($formatted_email =~ /^([^<]+)<(.+\@.*)>.*$/) { $name = $1; $address = $2; - } elsif ($formatted_email =~ /^\s*<(.*\@.*)>.*$/) { + } elsif ($formatted_email =~ /^\s*<(.+\@\S*)>.*$/) { $address = $1; - } elsif ($formatted_email =~ /^\s*(.*\@.*)$/) { + } elsif ($formatted_email =~ /^(.+\@\S*)$/) { $address = $1; } @@ -542,14 +541,16 @@ sub add_categories { } } -sub email_address_inuse { - my ($test_address) = @_; +my %email_hash_name; +my %email_hash_address; - foreach my $line (@email_to) { - my ($name, $address) = parse_email($line); +sub email_inuse { + my ($name, $address) = @_; + + return 1 if (($name eq "") && ($address eq "")); + return 1 if (($name ne "") && exists($email_hash_name{$name})); + return 1 if (($address ne "") && exists($email_hash_address{$address})); - return 1 if ($address eq $test_address); - } return 0; } @@ -558,8 +559,12 @@ sub push_email_address { my ($name, $address) = parse_email($line); - if (!email_address_inuse($address)) { + if (!$email_remove_duplicates) { + push(@email_to, format_email($name, $address)); + } elsif (!email_inuse($name, $address)) { push(@email_to, format_email($name, $address)); + $email_hash_name{$name}++; + $email_hash_address{$address}++; } } @@ -600,6 +605,9 @@ sub mailmap { my ($name, $address) = parse_email($line); if (!exists($hash{$name})) { $hash{$name} = $address; + } elsif ($address ne $hash{$name}) { + $address = $hash{$name}; + $line = format_email($name, $address); } if (exists($mailmap{$name})) { my $obj = $mailmap{$name}; @@ -652,31 +660,23 @@ sub recent_git_signoffs { $total_sign_offs = @lines; - @lines = mailmap(@lines); + if ($email_remove_duplicates) { + @lines = mailmap(@lines); + } @lines = sort(@lines); + # uniq -c - foreach my $line (@lines) { - $hash{$line}++; - } + $hash{$_}++ for @lines; + # sort -rn - @lines = (); foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { - push(@lines,"$hash{$line} $line"); - } - - foreach my $line (@lines) { - if ($line =~ m/([0-9]+)\s+(.*)/) { - my $sign_offs = $1; - $line = $2; - $count++; - if ($sign_offs < $email_git_min_signatures || - $count > $email_git_max_maintainers || - $sign_offs * 100 / $total_sign_offs < $email_git_min_percent) { - last; - } - push_email_address($line); - } + my $sign_offs = $hash{$line}; + $count++; + last if ($sign_offs < $email_git_min_signatures || + $count > $email_git_max_maintainers || + $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); + push_email_address($line); } } @@ -743,7 +743,9 @@ sub git_assign_blame { $total_sign_offs += @lines; - @lines = mailmap(@lines); + if ($email_remove_duplicates) { + @lines = mailmap(@lines); + } $hash{$_}++ for @lines; } -- cgit v1.2.3 From b781655a6f6d15bdcc96f2cc1d56b0658f9cf0b4 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 21 Sep 2009 17:04:24 -0700 Subject: scripts/get_maintainer.pl: add maintainers in order listed in matched section Previous behavior was "bottom-up" in each section from the pattern "F:" entry that matched. Now information is entered into the various lists in the "as entered" order for each matched section. This also allows the F: entry to be put anywhere in a section, not just as the last entries in the section. And a couple of improvements: Don't alphabetically sort before outputting the matched scm, status, subsystem and web sections. Ignore content after a single email address so these entries are acceptable M: name
whatever other comment And a fix: Make an M: entry without a name again use the name from an immediately preceding P: line if it exists. Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/get_maintainer.pl | 70 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 473b6741d55..cdb44b63342 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -313,22 +313,22 @@ if ($email || $email_list) { } if ($scm) { - @scm = sort_and_uniq(@scm); + @scm = uniq(@scm); output(@scm); } if ($status) { - @status = sort_and_uniq(@status); + @status = uniq(@status); output(@status); } if ($subsystem) { - @subsystem = sort_and_uniq(@subsystem); + @subsystem = uniq(@subsystem); output(@subsystem); } if ($web) { - @web = sort_and_uniq(@web); + @web = uniq(@web); output(@web); } @@ -442,7 +442,7 @@ sub parse_email { $address = $2; } elsif ($formatted_email =~ /^\s*<(.+\@\S*)>.*$/) { $address = $1; - } elsif ($formatted_email =~ /^(.+\@\S*)$/) { + } elsif ($formatted_email =~ /^(.+\@\S*).*$/) { $address = $1; } @@ -485,12 +485,46 @@ sub format_email { return $formatted_email; } -sub add_categories { +sub find_starting_index { + + my ($index) = @_; + + while ($index > 0) { + my $tv = $typevalue[$index]; + if (!($tv =~ m/^(\C):\s*(.*)/)) { + last; + } + $index--; + } + + return $index; +} + +sub find_ending_index { my ($index) = @_; - $index = $index - 1; - while ($index >= 0) { + while ($index < @typevalue) { my $tv = $typevalue[$index]; + if (!($tv =~ m/^(\C):\s*(.*)/)) { + last; + } + $index++; + } + + return $index; +} + +sub add_categories { + my ($index) = @_; + + my $i; + my $start = find_starting_index($index); + my $end = find_ending_index($index); + + push(@subsystem, $typevalue[$start]); + + for ($i = $start + 1; $i < $end; $i++) { + my $tv = $typevalue[$i]; if ($tv =~ m/^(\C):\s*(.*)/) { my $ptype = $1; my $pvalue = $2; @@ -513,11 +547,12 @@ sub add_categories { } elsif ($ptype eq "M") { my ($name, $address) = parse_email($pvalue); if ($name eq "") { - if ($index >= 0) { - my $tv = $typevalue[$index - 1]; + if ($i > 0) { + my $tv = $typevalue[$i - 1]; if ($tv =~ m/^(\C):\s*(.*)/) { if ($1 eq "P") { $name = $2; + $pvalue = format_email($name, $address); } } } @@ -532,11 +567,6 @@ sub add_categories { } elsif ($ptype eq "S") { push(@status, $pvalue); } - - $index--; - } else { - push(@subsystem,$tv); - $index = -1; } } } @@ -559,6 +589,10 @@ sub push_email_address { my ($name, $address) = parse_email($line); + if ($address eq "") { + return 0; + } + if (!$email_remove_duplicates) { push(@email_to, format_email($name, $address)); } elsif (!email_inuse($name, $address)) { @@ -566,6 +600,8 @@ sub push_email_address { $email_hash_name{$name}++; $email_hash_address{$address}++; } + + return 1; } sub push_email_addresses { @@ -581,7 +617,9 @@ sub push_email_addresses { push_email_address($entry); } } else { - warn("Invalid MAINTAINERS address: '" . $address . "'\n"); + if (!push_email_address($address)) { + warn("Invalid MAINTAINERS address: '" . $address . "'\n"); + } } } -- cgit v1.2.3 From 463f28648586721c2191130c9b3c27589dcc11a0 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Mon, 21 Sep 2009 17:04:34 -0700 Subject: checkpatch: possible types -- else cannot start a type An else cannot start a type, it would have to be within a block after the else. This can trigger false modifier matching. Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2d5ece798c4..fd648164925 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1372,6 +1372,8 @@ sub process { # Ignore functions being called } elsif ($s =~ /^.\s*$Ident\s*\(/s) { + } elsif ($s =~ /^.\s*else\b/s) { + # declarations always start with types } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) { my $type = $1; -- cgit v1.2.3 From 113f04a836481e9ecc26e8dee8b0e4d52878a288 Mon Sep 17 00:00:00 2001 From: Daniel Walker Date: Mon, 21 Sep 2009 17:04:35 -0700 Subject: checkpatch: handle C99 comments correctly (performance issue) This fixes the sanitation process in checkpatch.pl so that it blocks out the text after a C99 style comment the same way it does with block style comments. This prevents the text from getting processed as regular code. Signed-off-by: Daniel Walker Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index fd648164925..aa009a3b5b8 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -356,6 +356,13 @@ sub sanitise_line { $off++; next; } + if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') { + $sanitise_quote = '//'; + + substr($res, $off, 2, $sanitise_quote); + $off++; + next; + } # A \ in a string means ignore the next character. if (($sanitise_quote eq "'" || $sanitise_quote eq '"') && @@ -379,6 +386,8 @@ sub sanitise_line { #print "c<$c> SQ<$sanitise_quote>\n"; if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") { substr($res, $off, 1, $;); + } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") { + substr($res, $off, 1, $;); } elsif ($off != 0 && $sanitise_quote && $c ne "\t") { substr($res, $off, 1, 'X'); } else { @@ -386,6 +395,10 @@ sub sanitise_line { } } + if ($sanitise_quote eq '//') { + $sanitise_quote = ''; + } + # The pathname on a #include may be surrounded by '<' and '>'. if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) { my $clean = 'X' x length($1); -- cgit v1.2.3 From 30dad6ebecffebddf6b9947d11e31377fa900ff3 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Mon, 21 Sep 2009 17:04:36 -0700 Subject: checkpatch: indent checks -- stop when we run out of continuation lines Ensure we terminate when there are no futher continuation lines when trying to determine relative indent of conditionals and their blocks. Reported-by: John Daiker Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index aa009a3b5b8..b6f267b7203 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1547,8 +1547,9 @@ sub process { $s =~ /^\s*#\s*?/ || $s =~ /^\s*$Ident\s*:/) { $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0; - $s =~ s/^.*?\n//; - $cond_lines++; + if ($s =~ s/^.*?\n//) { + $cond_lines++; + } } } -- cgit v1.2.3 From 77f5b10a82bbd832c99ec4b120d5645342a5b140 Mon Sep 17 00:00:00 2001 From: Hannes Eder Date: Mon, 21 Sep 2009 17:04:37 -0700 Subject: checkpatch: make -f alias --file, add --help, more verbose help message Impact: - More verbose help/usage message. - Make the option -f an alias for --file. - On -h, --help, and --version display help message and exit(0). - With no FILE(s) given, exit(1) with "no input files". - On invalid options display help/usage and exit(1). Based on a patch by Pavel Machek. Signed-off-by: Hannes Eder Acked-by: Pavel Machek Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 55 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b6f267b7203..e3c6b4922ff 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -28,6 +28,41 @@ my $mailback = 0; my $summary_file = 0; my $root; my %debug; +my $help = 0; + +sub help { + my ($exitcode) = @_; + + print << "EOM"; +Usage: $P [OPTION]... [FILE]... +Version: $V + +Options: + -q, --quiet quiet + --no-tree run without a kernel tree + --no-signoff do not check for 'Signed-off-by' line + --patch treat FILE as patchfile (default) + --emacs emacs compile window format + --terse one line per report + -f, --file treat FILE as regular source file + --subjective, --strict enable more subjective tests + --root=PATH PATH to the kernel tree root + --no-summary suppress the per-file summary + --mailback only produce a report in case of warnings/errors + --summary-file include the filename in summary + --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of + 'values', 'possible', 'type', and 'attr' (default + is all off) + --test-only=WORD report only warnings/errors containing WORD + literally + -h, --help, --version display this help and exit + +When FILE is - read standard input. +EOM + + exit($exitcode); +} + GetOptions( 'q|quiet+' => \$quiet, 'tree!' => \$tree, @@ -35,7 +70,7 @@ GetOptions( 'patch!' => \$chk_patch, 'emacs!' => \$emacs, 'terse!' => \$terse, - 'file!' => \$file, + 'f|file!' => \$file, 'subjective!' => \$check, 'strict!' => \$check, 'root=s' => \$root, @@ -45,22 +80,16 @@ GetOptions( 'debug=s' => \%debug, 'test-only=s' => \$tst_only, -) or exit; + 'h|help' => \$help, + 'version' => \$help +) or help(1); + +help(0) if ($help); my $exit = 0; if ($#ARGV < 0) { - print "usage: $P [options] patchfile\n"; - print "version: $V\n"; - print "options: -q => quiet\n"; - print " --no-tree => run without a kernel tree\n"; - print " --terse => one line per report\n"; - print " --emacs => emacs compile window format\n"; - print " --file => check a source file\n"; - print " --strict => enable more subjective tests\n"; - print " --root => path to the kernel tree root\n"; - print " --no-summary => suppress the per-file summary\n"; - print " --summary-file => include the filename in summary\n"; + print "$P: no input files\n"; exit(1); } -- cgit v1.2.3 From ea71a0a019f913bdf506103bd90140d93a2b83f0 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Mon, 21 Sep 2009 17:04:38 -0700 Subject: checkpatch: format strings should not have brackets in macros We should not recommend braces for the following: #define pr_fmt(fmt) "%s: " fmt, __func__ allow things with double quotes round them to avoid this check. Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index e3c6b4922ff..57df9069921 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2288,7 +2288,8 @@ sub process { DECLARE_PER_CPU| DEFINE_PER_CPU| __typeof__\(| - \.$Ident\s*=\s* + \.$Ident\s*=\s*| + ^\"|\"$ }x; #print "REST<$rest> dstat<$dstat>\n"; if ($rest ne '') { -- cgit v1.2.3 From fb9e9096ba94385b738a8ad6c5864b5778285957 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Mon, 21 Sep 2009 17:04:38 -0700 Subject: checkpatch: limit sN/uN matches to actual bit sizes Limit our type matcher to the s/u/le/be etc sizes that actually exist to prevent miss categorising s2 as a type. Fix up the spelling of the error also. Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 57df9069921..7fee82384ed 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -182,7 +182,7 @@ our $UTF8 = qr { }x; our $typeTypedefs = qr{(?x: - (?:__)?(?:u|s|be|le)(?:\d|\d\d)| + (?:__)?(?:u|s|be|le)(?:8|16|32|64)| atomic_t )}; @@ -1936,7 +1936,7 @@ sub process { # A unary '*' may be const } elsif ($ctx =~ /.xW/) { - ERROR("Aspace prohibited after that '$op' $at\n" . $hereptr); + ERROR("space prohibited after that '$op' $at\n" . $hereptr); } # unary ++ and unary -- are allowed no space on one side. -- cgit v1.2.3 From 0487683096decad0720dfaf80b9d28173d5f6662 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Mon, 21 Sep 2009 17:04:39 -0700 Subject: checkpatch: version 0.29 Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7fee82384ed..8b1dfd544c6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -10,7 +10,7 @@ use strict; my $P = $0; $P =~ s@.*/@@g; -my $V = '0.28'; +my $V = '0.29'; use Getopt::Long qw(:config no_auto_abbrev); -- cgit v1.2.3 From 42e41c54d61e32e8a349943607daa53205324d7f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Sep 2009 17:04:40 -0700 Subject: checkpatch: add some common Blackfin checks Add checks for Blackfin-specific issues that seem to crop up from time to time. In particular, we have helper macros to break a 32bit address into the hi/lo parts, and we want to make sure people use the csync/ssync variant that includes fun anomaly workarounds. Signed-off-by: Mike Frysinger Signed-off-by: Bryan Wu Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- scripts/checkpatch.pl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 8b1dfd544c6..87bbb8bce9b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1378,6 +1378,18 @@ sub process { WARN("adding a line without newline at end of file\n" . $herecurr); } +# Blackfin: use hi/lo macros + if ($realfile =~ m@arch/blackfin/.*\.S$@) { + if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) { + my $herevet = "$here\n" . cat_vet($line) . "\n"; + ERROR("use the LO() macro, not (... & 0xFFFF)\n" . $herevet); + } + if ($line =~ /\.[hH][[:space:]]*=.*>>[[:space:]]*16/) { + my $herevet = "$here\n" . cat_vet($line) . "\n"; + ERROR("use the HI() macro, not (... >> 16)\n" . $herevet); + } + } + # check we are in a valid source file C or perl if not then ignore this hunk next if ($realfile !~ /\.(h|c|pl)$/); @@ -1397,6 +1409,16 @@ sub process { WARN("CVS style keyword markers, these will _not_ be updated\n". $herecurr); } +# Blackfin: don't use __builtin_bfin_[cs]sync + if ($line =~ /__builtin_bfin_csync/) { + my $herevet = "$here\n" . cat_vet($line) . "\n"; + ERROR("use the CSYNC() macro in asm/blackfin.h\n" . $herevet); + } + if ($line =~ /__builtin_bfin_ssync/) { + my $herevet = "$here\n" . cat_vet($line) . "\n"; + ERROR("use the SSYNC() macro in asm/blackfin.h\n" . $herevet); + } + # Check for potential 'bare' types my ($stat, $cond, $line_nr_next, $remain_next, $off_next); if ($realcnt && $line =~ /.\s*\S/) { -- cgit v1.2.3