[PATCH 6/8] docs: kernel-doc: Move STATE_PROTO processing into its own function

2018-02-14 Thread Jonathan Corbet
Move the top-level prototype-processing code out of process_file().

Reviewed-by: Jani Nikula 
Signed-off-by: Jonathan Corbet 
---
 scripts/kernel-doc | 46 --
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a6a7bb46ea29..2deddb876156 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1965,6 +1965,32 @@ sub process_body($$) {
 }
 
 
+#
+# STATE_PROTO: reading a function/whatever prototype.
+#
+sub process_proto($$) {
+my $file = shift;
+
+if (/$doc_inline_oneline/) {
+   $section = $1;
+   $contents = $2;
+   if ($contents ne "") {
+   $contents .= "\n";
+   dump_section($file, $section, $contents);
+   $section = $section_default;
+   $contents = "";
+   }
+} elsif (/$doc_inline_start/) {
+   $state = STATE_INLINE;
+   $inline_doc_state = STATE_INLINE_NAME;
+} elsif ($decl_type eq 'function') {
+   process_proto_function($_, $file);
+} else {
+   process_proto_type($_, $file);
+}
+}
+
+
 sub process_file($) {
 my $file;
 my $func;
@@ -2031,24 +2057,8 @@ sub process_file($) {
++$warnings;
}
}
-   } elsif ($state == STATE_PROTO) {   # scanning for function '{' 
(end of prototype)
-   if (/$doc_inline_oneline/) {
-   $section = $1;
-   $contents = $2;
-   if ($contents ne "") {
-   $contents .= "\n";
-   dump_section($file, $section, $contents);
-   $section = $section_default;
-   $contents = "";
-   }
-   } elsif (/$doc_inline_start/) {
-   $state = STATE_INLINE;
-   $inline_doc_state = STATE_INLINE_NAME;
-   } elsif ($decl_type eq 'function') {
-   process_proto_function($_, $file);
-   } else {
-   process_proto_type($_, $file);
-   }
+   } elsif ($state == STATE_PROTO) {
+   process_proto($file, $_);
} elsif ($state == STATE_DOCBLOCK) {
if (/$doc_end/)
{
-- 
2.14.3



[PATCH 6/8] docs: kernel-doc: Move STATE_PROTO processing into its own function

2018-02-14 Thread Jonathan Corbet
Move the top-level prototype-processing code out of process_file().

Reviewed-by: Jani Nikula 
Signed-off-by: Jonathan Corbet 
---
 scripts/kernel-doc | 46 --
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a6a7bb46ea29..2deddb876156 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1965,6 +1965,32 @@ sub process_body($$) {
 }
 
 
+#
+# STATE_PROTO: reading a function/whatever prototype.
+#
+sub process_proto($$) {
+my $file = shift;
+
+if (/$doc_inline_oneline/) {
+   $section = $1;
+   $contents = $2;
+   if ($contents ne "") {
+   $contents .= "\n";
+   dump_section($file, $section, $contents);
+   $section = $section_default;
+   $contents = "";
+   }
+} elsif (/$doc_inline_start/) {
+   $state = STATE_INLINE;
+   $inline_doc_state = STATE_INLINE_NAME;
+} elsif ($decl_type eq 'function') {
+   process_proto_function($_, $file);
+} else {
+   process_proto_type($_, $file);
+}
+}
+
+
 sub process_file($) {
 my $file;
 my $func;
@@ -2031,24 +2057,8 @@ sub process_file($) {
++$warnings;
}
}
-   } elsif ($state == STATE_PROTO) {   # scanning for function '{' 
(end of prototype)
-   if (/$doc_inline_oneline/) {
-   $section = $1;
-   $contents = $2;
-   if ($contents ne "") {
-   $contents .= "\n";
-   dump_section($file, $section, $contents);
-   $section = $section_default;
-   $contents = "";
-   }
-   } elsif (/$doc_inline_start/) {
-   $state = STATE_INLINE;
-   $inline_doc_state = STATE_INLINE_NAME;
-   } elsif ($decl_type eq 'function') {
-   process_proto_function($_, $file);
-   } else {
-   process_proto_type($_, $file);
-   }
+   } elsif ($state == STATE_PROTO) {
+   process_proto($file, $_);
} elsif ($state == STATE_DOCBLOCK) {
if (/$doc_end/)
{
-- 
2.14.3



Re: [PATCH 6/8] docs: kernel-doc: Move STATE_PROTO processing into its own function

2018-02-09 Thread Jani Nikula
On Wed, 07 Feb 2018, Jonathan Corbet  wrote:
> Move the top-level prototype-processing code out of process_file().
>
> Signed-off-by: Jonathan Corbet 

Reviewed-by: Jani Nikula 

> ---
>  scripts/kernel-doc | 46 --
>  1 file changed, 28 insertions(+), 18 deletions(-)
>
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index a6a7bb46ea29..2deddb876156 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -1965,6 +1965,32 @@ sub process_body($$) {
>  }
>  
>  
> +#
> +# STATE_PROTO: reading a function/whatever prototype.
> +#
> +sub process_proto($$) {
> +my $file = shift;
> +
> +if (/$doc_inline_oneline/) {
> + $section = $1;
> + $contents = $2;
> + if ($contents ne "") {
> + $contents .= "\n";
> + dump_section($file, $section, $contents);
> + $section = $section_default;
> + $contents = "";
> + }
> +} elsif (/$doc_inline_start/) {
> + $state = STATE_INLINE;
> + $inline_doc_state = STATE_INLINE_NAME;
> +} elsif ($decl_type eq 'function') {
> + process_proto_function($_, $file);
> +} else {
> + process_proto_type($_, $file);
> +}
> +}
> +
> +
>  sub process_file($) {
>  my $file;
>  my $func;
> @@ -2031,24 +2057,8 @@ sub process_file($) {
>   ++$warnings;
>   }
>   }
> - } elsif ($state == STATE_PROTO) {   # scanning for function '{' 
> (end of prototype)
> - if (/$doc_inline_oneline/) {
> - $section = $1;
> - $contents = $2;
> - if ($contents ne "") {
> - $contents .= "\n";
> - dump_section($file, $section, $contents);
> - $section = $section_default;
> - $contents = "";
> - }
> - } elsif (/$doc_inline_start/) {
> - $state = STATE_INLINE;
> - $inline_doc_state = STATE_INLINE_NAME;
> - } elsif ($decl_type eq 'function') {
> - process_proto_function($_, $file);
> - } else {
> - process_proto_type($_, $file);
> - }
> + } elsif ($state == STATE_PROTO) {
> + process_proto($file, $_);
>   } elsif ($state == STATE_DOCBLOCK) {
>   if (/$doc_end/)
>   {

-- 
Jani Nikula, Intel Open Source Technology Center


Re: [PATCH 6/8] docs: kernel-doc: Move STATE_PROTO processing into its own function

2018-02-09 Thread Jani Nikula
On Wed, 07 Feb 2018, Jonathan Corbet  wrote:
> Move the top-level prototype-processing code out of process_file().
>
> Signed-off-by: Jonathan Corbet 

Reviewed-by: Jani Nikula 

> ---
>  scripts/kernel-doc | 46 --
>  1 file changed, 28 insertions(+), 18 deletions(-)
>
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index a6a7bb46ea29..2deddb876156 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -1965,6 +1965,32 @@ sub process_body($$) {
>  }
>  
>  
> +#
> +# STATE_PROTO: reading a function/whatever prototype.
> +#
> +sub process_proto($$) {
> +my $file = shift;
> +
> +if (/$doc_inline_oneline/) {
> + $section = $1;
> + $contents = $2;
> + if ($contents ne "") {
> + $contents .= "\n";
> + dump_section($file, $section, $contents);
> + $section = $section_default;
> + $contents = "";
> + }
> +} elsif (/$doc_inline_start/) {
> + $state = STATE_INLINE;
> + $inline_doc_state = STATE_INLINE_NAME;
> +} elsif ($decl_type eq 'function') {
> + process_proto_function($_, $file);
> +} else {
> + process_proto_type($_, $file);
> +}
> +}
> +
> +
>  sub process_file($) {
>  my $file;
>  my $func;
> @@ -2031,24 +2057,8 @@ sub process_file($) {
>   ++$warnings;
>   }
>   }
> - } elsif ($state == STATE_PROTO) {   # scanning for function '{' 
> (end of prototype)
> - if (/$doc_inline_oneline/) {
> - $section = $1;
> - $contents = $2;
> - if ($contents ne "") {
> - $contents .= "\n";
> - dump_section($file, $section, $contents);
> - $section = $section_default;
> - $contents = "";
> - }
> - } elsif (/$doc_inline_start/) {
> - $state = STATE_INLINE;
> - $inline_doc_state = STATE_INLINE_NAME;
> - } elsif ($decl_type eq 'function') {
> - process_proto_function($_, $file);
> - } else {
> - process_proto_type($_, $file);
> - }
> + } elsif ($state == STATE_PROTO) {
> + process_proto($file, $_);
>   } elsif ($state == STATE_DOCBLOCK) {
>   if (/$doc_end/)
>   {

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH 6/8] docs: kernel-doc: Move STATE_PROTO processing into its own function

2018-02-07 Thread Jonathan Corbet
Move the top-level prototype-processing code out of process_file().

Signed-off-by: Jonathan Corbet 
---
 scripts/kernel-doc | 46 --
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a6a7bb46ea29..2deddb876156 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1965,6 +1965,32 @@ sub process_body($$) {
 }
 
 
+#
+# STATE_PROTO: reading a function/whatever prototype.
+#
+sub process_proto($$) {
+my $file = shift;
+
+if (/$doc_inline_oneline/) {
+   $section = $1;
+   $contents = $2;
+   if ($contents ne "") {
+   $contents .= "\n";
+   dump_section($file, $section, $contents);
+   $section = $section_default;
+   $contents = "";
+   }
+} elsif (/$doc_inline_start/) {
+   $state = STATE_INLINE;
+   $inline_doc_state = STATE_INLINE_NAME;
+} elsif ($decl_type eq 'function') {
+   process_proto_function($_, $file);
+} else {
+   process_proto_type($_, $file);
+}
+}
+
+
 sub process_file($) {
 my $file;
 my $func;
@@ -2031,24 +2057,8 @@ sub process_file($) {
++$warnings;
}
}
-   } elsif ($state == STATE_PROTO) {   # scanning for function '{' 
(end of prototype)
-   if (/$doc_inline_oneline/) {
-   $section = $1;
-   $contents = $2;
-   if ($contents ne "") {
-   $contents .= "\n";
-   dump_section($file, $section, $contents);
-   $section = $section_default;
-   $contents = "";
-   }
-   } elsif (/$doc_inline_start/) {
-   $state = STATE_INLINE;
-   $inline_doc_state = STATE_INLINE_NAME;
-   } elsif ($decl_type eq 'function') {
-   process_proto_function($_, $file);
-   } else {
-   process_proto_type($_, $file);
-   }
+   } elsif ($state == STATE_PROTO) {
+   process_proto($file, $_);
} elsif ($state == STATE_DOCBLOCK) {
if (/$doc_end/)
{
-- 
2.14.3



[PATCH 6/8] docs: kernel-doc: Move STATE_PROTO processing into its own function

2018-02-07 Thread Jonathan Corbet
Move the top-level prototype-processing code out of process_file().

Signed-off-by: Jonathan Corbet 
---
 scripts/kernel-doc | 46 --
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a6a7bb46ea29..2deddb876156 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1965,6 +1965,32 @@ sub process_body($$) {
 }
 
 
+#
+# STATE_PROTO: reading a function/whatever prototype.
+#
+sub process_proto($$) {
+my $file = shift;
+
+if (/$doc_inline_oneline/) {
+   $section = $1;
+   $contents = $2;
+   if ($contents ne "") {
+   $contents .= "\n";
+   dump_section($file, $section, $contents);
+   $section = $section_default;
+   $contents = "";
+   }
+} elsif (/$doc_inline_start/) {
+   $state = STATE_INLINE;
+   $inline_doc_state = STATE_INLINE_NAME;
+} elsif ($decl_type eq 'function') {
+   process_proto_function($_, $file);
+} else {
+   process_proto_type($_, $file);
+}
+}
+
+
 sub process_file($) {
 my $file;
 my $func;
@@ -2031,24 +2057,8 @@ sub process_file($) {
++$warnings;
}
}
-   } elsif ($state == STATE_PROTO) {   # scanning for function '{' 
(end of prototype)
-   if (/$doc_inline_oneline/) {
-   $section = $1;
-   $contents = $2;
-   if ($contents ne "") {
-   $contents .= "\n";
-   dump_section($file, $section, $contents);
-   $section = $section_default;
-   $contents = "";
-   }
-   } elsif (/$doc_inline_start/) {
-   $state = STATE_INLINE;
-   $inline_doc_state = STATE_INLINE_NAME;
-   } elsif ($decl_type eq 'function') {
-   process_proto_function($_, $file);
-   } else {
-   process_proto_type($_, $file);
-   }
+   } elsif ($state == STATE_PROTO) {
+   process_proto($file, $_);
} elsif ($state == STATE_DOCBLOCK) {
if (/$doc_end/)
{
-- 
2.14.3