drivers/block/floppy.c: convert some #include <asm/ to #include <linux/
[safe/jmp/linux-2.6] / scripts / kernel-doc
index 5c58478..208ad3b 100755 (executable)
@@ -13,8 +13,6 @@ use strict;
 ## This software falls under the GNU General Public License.     ##
 ## Please read the COPYING file for more information             ##
 
-# w.o. 03-11-2000: added the '-filelist' option.
-
 # 18/01/2001 -         Cleanups
 #              Functions prototyped as foo(void) same as foo()
 #              Stop eval'ing where we don't need to.
@@ -245,7 +243,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
 # could cause "use of undefined value" or other bugs.
 my ($function, %function_table, %parametertypes, $declaration_purpose);
 my ($type, $declaration_name, $return_type);
-my ($newsection, $newcontents, $prototype, $filelist, $brcount, %source_map);
+my ($newsection, $newcontents, $prototype, $brcount, %source_map);
 
 if (defined($ENV{'KBUILD_VERBOSE'})) {
        $verbose = "$ENV{'KBUILD_VERBOSE'}";
@@ -338,8 +336,6 @@ while ($ARGV[0] =~ m/^-(.*)/) {
        $verbose = 1;
     } elsif (($cmd eq "-h") || ($cmd eq "--help")) {
        usage();
-    } elsif ($cmd eq '-filelist') {
-           $filelist = shift @ARGV;
     } elsif ($cmd eq '-no-doc-sections') {
            $no_doc_sections = 1;
     }
@@ -1426,6 +1422,8 @@ sub dump_struct($$) {
        # strip comments:
        $members =~ s/\/\*.*?\*\///gos;
        $nested =~ s/\/\*.*?\*\///gos;
+       # strip kmemcheck_bitfield_{begin,end}.*;
+       $members =~ s/kmemcheck_bitfield_.*?;//gos;
 
        create_parameterlist($members, ';', $file);
        check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested);
@@ -1651,6 +1649,15 @@ sub push_parameter($$$) {
        }
        }
 
+       # strip spaces from $param so that it is one continous string
+       # on @parameterlist;
+       # this fixes a problem where check_sections() cannot find
+       # a parameter like "addr[6 + 2]" because it actually appears
+       # as "addr[6", "+", "2]" on the parameter list;
+       # but it's better to maintain the param string unchanged for output,
+       # so just weaken the string compare in check_sections() to ignore
+       # "[blah" in a parameter string;
+       ###$param =~ s/\s*//g;
        push @parameterlist, $param;
        $parametertypes{$param} = $type;
 }
@@ -1669,6 +1676,14 @@ sub check_sections($$$$$$) {
                        $prm_clean = $prms[$px];
                        $prm_clean =~ s/\[.*\]//;
                        $prm_clean =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//;
+                       # ignore array size in a parameter string;
+                       # however, the original param string may contain
+                       # spaces, e.g.:  addr[6 + 2]
+                       # and this appears in @prms as "addr[6" since the
+                       # parameter list is split at spaces;
+                       # hence just ignore "[..." for the sections check;
+                       $prm_clean =~ s/\[.*//;
+
                        ##$prm_clean =~ s/^\**//;
                        if ($prm_clean eq $sects[$sx]) {
                                $err = 0;
@@ -1792,14 +1807,6 @@ if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
        close(SOURCE_MAP);
 }
 
-if ($filelist) {
-       open(FLIST,"<$filelist") or die "Can't open file list $filelist";
-       while(<FLIST>) {
-               chop;
-               process_file($_);
-       }
-}
-
 foreach (@ARGV) {
     chomp;
     process_file($_);
@@ -1828,6 +1835,32 @@ sub reset_state {
     $state = 0;
 }
 
+sub tracepoint_munge($) {
+       my $file = shift;
+       my $tracepointname = 0;
+       my $tracepointargs = 0;
+
+       if ($prototype =~ m/TRACE_EVENT\((.*?),/) {
+               $tracepointname = $1;
+       }
+       if ($prototype =~ m/DEFINE_SINGLE_EVENT\((.*?),/) {
+               $tracepointname = $1;
+       }
+       if ($prototype =~ m/DEFINE_EVENT\((.*?),(.*?),/) {
+               $tracepointname = $2;
+       }
+       $tracepointname =~ s/^\s+//; #strip leading whitespace
+       if ($prototype =~ m/TP_PROTO\((.*?)\)/) {
+               $tracepointargs = $1;
+       }
+       if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
+               print STDERR "Warning(${file}:$.): Unrecognized tracepoint format: \n".
+                            "$prototype\n";
+       } else {
+               $prototype = "static inline void trace_$tracepointname($tracepointargs)";
+       }
+}
+
 sub syscall_munge() {
        my $void = 0;
 
@@ -1882,6 +1915,11 @@ sub process_state3_function($$) {
        if ($prototype =~ /SYSCALL_DEFINE/) {
                syscall_munge();
        }
+       if ($prototype =~ /TRACE_EVENT/ || $prototype =~ /DEFINE_EVENT/ ||
+           $prototype =~ /DEFINE_SINGLE_EVENT/)
+       {
+               tracepoint_munge($file);
+       }
        dump_function($prototype, $file);
        reset_state();
     }
@@ -1954,6 +1992,7 @@ sub process_file($) {
     my $identifier;
     my $func;
     my $descr;
+    my $in_purpose = 0;
     my $initial_section_counter = $section_counter;
 
     if (defined($ENV{'SRCTREE'})) {
@@ -1972,6 +2011,8 @@ sub process_file($) {
        return;
     }
 
+    $. = 1;
+
     $section_counter = 0;
     while (<IN>) {
        if ($state == 0) {
@@ -2003,6 +2044,7 @@ sub process_file($) {
                    $descr =~ s/\s*$//;
                    $descr =~ s/\s+/ /;
                    $declaration_purpose = xml_escape($descr);
+                   $in_purpose = 1;
                } else {
                    $declaration_purpose = "";
                }
@@ -2049,6 +2091,7 @@ sub process_file($) {
                }
 
                $in_doc_sect = 1;
+               $in_purpose = 0;
                $contents = $newcontents;
                if ($contents ne "") {
                    while ((substr($contents, 0, 1) eq " ") ||
@@ -2078,11 +2121,19 @@ sub process_file($) {
            } elsif (/$doc_content/) {
                # miguel-style comment kludge, look for blank lines after
                # @parameter line to signify start of description
-               if ($1 eq "" &&
-                       ($section =~ m/^@/ || $section eq $section_context)) {
-                   dump_section($file, $section, xml_escape($contents));
-                   $section = $section_default;
-                   $contents = "";
+               if ($1 eq "") {
+                   if ($section =~ m/^@/ || $section eq $section_context) {
+                       dump_section($file, $section, xml_escape($contents));
+                       $section = $section_default;
+                       $contents = "";
+                   } else {
+                       $contents .= "\n";
+                   }
+                   $in_purpose = 0;
+               } elsif ($in_purpose == 1) {
+                   # Continued declaration purpose
+                   chomp($declaration_purpose);
+                   $declaration_purpose .= " " . xml_escape($1);
                } else {
                    $contents .= $1 . "\n";
                }