Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[pandora-kernel.git] / scripts / kernel-doc
index 00e2129..187f5de 100755 (executable)
@@ -57,8 +57,8 @@ use strict;
 #      other functions are ignored.
 #
 #  -nofunction funcname
-#      If set, then only generate documentation for the other function(s).  All
-#      other functions are ignored. Cannot be used with -function together
+#      If set, then only generate documentation for the other function(s).
+#      Cannot be used together with -function
 #      (yes, that's a bug -- perl hackers can fix it 8))
 #
 #  c files - list of 'c' files to process
@@ -1056,7 +1056,8 @@ sub output_struct_man(%) {
            # pointer-to-function
            print ".BI \"    ".$1."\" ".$parameter." \") (".$2.")"."\"\n;\n";
        } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
-           print ".BI \"    ".$1."\" ".$parameter.$2." \""."\"\n;\n";
+           # bitfield
+           print ".BI \"    ".$1."\ \" ".$parameter.$2." \""."\"\n;\n";
        } else {
            $type =~ s/([^\*])$/$1 /;
            print ".BI \"    ".$type."\" ".$parameter." \""."\"\n;\n";
@@ -1118,7 +1119,10 @@ sub output_function_text(%) {
     my %args = %{$_[0]};
     my ($parameter, $section);
 
-    print "Function:\n\n";
+    print "Name:\n\n";
+    print $args{'function'}." - ".$args{'purpose'}."\n";
+
+    print "\nSynopsis:\n\n";
     my $start=$args{'functiontype'}." ".$args{'function'}." (";
     print $start;
     my $count = 0;
@@ -1169,6 +1173,7 @@ sub output_enum_text(%) {
     my $count;
     print "Enum:\n\n";
 
+    print "enum ".$args{'enum'}." - ".$args{'purpose'}."\n\n";
     print "enum ".$args{'enum'}." {\n";
     $count = 0;
     foreach $parameter (@{$args{'parameterlist'}}) {
@@ -1197,7 +1202,7 @@ sub output_typedef_text(%) {
     my $count;
     print "Typedef:\n\n";
 
-    print "typedef ".$args{'typedef'}."\n";
+    print "typedef ".$args{'typedef'}." - ".$args{'purpose'}."\n";
     output_section_text(@_);
 }
 
@@ -1206,7 +1211,7 @@ sub output_struct_text(%) {
     my %args = %{$_[0]};
     my ($parameter);
 
-    print $args{'type'}." ".$args{'struct'}.":\n\n";
+    print $args{'type'}." ".$args{'struct'}." - ".$args{'purpose'}."\n\n";
     print $args{'type'}." ".$args{'struct'}." {\n";
     foreach $parameter (@{$args{'parameterlist'}}) {
        if ($parameter =~ /^#/) {
@@ -1257,7 +1262,9 @@ sub output_intro_text(%) {
 }
 
 ##
-# generic output function for typedefs
+# generic output function for all types (function, struct/union, typedef, enum);
+# calls the generated, variable output_ function name based on
+# functype and output_mode
 sub output_declaration {
     no strict 'refs';
     my $name = shift;
@@ -1273,8 +1280,7 @@ sub output_declaration {
 }
 
 ##
-# generic output function - calls the right one based
-# on current output mode.
+# generic output function - calls the right one based on current output mode.
 sub output_intro {
     no strict 'refs';
     my $func = "output_intro_".$output_mode;
@@ -1513,6 +1519,10 @@ sub dump_function($$) {
     $prototype =~ s/^asmlinkage +//;
     $prototype =~ s/^inline +//;
     $prototype =~ s/^__inline__ +//;
+    $prototype =~ s/^__inline +//;
+    $prototype =~ s/^__always_inline +//;
+    $prototype =~ s/^noinline +//;
+    $prototype =~ s/__devinit +//;
     $prototype =~ s/^#define +//; #ak added
     $prototype =~ s/__attribute__ \(\([a-z,]*\)\)//;
 
@@ -1772,8 +1782,9 @@ sub process_file($) {
                $in_doc_sect = 1;
                $contents = $newcontents;
                if ($contents ne "") {
-                   if (substr($contents, 0, 1) eq " ") {
-                       $contents = substr($contents, 1);
+                   while ((substr($contents, 0, 1) eq " ") ||
+                       substr($contents, 0, 1) eq "\t") {
+                           $contents = substr($contents, 1);
                    }
                    $contents .= "\n";
                }