public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check
@ 2023-11-06 12:50 Nico Boehr
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 01/10] make: add target to check kernel-doc comments Nico Boehr
                   ` (10 more replies)
  0 siblings, 11 replies; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:50 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

It is important that we have a consistent formatting of our source code and
comments in kvm-unit-tests.

Yet, it's not always easy since tiny formatting mistakes are hard to spot
for reviewers. Respinning patches because of these issues can also be
frustrating for contributors.

This series is a RFC suggestion on how the situation could be improved
for kvm-unit-tests.

It adds a clang-format file, mostly based on the one already present in the
kernel. A new "make format" target makes it easy to properly format the
source. If maintainers want, they could even re-format the source code of
ther arch to ensure a consistent code formatting, but this is entirely
optional. I am also happy to move the "make format" into arch-specific code
if requested.

Additionally, I noticed that there is quite inconsistent use of kernel-doc
comments in the code. Add a respective check command and fix the existing
issues.

Nico Boehr (10):
  make: add target to check kernel-doc comments
  powerpc: properly format non-kernel-doc comments
  lib: s390x: cpacf: move kernel-doc comment to correct function
  s390x: properly format non-kernel-doc comments
  s390x: ensure kernel-doc parameters are properly formated
  x86: properly format non-kernel-doc comments
  s390x: cpumodel: list tcg_fail explicitly
  s390x: gs: turn off formatter for inline assembly
  add clang-format configuration file
  add make format

 .clang-format         |  689 +++++++++++
 Makefile              |    6 +
 lib/s390x/asm/cpacf.h |   20 +-
 lib/s390x/interrupt.c |    6 +-
 powerpc/emulator.c    |    2 +-
 powerpc/spapr_hcall.c |    6 +-
 powerpc/spapr_vpa.c   |    4 +-
 s390x/cpumodel.c      |   38 +-
 s390x/gs.c            |   44 +-
 s390x/sclp.c          |   32 +-
 scripts/kernel-doc    | 2526 +++++++++++++++++++++++++++++++++++++++++
 x86/msr.c             |    2 +-
 12 files changed, 3299 insertions(+), 76 deletions(-)
 create mode 100644 .clang-format
 create mode 100755 scripts/kernel-doc

-- 
2.41.0


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 01/10] make: add target to check kernel-doc comments
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
@ 2023-11-06 12:50 ` Nico Boehr
  2023-11-22 12:27   ` Thomas Huth
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments Nico Boehr
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:50 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

When we have a kernel-doc comment, it should be properly formatted.
Since this is a task that can be easily automated, add a new target
which checks all comments for proper kernel-doc formatting.

The kernel-doc script is copied as-is from the Linux kernel.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 Makefile           |    3 +
 scripts/kernel-doc | 2526 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 2529 insertions(+)
 create mode 100755 scripts/kernel-doc

diff --git a/Makefile b/Makefile
index 101c02803228..602910dda11b 100644
--- a/Makefile
+++ b/Makefile
@@ -144,3 +144,6 @@ cscope:
 .PHONY: tags
 tags:
 	ctags -R
+
+check-kerneldoc:
+	find . -name '*.[ch]' -exec scripts/kernel-doc -none {} +
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
new file mode 100755
index 000000000000..6e199a745ccb
--- /dev/null
+++ b/scripts/kernel-doc
@@ -0,0 +1,2526 @@
+#!/usr/bin/env perl
+# SPDX-License-Identifier: GPL-2.0
+
+use warnings;
+use strict;
+
+## Copyright (c) 1998 Michael Zucchi, All Rights Reserved        ##
+## Copyright (C) 2000, 1  Tim Waugh <twaugh@redhat.com>          ##
+## Copyright (C) 2001  Simon Huggins                             ##
+## Copyright (C) 2005-2012  Randy Dunlap                         ##
+## Copyright (C) 2012  Dan Luedtke                               ##
+## 								 ##
+## #define enhancements by Armin Kuster <akuster@mvista.com>	 ##
+## Copyright (c) 2000 MontaVista Software, Inc.			 ##
+#
+# Copyright (C) 2022 Tomasz Warniełło (POD)
+
+use Pod::Usage qw/pod2usage/;
+
+=head1 NAME
+
+kernel-doc - Print formatted kernel documentation to stdout
+
+=head1 SYNOPSIS
+
+ kernel-doc [-h] [-v] [-Werror] [-Wall] [-Wreturn] [-Wshort-description] [-Wcontents-before-sections]
+   [ -man |
+     -rst [-sphinx-version VERSION] [-enable-lineno] |
+     -none
+   ]
+   [
+     -export |
+     -internal |
+     [-function NAME] ... |
+     [-nosymbol NAME] ...
+   ]
+   [-no-doc-sections]
+   [-export-file FILE] ...
+   FILE ...
+
+Run `kernel-doc -h` for details.
+
+=head1 DESCRIPTION
+
+Read C language source or header FILEs, extract embedded documentation comments,
+and print formatted documentation to standard output.
+
+The documentation comments are identified by the "/**" opening comment mark.
+
+See Documentation/doc-guide/kernel-doc.rst for the documentation comment syntax.
+
+=cut
+
+# more perldoc at the end of the file
+
+## init lots of data
+
+my $errors = 0;
+my $warnings = 0;
+my $anon_struct_union = 0;
+
+# match expressions used to find embedded type information
+my $type_constant = '\b``([^\`]+)``\b';
+my $type_constant2 = '\%([-_\w]+)';
+my $type_func = '(\w+)\(\)';
+my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
+my $type_param_ref = '([\!~]?)\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
+my $type_fp_param = '\@(\w+)\(\)';  # Special RST handling for func ptr params
+my $type_fp_param2 = '\@(\w+->\S+)\(\)';  # Special RST handling for structs with func ptr params
+my $type_env = '(\$\w+)';
+my $type_enum = '\&(enum\s*([_\w]+))';
+my $type_struct = '\&(struct\s*([_\w]+))';
+my $type_typedef = '\&(typedef\s*([_\w]+))';
+my $type_union = '\&(union\s*([_\w]+))';
+my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
+my $type_fallback = '\&([_\w]+)';
+my $type_member_func = $type_member . '\(\)';
+
+# Output conversion substitutions.
+#  One for each output format
+
+# these are pretty rough
+my @highlights_man = (
+                      [$type_constant, "\$1"],
+                      [$type_constant2, "\$1"],
+                      [$type_func, "\\\\fB\$1\\\\fP"],
+                      [$type_enum, "\\\\fI\$1\\\\fP"],
+                      [$type_struct, "\\\\fI\$1\\\\fP"],
+                      [$type_typedef, "\\\\fI\$1\\\\fP"],
+                      [$type_union, "\\\\fI\$1\\\\fP"],
+                      [$type_param, "\\\\fI\$1\\\\fP"],
+                      [$type_param_ref, "\\\\fI\$1\$2\\\\fP"],
+                      [$type_member, "\\\\fI\$1\$2\$3\\\\fP"],
+                      [$type_fallback, "\\\\fI\$1\\\\fP"]
+		     );
+my $blankline_man = "";
+
+# rst-mode
+my @highlights_rst = (
+                       [$type_constant, "``\$1``"],
+                       [$type_constant2, "``\$1``"],
+                       # Note: need to escape () to avoid func matching later
+                       [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"],
+                       [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"],
+		       [$type_fp_param, "**\$1\\\\(\\\\)**"],
+		       [$type_fp_param2, "**\$1\\\\(\\\\)**"],
+                       [$type_func, "\$1()"],
+                       [$type_enum, "\\:c\\:type\\:`\$1 <\$2>`"],
+                       [$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"],
+                       [$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"],
+                       [$type_union, "\\:c\\:type\\:`\$1 <\$2>`"],
+                       # in rst this can refer to any type
+                       [$type_fallback, "\\:c\\:type\\:`\$1`"],
+                       [$type_param_ref, "**\$1\$2**"]
+		      );
+my $blankline_rst = "\n";
+
+# read arguments
+if ($#ARGV == -1) {
+	pod2usage(
+		-message => "No arguments!\n",
+		-exitval => 1,
+		-verbose => 99,
+		-sections => 'SYNOPSIS',
+		-output => \*STDERR,
+	);
+}
+
+my $kernelversion;
+my ($sphinx_major, $sphinx_minor, $sphinx_patch);
+
+my $dohighlight = "";
+
+my $verbose = 0;
+my $Werror = 0;
+my $Wreturn = 0;
+my $Wshort_desc = 0;
+my $Wcontents_before_sections = 0;
+my $output_mode = "rst";
+my $output_preformatted = 0;
+my $no_doc_sections = 0;
+my $enable_lineno = 0;
+my @highlights = @highlights_rst;
+my $blankline = $blankline_rst;
+my $modulename = "Kernel API";
+
+use constant {
+    OUTPUT_ALL          => 0, # output all symbols and doc sections
+    OUTPUT_INCLUDE      => 1, # output only specified symbols
+    OUTPUT_EXPORTED     => 2, # output exported symbols
+    OUTPUT_INTERNAL     => 3, # output non-exported symbols
+};
+my $output_selection = OUTPUT_ALL;
+my $show_not_found = 0;	# No longer used
+
+my @export_file_list;
+
+my @build_time;
+if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) &&
+    (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') {
+    @build_time = gmtime($seconds);
+} else {
+    @build_time = localtime;
+}
+
+my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
+		'July', 'August', 'September', 'October',
+		'November', 'December')[$build_time[4]] .
+  " " . ($build_time[5]+1900);
+
+# Essentially these are globals.
+# They probably want to be tidied up, made more localised or something.
+# CAVEAT EMPTOR!  Some of the others I localised may not want to be, which
+# could cause "use of undefined value" or other bugs.
+my ($function, %function_table, %parametertypes, $declaration_purpose);
+my %nosymbol_table = ();
+my $declaration_start_line;
+my ($type, $declaration_name, $return_type);
+my ($newsection, $newcontents, $prototype, $brcount, %source_map);
+
+if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
+	$verbose = 1;
+}
+
+if (defined($ENV{'KCFLAGS'})) {
+	my $kcflags = "$ENV{'KCFLAGS'}";
+
+	if ($kcflags =~ /Werror/) {
+		$Werror = 1;
+	}
+}
+
+# reading this variable is for backwards compat just in case
+# someone was calling it with the variable from outside the
+# kernel's build system
+if (defined($ENV{'KDOC_WERROR'})) {
+	$Werror = "$ENV{'KDOC_WERROR'}";
+}
+# other environment variables are converted to command-line
+# arguments in cmd_checkdoc in the build system
+
+# Generated docbook code is inserted in a template at a point where
+# docbook v3.1 requires a non-zero sequence of RefEntry's; see:
+# https://www.oasis-open.org/docbook/documentation/reference/html/refentry.html
+# We keep track of number of generated entries and generate a dummy
+# if needs be to ensure the expanded template can be postprocessed
+# into html.
+my $section_counter = 0;
+
+my $lineprefix="";
+
+# Parser states
+use constant {
+    STATE_NORMAL        => 0,        # normal code
+    STATE_NAME          => 1,        # looking for function name
+    STATE_BODY_MAYBE    => 2,        # body - or maybe more description
+    STATE_BODY          => 3,        # the body of the comment
+    STATE_BODY_WITH_BLANK_LINE => 4, # the body, which has a blank line
+    STATE_PROTO         => 5,        # scanning prototype
+    STATE_DOCBLOCK      => 6,        # documentation block
+    STATE_INLINE        => 7,        # gathering doc outside main block
+};
+my $state;
+my $in_doc_sect;
+my $leading_space;
+
+# Inline documentation state
+use constant {
+    STATE_INLINE_NA     => 0, # not applicable ($state != STATE_INLINE)
+    STATE_INLINE_NAME   => 1, # looking for member name (@foo:)
+    STATE_INLINE_TEXT   => 2, # looking for member documentation
+    STATE_INLINE_END    => 3, # done
+    STATE_INLINE_ERROR  => 4, # error - Comment without header was found.
+                              # Spit a warning as it's not
+                              # proper kernel-doc and ignore the rest.
+};
+my $inline_doc_state;
+
+#declaration types: can be
+# 'function', 'struct', 'union', 'enum', 'typedef'
+my $decl_type;
+
+# Name of the kernel-doc identifier for non-DOC markups
+my $identifier;
+
+my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
+my $doc_end = '\*/';
+my $doc_com = '\s*\*\s*';
+my $doc_com_body = '\s*\* ?';
+my $doc_decl = $doc_com . '(\w+)';
+# @params and a strictly limited set of supported section names
+# Specifically:
+#   Match @word:
+#	  @...:
+#         @{section-name}:
+# while trying to not match literal block starts like "example::"
+#
+my $doc_sect = $doc_com .
+    '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:([^:].*)?$';
+my $doc_content = $doc_com_body . '(.*)';
+my $doc_block = $doc_com . 'DOC:\s*(.*)?';
+my $doc_inline_start = '^\s*/\*\*\s*$';
+my $doc_inline_sect = '\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)';
+my $doc_inline_end = '^\s*\*/\s*$';
+my $doc_inline_oneline = '^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$';
+my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';
+my $export_symbol_ns = '^\s*EXPORT_SYMBOL_NS(_GPL)?\s*\(\s*(\w+)\s*,\s*\w+\)\s*;';
+my $function_pointer = qr{([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)};
+my $attribute = qr{__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)}i;
+
+my %parameterdescs;
+my %parameterdesc_start_lines;
+my @parameterlist;
+my %sections;
+my @sectionlist;
+my %section_start_lines;
+my $sectcheck;
+my $struct_actual;
+
+my $contents = "";
+my $new_start_line = 0;
+
+# the canonical section names. see also $doc_sect above.
+my $section_default = "Description";	# default section
+my $section_intro = "Introduction";
+my $section = $section_default;
+my $section_context = "Context";
+my $section_return = "Return";
+
+my $undescribed = "-- undescribed --";
+
+reset_state();
+
+while ($ARGV[0] =~ m/^--?(.*)/) {
+    my $cmd = $1;
+    shift @ARGV;
+    if ($cmd eq "man") {
+	$output_mode = "man";
+	@highlights = @highlights_man;
+	$blankline = $blankline_man;
+    } elsif ($cmd eq "rst") {
+	$output_mode = "rst";
+	@highlights = @highlights_rst;
+	$blankline = $blankline_rst;
+    } elsif ($cmd eq "none") {
+	$output_mode = "none";
+    } elsif ($cmd eq "module") { # not needed for XML, inherits from calling document
+	$modulename = shift @ARGV;
+    } elsif ($cmd eq "function") { # to only output specific functions
+	$output_selection = OUTPUT_INCLUDE;
+	$function = shift @ARGV;
+	$function_table{$function} = 1;
+    } elsif ($cmd eq "nosymbol") { # Exclude specific symbols
+	my $symbol = shift @ARGV;
+	$nosymbol_table{$symbol} = 1;
+    } elsif ($cmd eq "export") { # only exported symbols
+	$output_selection = OUTPUT_EXPORTED;
+	%function_table = ();
+    } elsif ($cmd eq "internal") { # only non-exported symbols
+	$output_selection = OUTPUT_INTERNAL;
+	%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 "Werror") {
+	$Werror = 1;
+    } elsif ($cmd eq "Wreturn") {
+	$Wreturn = 1;
+    } elsif ($cmd eq "Wshort-desc") {
+	$Wshort_desc = 1;
+    } elsif ($cmd eq "Wcontents-before-sections") {
+	$Wcontents_before_sections = 1;
+    } elsif ($cmd eq "Wall") {
+        $Wreturn = 1;
+        $Wshort_desc = 1;
+        $Wcontents_before_sections = 1;
+    } elsif (($cmd eq "h") || ($cmd eq "help")) {
+		pod2usage(-exitval => 0, -verbose => 2);
+    } elsif ($cmd eq 'no-doc-sections') {
+	    $no_doc_sections = 1;
+    } elsif ($cmd eq 'enable-lineno') {
+	    $enable_lineno = 1;
+    } elsif ($cmd eq 'show-not-found') {
+	$show_not_found = 1;  # A no-op but don't fail
+    } elsif ($cmd eq "sphinx-version") {
+	my $ver_string = shift @ARGV;
+	if ($ver_string =~ m/^(\d+)(\.\d+)?(\.\d+)?/) {
+	    $sphinx_major = $1;
+	    if (defined($2)) {
+		$sphinx_minor = substr($2,1);
+	    } else {
+		$sphinx_minor = 0;
+	    }
+	    if (defined($3)) {
+		$sphinx_patch = substr($3,1)
+	    } else {
+		$sphinx_patch = 0;
+	    }
+	} else {
+	    die "Sphinx version should either major.minor or major.minor.patch format\n";
+	}
+    } else {
+	# Unknown argument
+	pod2usage(
+	    -message => "Argument unknown!\n",
+	    -exitval => 1,
+	    -verbose => 99,
+	    -sections => 'SYNOPSIS',
+	    -output => \*STDERR,
+	    );
+    }
+    if ($#ARGV < 0){
+	pod2usage(
+	    -message => "FILE argument missing\n",
+	    -exitval => 1,
+	    -verbose => 99,
+	    -sections => 'SYNOPSIS',
+	    -output => \*STDERR,
+	    );
+    }
+}
+
+# continue execution near EOF;
+
+# The C domain dialect changed on Sphinx 3. So, we need to check the
+# version in order to produce the right tags.
+sub findprog($)
+{
+	foreach(split(/:/, $ENV{PATH})) {
+		return "$_/$_[0]" if(-x "$_/$_[0]");
+	}
+}
+
+sub get_sphinx_version()
+{
+	my $ver;
+
+	my $cmd = "sphinx-build";
+	if (!findprog($cmd)) {
+		my $cmd = "sphinx-build3";
+		if (!findprog($cmd)) {
+			$sphinx_major = 1;
+			$sphinx_minor = 2;
+			$sphinx_patch = 0;
+			printf STDERR "Warning: Sphinx version not found. Using default (Sphinx version %d.%d.%d)\n",
+			       $sphinx_major, $sphinx_minor, $sphinx_patch;
+			return;
+		}
+	}
+
+	open IN, "$cmd --version 2>&1 |";
+	while (<IN>) {
+		if (m/^\s*sphinx-build\s+([\d]+)\.([\d\.]+)(\+\/[\da-f]+)?$/) {
+			$sphinx_major = $1;
+			$sphinx_minor = $2;
+			$sphinx_patch = $3;
+			last;
+		}
+		# Sphinx 1.2.x uses a different format
+		if (m/^\s*Sphinx.*\s+([\d]+)\.([\d\.]+)$/) {
+			$sphinx_major = $1;
+			$sphinx_minor = $2;
+			$sphinx_patch = $3;
+			last;
+		}
+	}
+	close IN;
+}
+
+# get kernel version from env
+sub get_kernel_version() {
+    my $version = 'unknown kernel version';
+
+    if (defined($ENV{'KERNELVERSION'})) {
+	$version = $ENV{'KERNELVERSION'};
+    }
+    return $version;
+}
+
+#
+sub print_lineno {
+    my $lineno = shift;
+    if ($enable_lineno && defined($lineno)) {
+        print ".. LINENO " . $lineno . "\n";
+    }
+}
+
+sub emit_warning {
+    my $location = shift;
+    my $msg = shift;
+    print STDERR "$location: warning: $msg";
+    ++$warnings;
+}
+##
+# dumps section contents to arrays/hashes intended for that purpose.
+#
+sub dump_section {
+    my $file = shift;
+    my $name = shift;
+    my $contents = join "\n", @_;
+
+    if ($name =~ m/$type_param/) {
+	$name = $1;
+	$parameterdescs{$name} = $contents;
+	$sectcheck = $sectcheck . $name . " ";
+        $parameterdesc_start_lines{$name} = $new_start_line;
+        $new_start_line = 0;
+    } elsif ($name eq "@\.\.\.") {
+	$name = "...";
+	$parameterdescs{$name} = $contents;
+	$sectcheck = $sectcheck . $name . " ";
+        $parameterdesc_start_lines{$name} = $new_start_line;
+        $new_start_line = 0;
+    } else {
+	if (defined($sections{$name}) && ($sections{$name} ne "")) {
+	    # Only warn on user specified duplicate section names.
+	    if ($name ne $section_default) {
+		emit_warning("${file}:$.", "duplicate section name '$name'\n");
+	    }
+	    $sections{$name} .= $contents;
+	} else {
+	    $sections{$name} = $contents;
+	    push @sectionlist, $name;
+            $section_start_lines{$name} = $new_start_line;
+            $new_start_line = 0;
+	}
+    }
+}
+
+##
+# dump DOC: section after checking that it should go out
+#
+sub dump_doc_section {
+    my $file = shift;
+    my $name = shift;
+    my $contents = join "\n", @_;
+
+    if ($no_doc_sections) {
+        return;
+    }
+
+    return if (defined($nosymbol_table{$name}));
+
+    if (($output_selection == OUTPUT_ALL) ||
+	(($output_selection == OUTPUT_INCLUDE) &&
+	 defined($function_table{$name})))
+    {
+	dump_section($file, $name, $contents);
+	output_blockhead({'sectionlist' => \@sectionlist,
+			  'sections' => \%sections,
+			  'module' => $modulename,
+			  'content-only' => ($output_selection != OUTPUT_ALL), });
+    }
+}
+
+##
+# output function
+#
+# parameterdescs, a hash.
+#  function => "function name"
+#  parameterlist => @list of parameters
+#  parameterdescs => %parameter descriptions
+#  sectionlist => @list of sections
+#  sections => %section descriptions
+#
+
+sub output_highlight {
+    my $contents = join "\n",@_;
+    my $line;
+
+#   DEBUG
+#   if (!defined $contents) {
+#	use Carp;
+#	confess "output_highlight got called with no args?\n";
+#   }
+
+#   print STDERR "contents b4:$contents\n";
+    eval $dohighlight;
+    die $@ if $@;
+#   print STDERR "contents af:$contents\n";
+
+    foreach $line (split "\n", $contents) {
+	if (! $output_preformatted) {
+	    $line =~ s/^\s*//;
+	}
+	if ($line eq ""){
+	    if (! $output_preformatted) {
+		print $lineprefix, $blankline;
+	    }
+	} else {
+	    if ($output_mode eq "man" && substr($line, 0, 1) eq ".") {
+		print "\\&$line";
+	    } else {
+		print $lineprefix, $line;
+	    }
+	}
+	print "\n";
+    }
+}
+
+##
+# output function in man
+sub output_function_man(%) {
+    my %args = %{$_[0]};
+    my ($parameter, $section);
+    my $count;
+
+    print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n";
+
+    print ".SH NAME\n";
+    print $args{'function'} . " \\- " . $args{'purpose'} . "\n";
+
+    print ".SH SYNOPSIS\n";
+    if ($args{'functiontype'} ne "") {
+	print ".B \"" . $args{'functiontype'} . "\" " . $args{'function'} . "\n";
+    } else {
+	print ".B \"" . $args{'function'} . "\n";
+    }
+    $count = 0;
+    my $parenth = "(";
+    my $post = ",";
+    foreach my $parameter (@{$args{'parameterlist'}}) {
+	if ($count == $#{$args{'parameterlist'}}) {
+	    $post = ");";
+	}
+	$type = $args{'parametertypes'}{$parameter};
+	if ($type =~ m/$function_pointer/) {
+	    # pointer-to-function
+	    print ".BI \"" . $parenth . $1 . "\" " . " \") (" . $2 . ")" . $post . "\"\n";
+	} else {
+	    $type =~ s/([^\*])$/$1 /;
+	    print ".BI \"" . $parenth . $type . "\" " . " \"" . $post . "\"\n";
+	}
+	$count++;
+	$parenth = "";
+    }
+
+    print ".SH ARGUMENTS\n";
+    foreach $parameter (@{$args{'parameterlist'}}) {
+	my $parameter_name = $parameter;
+	$parameter_name =~ s/\[.*//;
+
+	print ".IP \"" . $parameter . "\" 12\n";
+	output_highlight($args{'parameterdescs'}{$parameter_name});
+    }
+    foreach $section (@{$args{'sectionlist'}}) {
+	print ".SH \"", uc $section, "\"\n";
+	output_highlight($args{'sections'}{$section});
+    }
+}
+
+##
+# output enum in man
+sub output_enum_man(%) {
+    my %args = %{$_[0]};
+    my ($parameter, $section);
+    my $count;
+
+    print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n";
+
+    print ".SH NAME\n";
+    print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n";
+
+    print ".SH SYNOPSIS\n";
+    print "enum " . $args{'enum'} . " {\n";
+    $count = 0;
+    foreach my $parameter (@{$args{'parameterlist'}}) {
+	print ".br\n.BI \"    $parameter\"\n";
+	if ($count == $#{$args{'parameterlist'}}) {
+	    print "\n};\n";
+	    last;
+	}
+	else {
+	    print ", \n.br\n";
+	}
+	$count++;
+    }
+
+    print ".SH Constants\n";
+    foreach $parameter (@{$args{'parameterlist'}}) {
+	my $parameter_name = $parameter;
+	$parameter_name =~ s/\[.*//;
+
+	print ".IP \"" . $parameter . "\" 12\n";
+	output_highlight($args{'parameterdescs'}{$parameter_name});
+    }
+    foreach $section (@{$args{'sectionlist'}}) {
+	print ".SH \"$section\"\n";
+	output_highlight($args{'sections'}{$section});
+    }
+}
+
+##
+# output struct in man
+sub output_struct_man(%) {
+    my %args = %{$_[0]};
+    my ($parameter, $section);
+
+    print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \"API Manual\" LINUX\n";
+
+    print ".SH NAME\n";
+    print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";
+
+    my $declaration = $args{'definition'};
+    $declaration =~ s/\t/  /g;
+    $declaration =~ s/\n/"\n.br\n.BI \"/g;
+    print ".SH SYNOPSIS\n";
+    print $args{'type'} . " " . $args{'struct'} . " {\n.br\n";
+    print ".BI \"$declaration\n};\n.br\n\n";
+
+    print ".SH Members\n";
+    foreach $parameter (@{$args{'parameterlist'}}) {
+	($parameter =~ /^#/) && next;
+
+	my $parameter_name = $parameter;
+	$parameter_name =~ s/\[.*//;
+
+	($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
+	print ".IP \"" . $parameter . "\" 12\n";
+	output_highlight($args{'parameterdescs'}{$parameter_name});
+    }
+    foreach $section (@{$args{'sectionlist'}}) {
+	print ".SH \"$section\"\n";
+	output_highlight($args{'sections'}{$section});
+    }
+}
+
+##
+# output typedef in man
+sub output_typedef_man(%) {
+    my %args = %{$_[0]};
+    my ($parameter, $section);
+
+    print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n";
+
+    print ".SH NAME\n";
+    print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n";
+
+    foreach $section (@{$args{'sectionlist'}}) {
+	print ".SH \"$section\"\n";
+	output_highlight($args{'sections'}{$section});
+    }
+}
+
+sub output_blockhead_man(%) {
+    my %args = %{$_[0]};
+    my ($parameter, $section);
+    my $count;
+
+    print ".TH \"$args{'module'}\" 9 \"$args{'module'}\" \"$man_date\" \"API Manual\" LINUX\n";
+
+    foreach $section (@{$args{'sectionlist'}}) {
+	print ".SH \"$section\"\n";
+	output_highlight($args{'sections'}{$section});
+    }
+}
+
+##
+# output in restructured text
+#
+
+#
+# This could use some work; it's used to output the DOC: sections, and
+# starts by putting out the name of the doc section itself, but that tends
+# to duplicate a header already in the template file.
+#
+sub output_blockhead_rst(%) {
+    my %args = %{$_[0]};
+    my ($parameter, $section);
+
+    foreach $section (@{$args{'sectionlist'}}) {
+	next if (defined($nosymbol_table{$section}));
+
+	if ($output_selection != OUTPUT_INCLUDE) {
+	    print ".. _$section:\n\n";
+	    print "**$section**\n\n";
+	}
+        print_lineno($section_start_lines{$section});
+	output_highlight_rst($args{'sections'}{$section});
+	print "\n";
+    }
+}
+
+#
+# Apply the RST highlights to a sub-block of text.
+#
+sub highlight_block($) {
+    # The dohighlight kludge requires the text be called $contents
+    my $contents = shift;
+    eval $dohighlight;
+    die $@ if $@;
+    return $contents;
+}
+
+#
+# Regexes used only here.
+#
+my $sphinx_literal = '^[^.].*::$';
+my $sphinx_cblock = '^\.\.\ +code-block::';
+
+sub output_highlight_rst {
+    my $input = join "\n",@_;
+    my $output = "";
+    my $line;
+    my $in_literal = 0;
+    my $litprefix;
+    my $block = "";
+
+    foreach $line (split "\n",$input) {
+	#
+	# If we're in a literal block, see if we should drop out
+	# of it.  Otherwise pass the line straight through unmunged.
+	#
+	if ($in_literal) {
+	    if (! ($line =~ /^\s*$/)) {
+		#
+		# If this is the first non-blank line in a literal
+		# block we need to figure out what the proper indent is.
+		#
+		if ($litprefix eq "") {
+		    $line =~ /^(\s*)/;
+		    $litprefix = '^' . $1;
+		    $output .= $line . "\n";
+		} elsif (! ($line =~ /$litprefix/)) {
+		    $in_literal = 0;
+		} else {
+		    $output .= $line . "\n";
+		}
+	    } else {
+		$output .= $line . "\n";
+	    }
+	}
+	#
+	# Not in a literal block (or just dropped out)
+	#
+	if (! $in_literal) {
+	    $block .= $line . "\n";
+	    if (($line =~ /$sphinx_literal/) || ($line =~ /$sphinx_cblock/)) {
+		$in_literal = 1;
+		$litprefix = "";
+		$output .= highlight_block($block);
+		$block = ""
+	    }
+	}
+    }
+
+    if ($block) {
+	$output .= highlight_block($block);
+    }
+    foreach $line (split "\n", $output) {
+	print $lineprefix . $line . "\n";
+    }
+}
+
+sub output_function_rst(%) {
+    my %args = %{$_[0]};
+    my ($parameter, $section);
+    my $oldprefix = $lineprefix;
+    my $start = "";
+    my $is_macro = 0;
+
+    if ($sphinx_major < 3) {
+	if ($args{'typedef'}) {
+	    print ".. c:type:: ". $args{'function'} . "\n\n";
+	    print_lineno($declaration_start_line);
+	    print "   **Typedef**: ";
+	    $lineprefix = "";
+	    output_highlight_rst($args{'purpose'});
+	    $start = "\n\n**Syntax**\n\n  ``";
+	    $is_macro = 1;
+	} else {
+	    print ".. c:function:: ";
+	}
+    } else {
+	if ($args{'typedef'} || $args{'functiontype'} eq "") {
+	    $is_macro = 1;
+	    print ".. c:macro:: ". $args{'function'} . "\n\n";
+	} else {
+	    print ".. c:function:: ";
+	}
+
+	if ($args{'typedef'}) {
+	    print_lineno($declaration_start_line);
+	    print "   **Typedef**: ";
+	    $lineprefix = "";
+	    output_highlight_rst($args{'purpose'});
+	    $start = "\n\n**Syntax**\n\n  ``";
+	} else {
+	    print "``" if ($is_macro);
+	}
+    }
+    if ($args{'functiontype'} ne "") {
+	$start .= $args{'functiontype'} . " " . $args{'function'} . " (";
+    } else {
+	$start .= $args{'function'} . " (";
+    }
+    print $start;
+
+    my $count = 0;
+    foreach my $parameter (@{$args{'parameterlist'}}) {
+	if ($count ne 0) {
+	    print ", ";
+	}
+	$count++;
+	$type = $args{'parametertypes'}{$parameter};
+
+	if ($type =~ m/$function_pointer/) {
+	    # pointer-to-function
+	    print $1 . $parameter . ") (" . $2 . ")";
+	} else {
+	    print $type;
+	}
+    }
+    if ($is_macro) {
+	print ")``\n\n";
+    } else {
+	print ")\n\n";
+    }
+    if (!$args{'typedef'}) {
+	print_lineno($declaration_start_line);
+	$lineprefix = "   ";
+	output_highlight_rst($args{'purpose'});
+	print "\n";
+    }
+
+    #
+    # Put our descriptive text into a container (thus an HTML <div>) to help
+    # set the function prototypes apart.
+    #
+    print ".. container:: kernelindent\n\n";
+    $lineprefix = "  ";
+    print $lineprefix . "**Parameters**\n\n";
+    foreach $parameter (@{$args{'parameterlist'}}) {
+	my $parameter_name = $parameter;
+	$parameter_name =~ s/\[.*//;
+	$type = $args{'parametertypes'}{$parameter};
+
+	if ($type ne "") {
+	    print $lineprefix . "``$type``\n";
+	} else {
+	    print $lineprefix . "``$parameter``\n";
+	}
+
+        print_lineno($parameterdesc_start_lines{$parameter_name});
+
+	$lineprefix = "    ";
+	if (defined($args{'parameterdescs'}{$parameter_name}) &&
+	    $args{'parameterdescs'}{$parameter_name} ne $undescribed) {
+	    output_highlight_rst($args{'parameterdescs'}{$parameter_name});
+	} else {
+	    print $lineprefix . "*undescribed*\n";
+	}
+	$lineprefix = "  ";
+	print "\n";
+    }
+
+    output_section_rst(@_);
+    $lineprefix = $oldprefix;
+}
+
+sub output_section_rst(%) {
+    my %args = %{$_[0]};
+    my $section;
+    my $oldprefix = $lineprefix;
+
+    foreach $section (@{$args{'sectionlist'}}) {
+	print $lineprefix . "**$section**\n\n";
+        print_lineno($section_start_lines{$section});
+	output_highlight_rst($args{'sections'}{$section});
+	print "\n";
+    }
+    print "\n";
+}
+
+sub output_enum_rst(%) {
+    my %args = %{$_[0]};
+    my ($parameter);
+    my $oldprefix = $lineprefix;
+    my $count;
+    my $outer;
+
+    if ($sphinx_major < 3) {
+	my $name = "enum " . $args{'enum'};
+	print "\n\n.. c:type:: " . $name . "\n\n";
+    } else {
+	my $name = $args{'enum'};
+	print "\n\n.. c:enum:: " . $name . "\n\n";
+    }
+    print_lineno($declaration_start_line);
+    $lineprefix = "  ";
+    output_highlight_rst($args{'purpose'});
+    print "\n";
+
+    print ".. container:: kernelindent\n\n";
+    $outer = $lineprefix . "  ";
+    $lineprefix = $outer . "  ";
+    print $outer . "**Constants**\n\n";
+    foreach $parameter (@{$args{'parameterlist'}}) {
+	print $outer . "``$parameter``\n";
+
+	if ($args{'parameterdescs'}{$parameter} ne $undescribed) {
+	    output_highlight_rst($args{'parameterdescs'}{$parameter});
+	} else {
+	    print $lineprefix . "*undescribed*\n";
+	}
+	print "\n";
+    }
+    print "\n";
+    $lineprefix = $oldprefix;
+    output_section_rst(@_);
+}
+
+sub output_typedef_rst(%) {
+    my %args = %{$_[0]};
+    my ($parameter);
+    my $oldprefix = $lineprefix;
+    my $name;
+
+    if ($sphinx_major < 3) {
+	$name = "typedef " . $args{'typedef'};
+    } else {
+	$name = $args{'typedef'};
+    }
+    print "\n\n.. c:type:: " . $name . "\n\n";
+    print_lineno($declaration_start_line);
+    $lineprefix = "   ";
+    output_highlight_rst($args{'purpose'});
+    print "\n";
+
+    $lineprefix = $oldprefix;
+    output_section_rst(@_);
+}
+
+sub output_struct_rst(%) {
+    my %args = %{$_[0]};
+    my ($parameter);
+    my $oldprefix = $lineprefix;
+
+    if ($sphinx_major < 3) {
+	my $name = $args{'type'} . " " . $args{'struct'};
+	print "\n\n.. c:type:: " . $name . "\n\n";
+    } else {
+	my $name = $args{'struct'};
+	if ($args{'type'} eq 'union') {
+	    print "\n\n.. c:union:: " . $name . "\n\n";
+	} else {
+	    print "\n\n.. c:struct:: " . $name . "\n\n";
+	}
+    }
+    print_lineno($declaration_start_line);
+    $lineprefix = "  ";
+    output_highlight_rst($args{'purpose'});
+    print "\n";
+
+    print ".. container:: kernelindent\n\n";
+    print $lineprefix . "**Definition**::\n\n";
+    my $declaration = $args{'definition'};
+    $lineprefix = $lineprefix . "  ";
+    $declaration =~ s/\t/$lineprefix/g;
+    print $lineprefix . $args{'type'} . " " . $args{'struct'} . " {\n$declaration" . $lineprefix . "};\n\n";
+
+    $lineprefix = "  ";
+    print $lineprefix . "**Members**\n\n";
+    foreach $parameter (@{$args{'parameterlist'}}) {
+	($parameter =~ /^#/) && next;
+
+	my $parameter_name = $parameter;
+	$parameter_name =~ s/\[.*//;
+
+	($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
+	$type = $args{'parametertypes'}{$parameter};
+        print_lineno($parameterdesc_start_lines{$parameter_name});
+	print $lineprefix . "``" . $parameter . "``\n";
+	$lineprefix = "    ";
+	output_highlight_rst($args{'parameterdescs'}{$parameter_name});
+	$lineprefix = "  ";
+	print "\n";
+    }
+    print "\n";
+
+    $lineprefix = $oldprefix;
+    output_section_rst(@_);
+}
+
+## none mode output functions
+
+sub output_function_none(%) {
+}
+
+sub output_enum_none(%) {
+}
+
+sub output_typedef_none(%) {
+}
+
+sub output_struct_none(%) {
+}
+
+sub output_blockhead_none(%) {
+}
+
+##
+# 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;
+    my $functype = shift;
+    my $func = "output_${functype}_$output_mode";
+
+    return if (defined($nosymbol_table{$name}));
+
+    if (($output_selection == OUTPUT_ALL) ||
+	(($output_selection == OUTPUT_INCLUDE ||
+	  $output_selection == OUTPUT_EXPORTED) &&
+	 defined($function_table{$name})) ||
+	($output_selection == OUTPUT_INTERNAL &&
+	 !($functype eq "function" && defined($function_table{$name}))))
+    {
+	&$func(@_);
+	$section_counter++;
+    }
+}
+
+##
+# generic output function - calls the right one based on current output mode.
+sub output_blockhead {
+    no strict 'refs';
+    my $func = "output_blockhead_" . $output_mode;
+    &$func(@_);
+    $section_counter++;
+}
+
+##
+# takes a declaration (struct, union, enum, typedef) and
+# invokes the right handler. NOT called for functions.
+sub dump_declaration($$) {
+    no strict 'refs';
+    my ($prototype, $file) = @_;
+    my $func = "dump_" . $decl_type;
+    &$func(@_);
+}
+
+sub dump_union($$) {
+    dump_struct(@_);
+}
+
+sub dump_struct($$) {
+    my $x = shift;
+    my $file = shift;
+    my $decl_type;
+    my $members;
+    my $type = qr{struct|union};
+    # For capturing struct/union definition body, i.e. "{members*}qualifiers*"
+    my $qualifiers = qr{$attribute|__packed|__aligned|____cacheline_aligned_in_smp|____cacheline_aligned};
+    my $definition_body = qr{\{(.*)\}\s*$qualifiers*};
+    my $struct_members = qr{($type)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;};
+
+    if ($x =~ /($type)\s+(\w+)\s*$definition_body/) {
+	$decl_type = $1;
+	$declaration_name = $2;
+	$members = $3;
+    } elsif ($x =~ /typedef\s+($type)\s*$definition_body\s*(\w+)\s*;/) {
+	$decl_type = $1;
+	$declaration_name = $3;
+	$members = $2;
+    }
+
+    if ($members) {
+	if ($identifier ne $declaration_name) {
+	    emit_warning("${file}:$.", "expecting prototype for $decl_type $identifier. Prototype was for $decl_type $declaration_name instead\n");
+	    return;
+	}
+
+	# ignore members marked private:
+	$members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
+	$members =~ s/\/\*\s*private:.*//gosi;
+	# strip comments:
+	$members =~ s/\/\*.*?\*\///gos;
+	# strip attributes
+	$members =~ s/\s*$attribute/ /gi;
+	$members =~ s/\s*__aligned\s*\([^;]*\)/ /gos;
+	$members =~ s/\s*__packed\s*/ /gos;
+	$members =~ s/\s*CRYPTO_MINALIGN_ATTR/ /gos;
+	$members =~ s/\s*____cacheline_aligned_in_smp/ /gos;
+	$members =~ s/\s*____cacheline_aligned/ /gos;
+	# unwrap struct_group():
+	# - first eat non-declaration parameters and rewrite for final match
+	# - then remove macro, outer parens, and trailing semicolon
+	$members =~ s/\bstruct_group\s*\(([^,]*,)/STRUCT_GROUP(/gos;
+	$members =~ s/\bstruct_group_(attr|tagged)\s*\(([^,]*,){2}/STRUCT_GROUP(/gos;
+	$members =~ s/\b__struct_group\s*\(([^,]*,){3}/STRUCT_GROUP(/gos;
+	$members =~ s/\bSTRUCT_GROUP(\(((?:(?>[^)(]+)|(?1))*)\))[^;]*;/$2/gos;
+
+	my $args = qr{([^,)]+)};
+	# replace DECLARE_BITMAP
+	$members =~ s/__ETHTOOL_DECLARE_LINK_MODE_MASK\s*\(([^\)]+)\)/DECLARE_BITMAP($1, __ETHTOOL_LINK_MODE_MASK_NBITS)/gos;
+	$members =~ s/DECLARE_PHY_INTERFACE_MASK\s*\(([^\)]+)\)/DECLARE_BITMAP($1, PHY_INTERFACE_MODE_MAX)/gos;
+	$members =~ s/DECLARE_BITMAP\s*\($args,\s*$args\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos;
+	# replace DECLARE_HASHTABLE
+	$members =~ s/DECLARE_HASHTABLE\s*\($args,\s*$args\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
+	# replace DECLARE_KFIFO
+	$members =~ s/DECLARE_KFIFO\s*\($args,\s*$args,\s*$args\)/$2 \*$1/gos;
+	# replace DECLARE_KFIFO_PTR
+	$members =~ s/DECLARE_KFIFO_PTR\s*\($args,\s*$args\)/$2 \*$1/gos;
+	# replace DECLARE_FLEX_ARRAY
+	$members =~ s/(?:__)?DECLARE_FLEX_ARRAY\s*\($args,\s*$args\)/$1 $2\[\]/gos;
+	#replace DEFINE_DMA_UNMAP_ADDR
+	$members =~ s/DEFINE_DMA_UNMAP_ADDR\s*\($args\)/dma_addr_t $1/gos;
+	#replace DEFINE_DMA_UNMAP_LEN
+	$members =~ s/DEFINE_DMA_UNMAP_LEN\s*\($args\)/__u32 $1/gos;
+	my $declaration = $members;
+
+	# Split nested struct/union elements as newer ones
+	while ($members =~ m/$struct_members/) {
+		my $newmember;
+		my $maintype = $1;
+		my $ids = $4;
+		my $content = $3;
+		foreach my $id(split /,/, $ids) {
+			$newmember .= "$maintype $id; ";
+
+			$id =~ s/[:\[].*//;
+			$id =~ s/^\s*\**(\S+)\s*/$1/;
+			foreach my $arg (split /;/, $content) {
+				next if ($arg =~ m/^\s*$/);
+				if ($arg =~ m/^([^\(]+\(\*?\s*)([\w\.]*)(\s*\).*)/) {
+					# pointer-to-function
+					my $type = $1;
+					my $name = $2;
+					my $extra = $3;
+					next if (!$name);
+					if ($id =~ m/^\s*$/) {
+						# anonymous struct/union
+						$newmember .= "$type$name$extra; ";
+					} else {
+						$newmember .= "$type$id.$name$extra; ";
+					}
+				} else {
+					my $type;
+					my $names;
+					$arg =~ s/^\s+//;
+					$arg =~ s/\s+$//;
+					# Handle bitmaps
+					$arg =~ s/:\s*\d+\s*//g;
+					# Handle arrays
+					$arg =~ s/\[.*\]//g;
+					# The type may have multiple words,
+					# and multiple IDs can be defined, like:
+					#	const struct foo, *bar, foobar
+					# So, we remove spaces when parsing the
+					# names, in order to match just names
+					# and commas for the names
+					$arg =~ s/\s*,\s*/,/g;
+					if ($arg =~ m/(.*)\s+([\S+,]+)/) {
+						$type = $1;
+						$names = $2;
+					} else {
+						$newmember .= "$arg; ";
+						next;
+					}
+					foreach my $name (split /,/, $names) {
+						$name =~ s/^\s*\**(\S+)\s*/$1/;
+						next if (($name =~ m/^\s*$/));
+						if ($id =~ m/^\s*$/) {
+							# anonymous struct/union
+							$newmember .= "$type $name; ";
+						} else {
+							$newmember .= "$type $id.$name; ";
+						}
+					}
+				}
+			}
+		}
+		$members =~ s/$struct_members/$newmember/;
+	}
+
+	# Ignore other nested elements, like enums
+	$members =~ s/(\{[^\{\}]*\})//g;
+
+	create_parameterlist($members, ';', $file, $declaration_name);
+	check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);
+
+	# Adjust declaration for better display
+	$declaration =~ s/([\{;])/$1\n/g;
+	$declaration =~ s/\}\s+;/};/g;
+	# Better handle inlined enums
+	do {} while ($declaration =~ s/(enum\s+\{[^\}]+),([^\n])/$1,\n$2/);
+
+	my @def_args = split /\n/, $declaration;
+	my $level = 1;
+	$declaration = "";
+	foreach my $clause (@def_args) {
+		$clause =~ s/^\s+//;
+		$clause =~ s/\s+$//;
+		$clause =~ s/\s+/ /;
+		next if (!$clause);
+		$level-- if ($clause =~ m/(\})/ && $level > 1);
+		if (!($clause =~ m/^\s*#/)) {
+			$declaration .= "\t" x $level;
+		}
+		$declaration .= "\t" . $clause . "\n";
+		$level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/));
+	}
+	output_declaration($declaration_name,
+			   'struct',
+			   {'struct' => $declaration_name,
+			    'module' => $modulename,
+			    'definition' => $declaration,
+			    'parameterlist' => \@parameterlist,
+			    'parameterdescs' => \%parameterdescs,
+			    'parametertypes' => \%parametertypes,
+			    'sectionlist' => \@sectionlist,
+			    'sections' => \%sections,
+			    'purpose' => $declaration_purpose,
+			    'type' => $decl_type
+			   });
+    }
+    else {
+	print STDERR "${file}:$.: error: Cannot parse struct or union!\n";
+	++$errors;
+    }
+}
+
+
+sub show_warnings($$) {
+	my $functype = shift;
+	my $name = shift;
+
+	return 0 if (defined($nosymbol_table{$name}));
+
+	return 1 if ($output_selection == OUTPUT_ALL);
+
+	if ($output_selection == OUTPUT_EXPORTED) {
+		if (defined($function_table{$name})) {
+			return 1;
+		} else {
+			return 0;
+		}
+	}
+        if ($output_selection == OUTPUT_INTERNAL) {
+		if (!($functype eq "function" && defined($function_table{$name}))) {
+			return 1;
+		} else {
+			return 0;
+		}
+	}
+	if ($output_selection == OUTPUT_INCLUDE) {
+		if (defined($function_table{$name})) {
+			return 1;
+		} else {
+			return 0;
+		}
+	}
+	die("Please add the new output type at show_warnings()");
+}
+
+sub dump_enum($$) {
+    my $x = shift;
+    my $file = shift;
+    my $members;
+
+    # ignore members marked private:
+    $x =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
+    $x =~ s/\/\*\s*private:.*}/}/gosi;
+
+    $x =~ s@/\*.*?\*/@@gos;	# strip comments.
+    # strip #define macros inside enums
+    $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
+
+    if ($x =~ /typedef\s+enum\s*\{(.*)\}\s*(\w*)\s*;/) {
+	$declaration_name = $2;
+	$members = $1;
+    } elsif ($x =~ /enum\s+(\w*)\s*\{(.*)\}/) {
+	$declaration_name = $1;
+	$members = $2;
+    }
+
+    if ($members) {
+	if ($identifier ne $declaration_name) {
+	    if ($identifier eq "") {
+		emit_warning("${file}:$.", "wrong kernel-doc identifier on line:\n");
+	    } else {
+		emit_warning("${file}:$.", "expecting prototype for enum $identifier. Prototype was for enum $declaration_name instead\n");
+	    }
+	    return;
+	}
+	$declaration_name = "(anonymous)" if ($declaration_name eq "");
+
+	my %_members;
+
+	$members =~ s/\s+$//;
+	$members =~ s/\([^;]*?[\)]//g;
+
+	foreach my $arg (split ',', $members) {
+	    $arg =~ s/^\s*(\w+).*/$1/;
+	    push @parameterlist, $arg;
+	    if (!$parameterdescs{$arg}) {
+		$parameterdescs{$arg} = $undescribed;
+	        if (show_warnings("enum", $declaration_name)) {
+			emit_warning("${file}:$.", "Enum value '$arg' not described in enum '$declaration_name'\n");
+		}
+	    }
+	    $_members{$arg} = 1;
+	}
+
+	while (my ($k, $v) = each %parameterdescs) {
+	    if (!exists($_members{$k})) {
+	        if (show_warnings("enum", $declaration_name)) {
+		     emit_warning("${file}:$.", "Excess enum value '$k' description in '$declaration_name'\n");
+		}
+	    }
+        }
+
+	output_declaration($declaration_name,
+			   'enum',
+			   {'enum' => $declaration_name,
+			    'module' => $modulename,
+			    'parameterlist' => \@parameterlist,
+			    'parameterdescs' => \%parameterdescs,
+			    'sectionlist' => \@sectionlist,
+			    'sections' => \%sections,
+			    'purpose' => $declaration_purpose
+			   });
+    } else {
+	print STDERR "${file}:$.: error: Cannot parse enum!\n";
+	++$errors;
+    }
+}
+
+my $typedef_type = qr { ((?:\s+[\w\*]+\b){1,8})\s* }x;
+my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
+my $typedef_args = qr { \s*\((.*)\); }x;
+
+my $typedef1 = qr { typedef$typedef_type\($typedef_ident\)$typedef_args }x;
+my $typedef2 = qr { typedef$typedef_type$typedef_ident$typedef_args }x;
+
+sub dump_typedef($$) {
+    my $x = shift;
+    my $file = shift;
+
+    $x =~ s@/\*.*?\*/@@gos;	# strip comments.
+
+    # Parse function typedef prototypes
+    if ($x =~ $typedef1 || $x =~ $typedef2) {
+	$return_type = $1;
+	$declaration_name = $2;
+	my $args = $3;
+	$return_type =~ s/^\s+//;
+
+	if ($identifier ne $declaration_name) {
+	    emit_warning("${file}:$.", "expecting prototype for typedef $identifier. Prototype was for typedef $declaration_name instead\n");
+	    return;
+	}
+
+	create_parameterlist($args, ',', $file, $declaration_name);
+
+	output_declaration($declaration_name,
+			   'function',
+			   {'function' => $declaration_name,
+			    'typedef' => 1,
+			    'module' => $modulename,
+			    'functiontype' => $return_type,
+			    'parameterlist' => \@parameterlist,
+			    'parameterdescs' => \%parameterdescs,
+			    'parametertypes' => \%parametertypes,
+			    'sectionlist' => \@sectionlist,
+			    'sections' => \%sections,
+			    'purpose' => $declaration_purpose
+			   });
+	return;
+    }
+
+    while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) {
+	$x =~ s/\(*.\)\s*;$/;/;
+	$x =~ s/\[*.\]\s*;$/;/;
+    }
+
+    if ($x =~ /typedef.*\s+(\w+)\s*;/) {
+	$declaration_name = $1;
+
+	if ($identifier ne $declaration_name) {
+	    emit_warning("${file}:$.", "expecting prototype for typedef $identifier. Prototype was for typedef $declaration_name instead\n");
+	    return;
+	}
+
+	output_declaration($declaration_name,
+			   'typedef',
+			   {'typedef' => $declaration_name,
+			    'module' => $modulename,
+			    'sectionlist' => \@sectionlist,
+			    'sections' => \%sections,
+			    'purpose' => $declaration_purpose
+			   });
+    }
+    else {
+	print STDERR "${file}:$.: error: Cannot parse typedef!\n";
+	++$errors;
+    }
+}
+
+sub save_struct_actual($) {
+    my $actual = shift;
+
+    # strip all spaces from the actual param so that it looks like one string item
+    $actual =~ s/\s*//g;
+    $struct_actual = $struct_actual . $actual . " ";
+}
+
+sub create_parameterlist($$$$) {
+    my $args = shift;
+    my $splitter = shift;
+    my $file = shift;
+    my $declaration_name = shift;
+    my $type;
+    my $param;
+
+    # temporarily replace commas inside function pointer definition
+    my $arg_expr = qr{\([^\),]+};
+    while ($args =~ /$arg_expr,/) {
+	$args =~ s/($arg_expr),/$1#/g;
+    }
+
+    foreach my $arg (split($splitter, $args)) {
+	# strip comments
+	$arg =~ s/\/\*.*\*\///;
+	# ignore argument attributes
+	$arg =~ s/\sPOS0?\s/ /;
+	# strip leading/trailing spaces
+	$arg =~ s/^\s*//;
+	$arg =~ s/\s*$//;
+	$arg =~ s/\s+/ /;
+
+	if ($arg =~ /^#/) {
+	    # Treat preprocessor directive as a typeless variable just to fill
+	    # corresponding data structures "correctly". Catch it later in
+	    # output_* subs.
+	    push_parameter($arg, "", "", $file);
+	} elsif ($arg =~ m/\(.+\)\s*\(/) {
+	    # pointer-to-function
+	    $arg =~ tr/#/,/;
+	    $arg =~ m/[^\(]+\(\*?\s*([\w\[\]\.]*)\s*\)/;
+	    $param = $1;
+	    $type = $arg;
+	    $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
+	    save_struct_actual($param);
+	    push_parameter($param, $type, $arg, $file, $declaration_name);
+	} elsif ($arg) {
+	    $arg =~ s/\s*:\s*/:/g;
+	    $arg =~ s/\s*\[/\[/g;
+
+	    my @args = split('\s*,\s*', $arg);
+	    if ($args[0] =~ m/\*/) {
+		$args[0] =~ s/(\*+)\s*/ $1/;
+	    }
+
+	    my @first_arg;
+	    if ($args[0] =~ /^(.*\s+)(.*?\[.*\].*)$/) {
+		    shift @args;
+		    push(@first_arg, split('\s+', $1));
+		    push(@first_arg, $2);
+	    } else {
+		    @first_arg = split('\s+', shift @args);
+	    }
+
+	    unshift(@args, pop @first_arg);
+	    $type = join " ", @first_arg;
+
+	    foreach $param (@args) {
+		if ($param =~ m/^(\*+)\s*(.*)/) {
+		    save_struct_actual($2);
+
+		    push_parameter($2, "$type $1", $arg, $file, $declaration_name);
+		}
+		elsif ($param =~ m/(.*?):(\d+)/) {
+		    if ($type ne "") { # skip unnamed bit-fields
+			save_struct_actual($1);
+			push_parameter($1, "$type:$2", $arg, $file, $declaration_name)
+		    }
+		}
+		else {
+		    save_struct_actual($param);
+		    push_parameter($param, $type, $arg, $file, $declaration_name);
+		}
+	    }
+	}
+    }
+}
+
+sub push_parameter($$$$$) {
+	my $param = shift;
+	my $type = shift;
+	my $org_arg = shift;
+	my $file = shift;
+	my $declaration_name = shift;
+
+	if (($anon_struct_union == 1) && ($type eq "") &&
+	    ($param eq "}")) {
+		return;		# ignore the ending }; from anon. struct/union
+	}
+
+	$anon_struct_union = 0;
+	$param =~ s/[\[\)].*//;
+
+	if ($type eq "" && $param =~ /\.\.\.$/)
+	{
+	    if (!$param =~ /\w\.\.\.$/) {
+	      # handles unnamed variable parameters
+	      $param = "...";
+	    }
+	    elsif ($param =~ /\w\.\.\.$/) {
+	      # for named variable parameters of the form `x...`, remove the dots
+	      $param =~ s/\.\.\.$//;
+	    }
+	    if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") {
+		$parameterdescs{$param} = "variable arguments";
+	    }
+	}
+	elsif ($type eq "" && ($param eq "" or $param eq "void"))
+	{
+	    $param="void";
+	    $parameterdescs{void} = "no arguments";
+	}
+	elsif ($type eq "" && ($param eq "struct" or $param eq "union"))
+	# handle unnamed (anonymous) union or struct:
+	{
+		$type = $param;
+		$param = "{unnamed_" . $param . "}";
+		$parameterdescs{$param} = "anonymous\n";
+		$anon_struct_union = 1;
+	}
+
+	# warn if parameter has no description
+	# (but ignore ones starting with # as these are not parameters
+	# but inline preprocessor statements);
+	# Note: It will also ignore void params and unnamed structs/unions
+	if (!defined $parameterdescs{$param} && $param !~ /^#/) {
+		$parameterdescs{$param} = $undescribed;
+
+	        if (show_warnings($type, $declaration_name) && $param !~ /\./) {
+			emit_warning("${file}:$.", "Function parameter or member '$param' not described in '$declaration_name'\n");
+		}
+	}
+
+	# strip spaces from $param so that it is one continuous 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;
+	$org_arg =~ s/\s\s+/ /g;
+	$parametertypes{$param} = $org_arg;
+}
+
+sub check_sections($$$$$) {
+	my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) = @_;
+	my @sects = split ' ', $sectcheck;
+	my @prms = split ' ', $prmscheck;
+	my $err;
+	my ($px, $sx);
+	my $prm_clean;		# strip trailing "[array size]" and/or beginning "*"
+
+	foreach $sx (0 .. $#sects) {
+		$err = 1;
+		foreach $px (0 .. $#prms) {
+			$prm_clean = $prms[$px];
+			$prm_clean =~ s/\[.*\]//;
+			$prm_clean =~ s/$attribute//i;
+			# 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;
+				last;
+			}
+		}
+		if ($err) {
+			if ($decl_type eq "function") {
+				emit_warning("${file}:$.",
+					"Excess function parameter " .
+					"'$sects[$sx]' " .
+					"description in '$decl_name'\n");
+			}
+		}
+	}
+}
+
+##
+# Checks the section describing the return value of a function.
+sub check_return_section {
+        my $file = shift;
+        my $declaration_name = shift;
+        my $return_type = shift;
+
+        # Ignore an empty return type (It's a macro)
+        # Ignore functions with a "void" return type. (But don't ignore "void *")
+        if (($return_type eq "") || ($return_type =~ /void\s*\w*\s*$/)) {
+                return;
+        }
+
+        if (!defined($sections{$section_return}) ||
+            $sections{$section_return} eq "") {
+                emit_warning("${file}:$.",
+                        "No description found for return value of " .
+                        "'$declaration_name'\n");
+        }
+}
+
+##
+# takes a function prototype and the name of the current file being
+# processed and spits out all the details stored in the global
+# arrays/hashes.
+sub dump_function($$) {
+    my $prototype = shift;
+    my $file = shift;
+    my $noret = 0;
+
+    print_lineno($new_start_line);
+
+    $prototype =~ s/^static +//;
+    $prototype =~ s/^extern +//;
+    $prototype =~ s/^asmlinkage +//;
+    $prototype =~ s/^inline +//;
+    $prototype =~ s/^__inline__ +//;
+    $prototype =~ s/^__inline +//;
+    $prototype =~ s/^__always_inline +//;
+    $prototype =~ s/^noinline +//;
+    $prototype =~ s/^__FORTIFY_INLINE +//;
+    $prototype =~ s/__init +//;
+    $prototype =~ s/__init_or_module +//;
+    $prototype =~ s/__deprecated +//;
+    $prototype =~ s/__flatten +//;
+    $prototype =~ s/__meminit +//;
+    $prototype =~ s/__must_check +//;
+    $prototype =~ s/__weak +//;
+    $prototype =~ s/__sched +//;
+    $prototype =~ s/__printf\s*\(\s*\d*\s*,\s*\d*\s*\) +//;
+    $prototype =~ s/__(?:re)?alloc_size\s*\(\s*\d+\s*(?:,\s*\d+\s*)?\) +//;
+    $prototype =~ s/__diagnose_as\s*\(\s*\S+\s*(?:,\s*\d+\s*)*\) +//;
+    my $define = $prototype =~ s/^#\s*define\s+//; #ak added
+    $prototype =~ s/__attribute_const__ +//;
+    $prototype =~ s/__attribute__\s*\(\(
+            (?:
+                 [\w\s]++          # attribute name
+                 (?:\([^)]*+\))?   # attribute arguments
+                 \s*+,?            # optional comma at the end
+            )+
+          \)\)\s+//x;
+
+    # Yes, this truly is vile.  We are looking for:
+    # 1. Return type (may be nothing if we're looking at a macro)
+    # 2. Function name
+    # 3. Function parameters.
+    #
+    # All the while we have to watch out for function pointer parameters
+    # (which IIRC is what the two sections are for), C types (these
+    # regexps don't even start to express all the possibilities), and
+    # so on.
+    #
+    # If you mess with these regexps, it's a good idea to check that
+    # the following functions' documentation still comes out right:
+    # - parport_register_device (function pointer parameters)
+    # - atomic_set (macro)
+    # - pci_match_device, __copy_to_user (long return type)
+    my $name = qr{[a-zA-Z0-9_~:]+};
+    my $prototype_end1 = qr{[^\(]*};
+    my $prototype_end2 = qr{[^\{]*};
+    my $prototype_end = qr{\(($prototype_end1|$prototype_end2)\)};
+    my $type1 = qr{[\w\s]+};
+    my $type2 = qr{$type1\*+};
+
+    if ($define && $prototype =~ m/^()($name)\s+/) {
+        # This is an object-like macro, it has no return type and no parameter
+        # list.
+        # Function-like macros are not allowed to have spaces between
+        # declaration_name and opening parenthesis (notice the \s+).
+        $return_type = $1;
+        $declaration_name = $2;
+        $noret = 1;
+    } elsif ($prototype =~ m/^()($name)\s*$prototype_end/ ||
+	$prototype =~ m/^($type1)\s+($name)\s*$prototype_end/ ||
+	$prototype =~ m/^($type2+)\s*($name)\s*$prototype_end/)  {
+	$return_type = $1;
+	$declaration_name = $2;
+	my $args = $3;
+
+	create_parameterlist($args, ',', $file, $declaration_name);
+    } else {
+	emit_warning("${file}:$.", "cannot understand function prototype: '$prototype'\n");
+	return;
+    }
+
+    if ($identifier ne $declaration_name) {
+	emit_warning("${file}:$.", "expecting prototype for $identifier(). Prototype was for $declaration_name() instead\n");
+	return;
+    }
+
+    my $prms = join " ", @parameterlist;
+    check_sections($file, $declaration_name, "function", $sectcheck, $prms);
+
+    # This check emits a lot of warnings at the moment, because many
+    # functions don't have a 'Return' doc section. So until the number
+    # of warnings goes sufficiently down, the check is only performed in
+    # -Wreturn mode.
+    # TODO: always perform the check.
+    if ($Wreturn && !$noret) {
+	    check_return_section($file, $declaration_name, $return_type);
+    }
+
+    # The function parser can be called with a typedef parameter.
+    # Handle it.
+    if ($return_type =~ /typedef/) {
+	output_declaration($declaration_name,
+			   'function',
+			   {'function' => $declaration_name,
+			    'typedef' => 1,
+			    'module' => $modulename,
+			    'functiontype' => $return_type,
+			    'parameterlist' => \@parameterlist,
+			    'parameterdescs' => \%parameterdescs,
+			    'parametertypes' => \%parametertypes,
+			    'sectionlist' => \@sectionlist,
+			    'sections' => \%sections,
+			    'purpose' => $declaration_purpose
+			   });
+    } else {
+	output_declaration($declaration_name,
+			   'function',
+			   {'function' => $declaration_name,
+			    'module' => $modulename,
+			    'functiontype' => $return_type,
+			    'parameterlist' => \@parameterlist,
+			    'parameterdescs' => \%parameterdescs,
+			    'parametertypes' => \%parametertypes,
+			    'sectionlist' => \@sectionlist,
+			    'sections' => \%sections,
+			    'purpose' => $declaration_purpose
+			   });
+    }
+}
+
+sub reset_state {
+    $function = "";
+    %parameterdescs = ();
+    %parametertypes = ();
+    @parameterlist = ();
+    %sections = ();
+    @sectionlist = ();
+    $sectcheck = "";
+    $struct_actual = "";
+    $prototype = "";
+
+    $state = STATE_NORMAL;
+    $inline_doc_state = STATE_INLINE_NA;
+}
+
+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)) {
+		emit_warning("${file}:$.", "Unrecognized tracepoint format: \n".
+			     "$prototype\n");
+	} else {
+		$prototype = "static inline void trace_$tracepointname($tracepointargs)";
+		$identifier = "trace_$identifier";
+	}
+}
+
+sub syscall_munge() {
+	my $void = 0;
+
+	$prototype =~ s@[\r\n]+@ @gos; # strip newlines/CR's
+##	if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
+	if ($prototype =~ m/SYSCALL_DEFINE0/) {
+		$void = 1;
+##		$prototype = "long sys_$1(void)";
+	}
+
+	$prototype =~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func name
+	if ($prototype =~ m/long (sys_.*?),/) {
+		$prototype =~ s/,/\(/;
+	} elsif ($void) {
+		$prototype =~ s/\)/\(void\)/;
+	}
+
+	# now delete all of the odd-number commas in $prototype
+	# so that arg types & arg names don't have a comma between them
+	my $count = 0;
+	my $len = length($prototype);
+	if ($void) {
+		$len = 0;	# skip the for-loop
+	}
+	for (my $ix = 0; $ix < $len; $ix++) {
+		if (substr($prototype, $ix, 1) eq ',') {
+			$count++;
+			if ($count % 2 == 1) {
+				substr($prototype, $ix, 1) = ' ';
+			}
+		}
+	}
+}
+
+sub process_proto_function($$) {
+    my $x = shift;
+    my $file = shift;
+
+    $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
+
+    if ($x =~ m#\s*/\*\s+MACDOC\s*#io || ($x =~ /^#/ && $x !~ /^#\s*define/)) {
+	# do nothing
+    }
+    elsif ($x =~ /([^\{]*)/) {
+	$prototype .= $1;
+    }
+
+    if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) {
+	$prototype =~ s@/\*.*?\*/@@gos;	# strip comments.
+	$prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
+	$prototype =~ s@^\s+@@gos; # strip leading spaces
+
+	 # Handle prototypes for function pointers like:
+	 # int (*pcs_config)(struct foo)
+	$prototype =~ s@^(\S+\s+)\(\s*\*(\S+)\)@$1$2@gos;
+
+	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();
+    }
+}
+
+sub process_proto_type($$) {
+    my $x = shift;
+    my $file = shift;
+
+    $x =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
+    $x =~ s@^\s+@@gos; # strip leading spaces
+    $x =~ s@\s+$@@gos; # strip trailing spaces
+    $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
+
+    if ($x =~ /^#/) {
+	# To distinguish preprocessor directive from regular declaration later.
+	$x .= ";";
+    }
+
+    while (1) {
+	if ( $x =~ /([^\{\};]*)([\{\};])(.*)/ ) {
+            if( length $prototype ) {
+                $prototype .= " "
+            }
+	    $prototype .= $1 . $2;
+	    ($2 eq '{') && $brcount++;
+	    ($2 eq '}') && $brcount--;
+	    if (($2 eq ';') && ($brcount == 0)) {
+		dump_declaration($prototype, $file);
+		reset_state();
+		last;
+	    }
+	    $x = $3;
+	} else {
+	    $prototype .= $x;
+	    last;
+	}
+    }
+}
+
+
+sub map_filename($) {
+    my $file;
+    my ($orig_file) = @_;
+
+    if (defined($ENV{'SRCTREE'})) {
+	$file = "$ENV{'SRCTREE'}" . "/" . $orig_file;
+    } 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;
+    }
+
+    while (<IN>) {
+	if (/$export_symbol/) {
+	    next if (defined($nosymbol_table{$2}));
+	    $function_table{$2} = 1;
+	}
+	if (/$export_symbol_ns/) {
+	    next if (defined($nosymbol_table{$2}));
+	    $function_table{$2} = 1;
+	}
+    }
+
+    close(IN);
+}
+
+#
+# Parsers for the various processing states.
+#
+# STATE_NORMAL: looking for the /** to begin everything.
+#
+sub process_normal() {
+    if (/$doc_start/o) {
+	$state = STATE_NAME;	# next line is always the function name
+	$in_doc_sect = 0;
+	$declaration_start_line = $. + 1;
+    }
+}
+
+#
+# STATE_NAME: Looking for the "name - description" line
+#
+sub process_name($$) {
+    my $file = shift;
+    my $descr;
+
+    if (/$doc_block/o) {
+	$state = STATE_DOCBLOCK;
+	$contents = "";
+	$new_start_line = $.;
+
+	if ( $1 eq "" ) {
+	    $section = $section_intro;
+	} else {
+	    $section = $1;
+	}
+    } elsif (/$doc_decl/o) {
+	$identifier = $1;
+	my $is_kernel_comment = 0;
+	my $decl_start = qr{$doc_com};
+	# test for pointer declaration type, foo * bar() - desc
+	my $fn_type = qr{\w+\s*\*\s*}; 
+	my $parenthesis = qr{\(\w*\)};
+	my $decl_end = qr{[-:].*};
+	if (/^$decl_start([\w\s]+?)$parenthesis?\s*$decl_end?$/) {
+	    $identifier = $1;
+	}
+	if ($identifier =~ m/^(struct|union|enum|typedef)\b\s*(\S*)/) {
+	    $decl_type = $1;
+	    $identifier = $2;
+	    $is_kernel_comment = 1;
+	}
+	# Look for foo() or static void foo() - description; or misspelt
+	# identifier
+	elsif (/^$decl_start$fn_type?(\w+)\s*$parenthesis?\s*$decl_end?$/ ||
+	    /^$decl_start$fn_type?(\w+.*)$parenthesis?\s*$decl_end$/) {
+	    $identifier = $1;
+	    $decl_type = 'function';
+	    $identifier =~ s/^define\s+//;
+	    $is_kernel_comment = 1;
+	}
+	$identifier =~ s/\s+$//;
+
+	$state = STATE_BODY;
+	# if there's no @param blocks need to set up default section
+	# here
+	$contents = "";
+	$section = $section_default;
+	$new_start_line = $. + 1;
+	if (/[-:](.*)/) {
+	    # strip leading/trailing/multiple spaces
+	    $descr= $1;
+	    $descr =~ s/^\s*//;
+	    $descr =~ s/\s*$//;
+	    $descr =~ s/\s+/ /g;
+	    $declaration_purpose = $descr;
+	    $state = STATE_BODY_MAYBE;
+	} else {
+	    $declaration_purpose = "";
+	}
+
+	if (!$is_kernel_comment) {
+	    emit_warning("${file}:$.", "This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst\n$_");
+	    $state = STATE_NORMAL;
+	}
+
+	if (($declaration_purpose eq "") && $Wshort_desc) {
+	    emit_warning("${file}:$.", "missing initial short description on line:\n$_");
+	}
+
+	if ($identifier eq "" && $decl_type ne "enum") {
+	    emit_warning("${file}:$.", "wrong kernel-doc identifier on line:\n$_");
+	    $state = STATE_NORMAL;
+	}
+
+	if ($verbose) {
+	    print STDERR "${file}:$.: info: Scanning doc for $decl_type $identifier\n";
+	}
+    } else {
+	emit_warning("${file}:$.", "Cannot understand $_ on line $. - I thought it was a doc line\n");
+	$state = STATE_NORMAL;
+    }
+}
+
+
+#
+# STATE_BODY and STATE_BODY_MAYBE: the bulk of a kerneldoc comment.
+#
+sub process_body($$) {
+    my $file = shift;
+
+    if ($state == STATE_BODY_WITH_BLANK_LINE && /^\s*\*\s?\S/) {
+	dump_section($file, $section, $contents);
+	$section = $section_default;
+	$new_start_line = $.;
+	$contents = "";
+    }
+
+    if (/$doc_sect/i) { # case insensitive for supported section names
+	$newsection = $1;
+	$newcontents = $2;
+
+	# map the supported section names to the canonical names
+	if ($newsection =~ m/^description$/i) {
+	    $newsection = $section_default;
+	} elsif ($newsection =~ m/^context$/i) {
+	    $newsection = $section_context;
+	} elsif ($newsection =~ m/^returns?$/i) {
+	    $newsection = $section_return;
+	} elsif ($newsection =~ m/^\@return$/) {
+	    # special: @return is a section, not a param description
+	    $newsection = $section_return;
+	}
+
+	if (($contents ne "") && ($contents ne "\n")) {
+	    if (!$in_doc_sect && $Wcontents_before_sections) {
+		emit_warning("${file}:$.", "contents before sections\n");
+	    }
+	    dump_section($file, $section, $contents);
+	    $section = $section_default;
+	}
+
+	$in_doc_sect = 1;
+	$state = STATE_BODY;
+	$contents = $newcontents;
+	$new_start_line = $.;
+	while (substr($contents, 0, 1) eq " ") {
+	    $contents = substr($contents, 1);
+	}
+	if ($contents ne "") {
+	    $contents .= "\n";
+	}
+	$section = $newsection;
+	$leading_space = undef;
+    } elsif (/$doc_end/) {
+	if (($contents ne "") && ($contents ne "\n")) {
+	    dump_section($file, $section, $contents);
+	    $section = $section_default;
+	    $contents = "";
+	}
+	# look for doc_com + <text> + doc_end:
+	if ($_ =~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') {
+	    emit_warning("${file}:$.", "suspicious ending line: $_");
+	}
+
+	$prototype = "";
+	$state = STATE_PROTO;
+	$brcount = 0;
+        $new_start_line = $. + 1;
+    } elsif (/$doc_content/) {
+	if ($1 eq "") {
+	    if ($section eq $section_context) {
+		dump_section($file, $section, $contents);
+		$section = $section_default;
+		$contents = "";
+		$new_start_line = $.;
+		$state = STATE_BODY;
+	    } else {
+		if ($section ne $section_default) {
+		    $state = STATE_BODY_WITH_BLANK_LINE;
+		} else {
+		    $state = STATE_BODY;
+		}
+		$contents .= "\n";
+	    }
+	} elsif ($state == STATE_BODY_MAYBE) {
+	    # Continued declaration purpose
+	    chomp($declaration_purpose);
+	    $declaration_purpose .= " " . $1;
+	    $declaration_purpose =~ s/\s+/ /g;
+	} else {
+	    my $cont = $1;
+	    if ($section =~ m/^@/ || $section eq $section_context) {
+		if (!defined $leading_space) {
+		    if ($cont =~ m/^(\s+)/) {
+			$leading_space = $1;
+		    } else {
+			$leading_space = "";
+		    }
+		}
+		$cont =~ s/^$leading_space//;
+	    }
+	    $contents .= $cont . "\n";
+	}
+    } else {
+	# i dont know - bad line?  ignore.
+	emit_warning("${file}:$.", "bad line: $_");
+    }
+}
+
+
+#
+# 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);
+    }
+}
+
+#
+# STATE_DOCBLOCK: within a DOC: block.
+#
+sub process_docblock($$) {
+    my $file = shift;
+
+    if (/$doc_end/) {
+	dump_doc_section($file, $section, $contents);
+	$section = $section_default;
+	$contents = "";
+	$function = "";
+	%parameterdescs = ();
+	%parametertypes = ();
+	@parameterlist = ();
+	%sections = ();
+	@sectionlist = ();
+	$prototype = "";
+	$state = STATE_NORMAL;
+    } elsif (/$doc_content/) {
+	if ( $1 eq "" )	{
+	    $contents .= $blankline;
+	} else {
+	    $contents .= $1 . "\n";
+	}
+    }
+}
+
+#
+# STATE_INLINE: docbook comments within a prototype.
+#
+sub process_inline($$) {
+    my $file = shift;
+
+    # First line (state 1) needs to be a @parameter
+    if ($inline_doc_state == STATE_INLINE_NAME && /$doc_inline_sect/o) {
+	$section = $1;
+	$contents = $2;
+	$new_start_line = $.;
+	if ($contents ne "") {
+	    while (substr($contents, 0, 1) eq " ") {
+		$contents = substr($contents, 1);
+	    }
+	    $contents .= "\n";
+	}
+	$inline_doc_state = STATE_INLINE_TEXT;
+	# Documentation block end */
+    } elsif (/$doc_inline_end/) {
+	if (($contents ne "") && ($contents ne "\n")) {
+	    dump_section($file, $section, $contents);
+	    $section = $section_default;
+	    $contents = "";
+	}
+	$state = STATE_PROTO;
+	$inline_doc_state = STATE_INLINE_NA;
+	# Regular text
+    } elsif (/$doc_content/) {
+	if ($inline_doc_state == STATE_INLINE_TEXT) {
+	    $contents .= $1 . "\n";
+	    # nuke leading blank lines
+	    if ($contents =~ /^\s*$/) {
+		$contents = "";
+	    }
+	} elsif ($inline_doc_state == STATE_INLINE_NAME) {
+	    $inline_doc_state = STATE_INLINE_ERROR;
+	    emit_warning("${file}:$.", "Incorrect use of kernel-doc format: $_");
+	}
+    }
+}
+
+
+sub process_file($) {
+    my $file;
+    my $initial_section_counter = $section_counter;
+    my ($orig_file) = @_;
+
+    $file = map_filename($orig_file);
+
+    if (!open(IN_FILE,"<$file")) {
+	print STDERR "Error: Cannot open file $file\n";
+	++$errors;
+	return;
+    }
+
+    $. = 1;
+
+    $section_counter = 0;
+    while (<IN_FILE>) {
+	while (s/\\\s*$//) {
+	    $_ .= <IN_FILE>;
+	}
+	# Replace tabs by spaces
+        while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
+	# Hand this line to the appropriate state handler
+	if ($state == STATE_NORMAL) {
+	    process_normal();
+	} elsif ($state == STATE_NAME) {
+	    process_name($file, $_);
+	} elsif ($state == STATE_BODY || $state == STATE_BODY_MAYBE ||
+		 $state == STATE_BODY_WITH_BLANK_LINE) {
+	    process_body($file, $_);
+	} elsif ($state == STATE_INLINE) { # scanning for inline parameters
+	    process_inline($file, $_);
+	} elsif ($state == STATE_PROTO) {
+	    process_proto($file, $_);
+	} elsif ($state == STATE_DOCBLOCK) {
+	    process_docblock($file, $_);
+	}
+    }
+
+    # Make sure we got something interesting.
+    if ($initial_section_counter == $section_counter && $
+	output_mode ne "none") {
+	if ($output_selection == OUTPUT_INCLUDE) {
+	    emit_warning("${file}:1", "'$_' not found\n")
+		for keys %function_table;
+	}
+	else {
+	    emit_warning("${file}:1", "no structured comments found\n");
+	}
+    }
+    close IN_FILE;
+}
+
+
+if ($output_mode eq "rst") {
+	get_sphinx_version() if (!$sphinx_major);
+}
+
+$kernelversion = get_kernel_version();
+
+# generate a sequence of code that will splice in highlighting information
+# using the s// operator.
+for (my $k = 0; $k < @highlights; $k++) {
+    my $pattern = $highlights[$k][0];
+    my $result = $highlights[$k][1];
+#   print STDERR "scanning pattern:$pattern, highlight:($result)\n";
+    $dohighlight .=  "\$contents =~ s:$pattern:$result:gs;\n";
+}
+
+# Read the file that maps relative names to absolute names for
+# separate source and object directories and for shadow trees.
+if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
+	my ($relname, $absname);
+	while(<SOURCE_MAP>) {
+		chop();
+		($relname, $absname) = (split())[0..1];
+		$relname =~ s:^/+::;
+		$source_map{$relname} = $absname;
+	}
+	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($_);
+}
+if ($verbose && $errors) {
+  print STDERR "$errors errors\n";
+}
+if ($verbose && $warnings) {
+  print STDERR "$warnings warnings\n";
+}
+
+if ($Werror && $warnings) {
+    print STDERR "$warnings warnings as Errors\n";
+    exit($warnings);
+} else {
+    exit($output_mode eq "none" ? 0 : $errors)
+}
+
+__END__
+
+=head1 OPTIONS
+
+=head2 Output format selection (mutually exclusive):
+
+=over 8
+
+=item -man
+
+Output troff manual page format.
+
+=item -rst
+
+Output reStructuredText format. This is the default.
+
+=item -none
+
+Do not output documentation, only warnings.
+
+=back
+
+=head2 Output format modifiers
+
+=head3 reStructuredText only
+
+=over 8
+
+=item -sphinx-version VERSION
+
+Use the ReST C domain dialect compatible with a specific Sphinx Version.
+
+If not specified, kernel-doc will auto-detect using the sphinx-build version
+found on PATH.
+
+=back
+
+=head2 Output selection (mutually exclusive):
+
+=over 8
+
+=item -export
+
+Only output documentation for the symbols that have been exported using
+EXPORT_SYMBOL() and related macros in any input FILE or -export-file FILE.
+
+=item -internal
+
+Only output documentation for the symbols that have NOT been exported using
+EXPORT_SYMBOL() and related macros in any input FILE or -export-file FILE.
+
+=item -function NAME
+
+Only output documentation for the given function or DOC: section title.
+All other functions and DOC: sections are ignored.
+
+May be specified multiple times.
+
+=item -nosymbol NAME
+
+Exclude the specified symbol from the output documentation.
+
+May be specified multiple times.
+
+=back
+
+=head2 Output selection modifiers:
+
+=over 8
+
+=item -no-doc-sections
+
+Do not output DOC: sections.
+
+=item -export-file FILE
+
+Specify an additional FILE in which to look for EXPORT_SYMBOL information.
+
+To be used with -export or -internal.
+
+May be specified multiple times.
+
+=back
+
+=head3 reStructuredText only
+
+=over 8
+
+=item -enable-lineno
+
+Enable output of .. LINENO lines.
+
+=back
+
+=head2 Other parameters:
+
+=over 8
+
+=item -h, -help
+
+Print this help.
+
+=item -v
+
+Verbose output, more warnings and other information.
+
+=item -Werror
+
+Treat warnings as errors.
+
+=back
+
+=cut
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 01/10] make: add target to check kernel-doc comments Nico Boehr
@ 2023-11-06 12:50 ` Nico Boehr
  2023-11-06 16:53   ` Claudio Imbrenda
  2023-11-22 12:28   ` Thomas Huth
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 03/10] lib: s390x: cpacf: move kernel-doc comment to correct function Nico Boehr
                   ` (8 subsequent siblings)
  10 siblings, 2 replies; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:50 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

These comments do not follow the kernel-doc style, hence they should not
start with /**.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 powerpc/emulator.c    | 2 +-
 powerpc/spapr_hcall.c | 6 +++---
 powerpc/spapr_vpa.c   | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/powerpc/emulator.c b/powerpc/emulator.c
index 65ae4b65e655..39dd59645368 100644
--- a/powerpc/emulator.c
+++ b/powerpc/emulator.c
@@ -71,7 +71,7 @@ static void test_64bit(void)
 	report_prefix_pop();
 }
 
-/**
+/*
  * Test 'Load String Word Immediate' instruction
  */
 static void test_lswi(void)
diff --git a/powerpc/spapr_hcall.c b/powerpc/spapr_hcall.c
index 0d0f25afe9f6..e9b5300a3912 100644
--- a/powerpc/spapr_hcall.c
+++ b/powerpc/spapr_hcall.c
@@ -16,7 +16,7 @@
 #define H_ZERO_PAGE	(1UL << (63-48))
 #define H_COPY_PAGE	(1UL << (63-49))
 
-/**
+/*
  * Test the H_SET_SPRG0 h-call by setting some values and checking whether
  * the SPRG0 register contains the correct values afterwards
  */
@@ -46,7 +46,7 @@ static void test_h_set_sprg0(int argc, char **argv)
 	       sprg0_orig);
 }
 
-/**
+/*
  * Test the H_PAGE_INIT h-call by using it to clear and to copy a page, and
  * by checking for the correct values in the destination page afterwards
  */
@@ -97,7 +97,7 @@ static int h_random(uint64_t *val)
 	return r3;
 }
 
-/**
+/*
  * Test H_RANDOM by calling it a couple of times to check whether all bit
  * positions really toggle (there should be no "stuck" bits in the output)
  */
diff --git a/powerpc/spapr_vpa.c b/powerpc/spapr_vpa.c
index 5586eb8d3341..6a3fe5e3f974 100644
--- a/powerpc/spapr_vpa.c
+++ b/powerpc/spapr_vpa.c
@@ -53,7 +53,7 @@ static void print_vpa(struct vpa *vpa)
 #define SUBFUNC_REGISTER	(1ULL << 45)
 #define SUBFUNC_DEREGISTER	(5ULL << 45)
 
-/**
+/*
  * Test the H_REGISTER_VPA h-call register/deregister calls.
  */
 static void test_register_vpa(void)
@@ -111,7 +111,7 @@ static void test_register_vpa(void)
 	report_prefix_pop();
 }
 
-/**
+/*
  * Test some VPA fields.
  */
 static void test_vpa(void)
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 03/10] lib: s390x: cpacf: move kernel-doc comment to correct function
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 01/10] make: add target to check kernel-doc comments Nico Boehr
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments Nico Boehr
@ 2023-11-06 12:50 ` Nico Boehr
  2023-11-22 12:47   ` Thomas Huth
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 04/10] s390x: properly format non-kernel-doc comments Nico Boehr
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:50 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

The kernel-doc comment seems to describe a different function further at
the bottom of the file; move the comment there and adjust the comment
accordingly.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 lib/s390x/asm/cpacf.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/s390x/asm/cpacf.h b/lib/s390x/asm/cpacf.h
index 685262b0ff62..378cd5cffcbf 100644
--- a/lib/s390x/asm/cpacf.h
+++ b/lib/s390x/asm/cpacf.h
@@ -137,16 +137,6 @@
 
 typedef struct { unsigned char bytes[16]; } cpacf_mask_t;
 
-/**
- * cpacf_query() - check if a specific CPACF function is available
- * @opcode: the opcode of the crypto instruction
- * @func: the function code to test for
- *
- * Executes the query function for the given crypto instruction @opcode
- * and checks if @func is available
- *
- * Returns 1 if @func is available for @opcode, 0 otherwise
- */
 static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
 {
 	register unsigned long r0 asm("0") = 0;	/* query function */
@@ -200,6 +190,16 @@ static inline int cpacf_test_func(cpacf_mask_t *mask, unsigned int func)
 	return (mask->bytes[func >> 3] & (0x80 >> (func & 7))) != 0;
 }
 
+/**
+ * cpacf_query_func() - check if a specific CPACF function is available
+ * @opcode: the opcode of the crypto instruction
+ * @func: the function code to test for
+ *
+ * Executes the query function for the given crypto instruction @opcode
+ * and checks if @func is available
+ *
+ * Returns 1 if @func is available for @opcode, 0 otherwise
+ */
 static inline int cpacf_query_func(unsigned int opcode, unsigned int func)
 {
 	cpacf_mask_t mask;
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 04/10] s390x: properly format non-kernel-doc comments
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
                   ` (2 preceding siblings ...)
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 03/10] lib: s390x: cpacf: move kernel-doc comment to correct function Nico Boehr
@ 2023-11-06 12:51 ` Nico Boehr
  2023-11-06 16:54   ` Claudio Imbrenda
  2023-11-22 12:47   ` Thomas Huth
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 05/10] s390x: ensure kernel-doc parameters are properly formated Nico Boehr
                   ` (6 subsequent siblings)
  10 siblings, 2 replies; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:51 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

These comments do not follow the kernel-doc style, hence they should not
start with /**.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 s390x/sclp.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/s390x/sclp.c b/s390x/sclp.c
index 1abb9029f984..ccbaa9136fdb 100644
--- a/s390x/sclp.c
+++ b/s390x/sclp.c
@@ -32,7 +32,7 @@ static union {
 } sccb_template;
 static uint32_t valid_code;						/* valid command code for READ SCP INFO */
 
-/**
+/*
  * Perform one service call, handling exceptions and interrupts.
  */
 static int sclp_service_call_test(unsigned int command, void *sccb)
@@ -51,7 +51,7 @@ static int sclp_service_call_test(unsigned int command, void *sccb)
 	return cc;
 }
 
-/**
+/*
  * Perform one test at the given address, optionally using the SCCB template,
  * checking for the expected program interrupts and return codes.
  *
@@ -96,7 +96,7 @@ static bool test_one_sccb(uint32_t cmd, uint8_t *addr, uint16_t buf_len, uint64_
 	return true;
 }
 
-/**
+/*
  * Wrapper for test_one_sccb to be used when the template should not be
  * copied and the memory address should not be touched.
  */
@@ -105,7 +105,7 @@ static bool test_one_ro(uint32_t cmd, uint8_t *addr, uint64_t exp_pgm, uint16_t
 	return test_one_sccb(cmd, addr, 0, exp_pgm, exp_rc);
 }
 
-/**
+/*
  * Wrapper for test_one_sccb to set up a simple SCCB template.
  *
  * The parameter sccb_len indicates the value that will be saved in the SCCB
@@ -124,7 +124,7 @@ static bool test_one_simple(uint32_t cmd, uint8_t *addr, uint16_t sccb_len,
 	return test_one_sccb(cmd, addr, buf_len, exp_pgm, exp_rc);
 }
 
-/**
+/*
  * Test SCCB lengths < 8.
  */
 static void test_sccb_too_short(void)
@@ -138,7 +138,7 @@ static void test_sccb_too_short(void)
 	report(len == 8, "SCCB too short");
 }
 
-/**
+/*
  * Test SCCBs that are not 64-bit aligned.
  */
 static void test_sccb_unaligned(void)
@@ -151,7 +151,7 @@ static void test_sccb_unaligned(void)
 	report(offset == 8, "SCCB unaligned");
 }
 
-/**
+/*
  * Test SCCBs whose address is in the lowcore or prefix area.
  */
 static void test_sccb_prefix(void)
@@ -202,7 +202,7 @@ static void test_sccb_prefix(void)
 	set_prefix(prefix);
 }
 
-/**
+/*
  * Test SCCBs that are above 2GB. If outside of memory, an addressing
  * exception is also allowed.
  */
@@ -245,7 +245,7 @@ static void test_sccb_high(void)
 	report(i == len, "SCCB high addresses");
 }
 
-/**
+/*
  * Test invalid commands, both invalid command detail codes and valid
  * ones with invalid command class code.
  */
@@ -275,7 +275,7 @@ static void test_inval(void)
 }
 
 
-/**
+/*
  * Test short SCCBs (but larger than 8).
  */
 static void test_short(void)
@@ -294,7 +294,7 @@ static void test_short(void)
 	report(len == 40, "Insufficient SCCB length (Read CPU info)");
 }
 
-/**
+/*
  * Test SCCB page boundary violations.
  */
 static void test_boundary(void)
@@ -318,7 +318,7 @@ out:
 	report(len > 4096 && offset == 4096, "SCCB page boundary violation");
 }
 
-/**
+/*
  * Test excessively long SCCBs.
  */
 static void test_toolong(void)
@@ -338,7 +338,7 @@ static void test_toolong(void)
 	report(len == 8192, "SCCB bigger than 4k");
 }
 
-/**
+/*
  * Test privileged operation.
  */
 static void test_priv(void)
@@ -354,7 +354,7 @@ static void test_priv(void)
 	report_prefix_pop();
 }
 
-/**
+/*
  * Test addressing exceptions. We need to test SCCB addresses between the
  * end of available memory and 2GB, because after 2GB a specification
  * exception is also allowed.
@@ -393,7 +393,7 @@ out:
 	report(i + maxram >= 0x80000000, "Invalid SCCB address");
 }
 
-/**
+/*
  * Test some bits in the instruction format that are specified to be ignored.
  */
 static void test_instbits(void)
@@ -422,7 +422,7 @@ static void test_instbits(void)
 	report(cc == 0, "Instruction format ignored bits");
 }
 
-/**
+/*
  * Find a valid READ INFO command code; not all codes are always allowed, and
  * probing should be performed in the right order.
  */
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 05/10] s390x: ensure kernel-doc parameters are properly formated
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
                   ` (3 preceding siblings ...)
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 04/10] s390x: properly format non-kernel-doc comments Nico Boehr
@ 2023-11-06 12:51 ` Nico Boehr
  2023-11-22 12:49   ` Thomas Huth
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 06/10] x86: properly format non-kernel-doc comments Nico Boehr
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:51 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

In kernel-doc, parameters names should end in a colon (:). Add them
where they are missing.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 lib/s390x/interrupt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
index 3f993a363ae2..75edcbfecb7d 100644
--- a/lib/s390x/interrupt.c
+++ b/lib/s390x/interrupt.c
@@ -61,7 +61,7 @@ uint16_t clear_pgm_int(void)
 
 /**
  * check_pgm_int_code - Check the program interrupt code on the current CPU.
- * @code the expected program interrupt code on the current CPU
+ * @code: the expected program interrupt code on the current CPU
  *
  * Check and report if the program interrupt on the current CPU matches the
  * expected one.
@@ -77,7 +77,7 @@ void check_pgm_int_code(uint16_t code)
 /**
  * register_pgm_cleanup_func - Register a cleanup function for progam
  * interrupts for the current CPU.
- * @f the cleanup function to be registered on the current CPU
+ * @f: the cleanup function to be registered on the current CPU
  *
  * Register a cleanup function to be called at the end of the normal
  * interrupt handling for program interrupts for this CPU.
@@ -92,7 +92,7 @@ void register_pgm_cleanup_func(void (*f)(struct stack_frame_int *))
 /**
  * register_ext_cleanup_func - Register a cleanup function for external
  * interrupts for the current CPU.
- * @f the cleanup function to be registered on the current CPU
+ * @f: the cleanup function to be registered on the current CPU
  *
  * Register a cleanup function to be called at the end of the normal
  * interrupt handling for external interrupts for this CPU.
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 06/10] x86: properly format non-kernel-doc comments
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
                   ` (4 preceding siblings ...)
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 05/10] s390x: ensure kernel-doc parameters are properly formated Nico Boehr
@ 2023-11-06 12:51 ` Nico Boehr
  2023-11-22 12:49   ` Thomas Huth
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 07/10] s390x: cpumodel: list tcg_fail explicitly Nico Boehr
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:51 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

These comments do not follow the kernel-doc style, hence they should not
start with /**.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 x86/msr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/msr.c b/x86/msr.c
index 789f23f8de78..3a041fab160a 100644
--- a/x86/msr.c
+++ b/x86/msr.c
@@ -6,7 +6,7 @@
 #include "msr.h"
 #include <stdlib.h>
 
-/**
+/*
  * This test allows two modes:
  * 1. Default: the `msr_info' array contains the default test configurations
  * 2. Custom: by providing command line arguments it is possible to test any MSR and value
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 07/10] s390x: cpumodel: list tcg_fail explicitly
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
                   ` (5 preceding siblings ...)
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 06/10] x86: properly format non-kernel-doc comments Nico Boehr
@ 2023-11-06 12:51 ` Nico Boehr
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 08/10] s390x: gs: turn off formatter for inline assembly Nico Boehr
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:51 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

This makes the list more readable.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 s390x/cpumodel.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/s390x/cpumodel.c b/s390x/cpumodel.c
index 5c0b73e0f9fe..5734312b102d 100644
--- a/s390x/cpumodel.c
+++ b/s390x/cpumodel.c
@@ -84,28 +84,28 @@ static struct {
 	bool expected_tcg_fail;
 } dep[] = {
 	/* from SA22-7832-11 4-98 facility indications */
-	{   4,   3 },
-	{   5,   3 },
-	{   5,   4 },
-	{  19,  18 },
+	{   4,   3, false },
+	{   5,   3, false },
+	{   5,   4, false },
+	{  19,  18, false },
 	{  37,  42, true },  /* TCG does not have DFP and won't get it soon */
-	{  43,  42 },
-	{  73,  49 },
-	{ 134, 129 },
-	{ 135, 129 },
-	{ 139,  25 },
-	{ 139,  28 },
-	{ 146,  76 },
+	{  43,  42, false },
+	{  73,  49, false },
+	{ 134, 129, false },
+	{ 135, 129, false },
+	{ 139,  25, false },
+	{ 139,  28, false },
+	{ 146,  76, false },
 	/* indirectly documented in description */
-	{  78,   8 },  /* EDAT */
+	{  78,   8, false },  /* EDAT */
 	/* new dependencies from gen15 */
-	{  61,  45 },
-	{ 148, 129 },
-	{ 148, 135 },
-	{ 152, 129 },
-	{ 152, 134 },
-	{ 155,  76 },
-	{ 155,  77 },
+	{  61,  45, false },
+	{ 148, 129, false },
+	{ 148, 135, false },
+	{ 152, 129, false },
+	{ 152, 134, false },
+	{ 155,  76, false },
+	{ 155,  77, false },
 };
 
 int main(void)
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 08/10] s390x: gs: turn off formatter for inline assembly
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
                   ` (6 preceding siblings ...)
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 07/10] s390x: cpumodel: list tcg_fail explicitly Nico Boehr
@ 2023-11-06 12:51 ` Nico Boehr
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 09/10] add clang-format configuration file Nico Boehr
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:51 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

clang-format does not properly understand the code and aligns the first
opening quote on consecutive lines with the last opening quote on the
previous line like so:

" some string " CONCATED_WITH_MACRO " continues here "
                                    " weird indent for some reason"

Disable clang-format for this block of code and properly align the
indented asm with the opening parenthesis.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 s390x/gs.c | 44 +++++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/s390x/gs.c b/s390x/gs.c
index 9ae893eaf89a..7e08c2a78d32 100644
--- a/s390x/gs.c
+++ b/s390x/gs.c
@@ -35,28 +35,30 @@ static inline unsigned long load_guarded(unsigned long *p)
 }
 
 /* guarded-storage event handler and finally it calls gs_handler */
+/* clang-format off */
 extern void gs_handler_asm(void);
-	asm (          ".macro	STGSC	args:vararg\n"
-		"	.insn	rxy,0xe30000000049,\\args\n"
-		"	.endm\n"
-		"	.globl	gs_handler_asm\n"
-		"gs_handler_asm:\n"
-		"	lgr	%r14,%r15\n"				/* Save current stack address in r14 */
-		".Lgs_handler_frame = 16*8+32+" xstr(STACK_FRAME_SIZE) "\n"
-		"	aghi	%r15,-(.Lgs_handler_frame)\n"		/* Allocate stack frame */
-		"	stmg	%r0,%r13,192(%r15)\n"			/* Store regs to save area */
-		"	stg	%r14,312(%r15)\n"
-		"	la	%r2," xstr(STACK_FRAME_SIZE) "(%r15)\n"	/* Store gscb address in this_cb */
-		"	STGSC	%r0," xstr(STACK_FRAME_SIZE) "(%r15)\n"
-		"	lg	%r14,24(%r2)\n"				/* Get GSEPLA from GSCB*/
-		"	lg	%r14,40(%r14)\n"			/* Get GSERA from GSEPL*/
-		"	stg	%r14,304(%r15)\n"			/* Store GSERA in r14 of reg save area */
-		"	brasl	%r14,gs_handler\n"			/* Jump to gs_handler */
-		"	lmg	%r0,%r15,192(%r15)\n"			/* Restore regs */
-		"	aghi	%r14, 6\n"				/* Add lgg instr len to GSERA */
-		"	br	%r14\n"					/* Jump to next instruction after lgg */
-		".size gs_handler_asm,.-gs_handler_asm\n"
-	);
+asm (".macro	STGSC	args:vararg\n"
+     "	.insn	rxy,0xe30000000049,\\args\n"
+     "	.endm\n"
+     "	.globl	gs_handler_asm\n"
+     "gs_handler_asm:\n"
+     "	lgr	%r14,%r15\n"				/* Save current stack address in r14 */
+     ".Lgs_handler_frame = 16*8+32+" xstr(STACK_FRAME_SIZE) "\n"
+     "	aghi	%r15,-(.Lgs_handler_frame)\n"		/* Allocate stack frame */
+     "	stmg	%r0,%r13,192(%r15)\n"			/* Store regs to save area */
+     "	stg	%r14,312(%r15)\n"
+     "	la	%r2," xstr(STACK_FRAME_SIZE) "(%r15)\n"	/* Store gscb address in this_cb */
+     "	STGSC	%r0," xstr(STACK_FRAME_SIZE) "(%r15)\n"
+     "	lg	%r14,24(%r2)\n"				/* Get GSEPLA from GSCB*/
+     "	lg	%r14,40(%r14)\n"			/* Get GSERA from GSEPL*/
+     "	stg	%r14,304(%r15)\n"			/* Store GSERA in r14 of reg save area */
+     "	brasl	%r14,gs_handler\n"			/* Jump to gs_handler */
+     "	lmg	%r0,%r15,192(%r15)\n"			/* Restore regs */
+     "	aghi	%r14, 6\n"				/* Add lgg instr len to GSERA */
+     "	br	%r14\n"					/* Jump to next instruction after lgg */
+     ".size gs_handler_asm,.-gs_handler_asm\n"
+);
+/* clang-format on */
 
 void gs_handler(struct gs_cb *this_cb)
 {
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 09/10] add clang-format configuration file
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
                   ` (7 preceding siblings ...)
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 08/10] s390x: gs: turn off formatter for inline assembly Nico Boehr
@ 2023-11-06 12:51 ` Nico Boehr
  2023-11-22 12:56   ` Thomas Huth
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 10/10] add make format Nico Boehr
  2023-11-22 13:09 ` [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Thomas Huth
  10 siblings, 1 reply; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:51 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

It is important that we follow a somewhat consistent source code
formatting.

At the same time, going through minor formatting issues is exhausting
for contributors and reviewers alike:

Contributors need to respin their patches because of minor formatting
issues. Reviewers need to look for often easily overlooked formatting
mistakes in submitted patches.

Since machines are much better at formatting source code than humans can
ever be, add a .clang-format configuration file.

The clang-format file is taken from Linux with the following changes:
- ColumnLimit set to 0, since we don't enforce as strict of a column
  limit as in the kernel.
- AlignTrailingComments set to true since that seems to be quite common
  in existing code.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 .clang-format | 689 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 689 insertions(+)
 create mode 100644 .clang-format

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000000..3bf5c6f2a5a9
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,689 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# clang-format configuration file. Intended for clang-format >= 11.
+#
+# For more information, see:
+#
+#   Documentation/process/clang-format.rst
+#   https://clang.llvm.org/docs/ClangFormat.html
+#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+#
+---
+AccessModifierOffset: -4
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Left
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterClass: false
+  AfterControlStatement: false
+  AfterEnum: false
+  AfterFunction: true
+  AfterNamespace: true
+  AfterObjCDeclaration: false
+  AfterStruct: false
+  AfterUnion: false
+  AfterExternBlock: false
+  BeforeCatch: false
+  BeforeElse: false
+  IndentBraces: false
+  SplitEmptyFunction: true
+  SplitEmptyRecord: true
+  SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeInheritanceComma: false
+BreakBeforeTernaryOperators: false
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeComma
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: false
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 8
+ContinuationIndentWidth: 8
+Cpp11BracedListStyle: false
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: false
+
+# Taken from:
+#   git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ tools/ \
+#   | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$,  - '\1'," \
+#   | LC_ALL=C sort -u
+ForEachMacros:
+  - '__ata_qc_for_each'
+  - '__bio_for_each_bvec'
+  - '__bio_for_each_segment'
+  - '__evlist__for_each_entry'
+  - '__evlist__for_each_entry_continue'
+  - '__evlist__for_each_entry_from'
+  - '__evlist__for_each_entry_reverse'
+  - '__evlist__for_each_entry_safe'
+  - '__for_each_mem_range'
+  - '__for_each_mem_range_rev'
+  - '__for_each_thread'
+  - '__hlist_for_each_rcu'
+  - '__map__for_each_symbol_by_name'
+  - '__perf_evlist__for_each_entry'
+  - '__perf_evlist__for_each_entry_reverse'
+  - '__perf_evlist__for_each_entry_safe'
+  - '__rq_for_each_bio'
+  - '__shost_for_each_device'
+  - 'apei_estatus_for_each_section'
+  - 'ata_for_each_dev'
+  - 'ata_for_each_link'
+  - 'ata_qc_for_each'
+  - 'ata_qc_for_each_raw'
+  - 'ata_qc_for_each_with_internal'
+  - 'ax25_for_each'
+  - 'ax25_uid_for_each'
+  - 'bio_for_each_bvec'
+  - 'bio_for_each_bvec_all'
+  - 'bio_for_each_folio_all'
+  - 'bio_for_each_integrity_vec'
+  - 'bio_for_each_segment'
+  - 'bio_for_each_segment_all'
+  - 'bio_list_for_each'
+  - 'bip_for_each_vec'
+  - 'bond_for_each_slave'
+  - 'bond_for_each_slave_rcu'
+  - 'bpf__perf_for_each_map'
+  - 'bpf__perf_for_each_map_named'
+  - 'bpf_for_each_spilled_reg'
+  - 'bpf_object__for_each_map'
+  - 'bpf_object__for_each_program'
+  - 'bpf_object__for_each_safe'
+  - 'bpf_perf_object__for_each'
+  - 'btree_for_each_safe128'
+  - 'btree_for_each_safe32'
+  - 'btree_for_each_safe64'
+  - 'btree_for_each_safel'
+  - 'card_for_each_dev'
+  - 'cgroup_taskset_for_each'
+  - 'cgroup_taskset_for_each_leader'
+  - 'cpufreq_for_each_efficient_entry_idx'
+  - 'cpufreq_for_each_entry'
+  - 'cpufreq_for_each_entry_idx'
+  - 'cpufreq_for_each_valid_entry'
+  - 'cpufreq_for_each_valid_entry_idx'
+  - 'css_for_each_child'
+  - 'css_for_each_descendant_post'
+  - 'css_for_each_descendant_pre'
+  - 'damon_for_each_region'
+  - 'damon_for_each_region_safe'
+  - 'damon_for_each_scheme'
+  - 'damon_for_each_scheme_safe'
+  - 'damon_for_each_target'
+  - 'damon_for_each_target_safe'
+  - 'data__for_each_file'
+  - 'data__for_each_file_new'
+  - 'data__for_each_file_start'
+  - 'device_for_each_child_node'
+  - 'displayid_iter_for_each'
+  - 'dma_fence_array_for_each'
+  - 'dma_fence_chain_for_each'
+  - 'dma_fence_unwrap_for_each'
+  - 'dma_resv_for_each_fence'
+  - 'dma_resv_for_each_fence_unlocked'
+  - 'do_for_each_ftrace_op'
+  - 'drm_atomic_crtc_for_each_plane'
+  - 'drm_atomic_crtc_state_for_each_plane'
+  - 'drm_atomic_crtc_state_for_each_plane_state'
+  - 'drm_atomic_for_each_plane_damage'
+  - 'drm_client_for_each_connector_iter'
+  - 'drm_client_for_each_modeset'
+  - 'drm_connector_for_each_possible_encoder'
+  - 'drm_for_each_bridge_in_chain'
+  - 'drm_for_each_connector_iter'
+  - 'drm_for_each_crtc'
+  - 'drm_for_each_crtc_reverse'
+  - 'drm_for_each_encoder'
+  - 'drm_for_each_encoder_mask'
+  - 'drm_for_each_fb'
+  - 'drm_for_each_legacy_plane'
+  - 'drm_for_each_plane'
+  - 'drm_for_each_plane_mask'
+  - 'drm_for_each_privobj'
+  - 'drm_mm_for_each_hole'
+  - 'drm_mm_for_each_node'
+  - 'drm_mm_for_each_node_in_range'
+  - 'drm_mm_for_each_node_safe'
+  - 'dsa_switch_for_each_available_port'
+  - 'dsa_switch_for_each_cpu_port'
+  - 'dsa_switch_for_each_port'
+  - 'dsa_switch_for_each_port_continue_reverse'
+  - 'dsa_switch_for_each_port_safe'
+  - 'dsa_switch_for_each_user_port'
+  - 'dsa_tree_for_each_user_port'
+  - 'dso__for_each_symbol'
+  - 'dsos__for_each_with_build_id'
+  - 'elf_hash_for_each_possible'
+  - 'elf_section__for_each_rel'
+  - 'elf_section__for_each_rela'
+  - 'elf_symtab__for_each_symbol'
+  - 'evlist__for_each_cpu'
+  - 'evlist__for_each_entry'
+  - 'evlist__for_each_entry_continue'
+  - 'evlist__for_each_entry_from'
+  - 'evlist__for_each_entry_reverse'
+  - 'evlist__for_each_entry_safe'
+  - 'flow_action_for_each'
+  - 'for_each_acpi_dev_match'
+  - 'for_each_active_dev_scope'
+  - 'for_each_active_drhd_unit'
+  - 'for_each_active_iommu'
+  - 'for_each_active_route'
+  - 'for_each_aggr_pgid'
+  - 'for_each_available_child_of_node'
+  - 'for_each_bench'
+  - 'for_each_bio'
+  - 'for_each_board_func_rsrc'
+  - 'for_each_btf_ext_rec'
+  - 'for_each_btf_ext_sec'
+  - 'for_each_bvec'
+  - 'for_each_card_auxs'
+  - 'for_each_card_auxs_safe'
+  - 'for_each_card_components'
+  - 'for_each_card_dapms'
+  - 'for_each_card_pre_auxs'
+  - 'for_each_card_prelinks'
+  - 'for_each_card_rtds'
+  - 'for_each_card_rtds_safe'
+  - 'for_each_card_widgets'
+  - 'for_each_card_widgets_safe'
+  - 'for_each_cgroup_storage_type'
+  - 'for_each_child_of_node'
+  - 'for_each_clear_bit'
+  - 'for_each_clear_bit_from'
+  - 'for_each_clear_bitrange'
+  - 'for_each_clear_bitrange_from'
+  - 'for_each_cmd'
+  - 'for_each_cmsghdr'
+  - 'for_each_collection'
+  - 'for_each_comp_order'
+  - 'for_each_compatible_node'
+  - 'for_each_component_dais'
+  - 'for_each_component_dais_safe'
+  - 'for_each_console'
+  - 'for_each_console_srcu'
+  - 'for_each_cpu'
+  - 'for_each_cpu_and'
+  - 'for_each_cpu_wrap'
+  - 'for_each_dapm_widgets'
+  - 'for_each_dedup_cand'
+  - 'for_each_dev_addr'
+  - 'for_each_dev_scope'
+  - 'for_each_dma_cap_mask'
+  - 'for_each_dpcm_be'
+  - 'for_each_dpcm_be_rollback'
+  - 'for_each_dpcm_be_safe'
+  - 'for_each_dpcm_fe'
+  - 'for_each_drhd_unit'
+  - 'for_each_dss_dev'
+  - 'for_each_efi_memory_desc'
+  - 'for_each_efi_memory_desc_in_map'
+  - 'for_each_element'
+  - 'for_each_element_extid'
+  - 'for_each_element_id'
+  - 'for_each_endpoint_of_node'
+  - 'for_each_event'
+  - 'for_each_event_tps'
+  - 'for_each_evictable_lru'
+  - 'for_each_fib6_node_rt_rcu'
+  - 'for_each_fib6_walker_rt'
+  - 'for_each_free_mem_pfn_range_in_zone'
+  - 'for_each_free_mem_pfn_range_in_zone_from'
+  - 'for_each_free_mem_range'
+  - 'for_each_free_mem_range_reverse'
+  - 'for_each_func_rsrc'
+  - 'for_each_group_device'
+  - 'for_each_group_evsel'
+  - 'for_each_group_member'
+  - 'for_each_hstate'
+  - 'for_each_if'
+  - 'for_each_inject_fn'
+  - 'for_each_insn'
+  - 'for_each_insn_prefix'
+  - 'for_each_intid'
+  - 'for_each_iommu'
+  - 'for_each_ip_tunnel_rcu'
+  - 'for_each_irq_nr'
+  - 'for_each_lang'
+  - 'for_each_link_codecs'
+  - 'for_each_link_cpus'
+  - 'for_each_link_platforms'
+  - 'for_each_lru'
+  - 'for_each_matching_node'
+  - 'for_each_matching_node_and_match'
+  - 'for_each_mem_pfn_range'
+  - 'for_each_mem_range'
+  - 'for_each_mem_range_rev'
+  - 'for_each_mem_region'
+  - 'for_each_member'
+  - 'for_each_memory'
+  - 'for_each_migratetype_order'
+  - 'for_each_missing_reg'
+  - 'for_each_net'
+  - 'for_each_net_continue_reverse'
+  - 'for_each_net_rcu'
+  - 'for_each_netdev'
+  - 'for_each_netdev_continue'
+  - 'for_each_netdev_continue_rcu'
+  - 'for_each_netdev_continue_reverse'
+  - 'for_each_netdev_feature'
+  - 'for_each_netdev_in_bond_rcu'
+  - 'for_each_netdev_rcu'
+  - 'for_each_netdev_reverse'
+  - 'for_each_netdev_safe'
+  - 'for_each_new_connector_in_state'
+  - 'for_each_new_crtc_in_state'
+  - 'for_each_new_mst_mgr_in_state'
+  - 'for_each_new_plane_in_state'
+  - 'for_each_new_plane_in_state_reverse'
+  - 'for_each_new_private_obj_in_state'
+  - 'for_each_new_reg'
+  - 'for_each_node'
+  - 'for_each_node_by_name'
+  - 'for_each_node_by_type'
+  - 'for_each_node_mask'
+  - 'for_each_node_state'
+  - 'for_each_node_with_cpus'
+  - 'for_each_node_with_property'
+  - 'for_each_nonreserved_multicast_dest_pgid'
+  - 'for_each_of_allnodes'
+  - 'for_each_of_allnodes_from'
+  - 'for_each_of_cpu_node'
+  - 'for_each_of_pci_range'
+  - 'for_each_old_connector_in_state'
+  - 'for_each_old_crtc_in_state'
+  - 'for_each_old_mst_mgr_in_state'
+  - 'for_each_old_plane_in_state'
+  - 'for_each_old_private_obj_in_state'
+  - 'for_each_oldnew_connector_in_state'
+  - 'for_each_oldnew_crtc_in_state'
+  - 'for_each_oldnew_mst_mgr_in_state'
+  - 'for_each_oldnew_plane_in_state'
+  - 'for_each_oldnew_plane_in_state_reverse'
+  - 'for_each_oldnew_private_obj_in_state'
+  - 'for_each_online_cpu'
+  - 'for_each_online_node'
+  - 'for_each_online_pgdat'
+  - 'for_each_path'
+  - 'for_each_pci_bridge'
+  - 'for_each_pci_dev'
+  - 'for_each_pcm_streams'
+  - 'for_each_physmem_range'
+  - 'for_each_populated_zone'
+  - 'for_each_possible_cpu'
+  - 'for_each_present_cpu'
+  - 'for_each_prime_number'
+  - 'for_each_prime_number_from'
+  - 'for_each_probe_cache_entry'
+  - 'for_each_process'
+  - 'for_each_process_thread'
+  - 'for_each_prop_codec_conf'
+  - 'for_each_prop_dai_codec'
+  - 'for_each_prop_dai_cpu'
+  - 'for_each_prop_dlc_codecs'
+  - 'for_each_prop_dlc_cpus'
+  - 'for_each_prop_dlc_platforms'
+  - 'for_each_property_of_node'
+  - 'for_each_reg'
+  - 'for_each_reg_filtered'
+  - 'for_each_registered_fb'
+  - 'for_each_requested_gpio'
+  - 'for_each_requested_gpio_in_range'
+  - 'for_each_reserved_mem_range'
+  - 'for_each_reserved_mem_region'
+  - 'for_each_rtd_codec_dais'
+  - 'for_each_rtd_components'
+  - 'for_each_rtd_cpu_dais'
+  - 'for_each_rtd_dais'
+  - 'for_each_script'
+  - 'for_each_sec'
+  - 'for_each_set_bit'
+  - 'for_each_set_bit_from'
+  - 'for_each_set_bitrange'
+  - 'for_each_set_bitrange_from'
+  - 'for_each_set_clump8'
+  - 'for_each_sg'
+  - 'for_each_sg_dma_page'
+  - 'for_each_sg_page'
+  - 'for_each_sgtable_dma_page'
+  - 'for_each_sgtable_dma_sg'
+  - 'for_each_sgtable_page'
+  - 'for_each_sgtable_sg'
+  - 'for_each_shell_test'
+  - 'for_each_sibling_event'
+  - 'for_each_subelement'
+  - 'for_each_subelement_extid'
+  - 'for_each_subelement_id'
+  - 'for_each_sublist'
+  - 'for_each_subsystem'
+  - 'for_each_supported_activate_fn'
+  - 'for_each_supported_inject_fn'
+  - 'for_each_test'
+  - 'for_each_thread'
+  - 'for_each_token'
+  - 'for_each_unicast_dest_pgid'
+  - 'for_each_vsi'
+  - 'for_each_wakeup_source'
+  - 'for_each_zone'
+  - 'for_each_zone_zonelist'
+  - 'for_each_zone_zonelist_nodemask'
+  - 'func_for_each_insn'
+  - 'fwnode_for_each_available_child_node'
+  - 'fwnode_for_each_child_node'
+  - 'fwnode_graph_for_each_endpoint'
+  - 'gadget_for_each_ep'
+  - 'genradix_for_each'
+  - 'genradix_for_each_from'
+  - 'hash_for_each'
+  - 'hash_for_each_possible'
+  - 'hash_for_each_possible_rcu'
+  - 'hash_for_each_possible_rcu_notrace'
+  - 'hash_for_each_possible_safe'
+  - 'hash_for_each_rcu'
+  - 'hash_for_each_safe'
+  - 'hashmap__for_each_entry'
+  - 'hashmap__for_each_entry_safe'
+  - 'hashmap__for_each_key_entry'
+  - 'hashmap__for_each_key_entry_safe'
+  - 'hctx_for_each_ctx'
+  - 'hists__for_each_format'
+  - 'hists__for_each_sort_list'
+  - 'hlist_bl_for_each_entry'
+  - 'hlist_bl_for_each_entry_rcu'
+  - 'hlist_bl_for_each_entry_safe'
+  - 'hlist_for_each'
+  - 'hlist_for_each_entry'
+  - 'hlist_for_each_entry_continue'
+  - 'hlist_for_each_entry_continue_rcu'
+  - 'hlist_for_each_entry_continue_rcu_bh'
+  - 'hlist_for_each_entry_from'
+  - 'hlist_for_each_entry_from_rcu'
+  - 'hlist_for_each_entry_rcu'
+  - 'hlist_for_each_entry_rcu_bh'
+  - 'hlist_for_each_entry_rcu_notrace'
+  - 'hlist_for_each_entry_safe'
+  - 'hlist_for_each_entry_srcu'
+  - 'hlist_for_each_safe'
+  - 'hlist_nulls_for_each_entry'
+  - 'hlist_nulls_for_each_entry_from'
+  - 'hlist_nulls_for_each_entry_rcu'
+  - 'hlist_nulls_for_each_entry_safe'
+  - 'i3c_bus_for_each_i2cdev'
+  - 'i3c_bus_for_each_i3cdev'
+  - 'idr_for_each_entry'
+  - 'idr_for_each_entry_continue'
+  - 'idr_for_each_entry_continue_ul'
+  - 'idr_for_each_entry_ul'
+  - 'in_dev_for_each_ifa_rcu'
+  - 'in_dev_for_each_ifa_rtnl'
+  - 'inet_bind_bucket_for_each'
+  - 'inet_lhash2_for_each_icsk'
+  - 'inet_lhash2_for_each_icsk_continue'
+  - 'inet_lhash2_for_each_icsk_rcu'
+  - 'interval_tree_for_each_double_span'
+  - 'interval_tree_for_each_span'
+  - 'intlist__for_each_entry'
+  - 'intlist__for_each_entry_safe'
+  - 'iopt_for_each_contig_area'
+  - 'kcore_copy__for_each_phdr'
+  - 'key_for_each'
+  - 'key_for_each_safe'
+  - 'klp_for_each_func'
+  - 'klp_for_each_func_safe'
+  - 'klp_for_each_func_static'
+  - 'klp_for_each_object'
+  - 'klp_for_each_object_safe'
+  - 'klp_for_each_object_static'
+  - 'kunit_suite_for_each_test_case'
+  - 'kvm_for_each_memslot'
+  - 'kvm_for_each_memslot_in_gfn_range'
+  - 'kvm_for_each_vcpu'
+  - 'libbpf_nla_for_each_attr'
+  - 'list_for_each'
+  - 'list_for_each_codec'
+  - 'list_for_each_codec_safe'
+  - 'list_for_each_continue'
+  - 'list_for_each_entry'
+  - 'list_for_each_entry_continue'
+  - 'list_for_each_entry_continue_rcu'
+  - 'list_for_each_entry_continue_reverse'
+  - 'list_for_each_entry_from'
+  - 'list_for_each_entry_from_rcu'
+  - 'list_for_each_entry_from_reverse'
+  - 'list_for_each_entry_lockless'
+  - 'list_for_each_entry_rcu'
+  - 'list_for_each_entry_reverse'
+  - 'list_for_each_entry_safe'
+  - 'list_for_each_entry_safe_continue'
+  - 'list_for_each_entry_safe_from'
+  - 'list_for_each_entry_safe_reverse'
+  - 'list_for_each_entry_srcu'
+  - 'list_for_each_from'
+  - 'list_for_each_prev'
+  - 'list_for_each_prev_safe'
+  - 'list_for_each_safe'
+  - 'llist_for_each'
+  - 'llist_for_each_entry'
+  - 'llist_for_each_entry_safe'
+  - 'llist_for_each_safe'
+  - 'map__for_each_symbol'
+  - 'map__for_each_symbol_by_name'
+  - 'map_for_each_event'
+  - 'map_for_each_metric'
+  - 'maps__for_each_entry'
+  - 'maps__for_each_entry_safe'
+  - 'mci_for_each_dimm'
+  - 'media_device_for_each_entity'
+  - 'media_device_for_each_intf'
+  - 'media_device_for_each_link'
+  - 'media_device_for_each_pad'
+  - 'msi_for_each_desc'
+  - 'nanddev_io_for_each_page'
+  - 'netdev_for_each_lower_dev'
+  - 'netdev_for_each_lower_private'
+  - 'netdev_for_each_lower_private_rcu'
+  - 'netdev_for_each_mc_addr'
+  - 'netdev_for_each_uc_addr'
+  - 'netdev_for_each_upper_dev_rcu'
+  - 'netdev_hw_addr_list_for_each'
+  - 'nft_rule_for_each_expr'
+  - 'nla_for_each_attr'
+  - 'nla_for_each_nested'
+  - 'nlmsg_for_each_attr'
+  - 'nlmsg_for_each_msg'
+  - 'nr_neigh_for_each'
+  - 'nr_neigh_for_each_safe'
+  - 'nr_node_for_each'
+  - 'nr_node_for_each_safe'
+  - 'of_for_each_phandle'
+  - 'of_property_for_each_string'
+  - 'of_property_for_each_u32'
+  - 'pci_bus_for_each_resource'
+  - 'pci_dev_for_each_resource'
+  - 'pcl_for_each_chunk'
+  - 'pcl_for_each_segment'
+  - 'pcm_for_each_format'
+  - 'perf_config_items__for_each_entry'
+  - 'perf_config_sections__for_each_entry'
+  - 'perf_config_set__for_each_entry'
+  - 'perf_cpu_map__for_each_cpu'
+  - 'perf_evlist__for_each_entry'
+  - 'perf_evlist__for_each_entry_reverse'
+  - 'perf_evlist__for_each_entry_safe'
+  - 'perf_evlist__for_each_evsel'
+  - 'perf_evlist__for_each_mmap'
+  - 'perf_hpp_list__for_each_format'
+  - 'perf_hpp_list__for_each_format_safe'
+  - 'perf_hpp_list__for_each_sort_list'
+  - 'perf_hpp_list__for_each_sort_list_safe'
+  - 'perf_pmu__for_each_hybrid_pmu'
+  - 'ping_portaddr_for_each_entry'
+  - 'ping_portaddr_for_each_entry_rcu'
+  - 'plist_for_each'
+  - 'plist_for_each_continue'
+  - 'plist_for_each_entry'
+  - 'plist_for_each_entry_continue'
+  - 'plist_for_each_entry_safe'
+  - 'plist_for_each_safe'
+  - 'pnp_for_each_card'
+  - 'pnp_for_each_dev'
+  - 'protocol_for_each_card'
+  - 'protocol_for_each_dev'
+  - 'queue_for_each_hw_ctx'
+  - 'radix_tree_for_each_slot'
+  - 'radix_tree_for_each_tagged'
+  - 'rb_for_each'
+  - 'rbtree_postorder_for_each_entry_safe'
+  - 'rdma_for_each_block'
+  - 'rdma_for_each_port'
+  - 'rdma_umem_for_each_dma_block'
+  - 'resort_rb__for_each_entry'
+  - 'resource_list_for_each_entry'
+  - 'resource_list_for_each_entry_safe'
+  - 'rhl_for_each_entry_rcu'
+  - 'rhl_for_each_rcu'
+  - 'rht_for_each'
+  - 'rht_for_each_entry'
+  - 'rht_for_each_entry_from'
+  - 'rht_for_each_entry_rcu'
+  - 'rht_for_each_entry_rcu_from'
+  - 'rht_for_each_entry_safe'
+  - 'rht_for_each_from'
+  - 'rht_for_each_rcu'
+  - 'rht_for_each_rcu_from'
+  - 'rq_for_each_bvec'
+  - 'rq_for_each_segment'
+  - 'rq_list_for_each'
+  - 'rq_list_for_each_safe'
+  - 'scsi_for_each_prot_sg'
+  - 'scsi_for_each_sg'
+  - 'sctp_for_each_hentry'
+  - 'sctp_skb_for_each'
+  - 'sec_for_each_insn'
+  - 'sec_for_each_insn_continue'
+  - 'sec_for_each_insn_from'
+  - 'shdma_for_each_chan'
+  - 'shost_for_each_device'
+  - 'sk_for_each'
+  - 'sk_for_each_bound'
+  - 'sk_for_each_entry_offset_rcu'
+  - 'sk_for_each_from'
+  - 'sk_for_each_rcu'
+  - 'sk_for_each_safe'
+  - 'sk_nulls_for_each'
+  - 'sk_nulls_for_each_from'
+  - 'sk_nulls_for_each_rcu'
+  - 'snd_array_for_each'
+  - 'snd_pcm_group_for_each_entry'
+  - 'snd_soc_dapm_widget_for_each_path'
+  - 'snd_soc_dapm_widget_for_each_path_safe'
+  - 'snd_soc_dapm_widget_for_each_sink_path'
+  - 'snd_soc_dapm_widget_for_each_source_path'
+  - 'strlist__for_each_entry'
+  - 'strlist__for_each_entry_safe'
+  - 'sym_for_each_insn'
+  - 'sym_for_each_insn_continue_reverse'
+  - 'symbols__for_each_entry'
+  - 'tb_property_for_each'
+  - 'tcf_act_for_each_action'
+  - 'tcf_exts_for_each_action'
+  - 'udp_portaddr_for_each_entry'
+  - 'udp_portaddr_for_each_entry_rcu'
+  - 'usb_hub_for_each_child'
+  - 'v4l2_device_for_each_subdev'
+  - 'v4l2_m2m_for_each_dst_buf'
+  - 'v4l2_m2m_for_each_dst_buf_safe'
+  - 'v4l2_m2m_for_each_src_buf'
+  - 'v4l2_m2m_for_each_src_buf_safe'
+  - 'virtio_device_for_each_vq'
+  - 'while_for_each_ftrace_op'
+  - 'xa_for_each'
+  - 'xa_for_each_marked'
+  - 'xa_for_each_range'
+  - 'xa_for_each_start'
+  - 'xas_for_each'
+  - 'xas_for_each_conflict'
+  - 'xas_for_each_marked'
+  - 'xbc_array_for_each_value'
+  - 'xbc_for_each_key_value'
+  - 'xbc_node_for_each_array_value'
+  - 'xbc_node_for_each_child'
+  - 'xbc_node_for_each_key_value'
+  - 'xbc_node_for_each_subkey'
+  - 'zorro_for_each_dev'
+
+IncludeBlocks: Preserve
+IncludeCategories:
+  - Regex: '.*'
+    Priority: 1
+IncludeIsMainRegex: '(Test)?$'
+IndentCaseLabels: false
+IndentGotoLabels: false
+IndentPPDirectives: None
+IndentWidth: 8
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 8
+ObjCSpaceAfterProperty: true
+ObjCSpaceBeforeProtocolList: true
+
+# Taken from git's rules
+PenaltyBreakAssignment: 10
+PenaltyBreakBeforeFirstCallParameter: 30
+PenaltyBreakComment: 10
+PenaltyBreakFirstLessLess: 0
+PenaltyBreakString: 10
+PenaltyExcessCharacter: 100
+PenaltyReturnTypeOnItsOwnLine: 60
+
+PointerAlignment: Right
+ReflowComments: false
+SortIncludes: false
+SortUsingDeclarations: false
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatementsExceptForEachMacros
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: false
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp03
+TabWidth: 8
+UseTab: Always
+...
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [kvm-unit-tests PATCH v1 10/10] add make format
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
                   ` (8 preceding siblings ...)
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 09/10] add clang-format configuration file Nico Boehr
@ 2023-11-06 12:51 ` Nico Boehr
  2023-11-22 13:09 ` [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Thomas Huth
  10 siblings, 0 replies; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 12:51 UTC (permalink / raw)
  To: frankja, imbrenda, thuth, david, pbonzini, andrew.jones, lvivier
  Cc: kvm, linux-s390

Add target "format" to the makefile to format all source files with
clang-format.

This currently assumes all architectures want to opt-in to formatting
with clang-format. Maybe they don't want that, then we can move the
target to architecture-specific folders.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index 602910dda11b..b5509c74ad5b 100644
--- a/Makefile
+++ b/Makefile
@@ -147,3 +147,6 @@ tags:
 
 check-kerneldoc:
 	find . -name '*.[ch]' -exec scripts/kernel-doc -none {} +
+
+format:
+	find . -name '*.[ch]' ! -type l -exec clang-format -i {} +
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments Nico Boehr
@ 2023-11-06 16:53   ` Claudio Imbrenda
  2023-11-06 17:13     ` Nico Boehr
  2023-11-22 12:28   ` Thomas Huth
  1 sibling, 1 reply; 24+ messages in thread
From: Claudio Imbrenda @ 2023-11-06 16:53 UTC (permalink / raw)
  To: Nico Boehr
  Cc: frankja, thuth, david, pbonzini, andrew.jones, lvivier, kvm,
	linux-s390

On Mon,  6 Nov 2023 13:50:58 +0100
Nico Boehr <nrb@linux.ibm.com> wrote:

> These comments do not follow the kernel-doc style, hence they should not
> start with /**.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>  powerpc/emulator.c    | 2 +-
>  powerpc/spapr_hcall.c | 6 +++---
>  powerpc/spapr_vpa.c   | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/powerpc/emulator.c b/powerpc/emulator.c
> index 65ae4b65e655..39dd59645368 100644
> --- a/powerpc/emulator.c
> +++ b/powerpc/emulator.c
> @@ -71,7 +71,7 @@ static void test_64bit(void)
>  	report_prefix_pop();
>  }
>  
> -/**
> +/*
>   * Test 'Load String Word Immediate' instruction
>   */

this should have the name of the function first: 
 * test_lswi() - Test 'Load String ... 

(same for all the other functions here)

>  static void test_lswi(void)
> diff --git a/powerpc/spapr_hcall.c b/powerpc/spapr_hcall.c
> index 0d0f25afe9f6..e9b5300a3912 100644
> --- a/powerpc/spapr_hcall.c
> +++ b/powerpc/spapr_hcall.c
> @@ -16,7 +16,7 @@
>  #define H_ZERO_PAGE	(1UL << (63-48))
>  #define H_COPY_PAGE	(1UL << (63-49))
>  
> -/**
> +/*
>   * Test the H_SET_SPRG0 h-call by setting some values and checking whether
>   * the SPRG0 register contains the correct values afterwards
>   */
> @@ -46,7 +46,7 @@ static void test_h_set_sprg0(int argc, char **argv)
>  	       sprg0_orig);
>  }
>  
> -/**
> +/*
>   * Test the H_PAGE_INIT h-call by using it to clear and to copy a page, and
>   * by checking for the correct values in the destination page afterwards
>   */
> @@ -97,7 +97,7 @@ static int h_random(uint64_t *val)
>  	return r3;
>  }
>  
> -/**
> +/*
>   * Test H_RANDOM by calling it a couple of times to check whether all bit
>   * positions really toggle (there should be no "stuck" bits in the output)
>   */
> diff --git a/powerpc/spapr_vpa.c b/powerpc/spapr_vpa.c
> index 5586eb8d3341..6a3fe5e3f974 100644
> --- a/powerpc/spapr_vpa.c
> +++ b/powerpc/spapr_vpa.c
> @@ -53,7 +53,7 @@ static void print_vpa(struct vpa *vpa)
>  #define SUBFUNC_REGISTER	(1ULL << 45)
>  #define SUBFUNC_DEREGISTER	(5ULL << 45)
>  
> -/**
> +/*
>   * Test the H_REGISTER_VPA h-call register/deregister calls.
>   */
>  static void test_register_vpa(void)
> @@ -111,7 +111,7 @@ static void test_register_vpa(void)
>  	report_prefix_pop();
>  }
>  
> -/**
> +/*
>   * Test some VPA fields.
>   */
>  static void test_vpa(void)


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 04/10] s390x: properly format non-kernel-doc comments
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 04/10] s390x: properly format non-kernel-doc comments Nico Boehr
@ 2023-11-06 16:54   ` Claudio Imbrenda
  2023-11-22 12:47   ` Thomas Huth
  1 sibling, 0 replies; 24+ messages in thread
From: Claudio Imbrenda @ 2023-11-06 16:54 UTC (permalink / raw)
  To: Nico Boehr
  Cc: frankja, thuth, david, pbonzini, andrew.jones, lvivier, kvm,
	linux-s390

On Mon,  6 Nov 2023 13:51:00 +0100
Nico Boehr <nrb@linux.ibm.com> wrote:

> These comments do not follow the kernel-doc style, hence they should not
> start with /**.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>  s390x/sclp.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/s390x/sclp.c b/s390x/sclp.c
> index 1abb9029f984..ccbaa9136fdb 100644
> --- a/s390x/sclp.c
> +++ b/s390x/sclp.c
> @@ -32,7 +32,7 @@ static union {
>  } sccb_template;
>  static uint32_t valid_code;						/* valid command code for READ SCP INFO */
>  
> -/**
> +/*
>   * Perform one service call, handling exceptions and interrupts.
>   */

 * sclp_service_call_test() - Perform ... 

(same for all the other functions)

>  static int sclp_service_call_test(unsigned int command, void *sccb)
> @@ -51,7 +51,7 @@ static int sclp_service_call_test(unsigned int command, void *sccb)
>  	return cc;
>  }
>  
> -/**
> +/*
>   * Perform one test at the given address, optionally using the SCCB template,
>   * checking for the expected program interrupts and return codes.
>   *
> @@ -96,7 +96,7 @@ static bool test_one_sccb(uint32_t cmd, uint8_t *addr, uint16_t buf_len, uint64_
>  	return true;
>  }
>  
> -/**
> +/*
>   * Wrapper for test_one_sccb to be used when the template should not be
>   * copied and the memory address should not be touched.
>   */
> @@ -105,7 +105,7 @@ static bool test_one_ro(uint32_t cmd, uint8_t *addr, uint64_t exp_pgm, uint16_t
>  	return test_one_sccb(cmd, addr, 0, exp_pgm, exp_rc);
>  }
>  
> -/**
> +/*
>   * Wrapper for test_one_sccb to set up a simple SCCB template.
>   *
>   * The parameter sccb_len indicates the value that will be saved in the SCCB
> @@ -124,7 +124,7 @@ static bool test_one_simple(uint32_t cmd, uint8_t *addr, uint16_t sccb_len,
>  	return test_one_sccb(cmd, addr, buf_len, exp_pgm, exp_rc);
>  }
>  
> -/**
> +/*
>   * Test SCCB lengths < 8.
>   */
>  static void test_sccb_too_short(void)
> @@ -138,7 +138,7 @@ static void test_sccb_too_short(void)
>  	report(len == 8, "SCCB too short");
>  }
>  
> -/**
> +/*
>   * Test SCCBs that are not 64-bit aligned.
>   */
>  static void test_sccb_unaligned(void)
> @@ -151,7 +151,7 @@ static void test_sccb_unaligned(void)
>  	report(offset == 8, "SCCB unaligned");
>  }
>  
> -/**
> +/*
>   * Test SCCBs whose address is in the lowcore or prefix area.
>   */
>  static void test_sccb_prefix(void)
> @@ -202,7 +202,7 @@ static void test_sccb_prefix(void)
>  	set_prefix(prefix);
>  }
>  
> -/**
> +/*
>   * Test SCCBs that are above 2GB. If outside of memory, an addressing
>   * exception is also allowed.
>   */
> @@ -245,7 +245,7 @@ static void test_sccb_high(void)
>  	report(i == len, "SCCB high addresses");
>  }
>  
> -/**
> +/*
>   * Test invalid commands, both invalid command detail codes and valid
>   * ones with invalid command class code.
>   */
> @@ -275,7 +275,7 @@ static void test_inval(void)
>  }
>  
>  
> -/**
> +/*
>   * Test short SCCBs (but larger than 8).
>   */
>  static void test_short(void)
> @@ -294,7 +294,7 @@ static void test_short(void)
>  	report(len == 40, "Insufficient SCCB length (Read CPU info)");
>  }
>  
> -/**
> +/*
>   * Test SCCB page boundary violations.
>   */
>  static void test_boundary(void)
> @@ -318,7 +318,7 @@ out:
>  	report(len > 4096 && offset == 4096, "SCCB page boundary violation");
>  }
>  
> -/**
> +/*
>   * Test excessively long SCCBs.
>   */
>  static void test_toolong(void)
> @@ -338,7 +338,7 @@ static void test_toolong(void)
>  	report(len == 8192, "SCCB bigger than 4k");
>  }
>  
> -/**
> +/*
>   * Test privileged operation.
>   */
>  static void test_priv(void)
> @@ -354,7 +354,7 @@ static void test_priv(void)
>  	report_prefix_pop();
>  }
>  
> -/**
> +/*
>   * Test addressing exceptions. We need to test SCCB addresses between the
>   * end of available memory and 2GB, because after 2GB a specification
>   * exception is also allowed.
> @@ -393,7 +393,7 @@ out:
>  	report(i + maxram >= 0x80000000, "Invalid SCCB address");
>  }
>  
> -/**
> +/*
>   * Test some bits in the instruction format that are specified to be ignored.
>   */
>  static void test_instbits(void)
> @@ -422,7 +422,7 @@ static void test_instbits(void)
>  	report(cc == 0, "Instruction format ignored bits");
>  }
>  
> -/**
> +/*
>   * Find a valid READ INFO command code; not all codes are always allowed, and
>   * probing should be performed in the right order.
>   */


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments
  2023-11-06 16:53   ` Claudio Imbrenda
@ 2023-11-06 17:13     ` Nico Boehr
  2023-11-07  8:37       ` Thomas Huth
  2023-11-07 18:42       ` Claudio Imbrenda
  0 siblings, 2 replies; 24+ messages in thread
From: Nico Boehr @ 2023-11-06 17:13 UTC (permalink / raw)
  To: Claudio Imbrenda
  Cc: frankja, thuth, david, pbonzini, andrew.jones, lvivier, kvm,
	linux-s390

Quoting Claudio Imbrenda (2023-11-06 17:53:16)
> On Mon,  6 Nov 2023 13:50:58 +0100
> Nico Boehr <nrb@linux.ibm.com> wrote:
> 
> > These comments do not follow the kernel-doc style, hence they should not
> > start with /**.
> > 
> > Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> > ---
> >  powerpc/emulator.c    | 2 +-
> >  powerpc/spapr_hcall.c | 6 +++---
> >  powerpc/spapr_vpa.c   | 4 ++--
> >  3 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/powerpc/emulator.c b/powerpc/emulator.c
> > index 65ae4b65e655..39dd59645368 100644
> > --- a/powerpc/emulator.c
> > +++ b/powerpc/emulator.c
> > @@ -71,7 +71,7 @@ static void test_64bit(void)
> >       report_prefix_pop();
> >  }
> >  
> > -/**
> > +/*
> >   * Test 'Load String Word Immediate' instruction
> >   */
> 
> this should have the name of the function first: 
>  * test_lswi() - Test 'Load String ... 
> 
> (same for all the other functions here)

Since none of these comments really follow kerneldoc style and are mostly
static anyways, the idea was to convert them to non-kerneldoc style, by
changing the comment from:
/**

to:
/*

But I am just as fine to make the comments proper kerneldoc style, if we
see value in that.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments
  2023-11-06 17:13     ` Nico Boehr
@ 2023-11-07  8:37       ` Thomas Huth
  2023-11-07 18:42       ` Claudio Imbrenda
  1 sibling, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2023-11-07  8:37 UTC (permalink / raw)
  To: Nico Boehr, Claudio Imbrenda
  Cc: frankja, david, pbonzini, andrew.jones, lvivier, kvm, linux-s390

On 06/11/2023 18.13, Nico Boehr wrote:
> Quoting Claudio Imbrenda (2023-11-06 17:53:16)
>> On Mon,  6 Nov 2023 13:50:58 +0100
>> Nico Boehr <nrb@linux.ibm.com> wrote:
>>
>>> These comments do not follow the kernel-doc style, hence they should not
>>> start with /**.
>>>
>>> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
>>> ---
>>>   powerpc/emulator.c    | 2 +-
>>>   powerpc/spapr_hcall.c | 6 +++---
>>>   powerpc/spapr_vpa.c   | 4 ++--
>>>   3 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/powerpc/emulator.c b/powerpc/emulator.c
>>> index 65ae4b65e655..39dd59645368 100644
>>> --- a/powerpc/emulator.c
>>> +++ b/powerpc/emulator.c
>>> @@ -71,7 +71,7 @@ static void test_64bit(void)
>>>        report_prefix_pop();
>>>   }
>>>   
>>> -/**
>>> +/*
>>>    * Test 'Load String Word Immediate' instruction
>>>    */
>>
>> this should have the name of the function first:
>>   * test_lswi() - Test 'Load String ...
>>
>> (same for all the other functions here)
> 
> Since none of these comments really follow kerneldoc style and are mostly
> static anyways, the idea was to convert them to non-kerneldoc style, by
> changing the comment from:
> /**
> 
> to:
> /*
> 
> But I am just as fine to make the comments proper kerneldoc style, if we
> see value in that.

I think it makes sense to do that for the files in the lib/ folder ... for 
the other ones, I think it is not really necessary (but it wouldn't hurt 
either).

  Thomas


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments
  2023-11-06 17:13     ` Nico Boehr
  2023-11-07  8:37       ` Thomas Huth
@ 2023-11-07 18:42       ` Claudio Imbrenda
  1 sibling, 0 replies; 24+ messages in thread
From: Claudio Imbrenda @ 2023-11-07 18:42 UTC (permalink / raw)
  To: Nico Boehr
  Cc: frankja, thuth, david, pbonzini, andrew.jones, lvivier, kvm,
	linux-s390

On Mon, 06 Nov 2023 18:13:37 +0100
Nico Boehr <nrb@linux.ibm.com> wrote:

> Quoting Claudio Imbrenda (2023-11-06 17:53:16)
> > On Mon,  6 Nov 2023 13:50:58 +0100
> > Nico Boehr <nrb@linux.ibm.com> wrote:
> >   
> > > These comments do not follow the kernel-doc style, hence they should not
> > > start with /**.
> > > 
> > > Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> > > ---
> > >  powerpc/emulator.c    | 2 +-
> > >  powerpc/spapr_hcall.c | 6 +++---
> > >  powerpc/spapr_vpa.c   | 4 ++--
> > >  3 files changed, 6 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/powerpc/emulator.c b/powerpc/emulator.c
> > > index 65ae4b65e655..39dd59645368 100644
> > > --- a/powerpc/emulator.c
> > > +++ b/powerpc/emulator.c
> > > @@ -71,7 +71,7 @@ static void test_64bit(void)
> > >       report_prefix_pop();
> > >  }
> > >  
> > > -/**
> > > +/*
> > >   * Test 'Load String Word Immediate' instruction
> > >   */  
> > 
> > this should have the name of the function first: 
> >  * test_lswi() - Test 'Load String ... 
> > 
> > (same for all the other functions here)  
> 
> Since none of these comments really follow kerneldoc style and are mostly
> static anyways, the idea was to convert them to non-kerneldoc style, by
> changing the comment from:
> /**
> 
> to:
> /*
> 
> But I am just as fine to make the comments proper kerneldoc style, if we
> see value in that.

oufff yes sorry I had totally misread that

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 01/10] make: add target to check kernel-doc comments
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 01/10] make: add target to check kernel-doc comments Nico Boehr
@ 2023-11-22 12:27   ` Thomas Huth
  0 siblings, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2023-11-22 12:27 UTC (permalink / raw)
  To: Nico Boehr, frankja, imbrenda, david, pbonzini, andrew.jones,
	lvivier
  Cc: kvm, linux-s390

On 06/11/2023 13.50, Nico Boehr wrote:
> When we have a kernel-doc comment, it should be properly formatted.
> Since this is a task that can be easily automated, add a new target
> which checks all comments for proper kernel-doc formatting.
> 
> The kernel-doc script is copied as-is from the Linux kernel.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>   Makefile           |    3 +
>   scripts/kernel-doc | 2526 ++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 2529 insertions(+)
>   create mode 100755 scripts/kernel-doc

Reviewed-by: Thomas Huth <thuth@redhat.com>


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments Nico Boehr
  2023-11-06 16:53   ` Claudio Imbrenda
@ 2023-11-22 12:28   ` Thomas Huth
  1 sibling, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2023-11-22 12:28 UTC (permalink / raw)
  To: Nico Boehr, frankja, imbrenda, david, pbonzini, andrew.jones,
	lvivier
  Cc: kvm, linux-s390

On 06/11/2023 13.50, Nico Boehr wrote:
> These comments do not follow the kernel-doc style, hence they should not
> start with /**.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>   powerpc/emulator.c    | 2 +-
>   powerpc/spapr_hcall.c | 6 +++---
>   powerpc/spapr_vpa.c   | 4 ++--
>   3 files changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 03/10] lib: s390x: cpacf: move kernel-doc comment to correct function
  2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 03/10] lib: s390x: cpacf: move kernel-doc comment to correct function Nico Boehr
@ 2023-11-22 12:47   ` Thomas Huth
  0 siblings, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2023-11-22 12:47 UTC (permalink / raw)
  To: Nico Boehr, frankja, imbrenda, david, pbonzini, andrew.jones,
	lvivier
  Cc: kvm, linux-s390

On 06/11/2023 13.50, Nico Boehr wrote:
> The kernel-doc comment seems to describe a different function further at
> the bottom of the file; move the comment there and adjust the comment
> accordingly.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>   lib/s390x/asm/cpacf.h | 20 ++++++++++----------
>   1 file changed, 10 insertions(+), 10 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 04/10] s390x: properly format non-kernel-doc comments
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 04/10] s390x: properly format non-kernel-doc comments Nico Boehr
  2023-11-06 16:54   ` Claudio Imbrenda
@ 2023-11-22 12:47   ` Thomas Huth
  1 sibling, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2023-11-22 12:47 UTC (permalink / raw)
  To: Nico Boehr, frankja, imbrenda, david, pbonzini, andrew.jones,
	lvivier
  Cc: kvm, linux-s390

On 06/11/2023 13.51, Nico Boehr wrote:
> These comments do not follow the kernel-doc style, hence they should not
> start with /**.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>   s390x/sclp.c | 32 ++++++++++++++++----------------
>   1 file changed, 16 insertions(+), 16 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 05/10] s390x: ensure kernel-doc parameters are properly formated
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 05/10] s390x: ensure kernel-doc parameters are properly formated Nico Boehr
@ 2023-11-22 12:49   ` Thomas Huth
  0 siblings, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2023-11-22 12:49 UTC (permalink / raw)
  To: Nico Boehr, frankja, imbrenda, david, pbonzini, andrew.jones,
	lvivier
  Cc: kvm, linux-s390

On 06/11/2023 13.51, Nico Boehr wrote:
> In kernel-doc, parameters names should end in a colon (:). Add them
> where they are missing.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>   lib/s390x/interrupt.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 06/10] x86: properly format non-kernel-doc comments
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 06/10] x86: properly format non-kernel-doc comments Nico Boehr
@ 2023-11-22 12:49   ` Thomas Huth
  0 siblings, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2023-11-22 12:49 UTC (permalink / raw)
  To: Nico Boehr, frankja, imbrenda, david, pbonzini, andrew.jones,
	lvivier
  Cc: kvm, linux-s390

On 06/11/2023 13.51, Nico Boehr wrote:
> These comments do not follow the kernel-doc style, hence they should not
> start with /**.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
>   x86/msr.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/x86/msr.c b/x86/msr.c
> index 789f23f8de78..3a041fab160a 100644
> --- a/x86/msr.c
> +++ b/x86/msr.c
> @@ -6,7 +6,7 @@
>   #include "msr.h"
>   #include <stdlib.h>
>   
> -/**
> +/*
>    * This test allows two modes:
>    * 1. Default: the `msr_info' array contains the default test configurations
>    * 2. Custom: by providing command line arguments it is possible to test any MSR and value

Reviewed-by: Thomas Huth <thuth@redhat.com>


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 09/10] add clang-format configuration file
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 09/10] add clang-format configuration file Nico Boehr
@ 2023-11-22 12:56   ` Thomas Huth
  0 siblings, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2023-11-22 12:56 UTC (permalink / raw)
  To: Nico Boehr, frankja, imbrenda, david, pbonzini, andrew.jones,
	lvivier
  Cc: kvm, linux-s390

On 06/11/2023 13.51, Nico Boehr wrote:
> It is important that we follow a somewhat consistent source code
> formatting.
> 
> At the same time, going through minor formatting issues is exhausting
> for contributors and reviewers alike:
> 
> Contributors need to respin their patches because of minor formatting
> issues. Reviewers need to look for often easily overlooked formatting
> mistakes in submitted patches.
> 
> Since machines are much better at formatting source code than humans can
> ever be, add a .clang-format configuration file.
> 
> The clang-format file is taken from Linux with the following changes:
> - ColumnLimit set to 0, since we don't enforce as strict of a column
>    limit as in the kernel.
> - AlignTrailingComments set to true since that seems to be quite common
>    in existing code.
> 
> Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
> ---
...
> +# Taken from:
> +#   git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ tools/ \
> +#   | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$,  - '\1'," \
> +#   | LC_ALL=C sort -u
> +ForEachMacros:
> +  - '__ata_qc_for_each'
> +  - '__bio_for_each_bvec'
> +  - '__bio_for_each_segment'
> +  - '__evlist__for_each_entry'
> +  - '__evlist__for_each_entry_continue'
> +  - '__evlist__for_each_entry_from'
> +  - '__evlist__for_each_entry_reverse'
> +  - '__evlist__for_each_entry_safe'
> +  - '__for_each_mem_range'
> +  - '__for_each_mem_range_rev'
> +  - '__for_each_thread'
> +  - '__hlist_for_each_rcu'
> +  - '__map__for_each_symbol_by_name'
> +  - '__perf_evlist__for_each_entry'
> +  - '__perf_evlist__for_each_entry_reverse'
> +  - '__perf_evlist__for_each_entry_safe'
> +  - '__rq_for_each_bio'
> +  - '__shost_for_each_device'
> +  - 'apei_estatus_for_each_section'
> +  - 'ata_for_each_dev'
> +  - 'ata_for_each_link'
> +  - 'ata_qc_for_each'
> +  - 'ata_qc_for_each_raw'
> +  - 'ata_qc_for_each_with_internal'
> +  - 'ax25_for_each'
> +  - 'ax25_uid_for_each'
> +  - 'bio_for_each_bvec'
> +  - 'bio_for_each_bvec_all'
> +  - 'bio_for_each_folio_all'
> +  - 'bio_for_each_integrity_vec'
> +  - 'bio_for_each_segment'
> +  - 'bio_for_each_segment_all'
> +  - 'bio_list_for_each'
> +  - 'bip_for_each_vec'
> +  - 'bond_for_each_slave'
> +  - 'bond_for_each_slave_rcu'
> +  - 'bpf__perf_for_each_map'
> +  - 'bpf__perf_for_each_map_named'
> +  - 'bpf_for_each_spilled_reg'
> +  - 'bpf_object__for_each_map'
> +  - 'bpf_object__for_each_program'
> +  - 'bpf_object__for_each_safe'
> +  - 'bpf_perf_object__for_each'
> +  - 'btree_for_each_safe128'
> +  - 'btree_for_each_safe32'
> +  - 'btree_for_each_safe64'
> +  - 'btree_for_each_safel'
> +  - 'card_for_each_dev'
> +  - 'cgroup_taskset_for_each'
> +  - 'cgroup_taskset_for_each_leader'
> +  - 'cpufreq_for_each_efficient_entry_idx'
> +  - 'cpufreq_for_each_entry'
> +  - 'cpufreq_for_each_entry_idx'
> +  - 'cpufreq_for_each_valid_entry'
> +  - 'cpufreq_for_each_valid_entry_idx'
> +  - 'css_for_each_child'
> +  - 'css_for_each_descendant_post'
> +  - 'css_for_each_descendant_pre'
> +  - 'damon_for_each_region'
> +  - 'damon_for_each_region_safe'
> +  - 'damon_for_each_scheme'
> +  - 'damon_for_each_scheme_safe'
> +  - 'damon_for_each_target'
> +  - 'damon_for_each_target_safe'
> +  - 'data__for_each_file'
> +  - 'data__for_each_file_new'
> +  - 'data__for_each_file_start'
> +  - 'device_for_each_child_node'
> +  - 'displayid_iter_for_each'
> +  - 'dma_fence_array_for_each'
> +  - 'dma_fence_chain_for_each'
> +  - 'dma_fence_unwrap_for_each'
> +  - 'dma_resv_for_each_fence'
> +  - 'dma_resv_for_each_fence_unlocked'
> +  - 'do_for_each_ftrace_op'
> +  - 'drm_atomic_crtc_for_each_plane'
> +  - 'drm_atomic_crtc_state_for_each_plane'
> +  - 'drm_atomic_crtc_state_for_each_plane_state'
> +  - 'drm_atomic_for_each_plane_damage'
> +  - 'drm_client_for_each_connector_iter'
> +  - 'drm_client_for_each_modeset'
> +  - 'drm_connector_for_each_possible_encoder'
> +  - 'drm_for_each_bridge_in_chain'
> +  - 'drm_for_each_connector_iter'
> +  - 'drm_for_each_crtc'
> +  - 'drm_for_each_crtc_reverse'
> +  - 'drm_for_each_encoder'
> +  - 'drm_for_each_encoder_mask'
> +  - 'drm_for_each_fb'
> +  - 'drm_for_each_legacy_plane'
> +  - 'drm_for_each_plane'
> +  - 'drm_for_each_plane_mask'
> +  - 'drm_for_each_privobj'
> +  - 'drm_mm_for_each_hole'
> +  - 'drm_mm_for_each_node'
> +  - 'drm_mm_for_each_node_in_range'
> +  - 'drm_mm_for_each_node_safe'
> +  - 'dsa_switch_for_each_available_port'
> +  - 'dsa_switch_for_each_cpu_port'
> +  - 'dsa_switch_for_each_port'
> +  - 'dsa_switch_for_each_port_continue_reverse'
> +  - 'dsa_switch_for_each_port_safe'
> +  - 'dsa_switch_for_each_user_port'
> +  - 'dsa_tree_for_each_user_port'
> +  - 'dso__for_each_symbol'
> +  - 'dsos__for_each_with_build_id'
> +  - 'elf_hash_for_each_possible'
> +  - 'elf_section__for_each_rel'
> +  - 'elf_section__for_each_rela'
> +  - 'elf_symtab__for_each_symbol'
> +  - 'evlist__for_each_cpu'
> +  - 'evlist__for_each_entry'
> +  - 'evlist__for_each_entry_continue'
> +  - 'evlist__for_each_entry_from'
> +  - 'evlist__for_each_entry_reverse'
> +  - 'evlist__for_each_entry_safe'
> +  - 'flow_action_for_each'
> +  - 'for_each_acpi_dev_match'
> +  - 'for_each_active_dev_scope'
> +  - 'for_each_active_drhd_unit'
> +  - 'for_each_active_iommu'
> +  - 'for_each_active_route'
> +  - 'for_each_aggr_pgid'
> +  - 'for_each_available_child_of_node'
> +  - 'for_each_bench'
> +  - 'for_each_bio'
> +  - 'for_each_board_func_rsrc'
> +  - 'for_each_btf_ext_rec'
> +  - 'for_each_btf_ext_sec'
> +  - 'for_each_bvec'
> +  - 'for_each_card_auxs'
> +  - 'for_each_card_auxs_safe'
> +  - 'for_each_card_components'
> +  - 'for_each_card_dapms'
> +  - 'for_each_card_pre_auxs'
> +  - 'for_each_card_prelinks'
> +  - 'for_each_card_rtds'
> +  - 'for_each_card_rtds_safe'
> +  - 'for_each_card_widgets'
> +  - 'for_each_card_widgets_safe'
> +  - 'for_each_cgroup_storage_type'
> +  - 'for_each_child_of_node'
> +  - 'for_each_clear_bit'
> +  - 'for_each_clear_bit_from'
> +  - 'for_each_clear_bitrange'
> +  - 'for_each_clear_bitrange_from'
> +  - 'for_each_cmd'
> +  - 'for_each_cmsghdr'
> +  - 'for_each_collection'
> +  - 'for_each_comp_order'
> +  - 'for_each_compatible_node'
> +  - 'for_each_component_dais'
> +  - 'for_each_component_dais_safe'
> +  - 'for_each_console'
> +  - 'for_each_console_srcu'
> +  - 'for_each_cpu'
> +  - 'for_each_cpu_and'
> +  - 'for_each_cpu_wrap'
> +  - 'for_each_dapm_widgets'
> +  - 'for_each_dedup_cand'
> +  - 'for_each_dev_addr'
> +  - 'for_each_dev_scope'
> +  - 'for_each_dma_cap_mask'
> +  - 'for_each_dpcm_be'
> +  - 'for_each_dpcm_be_rollback'
> +  - 'for_each_dpcm_be_safe'
> +  - 'for_each_dpcm_fe'
> +  - 'for_each_drhd_unit'
> +  - 'for_each_dss_dev'
> +  - 'for_each_efi_memory_desc'
> +  - 'for_each_efi_memory_desc_in_map'
> +  - 'for_each_element'
> +  - 'for_each_element_extid'
> +  - 'for_each_element_id'
> +  - 'for_each_endpoint_of_node'
> +  - 'for_each_event'
> +  - 'for_each_event_tps'
> +  - 'for_each_evictable_lru'
> +  - 'for_each_fib6_node_rt_rcu'
> +  - 'for_each_fib6_walker_rt'
> +  - 'for_each_free_mem_pfn_range_in_zone'
> +  - 'for_each_free_mem_pfn_range_in_zone_from'
> +  - 'for_each_free_mem_range'
> +  - 'for_each_free_mem_range_reverse'
> +  - 'for_each_func_rsrc'
> +  - 'for_each_group_device'
> +  - 'for_each_group_evsel'
> +  - 'for_each_group_member'
> +  - 'for_each_hstate'
> +  - 'for_each_if'
> +  - 'for_each_inject_fn'
> +  - 'for_each_insn'
> +  - 'for_each_insn_prefix'
> +  - 'for_each_intid'
> +  - 'for_each_iommu'
> +  - 'for_each_ip_tunnel_rcu'
> +  - 'for_each_irq_nr'
> +  - 'for_each_lang'
> +  - 'for_each_link_codecs'
> +  - 'for_each_link_cpus'
> +  - 'for_each_link_platforms'
> +  - 'for_each_lru'
> +  - 'for_each_matching_node'
> +  - 'for_each_matching_node_and_match'
> +  - 'for_each_mem_pfn_range'
> +  - 'for_each_mem_range'
> +  - 'for_each_mem_range_rev'
> +  - 'for_each_mem_region'
> +  - 'for_each_member'
> +  - 'for_each_memory'
> +  - 'for_each_migratetype_order'
> +  - 'for_each_missing_reg'
> +  - 'for_each_net'
> +  - 'for_each_net_continue_reverse'
> +  - 'for_each_net_rcu'
> +  - 'for_each_netdev'
> +  - 'for_each_netdev_continue'
> +  - 'for_each_netdev_continue_rcu'
> +  - 'for_each_netdev_continue_reverse'
> +  - 'for_each_netdev_feature'
> +  - 'for_each_netdev_in_bond_rcu'
> +  - 'for_each_netdev_rcu'
> +  - 'for_each_netdev_reverse'
> +  - 'for_each_netdev_safe'
> +  - 'for_each_new_connector_in_state'
> +  - 'for_each_new_crtc_in_state'
> +  - 'for_each_new_mst_mgr_in_state'
> +  - 'for_each_new_plane_in_state'
> +  - 'for_each_new_plane_in_state_reverse'
> +  - 'for_each_new_private_obj_in_state'
> +  - 'for_each_new_reg'
> +  - 'for_each_node'
> +  - 'for_each_node_by_name'
> +  - 'for_each_node_by_type'
> +  - 'for_each_node_mask'
> +  - 'for_each_node_state'
> +  - 'for_each_node_with_cpus'
> +  - 'for_each_node_with_property'
> +  - 'for_each_nonreserved_multicast_dest_pgid'
> +  - 'for_each_of_allnodes'
> +  - 'for_each_of_allnodes_from'
> +  - 'for_each_of_cpu_node'
> +  - 'for_each_of_pci_range'
> +  - 'for_each_old_connector_in_state'
> +  - 'for_each_old_crtc_in_state'
> +  - 'for_each_old_mst_mgr_in_state'
> +  - 'for_each_old_plane_in_state'
> +  - 'for_each_old_private_obj_in_state'
> +  - 'for_each_oldnew_connector_in_state'
> +  - 'for_each_oldnew_crtc_in_state'
> +  - 'for_each_oldnew_mst_mgr_in_state'
> +  - 'for_each_oldnew_plane_in_state'
> +  - 'for_each_oldnew_plane_in_state_reverse'
> +  - 'for_each_oldnew_private_obj_in_state'
> +  - 'for_each_online_cpu'
> +  - 'for_each_online_node'
> +  - 'for_each_online_pgdat'
> +  - 'for_each_path'
> +  - 'for_each_pci_bridge'
> +  - 'for_each_pci_dev'
> +  - 'for_each_pcm_streams'
> +  - 'for_each_physmem_range'
> +  - 'for_each_populated_zone'
> +  - 'for_each_possible_cpu'
> +  - 'for_each_present_cpu'
> +  - 'for_each_prime_number'
> +  - 'for_each_prime_number_from'
> +  - 'for_each_probe_cache_entry'
> +  - 'for_each_process'
> +  - 'for_each_process_thread'
> +  - 'for_each_prop_codec_conf'
> +  - 'for_each_prop_dai_codec'
> +  - 'for_each_prop_dai_cpu'
> +  - 'for_each_prop_dlc_codecs'
> +  - 'for_each_prop_dlc_cpus'
> +  - 'for_each_prop_dlc_platforms'
> +  - 'for_each_property_of_node'
> +  - 'for_each_reg'
> +  - 'for_each_reg_filtered'
> +  - 'for_each_registered_fb'
> +  - 'for_each_requested_gpio'
> +  - 'for_each_requested_gpio_in_range'
> +  - 'for_each_reserved_mem_range'
> +  - 'for_each_reserved_mem_region'
> +  - 'for_each_rtd_codec_dais'
> +  - 'for_each_rtd_components'
> +  - 'for_each_rtd_cpu_dais'
> +  - 'for_each_rtd_dais'
> +  - 'for_each_script'
> +  - 'for_each_sec'
> +  - 'for_each_set_bit'
> +  - 'for_each_set_bit_from'
> +  - 'for_each_set_bitrange'
> +  - 'for_each_set_bitrange_from'
> +  - 'for_each_set_clump8'
> +  - 'for_each_sg'
> +  - 'for_each_sg_dma_page'
> +  - 'for_each_sg_page'
> +  - 'for_each_sgtable_dma_page'
> +  - 'for_each_sgtable_dma_sg'
> +  - 'for_each_sgtable_page'
> +  - 'for_each_sgtable_sg'
> +  - 'for_each_shell_test'
> +  - 'for_each_sibling_event'
> +  - 'for_each_subelement'
> +  - 'for_each_subelement_extid'
> +  - 'for_each_subelement_id'
> +  - 'for_each_sublist'
> +  - 'for_each_subsystem'
> +  - 'for_each_supported_activate_fn'
> +  - 'for_each_supported_inject_fn'
> +  - 'for_each_test'
> +  - 'for_each_thread'
> +  - 'for_each_token'
> +  - 'for_each_unicast_dest_pgid'
> +  - 'for_each_vsi'
> +  - 'for_each_wakeup_source'
> +  - 'for_each_zone'
> +  - 'for_each_zone_zonelist'
> +  - 'for_each_zone_zonelist_nodemask'
> +  - 'func_for_each_insn'
> +  - 'fwnode_for_each_available_child_node'
> +  - 'fwnode_for_each_child_node'
> +  - 'fwnode_graph_for_each_endpoint'
> +  - 'gadget_for_each_ep'
> +  - 'genradix_for_each'
> +  - 'genradix_for_each_from'
> +  - 'hash_for_each'
> +  - 'hash_for_each_possible'
> +  - 'hash_for_each_possible_rcu'
> +  - 'hash_for_each_possible_rcu_notrace'
> +  - 'hash_for_each_possible_safe'
> +  - 'hash_for_each_rcu'
> +  - 'hash_for_each_safe'
> +  - 'hashmap__for_each_entry'
> +  - 'hashmap__for_each_entry_safe'
> +  - 'hashmap__for_each_key_entry'
> +  - 'hashmap__for_each_key_entry_safe'
> +  - 'hctx_for_each_ctx'
> +  - 'hists__for_each_format'
> +  - 'hists__for_each_sort_list'
> +  - 'hlist_bl_for_each_entry'
> +  - 'hlist_bl_for_each_entry_rcu'
> +  - 'hlist_bl_for_each_entry_safe'
> +  - 'hlist_for_each'
> +  - 'hlist_for_each_entry'
> +  - 'hlist_for_each_entry_continue'
> +  - 'hlist_for_each_entry_continue_rcu'
> +  - 'hlist_for_each_entry_continue_rcu_bh'
> +  - 'hlist_for_each_entry_from'
> +  - 'hlist_for_each_entry_from_rcu'
> +  - 'hlist_for_each_entry_rcu'
> +  - 'hlist_for_each_entry_rcu_bh'
> +  - 'hlist_for_each_entry_rcu_notrace'
> +  - 'hlist_for_each_entry_safe'
> +  - 'hlist_for_each_entry_srcu'
> +  - 'hlist_for_each_safe'
> +  - 'hlist_nulls_for_each_entry'
> +  - 'hlist_nulls_for_each_entry_from'
> +  - 'hlist_nulls_for_each_entry_rcu'
> +  - 'hlist_nulls_for_each_entry_safe'
> +  - 'i3c_bus_for_each_i2cdev'
> +  - 'i3c_bus_for_each_i3cdev'
> +  - 'idr_for_each_entry'
> +  - 'idr_for_each_entry_continue'
> +  - 'idr_for_each_entry_continue_ul'
> +  - 'idr_for_each_entry_ul'
> +  - 'in_dev_for_each_ifa_rcu'
> +  - 'in_dev_for_each_ifa_rtnl'
> +  - 'inet_bind_bucket_for_each'
> +  - 'inet_lhash2_for_each_icsk'
> +  - 'inet_lhash2_for_each_icsk_continue'
> +  - 'inet_lhash2_for_each_icsk_rcu'
> +  - 'interval_tree_for_each_double_span'
> +  - 'interval_tree_for_each_span'
> +  - 'intlist__for_each_entry'
> +  - 'intlist__for_each_entry_safe'
> +  - 'iopt_for_each_contig_area'
> +  - 'kcore_copy__for_each_phdr'
> +  - 'key_for_each'
> +  - 'key_for_each_safe'
> +  - 'klp_for_each_func'
> +  - 'klp_for_each_func_safe'
> +  - 'klp_for_each_func_static'
> +  - 'klp_for_each_object'
> +  - 'klp_for_each_object_safe'
> +  - 'klp_for_each_object_static'
> +  - 'kunit_suite_for_each_test_case'
> +  - 'kvm_for_each_memslot'
> +  - 'kvm_for_each_memslot_in_gfn_range'
> +  - 'kvm_for_each_vcpu'
> +  - 'libbpf_nla_for_each_attr'
> +  - 'list_for_each'
> +  - 'list_for_each_codec'
> +  - 'list_for_each_codec_safe'
> +  - 'list_for_each_continue'
> +  - 'list_for_each_entry'
> +  - 'list_for_each_entry_continue'
> +  - 'list_for_each_entry_continue_rcu'
> +  - 'list_for_each_entry_continue_reverse'
> +  - 'list_for_each_entry_from'
> +  - 'list_for_each_entry_from_rcu'
> +  - 'list_for_each_entry_from_reverse'
> +  - 'list_for_each_entry_lockless'
> +  - 'list_for_each_entry_rcu'
> +  - 'list_for_each_entry_reverse'
> +  - 'list_for_each_entry_safe'
> +  - 'list_for_each_entry_safe_continue'
> +  - 'list_for_each_entry_safe_from'
> +  - 'list_for_each_entry_safe_reverse'
> +  - 'list_for_each_entry_srcu'
> +  - 'list_for_each_from'
> +  - 'list_for_each_prev'
> +  - 'list_for_each_prev_safe'
> +  - 'list_for_each_safe'
> +  - 'llist_for_each'
> +  - 'llist_for_each_entry'
> +  - 'llist_for_each_entry_safe'
> +  - 'llist_for_each_safe'
> +  - 'map__for_each_symbol'
> +  - 'map__for_each_symbol_by_name'
> +  - 'map_for_each_event'
> +  - 'map_for_each_metric'
> +  - 'maps__for_each_entry'
> +  - 'maps__for_each_entry_safe'
> +  - 'mci_for_each_dimm'
> +  - 'media_device_for_each_entity'
> +  - 'media_device_for_each_intf'
> +  - 'media_device_for_each_link'
> +  - 'media_device_for_each_pad'
> +  - 'msi_for_each_desc'
> +  - 'nanddev_io_for_each_page'
> +  - 'netdev_for_each_lower_dev'
> +  - 'netdev_for_each_lower_private'
> +  - 'netdev_for_each_lower_private_rcu'
> +  - 'netdev_for_each_mc_addr'
> +  - 'netdev_for_each_uc_addr'
> +  - 'netdev_for_each_upper_dev_rcu'
> +  - 'netdev_hw_addr_list_for_each'
> +  - 'nft_rule_for_each_expr'
> +  - 'nla_for_each_attr'
> +  - 'nla_for_each_nested'
> +  - 'nlmsg_for_each_attr'
> +  - 'nlmsg_for_each_msg'
> +  - 'nr_neigh_for_each'
> +  - 'nr_neigh_for_each_safe'
> +  - 'nr_node_for_each'
> +  - 'nr_node_for_each_safe'
> +  - 'of_for_each_phandle'
> +  - 'of_property_for_each_string'
> +  - 'of_property_for_each_u32'
> +  - 'pci_bus_for_each_resource'
> +  - 'pci_dev_for_each_resource'
> +  - 'pcl_for_each_chunk'
> +  - 'pcl_for_each_segment'
> +  - 'pcm_for_each_format'
> +  - 'perf_config_items__for_each_entry'
> +  - 'perf_config_sections__for_each_entry'
> +  - 'perf_config_set__for_each_entry'
> +  - 'perf_cpu_map__for_each_cpu'
> +  - 'perf_evlist__for_each_entry'
> +  - 'perf_evlist__for_each_entry_reverse'
> +  - 'perf_evlist__for_each_entry_safe'
> +  - 'perf_evlist__for_each_evsel'
> +  - 'perf_evlist__for_each_mmap'
> +  - 'perf_hpp_list__for_each_format'
> +  - 'perf_hpp_list__for_each_format_safe'
> +  - 'perf_hpp_list__for_each_sort_list'
> +  - 'perf_hpp_list__for_each_sort_list_safe'
> +  - 'perf_pmu__for_each_hybrid_pmu'
> +  - 'ping_portaddr_for_each_entry'
> +  - 'ping_portaddr_for_each_entry_rcu'
> +  - 'plist_for_each'
> +  - 'plist_for_each_continue'
> +  - 'plist_for_each_entry'
> +  - 'plist_for_each_entry_continue'
> +  - 'plist_for_each_entry_safe'
> +  - 'plist_for_each_safe'
> +  - 'pnp_for_each_card'
> +  - 'pnp_for_each_dev'
> +  - 'protocol_for_each_card'
> +  - 'protocol_for_each_dev'
> +  - 'queue_for_each_hw_ctx'
> +  - 'radix_tree_for_each_slot'
> +  - 'radix_tree_for_each_tagged'
> +  - 'rb_for_each'
> +  - 'rbtree_postorder_for_each_entry_safe'
> +  - 'rdma_for_each_block'
> +  - 'rdma_for_each_port'
> +  - 'rdma_umem_for_each_dma_block'
> +  - 'resort_rb__for_each_entry'
> +  - 'resource_list_for_each_entry'
> +  - 'resource_list_for_each_entry_safe'
> +  - 'rhl_for_each_entry_rcu'
> +  - 'rhl_for_each_rcu'
> +  - 'rht_for_each'
> +  - 'rht_for_each_entry'
> +  - 'rht_for_each_entry_from'
> +  - 'rht_for_each_entry_rcu'
> +  - 'rht_for_each_entry_rcu_from'
> +  - 'rht_for_each_entry_safe'
> +  - 'rht_for_each_from'
> +  - 'rht_for_each_rcu'
> +  - 'rht_for_each_rcu_from'
> +  - 'rq_for_each_bvec'
> +  - 'rq_for_each_segment'
> +  - 'rq_list_for_each'
> +  - 'rq_list_for_each_safe'
> +  - 'scsi_for_each_prot_sg'
> +  - 'scsi_for_each_sg'
> +  - 'sctp_for_each_hentry'
> +  - 'sctp_skb_for_each'
> +  - 'sec_for_each_insn'
> +  - 'sec_for_each_insn_continue'
> +  - 'sec_for_each_insn_from'
> +  - 'shdma_for_each_chan'
> +  - 'shost_for_each_device'
> +  - 'sk_for_each'
> +  - 'sk_for_each_bound'
> +  - 'sk_for_each_entry_offset_rcu'
> +  - 'sk_for_each_from'
> +  - 'sk_for_each_rcu'
> +  - 'sk_for_each_safe'
> +  - 'sk_nulls_for_each'
> +  - 'sk_nulls_for_each_from'
> +  - 'sk_nulls_for_each_rcu'
> +  - 'snd_array_for_each'
> +  - 'snd_pcm_group_for_each_entry'
> +  - 'snd_soc_dapm_widget_for_each_path'
> +  - 'snd_soc_dapm_widget_for_each_path_safe'
> +  - 'snd_soc_dapm_widget_for_each_sink_path'
> +  - 'snd_soc_dapm_widget_for_each_source_path'
> +  - 'strlist__for_each_entry'
> +  - 'strlist__for_each_entry_safe'
> +  - 'sym_for_each_insn'
> +  - 'sym_for_each_insn_continue_reverse'
> +  - 'symbols__for_each_entry'
> +  - 'tb_property_for_each'
> +  - 'tcf_act_for_each_action'
> +  - 'tcf_exts_for_each_action'
> +  - 'udp_portaddr_for_each_entry'
> +  - 'udp_portaddr_for_each_entry_rcu'
> +  - 'usb_hub_for_each_child'
> +  - 'v4l2_device_for_each_subdev'
> +  - 'v4l2_m2m_for_each_dst_buf'
> +  - 'v4l2_m2m_for_each_dst_buf_safe'
> +  - 'v4l2_m2m_for_each_src_buf'
> +  - 'v4l2_m2m_for_each_src_buf_safe'
> +  - 'virtio_device_for_each_vq'
> +  - 'while_for_each_ftrace_op'
> +  - 'xa_for_each'
> +  - 'xa_for_each_marked'
> +  - 'xa_for_each_range'
> +  - 'xa_for_each_start'
> +  - 'xas_for_each'
> +  - 'xas_for_each_conflict'
> +  - 'xas_for_each_marked'
> +  - 'xbc_array_for_each_value'
> +  - 'xbc_for_each_key_value'
> +  - 'xbc_node_for_each_array_value'
> +  - 'xbc_node_for_each_child'
> +  - 'xbc_node_for_each_key_value'
> +  - 'xbc_node_for_each_subkey'
> +  - 'zorro_for_each_dev'

A lot of these symbols don't and will never exist in kvm-unit-tests ... 
shouldn't we better trim the list to the ones that are available here?

  Thomas


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check
  2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
                   ` (9 preceding siblings ...)
  2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 10/10] add make format Nico Boehr
@ 2023-11-22 13:09 ` Thomas Huth
  10 siblings, 0 replies; 24+ messages in thread
From: Thomas Huth @ 2023-11-22 13:09 UTC (permalink / raw)
  To: Nico Boehr, frankja, imbrenda, david, pbonzini, andrew.jones,
	lvivier
  Cc: kvm, linux-s390

On 06/11/2023 13.50, Nico Boehr wrote:
> It is important that we have a consistent formatting of our source code and
> comments in kvm-unit-tests.
> 
> Yet, it's not always easy since tiny formatting mistakes are hard to spot
> for reviewers. Respinning patches because of these issues can also be
> frustrating for contributors.
> 
> This series is a RFC suggestion on how the situation could be improved
> for kvm-unit-tests.
> 
> It adds a clang-format file, mostly based on the one already present in the
> kernel. A new "make format" target makes it easy to properly format the
> source. If maintainers want, they could even re-format the source code of
> ther arch to ensure a consistent code formatting, but this is entirely
> optional. I am also happy to move the "make format" into arch-specific code
> if requested.
> 
> Additionally, I noticed that there is quite inconsistent use of kernel-doc
> comments in the code. Add a respective check command and fix the existing
> issues.

I think the kerneldoc patches are good to go, so I went ahead and pushed 
them to the repo now.

For the s390x beautification patches (patch 07 and 08), it would be good to 
get some other reviews first ... Claudio? Janosch?

  Thomas


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-11-22 13:09 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-06 12:50 [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Nico Boehr
2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 01/10] make: add target to check kernel-doc comments Nico Boehr
2023-11-22 12:27   ` Thomas Huth
2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 02/10] powerpc: properly format non-kernel-doc comments Nico Boehr
2023-11-06 16:53   ` Claudio Imbrenda
2023-11-06 17:13     ` Nico Boehr
2023-11-07  8:37       ` Thomas Huth
2023-11-07 18:42       ` Claudio Imbrenda
2023-11-22 12:28   ` Thomas Huth
2023-11-06 12:50 ` [kvm-unit-tests PATCH v1 03/10] lib: s390x: cpacf: move kernel-doc comment to correct function Nico Boehr
2023-11-22 12:47   ` Thomas Huth
2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 04/10] s390x: properly format non-kernel-doc comments Nico Boehr
2023-11-06 16:54   ` Claudio Imbrenda
2023-11-22 12:47   ` Thomas Huth
2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 05/10] s390x: ensure kernel-doc parameters are properly formated Nico Boehr
2023-11-22 12:49   ` Thomas Huth
2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 06/10] x86: properly format non-kernel-doc comments Nico Boehr
2023-11-22 12:49   ` Thomas Huth
2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 07/10] s390x: cpumodel: list tcg_fail explicitly Nico Boehr
2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 08/10] s390x: gs: turn off formatter for inline assembly Nico Boehr
2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 09/10] add clang-format configuration file Nico Boehr
2023-11-22 12:56   ` Thomas Huth
2023-11-06 12:51 ` [kvm-unit-tests PATCH v1 10/10] add make format Nico Boehr
2023-11-22 13:09 ` [kvm-unit-tests PATCH v1 00/10] RFC: Add clang-format and kerneldoc check Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox