checkpatch: __weak is an official attribute
[pandora-kernel.git] / scripts / checkpatch.pl
index f88bb3e..c79abb4 100755 (executable)
@@ -116,7 +116,8 @@ our $Attribute      = qr{
                        __(?:mem|cpu|dev|)(?:initdata|init)|
                        ____cacheline_aligned|
                        ____cacheline_aligned_in_smp|
-                       ____cacheline_internodealigned_in_smp
+                       ____cacheline_internodealigned_in_smp|
+                       __weak
                  }x;
 our $Modifier;
 our $Inline    = qr{inline|__always_inline|noinline};
@@ -1097,8 +1098,8 @@ sub process {
                                         $rawlines[$ln - 1] =~ /^-/);
                                $cnt--;
                                #print "RAW<$rawlines[$ln - 1]>\n";
-                               ($edge) = (defined $rawlines[$ln - 1] &&
-                                       $rawlines[$ln - 1] =~ m@(/\*|\*/)@);
+                               last if (!defined $rawlines[$ln - 1]);
+                               ($edge) = ($rawlines[$ln - 1] =~ m@(/\*|\*/)@);
                                last if (defined $edge);
                        }
                        if (defined $edge && $edge eq '*/') {
@@ -1109,7 +1110,7 @@ sub process {
                        # is the start of a diff block and this line starts
                        # ' *' then it is very likely a comment.
                        if (!defined $edge &&
-                           $rawlines[$linenr] =~ m@^.\s* \*(?:\s|$)@)
+                           $rawlines[$linenr] =~ m@^.\s*(?:\*\*+| \*)(?:\s|$)@)
                        {
                                $in_comment = 1;
                        }
@@ -2167,9 +2168,10 @@ sub process {
                                MODULE_PARAM_DESC|
                                DECLARE_PER_CPU|
                                DEFINE_PER_CPU|
-                               __typeof__\(
+                               __typeof__\(|
+                               \.$Ident\s*=\s*
                        }x;
-                       #print "REST<$rest>\n";
+                       #print "REST<$rest> dstat<$dstat>\n";
                        if ($rest ne '') {
                                if ($rest !~ /while\s*\(/ &&
                                    $dstat !~ /$exceptions/)
@@ -2466,6 +2468,15 @@ sub process {
                                last;
                        }
                }
+
+# whine mightly about in_atomic
+               if ($line =~ /\bin_atomic\s*\(/) {
+                       if ($realfile =~ m@^drivers/@) {
+                               ERROR("do not use in_atomic in drivers\n" . $herecurr);
+                       } else {
+                               WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr);
+                       }
+               }
        }
 
        # If we have no input at all, then there is nothing to report on