ACPI / bus: Adjust ACPI subsystem initialization for new table loading mode
[cascardo/linux.git] / scripts / kernel-doc
index 27757c2..4f2e904 100755 (executable)
@@ -61,10 +61,10 @@ Output format selection (mutually exclusive):
 Output selection (mutually exclusive):
   -export              Only output documentation for symbols that have been
                        exported using EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL()
-                       in the same FILE.
+                        in any input FILE or -export-file FILE.
   -internal            Only output documentation for symbols that have NOT been
                        exported using EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL()
-                       in the same FILE.
+                        in any input FILE or -export-file FILE.
   -function NAME       Only output documentation for the given function(s)
                        or DOC: section title(s). All other functions and DOC:
                        sections are ignored. May be specified multiple times.
@@ -76,6 +76,9 @@ Output selection modifiers:
   -no-doc-sections     Do not output DOC: sections.
   -enable-lineno        Enable output of #define LINENO lines. Only works with
                         reStructuredText format.
+  -export-file FILE     Specify an additional FILE in which to look for
+                        EXPORT_SYMBOL() and EXPORT_SYMBOL_GPL(). To be used with
+                        -export or -internal. May be specified multiple times.
 
 Other parameters:
   -v                   Verbose output, more warnings and other information.
@@ -336,6 +339,8 @@ use constant {
 my $output_selection = OUTPUT_ALL;
 my $show_not_found = 0;
 
+my @export_file_list;
+
 my @build_time;
 if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) &&
     (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') {
@@ -484,10 +489,13 @@ while ($ARGV[0] =~ m/^-(.*)/) {
        $function_table{$function} = 1;
     } elsif ($cmd eq "-export") { # only exported symbols
        $output_selection = OUTPUT_EXPORTED;
-       %function_table = ()
+       %function_table = ();
     } elsif ($cmd eq "-internal") { # only non-exported symbols
        $output_selection = OUTPUT_INTERNAL;
-       %function_table = ()
+       %function_table = ();
+    } elsif ($cmd eq "-export-file") {
+       my $file = shift @ARGV;
+       push(@export_file_list, $file);
     } elsif ($cmd eq "-v") {
        $verbose = 1;
     } elsif (($cmd eq "-h") || ($cmd eq "--help")) {
@@ -529,24 +537,24 @@ sub dump_section {
     my $contents = join "\n", @_;
 
     if ($name =~ m/$type_param/) {
-#      print STDERR "parameter def '$1' = '$contents'\n";
        $name = $1;
        $parameterdescs{$name} = $contents;
        $sectcheck = $sectcheck . $name . " ";
         $parameterdesc_start_lines{$name} = $new_start_line;
         $new_start_line = 0;
     } elsif ($name eq "@\.\.\.") {
-#      print STDERR "parameter def '...' = '$contents'\n";
        $name = "...";
        $parameterdescs{$name} = $contents;
        $sectcheck = $sectcheck . $name . " ";
         $parameterdesc_start_lines{$name} = $new_start_line;
         $new_start_line = 0;
     } else {
-#      print STDERR "other section '$name' = '$contents'\n";
        if (defined($sections{$name}) && ($sections{$name} ne "")) {
-           print STDERR "${file}:$.: warning: duplicate section name '$name'\n";
-           ++$warnings;
+           # Only warn on user specified duplicate section names.
+           if ($name ne $section_default) {
+               print STDERR "${file}:$.: warning: duplicate section name '$name'\n";
+               ++$warnings;
+           }
            $sections{$name} .= $contents;
        } else {
            $sections{$name} = $contents;
@@ -1840,6 +1848,10 @@ sub output_function_rst(%) {
        }
        $count++;
        $type = $args{'parametertypes'}{$parameter};
+
+       # RST doesn't like address_space tags at function prototypes
+       $type =~ s/__(user|kernel|iomem|percpu|pmem|rcu)\s*//;
+
        if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
            # pointer-to-function
            print $1 . $parameter . ") (" . $2;
@@ -2730,41 +2742,58 @@ sub local_unescape($) {
        return $text;
 }
 
-sub process_file($) {
+sub map_filename($) {
     my $file;
-    my $identifier;
-    my $func;
-    my $descr;
-    my $in_purpose = 0;
-    my $initial_section_counter = $section_counter;
     my ($orig_file) = @_;
-    my $leading_space;
 
     if (defined($ENV{'SRCTREE'})) {
        $file = "$ENV{'SRCTREE'}" . "/" . $orig_file;
-    }
-    else {
+    } else {
        $file = $orig_file;
     }
+
     if (defined($source_map{$file})) {
        $file = $source_map{$file};
     }
 
+    return $file;
+}
+
+sub process_export_file($) {
+    my ($orig_file) = @_;
+    my $file = map_filename($orig_file);
+
     if (!open(IN,"<$file")) {
        print STDERR "Error: Cannot open file $file\n";
        ++$errors;
        return;
     }
 
-    # two passes for -export and -internal
-    if ($output_selection == OUTPUT_EXPORTED ||
-       $output_selection == OUTPUT_INTERNAL) {
-       while (<IN>) {
-           if (/$export_symbol/o) {
-               $function_table{$2} = 1;
-           }
+    while (<IN>) {
+       if (/$export_symbol/) {
+           $function_table{$2} = 1;
        }
-       seek(IN, 0, 0);
+    }
+
+    close(IN);
+}
+
+sub process_file($) {
+    my $file;
+    my $identifier;
+    my $func;
+    my $descr;
+    my $in_purpose = 0;
+    my $initial_section_counter = $section_counter;
+    my ($orig_file) = @_;
+    my $leading_space;
+
+    $file = map_filename($orig_file);
+
+    if (!open(IN,"<$file")) {
+       print STDERR "Error: Cannot open file $file\n";
+       ++$errors;
+       return;
     }
 
     $. = 1;
@@ -2969,7 +2998,7 @@ sub process_file($) {
                    }
                } elsif ($inline_doc_state == STATE_INLINE_NAME) {
                    $inline_doc_state = STATE_INLINE_ERROR;
-                   print STDERR "Warning(${file}:$.): ";
+                   print STDERR "${file}:$.: warning: ";
                    print STDERR "Incorrect use of kernel-doc format: $_";
                    ++$warnings;
                }
@@ -3072,6 +3101,17 @@ if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
        close(SOURCE_MAP);
 }
 
+if ($output_selection == OUTPUT_EXPORTED ||
+    $output_selection == OUTPUT_INTERNAL) {
+
+    push(@export_file_list, @ARGV);
+
+    foreach (@export_file_list) {
+       chomp;
+       process_export_file($_);
+    }
+}
+
 foreach (@ARGV) {
     chomp;
     process_file($_);