aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-08-16 17:09:34 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-16 17:09:34 -0400
commit300a103d1504134f8c4a7e831f995e917ea9b1e4 (patch)
tree7f94d5fff513d132bd0b57a9e3bd96c4cc80d707 /scripts
parent0a492896ac07336c98f37ad7fab4a6387b6ada78 (diff)
parentda5cabf80e2433131bf0ed8993abc0f7ea618c73 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.headersinst3
-rwxr-xr-xscripts/checkpatch.pl42
-rwxr-xr-xscripts/checksyscalls.sh1
-rw-r--r--scripts/kconfig/conf.c15
-rw-r--r--scripts/kconfig/confdata.c111
-rw-r--r--scripts/kconfig/expr.c2
-rw-r--r--scripts/kconfig/lkc.h10
-rw-r--r--scripts/kconfig/nconf.c2
-rwxr-xr-xscripts/kernel-doc2
-rw-r--r--scripts/mod/modpost.c73
-rwxr-xr-xscripts/setlocalversion2
11 files changed, 195 insertions, 68 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 0fcd83838771..f89cb87f5c01 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -3,7 +3,6 @@
3# 3#
4# header-y - list files to be installed. They are preprocessed 4# header-y - list files to be installed. They are preprocessed
5# to remove __KERNEL__ section of the file 5# to remove __KERNEL__ section of the file
6# unifdef-y - Same as header-y. Obsolete
7# objhdr-y - Same as header-y but for generated files 6# objhdr-y - Same as header-y but for generated files
8# 7#
9# ========================================================================== 8# ==========================================================================
@@ -20,7 +19,7 @@ include scripts/Kbuild.include
20 19
21install := $(INSTALL_HDR_PATH)/$(_dst) 20install := $(INSTALL_HDR_PATH)/$(_dst)
22 21
23header-y := $(sort $(header-y) $(unifdef-y)) 22header-y := $(sort $(header-y))
24subdirs := $(patsubst %/,%,$(filter %/, $(header-y))) 23subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
25header-y := $(filter-out %/, $(header-y)) 24header-y := $(filter-out %/, $(header-y))
26 25
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bd88f11b0953..2039acdf5122 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -195,7 +195,7 @@ our $typeTypedefs = qr{(?x:
195our $logFunctions = qr{(?x: 195our $logFunctions = qr{(?x:
196 printk| 196 printk|
197 pr_(debug|dbg|vdbg|devel|info|warning|err|notice|alert|crit|emerg|cont)| 197 pr_(debug|dbg|vdbg|devel|info|warning|err|notice|alert|crit|emerg|cont)|
198 dev_(printk|dbg|vdbg|info|warn|err|notice|alert|crit|emerg|WARN)| 198 (dev|netdev|netif)_(printk|dbg|vdbg|info|warn|err|notice|alert|crit|emerg|WARN)|
199 WARN| 199 WARN|
200 panic 200 panic
201)}; 201)};
@@ -224,6 +224,12 @@ our @modifierList = (
224 qr{fastcall}, 224 qr{fastcall},
225); 225);
226 226
227our $allowed_asm_includes = qr{(?x:
228 irq|
229 memory
230)};
231# memory.h: ARM has a custom one
232
227sub build_types { 233sub build_types {
228 my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; 234 my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)";
229 my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)"; 235 my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";
@@ -552,6 +558,9 @@ sub ctx_statement_block {
552 $type = ($level != 0)? '{' : ''; 558 $type = ($level != 0)? '{' : '';
553 559
554 if ($level == 0) { 560 if ($level == 0) {
561 if (substr($blk, $off + 1, 1) eq ';') {
562 $off++;
563 }
555 last; 564 last;
556 } 565 }
557 } 566 }
@@ -1403,7 +1412,8 @@ sub process {
1403#80 column limit 1412#80 column limit
1404 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ && 1413 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
1405 $rawline !~ /^.\s*\*\s*\@$Ident\s/ && 1414 $rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
1406 $line !~ /^\+\s*$logFunctions\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ && 1415 !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ ||
1416 $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) &&
1407 $length > 80) 1417 $length > 80)
1408 { 1418 {
1409 WARN("line over 80 characters\n" . $herecurr); 1419 WARN("line over 80 characters\n" . $herecurr);
@@ -1448,6 +1458,13 @@ sub process {
1448 WARN("please, no space before tabs\n" . $herevet); 1458 WARN("please, no space before tabs\n" . $herevet);
1449 } 1459 }
1450 1460
1461# check for spaces at the beginning of a line.
1462 if ($rawline =~ /^\+ / && $rawline !~ /\+ +\*/) {
1463 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1464 WARN("please, no space for starting a line, \
1465 excluding comments\n" . $herevet);
1466 }
1467
1451# check we are in a valid C source file if not then ignore this hunk 1468# check we are in a valid C source file if not then ignore this hunk
1452 next if ($realfile !~ /\.(h|c)$/); 1469 next if ($realfile !~ /\.(h|c)$/);
1453 1470
@@ -1778,9 +1795,9 @@ sub process {
1778 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); 1795 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
1779 } 1796 }
1780 1797
1781# check for external initialisers. 1798# check for global initialisers.
1782 if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) { 1799 if ($line =~ /^.$Type\s*$Ident\s*(?:\s+$Modifier)*\s*=\s*(0|NULL|false)\s*;/) {
1783 ERROR("do not initialise externals to 0 or NULL\n" . 1800 ERROR("do not initialise globals to 0 or NULL\n" .
1784 $herecurr); 1801 $herecurr);
1785 } 1802 }
1786# check for static initialisers. 1803# check for static initialisers.
@@ -2308,7 +2325,7 @@ sub process {
2308 my $checkfile = "include/linux/$file"; 2325 my $checkfile = "include/linux/$file";
2309 if (-f "$root/$checkfile" && 2326 if (-f "$root/$checkfile" &&
2310 $realfile ne $checkfile && 2327 $realfile ne $checkfile &&
2311 $1 ne 'irq') 2328 $1 !~ /$allowed_asm_includes/)
2312 { 2329 {
2313 if ($realfile =~ m{^arch/}) { 2330 if ($realfile =~ m{^arch/}) {
2314 CHK("Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr); 2331 CHK("Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
@@ -2570,6 +2587,21 @@ sub process {
2570 } 2587 }
2571 } 2588 }
2572 2589
2590# prefer usleep_range over udelay
2591 if ($line =~ /\budelay\s*\(\s*(\w+)\s*\)/) {
2592 # ignore udelay's < 10, however
2593 if (! (($1 =~ /(\d+)/) && ($1 < 10)) ) {
2594 CHK("usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $line);
2595 }
2596 }
2597
2598# warn about unexpectedly long msleep's
2599 if ($line =~ /\bmsleep\s*\((\d+)\);/) {
2600 if ($1 < 20) {
2601 WARN("msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt\n" . $line);
2602 }
2603 }
2604
2573# warn about #ifdefs in C files 2605# warn about #ifdefs in C files
2574# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { 2606# if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
2575# print "#ifdef in C files should be avoided\n"; 2607# print "#ifdef in C files should be avoided\n";
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 66ad375612f2..6bb42e72e0e5 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -183,7 +183,6 @@ cat << EOF
183#define __IGNORE_ustat /* statfs */ 183#define __IGNORE_ustat /* statfs */
184#define __IGNORE_utime /* utimes */ 184#define __IGNORE_utime /* utimes */
185#define __IGNORE_vfork /* clone */ 185#define __IGNORE_vfork /* clone */
186#define __IGNORE_wait4 /* waitid */
187 186
188/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */ 187/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
189#ifdef __NR_sync_file_range2 188#ifdef __NR_sync_file_range2
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 274f2716b03e..5b7c86ea43a1 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -108,7 +108,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
108 check_stdin(); 108 check_stdin();
109 case oldaskconfig: 109 case oldaskconfig:
110 fflush(stdout); 110 fflush(stdout);
111 fgets(line, 128, stdin); 111 xfgets(line, 128, stdin);
112 return 1; 112 return 1;
113 default: 113 default:
114 break; 114 break;
@@ -306,7 +306,7 @@ static int conf_choice(struct menu *menu)
306 check_stdin(); 306 check_stdin();
307 case oldaskconfig: 307 case oldaskconfig:
308 fflush(stdout); 308 fflush(stdout);
309 fgets(line, 128, stdin); 309 xfgets(line, 128, stdin);
310 strip(line); 310 strip(line);
311 if (line[0] == '?') { 311 if (line[0] == '?') {
312 print_help(menu); 312 print_help(menu);
@@ -644,3 +644,14 @@ int main(int ac, char **av)
644 } 644 }
645 return 0; 645 return 0;
646} 646}
647/*
648 * Helper function to facilitate fgets() by Jean Sacren.
649 */
650void xfgets(str, size, in)
651 char *str;
652 int size;
653 FILE *in;
654{
655 if (fgets(str, size, in) == NULL)
656 fprintf(stderr, "\nError in reading or end of file.\n");
657}
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index f81f263b64f2..c39327e60ea4 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -412,7 +412,7 @@ static void conf_write_string(bool headerfile, const char *name,
412 while (1) { 412 while (1) {
413 l = strcspn(str, "\"\\"); 413 l = strcspn(str, "\"\\");
414 if (l) { 414 if (l) {
415 fwrite(str, l, 1, out); 415 xfwrite(str, l, 1, out);
416 str += l; 416 str += l;
417 } 417 }
418 if (!*str) 418 if (!*str)
@@ -497,7 +497,7 @@ int conf_write_defconfig(const char *filename)
497 /* 497 /*
498 * If symbol is a choice value and equals to the 498 * If symbol is a choice value and equals to the
499 * default for a choice - skip. 499 * default for a choice - skip.
500 * But only if value equal to "y". 500 * But only if value is bool and equal to "y" .
501 */ 501 */
502 if (sym_is_choice_value(sym)) { 502 if (sym_is_choice_value(sym)) {
503 struct symbol *cs; 503 struct symbol *cs;
@@ -506,9 +506,8 @@ int conf_write_defconfig(const char *filename)
506 cs = prop_get_symbol(sym_get_choice_prop(sym)); 506 cs = prop_get_symbol(sym_get_choice_prop(sym));
507 ds = sym_choice_default(cs); 507 ds = sym_choice_default(cs);
508 if (sym == ds) { 508 if (sym == ds) {
509 if ((sym->type == S_BOOLEAN || 509 if ((sym->type == S_BOOLEAN) &&
510 sym->type == S_TRISTATE) && 510 sym_get_tristate_value(sym) == yes)
511 sym_get_tristate_value(sym) == yes)
512 goto next_menu; 511 goto next_menu;
513 } 512 }
514 } 513 }
@@ -919,13 +918,73 @@ void conf_set_changed_callback(void (*fn)(void))
919 conf_changed_callback = fn; 918 conf_changed_callback = fn;
920} 919}
921 920
921static void randomize_choice_values(struct symbol *csym)
922{
923 struct property *prop;
924 struct symbol *sym;
925 struct expr *e;
926 int cnt, def;
922 927
923void conf_set_all_new_symbols(enum conf_def_mode mode) 928 /*
929 * If choice is mod then we may have more items slected
930 * and if no then no-one.
931 * In both cases stop.
932 */
933 if (csym->curr.tri != yes)
934 return;
935
936 prop = sym_get_choice_prop(csym);
937
938 /* count entries in choice block */
939 cnt = 0;
940 expr_list_for_each_sym(prop->expr, e, sym)
941 cnt++;
942
943 /*
944 * find a random value and set it to yes,
945 * set the rest to no so we have only one set
946 */
947 def = (rand() % cnt);
948
949 cnt = 0;
950 expr_list_for_each_sym(prop->expr, e, sym) {
951 if (def == cnt++) {
952 sym->def[S_DEF_USER].tri = yes;
953 csym->def[S_DEF_USER].val = sym;
954 }
955 else {
956 sym->def[S_DEF_USER].tri = no;
957 }
958 }
959 csym->flags |= SYMBOL_DEF_USER;
960 /* clear VALID to get value calculated */
961 csym->flags &= ~(SYMBOL_VALID);
962}
963
964static void set_all_choice_values(struct symbol *csym)
924{ 965{
925 struct symbol *sym, *csym;
926 struct property *prop; 966 struct property *prop;
967 struct symbol *sym;
927 struct expr *e; 968 struct expr *e;
928 int i, cnt, def; 969
970 prop = sym_get_choice_prop(csym);
971
972 /*
973 * Set all non-assinged choice values to no
974 */
975 expr_list_for_each_sym(prop->expr, e, sym) {
976 if (!sym_has_value(sym))
977 sym->def[S_DEF_USER].tri = no;
978 }
979 csym->flags |= SYMBOL_DEF_USER;
980 /* clear VALID to get value calculated */
981 csym->flags &= ~(SYMBOL_VALID);
982}
983
984void conf_set_all_new_symbols(enum conf_def_mode mode)
985{
986 struct symbol *sym, *csym;
987 int i, cnt;
929 988
930 for_all_symbols(i, sym) { 989 for_all_symbols(i, sym) {
931 if (sym_has_value(sym)) 990 if (sym_has_value(sym))
@@ -961,8 +1020,6 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
961 1020
962 sym_clear_all_valid(); 1021 sym_clear_all_valid();
963 1022
964 if (mode != def_random)
965 return;
966 /* 1023 /*
967 * We have different type of choice blocks. 1024 * We have different type of choice blocks.
968 * If curr.tri equal to mod then we can select several 1025 * If curr.tri equal to mod then we can select several
@@ -977,35 +1034,9 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
977 continue; 1034 continue;
978 1035
979 sym_calc_value(csym); 1036 sym_calc_value(csym);
980 1037 if (mode == def_random)
981 if (csym->curr.tri != yes) 1038 randomize_choice_values(csym);
982 continue; 1039 else
983 1040 set_all_choice_values(csym);
984 prop = sym_get_choice_prop(csym);
985
986 /* count entries in choice block */
987 cnt = 0;
988 expr_list_for_each_sym(prop->expr, e, sym)
989 cnt++;
990
991 /*
992 * find a random value and set it to yes,
993 * set the rest to no so we have only one set
994 */
995 def = (rand() % cnt);
996
997 cnt = 0;
998 expr_list_for_each_sym(prop->expr, e, sym) {
999 if (def == cnt++) {
1000 sym->def[S_DEF_USER].tri = yes;
1001 csym->def[S_DEF_USER].val = sym;
1002 }
1003 else {
1004 sym->def[S_DEF_USER].tri = no;
1005 }
1006 }
1007 csym->flags |= SYMBOL_DEF_USER;
1008 /* clear VALID to get value calculated */
1009 csym->flags &= ~(SYMBOL_VALID);
1010 } 1041 }
1011} 1042}
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 8f18e37892cb..330e7c0048a8 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1087,7 +1087,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
1087 1087
1088static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) 1088static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
1089{ 1089{
1090 fwrite(str, strlen(str), 1, data); 1090 xfwrite(str, strlen(str), 1, data);
1091} 1091}
1092 1092
1093void expr_fprint(struct expr *e, FILE *out) 1093void expr_fprint(struct expr *e, FILE *out)
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 76db065ed72c..bdf71bd31412 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -72,6 +72,9 @@ void zconf_nextfile(const char *name);
72int zconf_lineno(void); 72int zconf_lineno(void);
73char *zconf_curname(void); 73char *zconf_curname(void);
74 74
75/* conf.c */
76void xfgets(char *str, int size, FILE *in);
77
75/* confdata.c */ 78/* confdata.c */
76const char *conf_get_configname(void); 79const char *conf_get_configname(void);
77const char *conf_get_autoconfig_name(void); 80const char *conf_get_autoconfig_name(void);
@@ -80,6 +83,13 @@ void sym_set_change_count(int count);
80void sym_add_change_count(int count); 83void sym_add_change_count(int count);
81void conf_set_all_new_symbols(enum conf_def_mode mode); 84void conf_set_all_new_symbols(enum conf_def_mode mode);
82 85
86/* confdata.c and expr.c */
87static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
88{
89 if (fwrite(str, len, count, out) < count)
90 fprintf(stderr, "\nError in writing or end of file.\n");
91}
92
83/* kconfig_load.c */ 93/* kconfig_load.c */
84void kconfig_load(void); 94void kconfig_load(void);
85 95
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 762caf80ce37..2ba71bcd38e6 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -676,6 +676,8 @@ static void *item_data(void)
676 struct mitem *mcur; 676 struct mitem *mcur;
677 677
678 cur = current_item(curses_menu); 678 cur = current_item(curses_menu);
679 if (!cur)
680 return NULL;
679 mcur = (struct mitem *) item_userptr(cur); 681 mcur = (struct mitem *) item_userptr(cur);
680 return mcur->usrptr; 682 return mcur->usrptr;
681 683
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index fcdfb245a575..102e1235fd5c 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1454,6 +1454,8 @@ sub dump_enum($$) {
1454 my $file = shift; 1454 my $file = shift;
1455 1455
1456 $x =~ s@/\*.*?\*/@@gos; # strip comments. 1456 $x =~ s@/\*.*?\*/@@gos; # strip comments.
1457 $x =~ s/^#\s*define\s+.*$//; # strip #define macros inside enums
1458
1457 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { 1459 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
1458 $declaration_name = $1; 1460 $declaration_name = $1;
1459 my $members = $2; 1461 my $members = $2;
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index c827309c29cf..1ec7158b6c1f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -14,6 +14,7 @@
14#define _GNU_SOURCE 14#define _GNU_SOURCE
15#include <stdio.h> 15#include <stdio.h>
16#include <ctype.h> 16#include <ctype.h>
17#include <string.h>
17#include "modpost.h" 18#include "modpost.h"
18#include "../../include/generated/autoconf.h" 19#include "../../include/generated/autoconf.h"
19#include "../../include/linux/license.h" 20#include "../../include/linux/license.h"
@@ -789,6 +790,7 @@ static const char *section_white_list[] =
789{ 790{
790 ".comment*", 791 ".comment*",
791 ".debug*", 792 ".debug*",
793 ".GCC-command-line", /* mn10300 */
792 ".mdebug*", /* alpha, score, mips etc. */ 794 ".mdebug*", /* alpha, score, mips etc. */
793 ".pdr", /* alpha, score, mips etc. */ 795 ".pdr", /* alpha, score, mips etc. */
794 ".stab*", 796 ".stab*",
@@ -1033,6 +1035,13 @@ static const struct sectioncheck *section_mismatch(
1033 * fromsec = .data* 1035 * fromsec = .data*
1034 * atsym =__param* 1036 * atsym =__param*
1035 * 1037 *
1038 * Pattern 1a:
1039 * module_param_call() ops can refer to __init set function if permissions=0
1040 * The pattern is identified by:
1041 * tosec = .init.text
1042 * fromsec = .data*
1043 * atsym = __param_ops_*
1044 *
1036 * Pattern 2: 1045 * Pattern 2:
1037 * Many drivers utilise a *driver container with references to 1046 * Many drivers utilise a *driver container with references to
1038 * add, remove, probe functions etc. 1047 * add, remove, probe functions etc.
@@ -1067,6 +1076,12 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
1067 (strncmp(fromsym, "__param", strlen("__param")) == 0)) 1076 (strncmp(fromsym, "__param", strlen("__param")) == 0))
1068 return 0; 1077 return 0;
1069 1078
1079 /* Check for pattern 1a */
1080 if (strcmp(tosec, ".init.text") == 0 &&
1081 match(fromsec, data_sections) &&
1082 (strncmp(fromsym, "__param_ops_", strlen("__param_ops_")) == 0))
1083 return 0;
1084
1070 /* Check for pattern 2 */ 1085 /* Check for pattern 2 */
1071 if (match(tosec, init_exit_sections) && 1086 if (match(tosec, init_exit_sections) &&
1072 match(fromsec, data_sections) && 1087 match(fromsec, data_sections) &&
@@ -1217,7 +1232,7 @@ static char *sec2annotation(const char *s)
1217 strcat(p, " "); 1232 strcat(p, " ");
1218 return r; /* we leak her but we do not care */ 1233 return r; /* we leak her but we do not care */
1219 } else { 1234 } else {
1220 return ""; 1235 return strdup("");
1221 } 1236 }
1222} 1237}
1223 1238
@@ -1245,6 +1260,8 @@ static void report_sec_mismatch(const char *modname,
1245{ 1260{
1246 const char *from, *from_p; 1261 const char *from, *from_p;
1247 const char *to, *to_p; 1262 const char *to, *to_p;
1263 char *prl_from;
1264 char *prl_to;
1248 1265
1249 switch (from_is_func) { 1266 switch (from_is_func) {
1250 case 0: from = "variable"; from_p = ""; break; 1267 case 0: from = "variable"; from_p = ""; break;
@@ -1268,16 +1285,21 @@ static void report_sec_mismatch(const char *modname,
1268 1285
1269 switch (mismatch->mismatch) { 1286 switch (mismatch->mismatch) {
1270 case TEXT_TO_ANY_INIT: 1287 case TEXT_TO_ANY_INIT:
1288 prl_from = sec2annotation(fromsec);
1289 prl_to = sec2annotation(tosec);
1271 fprintf(stderr, 1290 fprintf(stderr,
1272 "The function %s%s() references\n" 1291 "The function %s%s() references\n"
1273 "the %s %s%s%s.\n" 1292 "the %s %s%s%s.\n"
1274 "This is often because %s lacks a %s\n" 1293 "This is often because %s lacks a %s\n"
1275 "annotation or the annotation of %s is wrong.\n", 1294 "annotation or the annotation of %s is wrong.\n",
1276 sec2annotation(fromsec), fromsym, 1295 prl_from, fromsym,
1277 to, sec2annotation(tosec), tosym, to_p, 1296 to, prl_to, tosym, to_p,
1278 fromsym, sec2annotation(tosec), tosym); 1297 fromsym, prl_to, tosym);
1298 free(prl_from);
1299 free(prl_to);
1279 break; 1300 break;
1280 case DATA_TO_ANY_INIT: { 1301 case DATA_TO_ANY_INIT: {
1302 prl_to = sec2annotation(tosec);
1281 const char *const *s = mismatch->symbol_white_list; 1303 const char *const *s = mismatch->symbol_white_list;
1282 fprintf(stderr, 1304 fprintf(stderr,
1283 "The variable %s references\n" 1305 "The variable %s references\n"
@@ -1285,20 +1307,24 @@ static void report_sec_mismatch(const char *modname,
1285 "If the reference is valid then annotate the\n" 1307 "If the reference is valid then annotate the\n"
1286 "variable with __init* or __refdata (see linux/init.h) " 1308 "variable with __init* or __refdata (see linux/init.h) "
1287 "or name the variable:\n", 1309 "or name the variable:\n",
1288 fromsym, to, sec2annotation(tosec), tosym, to_p); 1310 fromsym, to, prl_to, tosym, to_p);
1289 while (*s) 1311 while (*s)
1290 fprintf(stderr, "%s, ", *s++); 1312 fprintf(stderr, "%s, ", *s++);
1291 fprintf(stderr, "\n"); 1313 fprintf(stderr, "\n");
1314 free(prl_to);
1292 break; 1315 break;
1293 } 1316 }
1294 case TEXT_TO_ANY_EXIT: 1317 case TEXT_TO_ANY_EXIT:
1318 prl_to = sec2annotation(tosec);
1295 fprintf(stderr, 1319 fprintf(stderr,
1296 "The function %s() references a %s in an exit section.\n" 1320 "The function %s() references a %s in an exit section.\n"
1297 "Often the %s %s%s has valid usage outside the exit section\n" 1321 "Often the %s %s%s has valid usage outside the exit section\n"
1298 "and the fix is to remove the %sannotation of %s.\n", 1322 "and the fix is to remove the %sannotation of %s.\n",
1299 fromsym, to, to, tosym, to_p, sec2annotation(tosec), tosym); 1323 fromsym, to, to, tosym, to_p, prl_to, tosym);
1324 free(prl_to);
1300 break; 1325 break;
1301 case DATA_TO_ANY_EXIT: { 1326 case DATA_TO_ANY_EXIT: {
1327 prl_to = sec2annotation(tosec);
1302 const char *const *s = mismatch->symbol_white_list; 1328 const char *const *s = mismatch->symbol_white_list;
1303 fprintf(stderr, 1329 fprintf(stderr,
1304 "The variable %s references\n" 1330 "The variable %s references\n"
@@ -1306,24 +1332,31 @@ static void report_sec_mismatch(const char *modname,
1306 "If the reference is valid then annotate the\n" 1332 "If the reference is valid then annotate the\n"
1307 "variable with __exit* (see linux/init.h) or " 1333 "variable with __exit* (see linux/init.h) or "
1308 "name the variable:\n", 1334 "name the variable:\n",
1309 fromsym, to, sec2annotation(tosec), tosym, to_p); 1335 fromsym, to, prl_to, tosym, to_p);
1310 while (*s) 1336 while (*s)
1311 fprintf(stderr, "%s, ", *s++); 1337 fprintf(stderr, "%s, ", *s++);
1312 fprintf(stderr, "\n"); 1338 fprintf(stderr, "\n");
1339 free(prl_to);
1313 break; 1340 break;
1314 } 1341 }
1315 case XXXINIT_TO_SOME_INIT: 1342 case XXXINIT_TO_SOME_INIT:
1316 case XXXEXIT_TO_SOME_EXIT: 1343 case XXXEXIT_TO_SOME_EXIT:
1344 prl_from = sec2annotation(fromsec);
1345 prl_to = sec2annotation(tosec);
1317 fprintf(stderr, 1346 fprintf(stderr,
1318 "The %s %s%s%s references\n" 1347 "The %s %s%s%s references\n"
1319 "a %s %s%s%s.\n" 1348 "a %s %s%s%s.\n"
1320 "If %s is only used by %s then\n" 1349 "If %s is only used by %s then\n"
1321 "annotate %s with a matching annotation.\n", 1350 "annotate %s with a matching annotation.\n",
1322 from, sec2annotation(fromsec), fromsym, from_p, 1351 from, prl_from, fromsym, from_p,
1323 to, sec2annotation(tosec), tosym, to_p, 1352 to, prl_to, tosym, to_p,
1324 tosym, fromsym, tosym); 1353 tosym, fromsym, tosym);
1354 free(prl_from);
1355 free(prl_to);
1325 break; 1356 break;
1326 case ANY_INIT_TO_ANY_EXIT: 1357 case ANY_INIT_TO_ANY_EXIT:
1358 prl_from = sec2annotation(fromsec);
1359 prl_to = sec2annotation(tosec);
1327 fprintf(stderr, 1360 fprintf(stderr,
1328 "The %s %s%s%s references\n" 1361 "The %s %s%s%s references\n"
1329 "a %s %s%s%s.\n" 1362 "a %s %s%s%s.\n"
@@ -1332,11 +1365,15 @@ static void report_sec_mismatch(const char *modname,
1332 "uses functionality in the exit path.\n" 1365 "uses functionality in the exit path.\n"
1333 "The fix is often to remove the %sannotation of\n" 1366 "The fix is often to remove the %sannotation of\n"
1334 "%s%s so it may be used outside an exit section.\n", 1367 "%s%s so it may be used outside an exit section.\n",
1335 from, sec2annotation(fromsec), fromsym, from_p, 1368 from, prl_from, fromsym, from_p,
1336 to, sec2annotation(tosec), tosym, to_p, 1369 to, prl_to, tosym, to_p,
1337 sec2annotation(tosec), tosym, to_p); 1370 prl_to, tosym, to_p);
1371 free(prl_from);
1372 free(prl_to);
1338 break; 1373 break;
1339 case ANY_EXIT_TO_ANY_INIT: 1374 case ANY_EXIT_TO_ANY_INIT:
1375 prl_from = sec2annotation(fromsec);
1376 prl_to = sec2annotation(tosec);
1340 fprintf(stderr, 1377 fprintf(stderr,
1341 "The %s %s%s%s references\n" 1378 "The %s %s%s%s references\n"
1342 "a %s %s%s%s.\n" 1379 "a %s %s%s%s.\n"
@@ -1345,16 +1382,20 @@ static void report_sec_mismatch(const char *modname,
1345 "uses functionality in the init path.\n" 1382 "uses functionality in the init path.\n"
1346 "The fix is often to remove the %sannotation of\n" 1383 "The fix is often to remove the %sannotation of\n"
1347 "%s%s so it may be used outside an init section.\n", 1384 "%s%s so it may be used outside an init section.\n",
1348 from, sec2annotation(fromsec), fromsym, from_p, 1385 from, prl_from, fromsym, from_p,
1349 to, sec2annotation(tosec), tosym, to_p, 1386 to, prl_to, tosym, to_p,
1350 sec2annotation(tosec), tosym, to_p); 1387 prl_to, tosym, to_p);
1388 free(prl_from);
1389 free(prl_to);
1351 break; 1390 break;
1352 case EXPORT_TO_INIT_EXIT: 1391 case EXPORT_TO_INIT_EXIT:
1392 prl_to = sec2annotation(tosec);
1353 fprintf(stderr, 1393 fprintf(stderr,
1354 "The symbol %s is exported and annotated %s\n" 1394 "The symbol %s is exported and annotated %s\n"
1355 "Fix this by removing the %sannotation of %s " 1395 "Fix this by removing the %sannotation of %s "
1356 "or drop the export.\n", 1396 "or drop the export.\n",
1357 tosym, sec2annotation(tosec), sec2annotation(tosec), tosym); 1397 tosym, prl_to, prl_to, tosym);
1398 free(prl_to);
1358 break; 1399 break;
1359 } 1400 }
1360 fprintf(stderr, "\n"); 1401 fprintf(stderr, "\n");
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 64a9cb5556cd..e90a91cc5185 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -86,7 +86,7 @@ scm_version()
86 86
87 # Check for mercurial and a mercurial repo. 87 # Check for mercurial and a mercurial repo.
88 if hgid=`hg id 2>/dev/null`; then 88 if hgid=`hg id 2>/dev/null`; then
89 tag=`printf '%s' "$hgid" | cut -d' ' -f2` 89 tag=`printf '%s' "$hgid" | cut -s -d' ' -f2`
90 90
91 # Do we have an untagged version? 91 # Do we have an untagged version?
92 if [ -z "$tag" -o "$tag" = tip ]; then 92 if [ -z "$tag" -o "$tag" = tip ]; then