linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Frank Rowand <frowand.list@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH 6/8] of: Fix kerneldoc output formatting
Date: Thu, 25 Mar 2021 18:46:15 +0100	[thread overview]
Message-ID: <20210325184615.08526aed@coco.lan> (raw)
In-Reply-To: <20210325164713.1296407-7-robh@kernel.org>

Em Thu, 25 Mar 2021 10:47:11 -0600
Rob Herring <robh@kernel.org> escreveu:

> The indentation of the kerneldoc comments affects the output formatting.
> Leading tabs in particular don't work, and sections need to be indented
> under the section header.
> 
> The example snippets for DT source in the comments still have some
> formatting issues, but there doesn't seem to be any way to do multi-line
> literal blocks in kerneldoc.
> 
> Cc: Frank Rowand <frowand.list@gmail.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> 
> Note the dts examples still cause warnings. I couldn't find any way to 
> do a literal block and fix them. Minimally, there needs to be a way to 
> escape ':' and not create sections:
> 
> Documentation/devicetree/kernel-api:11: ../drivers/of/base.c:1466: WARNING: Definition list ends without a blank line; unexpected unindent.

You can do something like this:

/**
 * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
 * @np:		pointer to a device tree node containing a list
 * @list_name:	property name that contains a list
 * @cells_name:	property name that specifies phandles' arguments count
 * @index:	index of a phandle to parse out
 * @out_args:	optional pointer to output arguments structure (will be filled)
 *
 * This function is useful to parse lists of phandles and their arguments.
 * Returns 0 on success and fills out_args, on error returns appropriate
 * errno value.
 *
 * Caller is responsible to call of_node_put() on the returned out_args->np
 * pointer.
 *
 * For example::
 *
 *	phandle1: node1 {
 *		#list-cells = <2>;
 *	};
 *
 *	phandle2: node2 {
 *		#list-cells = <1>;
 *	};
 *
 *	node3 {
 *		list = <&phandle1 1 2 &phandle2 3>;
 *	};
 *
 * To get a device_node of the ``node2`` node you may call this:
 * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
 */


The problem is that using just:

/**
 ...
 * Example::
 ...

Would make confusion with an existing regex at kernel-doc script that
parses a regex similar to this:

	\*\s+(\w+):

Into:
	**$1**

So, using two words fix the issue.

Granted, this is something that could be improved at kernel-doc with
something like (untested):

<snip>
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index cb92d0e1e932..cea82e004fce 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -392,7 +392,7 @@ my $doc_com_body = '\s*\* ?';
 my $doc_decl = $doc_com . '(\w+)';
 # @params and a strictly limited set of supported section names
 my $doc_sect = $doc_com .
-    '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)';
+    '\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*$';
</snip>

I'll run some tests if the above works and submit a separate patch
addressing it, likely tomorrow.

Thanks,
Mauro

  reply	other threads:[~2021-03-25 17:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25 16:47 [PATCH 0/8] dt: doc build improvements and kerneldoc addition Rob Herring
2021-03-25 16:47 ` [PATCH 1/8] dt-bindings: Fix reference in submitting-patches.rst to the DT ABI doc Rob Herring
2021-03-25 17:51   ` Mauro Carvalho Chehab
2021-03-25 16:47 ` [PATCH 2/8] docs: dt: writing-schema: Remove spurious indentation Rob Herring
2021-03-25 17:51   ` Mauro Carvalho Chehab
2021-03-25 16:47 ` [PATCH 3/8] docs: dt: writing-schema: Include the example schema in the doc build Rob Herring
2021-03-25 17:52   ` Mauro Carvalho Chehab
2021-03-25 16:47 ` [PATCH 4/8] docs: dt: Make 'Devicetree' wording more consistent Rob Herring
2021-03-25 17:25   ` Mauro Carvalho Chehab
2021-03-25 16:47 ` [PATCH 5/8] docs: dt: Group DT docs into relevant sub-sections Rob Herring
2021-03-25 17:52   ` Mauro Carvalho Chehab
2021-03-25 16:47 ` [PATCH 6/8] of: Fix kerneldoc output formatting Rob Herring
2021-03-25 17:46   ` Mauro Carvalho Chehab [this message]
2021-03-25 18:14     ` [PATCH] kernel-doc: better handle '::' sequences Mauro Carvalho Chehab
2021-03-25 18:51       ` Jonathan Corbet
2021-03-25 19:14         ` Matthew Wilcox
2021-03-25 21:04           ` Jonathan Corbet
2021-03-25 22:14             ` Matthew Wilcox
2021-03-25 22:30               ` Jonathan Corbet
2021-03-29 14:42                 ` Matthew Wilcox
2021-03-29 18:33                   ` Jani Nikula
2021-03-29 18:58                     ` Matthew Wilcox
2021-03-30 11:35                       ` Jani Nikula
2021-03-30 12:43                         ` Markus Heiser
2021-03-30 13:06                           ` Matthew Wilcox
2021-03-29 19:34                   ` kerneldoc and rust (was [PATCH] kernel-doc: better handle '::' sequences) Jonathan Corbet
2021-03-29 19:42                     ` Miguel Ojeda
2021-03-29 20:40               ` [PATCH] kernel-doc: better handle '::' sequences Miguel Ojeda
2021-03-30 11:07                 ` Jani Nikula
2021-03-30 22:46                   ` Miguel Ojeda
2021-03-25 16:47 ` [PATCH 7/8] of: Add missing 'Return' section in kerneldoc comments Rob Herring
2021-03-25 17:52   ` Mauro Carvalho Chehab
2021-03-25 16:47 ` [PATCH 8/8] docs: dt: Add DT API documentation Rob Herring
2021-03-25 17:53   ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210325184615.08526aed@coco.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).