From: Randy Dunlap <rdunlap@infradead.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Linux Doc Mailing List <linux-doc@vger.kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel-doc: add support for handling global variables
Date: Tue, 9 Sep 2025 14:06:43 -0700 [thread overview]
Message-ID: <5dc41508-43e8-4e80-b4e0-149af7bbdf19@infradead.org> (raw)
In-Reply-To: <20250909215824.1968220c@foz.lan>
On 9/9/25 12:58 PM, Mauro Carvalho Chehab wrote:
> Em Tue, 9 Sep 2025 00:27:20 -0700
> Randy Dunlap <rdunlap@infradead.org> escreveu:
>
>> Hi Mauro,
>>
>> So, I grabbed some global data from 6-8 places in the kernel and put them intoinit/kdoc-globals-test.c. Then I modified Documentation/core-api/kernel-api.rst
>> like this at the end of that file:
>>
>> +
>> +Kernel Globals
>> +==========================
>> +
>> +.. kernel-doc:: init/kdoc-globals-test.c
>> + :identifiers:
>>
>> The html output says
>> "Kernel Globals"
>> but nothing else.
>
> I usually don't add :identifiers: on kernel-doc entries. If you use
> identifiers, you need to explicitly tell what symbols you want.
Well, it worked/works without using having any identifiers listed, and
the docs in Documentation/doc-guide/kernel-doc.rst says that they are
optional:
identifiers: *[ function/type ...]*
Include documentation for each *function* and *type* in *source*.
If no *function* is specified, the documentation for all functions
and types in the *source* will be included.
*type* can be a struct, union, enum, or typedef identifier.
> As a reference, kerneldoc.py logic for identifiers is:
>
> if 'identifiers' in self.options:
> identifiers = self.options.get('identifiers').split()
> if identifiers:
> for i in identifiers:
> i = i.rstrip("\\").strip()
> if not i:
> continue
>
> cmd += ['-function', i]
> self.msg_args["symbol"].append(i)
>
> without it, it will pick the entire set of symbols.
Yeah, that's exactly what I want, so I don't see a problem.
>> My test files are attached. I dumbed down (simplified) a few
>> of the globals from fancy types to just unsigned long, but that
>> didn't help the output results any.
>
> Looking on your attachment, you can either drop :identifiers:
> or list all of them:
>
> .. kernel-doc:: init/kdoc-globals-test.c
> :identifiers: ROOT_DEV loop_per_jiffy
> :identifiers: preset_lpj
>
> (here, it should only show those 3 symbols)
>
> see, having this:
>
> .. kernel-doc:: init/kdoc-globals-test.c
> :identifiers: ROOT_DEV
>
> will run:
>
> $ ./scripts/kernel-doc init/kdoc-globals-test.c -function ROOT_DEV
>
>
> .. c:var:: unsigned long ROOT_DEV;
>
> system root device
Yes, I understand how to use explicit identifiers. :)
Thanks.
--
~Randy
next prev parent reply other threads:[~2025-09-09 21:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-07 16:22 Mauro Carvalho Chehab
2025-09-07 21:34 ` Mauro Carvalho Chehab
2025-09-09 6:22 ` Randy Dunlap
2025-09-09 20:12 ` Mauro Carvalho Chehab
2025-09-09 7:27 ` Randy Dunlap
2025-09-09 15:57 ` Randy Dunlap
2025-09-09 16:18 ` Mauro Carvalho Chehab
2025-09-09 18:20 ` Randy Dunlap
2025-09-09 20:37 ` Mauro Carvalho Chehab
2025-09-09 19:58 ` Mauro Carvalho Chehab
2025-09-09 20:09 ` Mauro Carvalho Chehab
2025-09-09 21:06 ` Randy Dunlap [this message]
2025-09-09 23:09 ` Mauro Carvalho Chehab
2025-09-09 23:49 ` Randy Dunlap
2025-09-09 23:50 ` Randy Dunlap
2025-09-10 0:02 ` Randy Dunlap
2025-09-10 4:23 ` Mauro Carvalho Chehab
2025-09-10 5:59 ` Randy Dunlap
2025-09-10 6:13 ` Randy Dunlap
2025-09-10 8:54 ` Mauro Carvalho Chehab
2025-11-15 0:50 ` Randy Dunlap
2025-11-16 10:28 ` Mauro Carvalho Chehab
2025-11-16 19:46 ` Randy Dunlap
2025-11-17 9:45 ` Mauro Carvalho Chehab
2025-11-17 17:45 ` Randy Dunlap
2025-09-10 9:24 ` Jani Nikula
2025-09-10 12:13 ` 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=5dc41508-43e8-4e80-b4e0-149af7bbdf19@infradead.org \
--to=rdunlap@infradead.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+huawei@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
all inboxes | Powered by JetHome®