diff options
Diffstat (limited to 'scripts/checkpatch.pl')
| -rwxr-xr-x | scripts/checkpatch.pl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a4d74344d805..bd88f11b0953 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -1382,6 +1382,21 @@ sub process { | |||
| 1382 | ERROR("trailing whitespace\n" . $herevet); | 1382 | ERROR("trailing whitespace\n" . $herevet); |
| 1383 | } | 1383 | } |
| 1384 | 1384 | ||
| 1385 | # check for Kconfig help text having a real description | ||
| 1386 | if ($realfile =~ /Kconfig/ && | ||
| 1387 | $line =~ /\+?\s*(---)?help(---)?$/) { | ||
| 1388 | my $length = 0; | ||
| 1389 | for (my $l = $linenr; defined($lines[$l]); $l++) { | ||
| 1390 | my $f = $lines[$l]; | ||
| 1391 | $f =~ s/#.*//; | ||
| 1392 | $f =~ s/^\s+//; | ||
| 1393 | next if ($f =~ /^$/); | ||
| 1394 | last if ($f =~ /^\s*config\s/); | ||
| 1395 | $length++; | ||
| 1396 | } | ||
| 1397 | WARN("please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($length < 4); | ||
| 1398 | } | ||
| 1399 | |||
| 1385 | # check we are in a valid source file if not then ignore this hunk | 1400 | # check we are in a valid source file if not then ignore this hunk |
| 1386 | next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); | 1401 | next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/); |
| 1387 | 1402 | ||
| @@ -2586,6 +2601,11 @@ sub process { | |||
| 2586 | CHK("architecture specific defines should be avoided\n" . $herecurr); | 2601 | CHK("architecture specific defines should be avoided\n" . $herecurr); |
| 2587 | } | 2602 | } |
| 2588 | 2603 | ||
| 2604 | # Check that the storage class is at the beginning of a declaration | ||
| 2605 | if ($line =~ /\b$Storage\b/ && $line !~ /^.\s*$Storage\b/) { | ||
| 2606 | WARN("storage class should be at the beginning of the declaration\n" . $herecurr) | ||
| 2607 | } | ||
| 2608 | |||
| 2589 | # check the location of the inline attribute, that it is between | 2609 | # check the location of the inline attribute, that it is between |
| 2590 | # storage class and type. | 2610 | # storage class and type. |
| 2591 | if ($line =~ /\b$Type\s+$Inline\b/ || | 2611 | if ($line =~ /\b$Type\s+$Inline\b/ || |
| @@ -2656,6 +2676,7 @@ sub process { | |||
| 2656 | # check for semaphores used as mutexes | 2676 | # check for semaphores used as mutexes |
| 2657 | if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) { | 2677 | if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) { |
| 2658 | WARN("consider using a completion\n" . $herecurr); | 2678 | WARN("consider using a completion\n" . $herecurr); |
| 2679 | |||
| 2659 | } | 2680 | } |
| 2660 | # recommend strict_strto* over simple_strto* | 2681 | # recommend strict_strto* over simple_strto* |
| 2661 | if ($line =~ /\bsimple_(strto.*?)\s*\(/) { | 2682 | if ($line =~ /\bsimple_(strto.*?)\s*\(/) { |
| @@ -2740,6 +2761,16 @@ sub process { | |||
| 2740 | WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); | 2761 | WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); |
| 2741 | } | 2762 | } |
| 2742 | } | 2763 | } |
| 2764 | |||
| 2765 | # check for lockdep_set_novalidate_class | ||
| 2766 | if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ || | ||
| 2767 | $line =~ /__lockdep_no_validate__\s*\)/ ) { | ||
| 2768 | if ($realfile !~ m@^kernel/lockdep@ && | ||
| 2769 | $realfile !~ m@^include/linux/lockdep@ && | ||
| 2770 | $realfile !~ m@^drivers/base/core@) { | ||
| 2771 | ERROR("lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr); | ||
| 2772 | } | ||
| 2773 | } | ||
| 2743 | } | 2774 | } |
| 2744 | 2775 | ||
| 2745 | # If we have no input at all, then there is nothing to report on | 2776 | # If we have no input at all, then there is nothing to report on |
