ubus: update to latest version, fixes lua binding issues and adds fd passing support
[openwrt.git] / scripts / checkpatch.pl
index aba59c7..5e2c0b9 100755 (executable)
@@ -353,27 +353,6 @@ sub deparenthesize {
 
 $chk_signoff = 0 if ($file);
 
-my @dep_includes = ();
-my @dep_functions = ();
-my $removal = "Documentation/feature-removal-schedule.txt";
-if ($tree && -f "$root/$removal") {
-       open(my $REMOVE, '<', "$root/$removal") ||
-                               die "$P: $removal: open failed - $!\n";
-       while (<$REMOVE>) {
-               if (/^Check:\s+(.*\S)/) {
-                       for my $entry (split(/[, ]+/, $1)) {
-                               if ($entry =~ m@include/(.*)@) {
-                                       push(@dep_includes, $1);
-
-                               } elsif ($entry !~ m@/@) {
-                                       push(@dep_functions, $entry);
-                               }
-                       }
-               }
-       }
-       close($REMOVE);
-}
-
 my @rawlines = ();
 my @lines = ();
 my $vname;
@@ -1412,24 +1391,12 @@ sub process {
        my $suppress_statement = 0;
 
        # Pre-scan the patch sanitizing the lines.
-       # Pre-scan the patch looking for any __setup documentation.
-       #
-       my @setup_docs = ();
-       my $setup_docs = 0;
-
        sanitise_line_reset();
        my $line;
        foreach my $rawline (@rawlines) {
                $linenr++;
                $line = $rawline;
 
-               if ($rawline=~/^\+\+\+\s+(\S+)/) {
-                       $setup_docs = 0;
-                       if ($1 =~ m@Documentation/kernel-parameters.txt$@) {
-                               $setup_docs = 1;
-                       }
-                       #next;
-               }
                if ($rawline=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
                        $realline=$1-1;
                        if (defined $2) {
@@ -1488,10 +1455,6 @@ sub process {
 
                #print "==>$rawline\n";
                #print "-->$line\n";
-
-               if ($setup_docs && $line =~ /^\+/) {
-                       push(@setup_docs, $line);
-               }
        }
 
        $prefix = '';
@@ -2348,11 +2311,11 @@ sub process {
                }
 
 # # no BUG() or BUG_ON()
-#              if ($line =~ /\b(BUG|BUG_ON)\b/) {
-#                      print "Try to use WARN_ON & Recovery code rather than BUG() or BUG_ON()\n";
-#                      print "$herecurr";
-#                      $clean = 0;
-#              }
+#              if ($line =~ /\b(BUG|BUG_ON)\b/) {
+#                      print "Try to use WARN_ON & Recovery code rather than BUG() or BUG_ON()\n";
+#                      print "$herecurr";
+#                      $clean = 0;
+#              }
 
                if ($line =~ /\bLINUX_VERSION_CODE\b/) {
                        WARN("LINUX_VERSION_CODE",
@@ -2619,13 +2582,13 @@ sub process {
                                            ($op eq '>' &&
                                             $ca =~ /<\S+\@\S+$/))
                                        {
-                                               $ok = 1;
+                                               $ok = 1;
                                        }
 
                                        # Ignore ?:
                                        if (($opv eq ':O' && $ca =~ /\?$/) ||
                                            ($op eq '?' && $cc =~ /^:/)) {
-                                               $ok = 1;
+                                               $ok = 1;
                                        }
 
                                        if ($ok == 0) {
@@ -2645,19 +2608,19 @@ sub process {
 
 ## # check for multiple declarations, allowing for a function declaration
 ## # continuation.
-##             if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
-##                 $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
+##             if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
+##                 $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
 ##
-##                     # Remove any bracketed sections to ensure we do not
-##                     # falsly report the parameters of functions.
-##                     my $ln = $line;
-##                     while ($ln =~ s/\([^\(\)]*\)//g) {
-##                     }
-##                     if ($ln =~ /,/) {
-##                             WARN("MULTIPLE_DECLARATION",
+##                     # Remove any bracketed sections to ensure we do not
+##                     # falsly report the parameters of functions.
+##                     my $ln = $line;
+##                     while ($ln =~ s/\([^\(\)]*\)//g) {
+##                     }
+##                     if ($ln =~ /,/) {
+##                             WARN("MULTIPLE_DECLARATION",
 ##                                  "declaring multiple variables together should be avoided\n" . $herecurr);
-##                     }
-##             }
+##                     }
+##             }
 
 #need space before brace following if, while, etc
                if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
@@ -2777,7 +2740,7 @@ sub process {
                        # conditional.
                        substr($s, 0, length($c), '');
                        $s =~ s/\n.*//g;
-                       $s =~ s/$;//g;  # Remove any comments
+                       $s =~ s/$;//g;  # Remove any comments
                        if (length($c) && $s !~ /^\s*{?\s*\\*\s*$/ &&
                            $c !~ /}\s*while\s*/)
                        {
@@ -2816,7 +2779,7 @@ sub process {
 # if and else should not have general statements after it
                if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/) {
                        my $s = $1;
-                       $s =~ s/$;//g;  # Remove any comments
+                       $s =~ s/$;//g;  # Remove any comments
                        if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) {
                                ERROR("TRAILING_STATEMENTS",
                                      "trailing statements should be on next line\n" . $herecurr);
@@ -3099,22 +3062,6 @@ sub process {
                        }
                }
 
-# don't include deprecated include files (uses RAW line)
-               for my $inc (@dep_includes) {
-                       if ($rawline =~ m@^.\s*\#\s*include\s*\<$inc>@) {
-                               ERROR("DEPRECATED_INCLUDE",
-                                     "Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n" . $herecurr);
-                       }
-               }
-
-# don't use deprecated functions
-               for my $func (@dep_functions) {
-                       if ($line =~ /\b$func\b/) {
-                               ERROR("DEPRECATED_FUNCTION",
-                                     "Don't use $func(): see Documentation/feature-removal-schedule.txt\n" . $herecurr);
-                       }
-               }
-
 # no volatiles please
                my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
                if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
@@ -3326,16 +3273,6 @@ sub process {
                             "externs should be avoided in .c files\n" .  $herecurr);
                }
 
-# checks for new __setup's
-               if ($rawline =~ /\b__setup\("([^"]*)"/) {
-                       my $name = $1;
-
-                       if (!grep(/$name/, @setup_docs)) {
-                               CHK("UNDOCUMENTED_SETUP",
-                                   "__setup appears un-documented -- check Documentation/kernel-parameters.txt\n" . $herecurr);
-                       }
-               }
-
 # check for pointless casting of kmalloc return
                if ($line =~ /\*\s*\)\s*[kv][czm]alloc(_node){0,1}\b/) {
                        WARN("UNNECESSARY_CASTS",