diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/checkpatch.pl | 43 | ||||
| -rwxr-xr-x | scripts/get_maintainer.pl | 2 | ||||
| -rw-r--r-- | scripts/mod/file2alias.c | 25 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 7 |
4 files changed, 66 insertions, 11 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 9d761c95eca2..5e93342d22f9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -240,9 +240,8 @@ our $NonptrType; | |||
| 240 | our $Type; | 240 | our $Type; |
| 241 | our $Declare; | 241 | our $Declare; |
| 242 | 242 | ||
| 243 | our $UTF8 = qr { | 243 | our $NON_ASCII_UTF8 = qr{ |
| 244 | [\x09\x0A\x0D\x20-\x7E] # ASCII | 244 | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte |
| 245 | | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | ||
| 246 | | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs | 245 | | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs |
| 247 | | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte | 246 | | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte |
| 248 | | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates | 247 | | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates |
| @@ -251,6 +250,11 @@ our $UTF8 = qr { | |||
| 251 | | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 | 250 | | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 |
| 252 | }x; | 251 | }x; |
| 253 | 252 | ||
| 253 | our $UTF8 = qr{ | ||
| 254 | [\x09\x0A\x0D\x20-\x7E] # ASCII | ||
| 255 | | $NON_ASCII_UTF8 | ||
| 256 | }x; | ||
| 257 | |||
| 254 | our $typeTypedefs = qr{(?x: | 258 | our $typeTypedefs = qr{(?x: |
| 255 | (?:__)?(?:u|s|be|le)(?:8|16|32|64)| | 259 | (?:__)?(?:u|s|be|le)(?:8|16|32|64)| |
| 256 | atomic_t | 260 | atomic_t |
| @@ -1330,6 +1334,9 @@ sub process { | |||
| 1330 | my $signoff = 0; | 1334 | my $signoff = 0; |
| 1331 | my $is_patch = 0; | 1335 | my $is_patch = 0; |
| 1332 | 1336 | ||
| 1337 | my $in_header_lines = 1; | ||
| 1338 | my $in_commit_log = 0; #Scanning lines before patch | ||
| 1339 | |||
| 1333 | our @report = (); | 1340 | our @report = (); |
| 1334 | our $cnt_lines = 0; | 1341 | our $cnt_lines = 0; |
| 1335 | our $cnt_error = 0; | 1342 | our $cnt_error = 0; |
| @@ -1497,7 +1504,6 @@ sub process { | |||
| 1497 | if ($line =~ /^diff --git.*?(\S+)$/) { | 1504 | if ($line =~ /^diff --git.*?(\S+)$/) { |
| 1498 | $realfile = $1; | 1505 | $realfile = $1; |
| 1499 | $realfile =~ s@^([^/]*)/@@; | 1506 | $realfile =~ s@^([^/]*)/@@; |
| 1500 | |||
| 1501 | } elsif ($line =~ /^\+\+\+\s+(\S+)/) { | 1507 | } elsif ($line =~ /^\+\+\+\s+(\S+)/) { |
| 1502 | $realfile = $1; | 1508 | $realfile = $1; |
| 1503 | $realfile =~ s@^([^/]*)/@@; | 1509 | $realfile =~ s@^([^/]*)/@@; |
| @@ -1536,6 +1542,7 @@ sub process { | |||
| 1536 | # Check the patch for a signoff: | 1542 | # Check the patch for a signoff: |
| 1537 | if ($line =~ /^\s*signed-off-by:/i) { | 1543 | if ($line =~ /^\s*signed-off-by:/i) { |
| 1538 | $signoff++; | 1544 | $signoff++; |
| 1545 | $in_commit_log = 0; | ||
| 1539 | } | 1546 | } |
| 1540 | 1547 | ||
| 1541 | # Check signature styles | 1548 | # Check signature styles |
| @@ -1613,6 +1620,21 @@ sub process { | |||
| 1613 | "Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr); | 1620 | "Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr); |
| 1614 | } | 1621 | } |
| 1615 | 1622 | ||
| 1623 | # Check if it's the start of a commit log | ||
| 1624 | # (not a header line and we haven't seen the patch filename) | ||
| 1625 | if ($in_header_lines && $realfile =~ /^$/ && | ||
| 1626 | $rawline !~ /^(commit\b|from\b|\w+:).+$/i) { | ||
| 1627 | $in_header_lines = 0; | ||
| 1628 | $in_commit_log = 1; | ||
| 1629 | } | ||
| 1630 | |||
| 1631 | # Still not yet in a patch, check for any UTF-8 | ||
| 1632 | if ($in_commit_log && $realfile =~ /^$/ && | ||
| 1633 | $rawline =~ /$NON_ASCII_UTF8/) { | ||
| 1634 | CHK("UTF8_BEFORE_PATCH", | ||
| 1635 | "8-bit UTF-8 used in possible commit log\n" . $herecurr); | ||
| 1636 | } | ||
| 1637 | |||
| 1616 | # ignore non-hunk lines and lines being removed | 1638 | # ignore non-hunk lines and lines being removed |
| 1617 | next if (!$hunk_line || $line =~ /^-/); | 1639 | next if (!$hunk_line || $line =~ /^-/); |
| 1618 | 1640 | ||
| @@ -2574,7 +2596,8 @@ sub process { | |||
| 2574 | } else { | 2596 | } else { |
| 2575 | $cast = $cast2; | 2597 | $cast = $cast2; |
| 2576 | } | 2598 | } |
| 2577 | WARN("$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . $herecurr); | 2599 | WARN("MINMAX", |
| 2600 | "$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . $herecurr); | ||
| 2578 | } | 2601 | } |
| 2579 | } | 2602 | } |
| 2580 | 2603 | ||
| @@ -2931,11 +2954,11 @@ sub process { | |||
| 2931 | } | 2954 | } |
| 2932 | } | 2955 | } |
| 2933 | if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) { | 2956 | if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) { |
| 2934 | my $herectx = $here . "\n";; | 2957 | my $herectx = $here . "\n"; |
| 2935 | my $cnt = statement_rawlines($block); | 2958 | my $cnt = statement_rawlines($block); |
| 2936 | 2959 | ||
| 2937 | for (my $n = 0; $n < $cnt; $n++) { | 2960 | for (my $n = 0; $n < $cnt; $n++) { |
| 2938 | $herectx .= raw_line($linenr, $n) . "\n";; | 2961 | $herectx .= raw_line($linenr, $n) . "\n"; |
| 2939 | } | 2962 | } |
| 2940 | 2963 | ||
| 2941 | WARN("BRACES", | 2964 | WARN("BRACES", |
| @@ -3150,10 +3173,10 @@ sub process { | |||
| 3150 | "consider using a completion\n" . $herecurr); | 3173 | "consider using a completion\n" . $herecurr); |
| 3151 | 3174 | ||
| 3152 | } | 3175 | } |
| 3153 | # recommend kstrto* over simple_strto* | 3176 | # recommend kstrto* over simple_strto* and strict_strto* |
| 3154 | if ($line =~ /\bsimple_(strto.*?)\s*\(/) { | 3177 | if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) { |
| 3155 | WARN("CONSIDER_KSTRTO", | 3178 | WARN("CONSIDER_KSTRTO", |
| 3156 | "consider using kstrto* in preference to simple_$1\n" . $herecurr); | 3179 | "$1 is obsolete, use k$3 instead\n" . $herecurr); |
| 3157 | } | 3180 | } |
| 3158 | # check for __initcall(), use device_initcall() explicitly please | 3181 | # check for __initcall(), use device_initcall() explicitly please |
| 3159 | if ($line =~ /^.\s*__initcall\s*\(/) { | 3182 | if ($line =~ /^.\s*__initcall\s*\(/) { |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index eb2f1e64edf7..4594f3341051 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
| @@ -1389,7 +1389,7 @@ sub vcs_exists { | |||
| 1389 | warn("$P: No supported VCS found. Add --nogit to options?\n"); | 1389 | warn("$P: No supported VCS found. Add --nogit to options?\n"); |
| 1390 | warn("Using a git repository produces better results.\n"); | 1390 | warn("Using a git repository produces better results.\n"); |
| 1391 | warn("Try Linus Torvalds' latest git repository using:\n"); | 1391 | warn("Try Linus Torvalds' latest git repository using:\n"); |
| 1392 | warn("git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n"); | 1392 | warn("git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git\n"); |
| 1393 | $printed_novcs = 1; | 1393 | $printed_novcs = 1; |
| 1394 | } | 1394 | } |
| 1395 | return 0; | 1395 | return 0; |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index e26e2fb462d4..f936d1fa969d 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -735,6 +735,27 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, | |||
| 735 | return 1; | 735 | return 1; |
| 736 | } | 736 | } |
| 737 | 737 | ||
| 738 | /* | ||
| 739 | * Looks like: vmbus:guid | ||
| 740 | * Each byte of the guid will be represented by two hex characters | ||
| 741 | * in the name. | ||
| 742 | */ | ||
| 743 | |||
| 744 | static int do_vmbus_entry(const char *filename, struct hv_vmbus_device_id *id, | ||
| 745 | char *alias) | ||
| 746 | { | ||
| 747 | int i; | ||
| 748 | char guid_name[((sizeof(id->guid) + 1)) * 2]; | ||
| 749 | |||
| 750 | for (i = 0; i < (sizeof(id->guid) * 2); i += 2) | ||
| 751 | sprintf(&guid_name[i], "%02x", id->guid[i/2]); | ||
| 752 | |||
| 753 | strcpy(alias, "vmbus:"); | ||
| 754 | strcat(alias, guid_name); | ||
| 755 | |||
| 756 | return 1; | ||
| 757 | } | ||
| 758 | |||
| 738 | /* Looks like: i2c:S */ | 759 | /* Looks like: i2c:S */ |
| 739 | static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | 760 | static int do_i2c_entry(const char *filename, struct i2c_device_id *id, |
| 740 | char *alias) | 761 | char *alias) |
| @@ -994,6 +1015,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 994 | do_table(symval, sym->st_size, | 1015 | do_table(symval, sym->st_size, |
| 995 | sizeof(struct virtio_device_id), "virtio", | 1016 | sizeof(struct virtio_device_id), "virtio", |
| 996 | do_virtio_entry, mod); | 1017 | do_virtio_entry, mod); |
| 1018 | else if (sym_is(symname, "__mod_vmbus_device_table")) | ||
| 1019 | do_table(symval, sym->st_size, | ||
| 1020 | sizeof(struct hv_vmbus_device_id), "vmbus", | ||
| 1021 | do_vmbus_entry, mod); | ||
| 997 | else if (sym_is(symname, "__mod_i2c_device_table")) | 1022 | else if (sym_is(symname, "__mod_i2c_device_table")) |
| 998 | do_table(symval, sym->st_size, | 1023 | do_table(symval, sym->st_size, |
| 999 | sizeof(struct i2c_device_id), "i2c", | 1024 | sizeof(struct i2c_device_id), "i2c", |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index a509ff8f32fa..2bd594e6d1b4 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -1849,6 +1849,12 @@ static void add_header(struct buffer *b, struct module *mod) | |||
| 1849 | buf_printf(b, "};\n"); | 1849 | buf_printf(b, "};\n"); |
| 1850 | } | 1850 | } |
| 1851 | 1851 | ||
| 1852 | static void add_intree_flag(struct buffer *b, int is_intree) | ||
| 1853 | { | ||
| 1854 | if (is_intree) | ||
| 1855 | buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n"); | ||
| 1856 | } | ||
| 1857 | |||
| 1852 | static void add_staging_flag(struct buffer *b, const char *name) | 1858 | static void add_staging_flag(struct buffer *b, const char *name) |
| 1853 | { | 1859 | { |
| 1854 | static const char *staging_dir = "drivers/staging"; | 1860 | static const char *staging_dir = "drivers/staging"; |
| @@ -2169,6 +2175,7 @@ int main(int argc, char **argv) | |||
| 2169 | buf.pos = 0; | 2175 | buf.pos = 0; |
| 2170 | 2176 | ||
| 2171 | add_header(&buf, mod); | 2177 | add_header(&buf, mod); |
| 2178 | add_intree_flag(&buf, !external_module); | ||
| 2172 | add_staging_flag(&buf, mod->name); | 2179 | add_staging_flag(&buf, mod->name); |
| 2173 | err |= add_versions(&buf, mod); | 2180 | err |= add_versions(&buf, mod); |
| 2174 | add_depends(&buf, mod, modules); | 2181 | add_depends(&buf, mod, modules); |
