From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Vegard Nossum <vegard.nossum@oracle.com>,
ksummit@lists.linux.dev,
Linux Documentation <linux-doc@vger.kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Akira Yokosawa <akiyks@gmail.com>,
Bagas Sanjaya <bagasdotme@gmail.com>,
Jani Nikula <jani.nikula@intel.com>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [TECH TOPIC] Kernel documentation - update and future directions
Date: Mon, 1 Sep 2025 21:27:51 +0200 [thread overview]
Message-ID: <20250901212751.638cc4a8@foz.lan> (raw)
In-Reply-To: <636fe6e8-dc66-4521-a64a-4fb972e7ef39@infradead.org>
Em Sun, 31 Aug 2025 23:17:22 -0700
Randy Dunlap <rdunlap@infradead.org> escreveu:
> On 8/31/25 1:16 PM, Jonathan Corbet wrote:
> > Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:
> >
> >> 4) kernel-doc kAPI
> >>
> >> It shouldn't be that hard to do the same for kernel-doc kAPI documentation:
> >> kernel-doc now can parse the entire tree with:
> >>
> >> $ scripts/kernel-doc .
> >>
> >> Someone can easily use it to discover the current gaps at the docs that
> >> have already some kernel-doc markups and identify what of them aren't
> >> yet placed under Documentation/ ".. kernel-doc::" markups.
>
> Mauro, I tried that for one file: kernel/audit.c
> but didn't see what I expected to see.
> What options should I be using to find the gaps?
If you want to check all warnings kernel-doc detect, use -Wall:
$ ./scripts/kernel-doc -Wall kernel/audit.c --none
Warning: kernel/audit.c:216 No description found for return value of 'auditd_test_task'
Warning: kernel/audit.c:254 No description found for return value of 'audit_ctl_owner_current'
Warning: kernel/audit.c:265 No description found for return value of 'auditd_pid_vnr'
Warning: kernel/audit.c:289 No description found for return value of 'audit_get_sk'
Warning: kernel/audit.c:498 No description found for return value of 'auditd_set'
Warning: kernel/audit.c:687 No description found for return value of 'auditd_send_unicast_skb'
Warning: kernel/audit.c:747 No description found for return value of 'kauditd_send_queue'
Warning: kernel/audit.c:841 No description found for return value of 'kauditd_thread'
Warning: kernel/audit.c:1828 No description found for return value of 'audit_serial'
Warning: kernel/audit.c:1860 No description found for return value of 'audit_log_start'
Warning: kernel/audit.c:1937 No description found for return value of 'audit_expand'
Warning: kernel/audit.c:2093 No description found for return value of 'audit_string_contains_control'
Warning: kernel/audit.c:2359 No description found for return value of 'audit_set_loginuid'
Warning: kernel/audit.c:2394 No description found for return value of 'audit_signal_info'
To be bug-compatible with the Perl version, I ported -Wall to it,
as otherwise there would be tons of extra warnings after migration.
Ok, it doesn't tell that there are exports there, although kernel-doc
knows, as it has to process exports anyway.
> > ...or one can use scripts/find-unused-docs.sh, which was written for
> > just this purpose :)
It should be very easy to add an option to kernel-doc to do the same.
IMO, reducing the number of scripts may help people to better use
the tools.
>
> Yes, and I have used this script. It does what it was meant to do AFAIK.
> It's reporting is at a gross file level.
>
> I made a small subdirectory called "test" and copied kernel/audit.c to test/.
>
> $ ./scripts/find-unused-docs.sh test/
> The following files contain kerneldoc comments for exported functions that are not used in the formatted documentation
> test/audit.c
>
> Sometime in the last 2-3 years Matthew Wilcox asked me about a tool (script, whatever)that would detect both EXPORTs without kernel-doc and kernel-doc without EXPORTs.
> Either one of these can be noisy (with false positives) and they often don't lend
> themselves to easy/beginner fixes.
Heh, not knowing/remembering about find-unused-docs.sh, I actually
wrote a prototype for something similar sometime ago, in Perl.
Didn't upstream it though, nor used it much as I got sidetracked
by other things. My goal on that time were to find gaps on media kAPI.
> Anyway, after some delay, I have such a script. It's written in Perl (I started
> on it over a year ago!). It might have been desirable to add it to scripts/kernel-doc.pl
> at the time, but it didn't seem to me like a good fit there, so it's independent.
>
> Running (no options, just produce a summary)
> $ kerndoc-export-search.pl test/audit.c
> reports:
> Missing kernel-doc for: audit_log_task_info
> Missing kernel-doc for: audit_enabled
> Missing kernel-doc for: audit_log_task_context
> 3 missing kernel-docs
> Missing EXPORT for: audit_serial
> Missing EXPORT for: audit_log_untrustedstring
> Missing EXPORT for: audit_log_n_untrustedstring
> Missing EXPORT for: audit_log_n_hex
> Missing EXPORT for: audit_log_lost
> Missing EXPORT for: audit_set_loginuid
> Missing EXPORT for: auditd_test_task
> Missing EXPORT for: audit_ctl_lock
> Missing EXPORT for: audit_string_contains_control
> Missing EXPORT for: audit_signal_info
> Missing EXPORT for: audit_log_path_denied
> Missing EXPORT for: audit_ctl_unlock
> 12 missing Exports
>
> If that's not verbose enough (!), the -l (list) option lists each function's
> location and short description. One example:
> test/audit.c: 2006: audit_log_format: * audit_log_format - format a message into the audit buffer.
Nice! Yet, I suggest trying to merge with kernel-doc, even if the
actual implementation would be on a separate class inside a
separate file.
Still, the way kernel-doc works allow one to just write a different
output class (or improve the output class used by --none) to use
the already parsed data on different ways.
> But that generates lots of output.
>
> And of course, for function, I mean function/struct/union/enum/typedef.
>
> There is a "verbose" option but it currently does not print anything.
>
> Here is a help summary:
> $ kerndoc-export-search.pl -h
> kerndoc-export-search.pl [--list|-l] [--verbose|-v] file(s)
> where --list prints filename:line:funcname: short_description
> where --verbose prints more info.
> default: prints a doc/export summary + warnings.
> version: 0.9
>
>
> Feel free to use in any way or to rewrite & merge it into the
> kdoc python system.
Good to know! I'll try to take a look on it later on.
Thanks,
Mauro
next prev parent reply other threads:[~2025-09-01 19:27 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87plcndkzs.fsf@trenco.lwn.net>
[not found] ` <20250828230104.GB26612@pendragon.ideasonboard.com>
[not found] ` <87wm6l0w2y.fsf@trenco.lwn.net>
2025-08-30 16:00 ` [TECH TOPIC] Kernel documentation - update and future directions Vegard Nossum
2025-08-30 22:23 ` Laurent Pinchart
2025-08-30 23:08 ` Jonathan Corbet
2025-08-31 14:03 ` Mauro Carvalho Chehab
2025-08-31 20:16 ` Jonathan Corbet
2025-09-01 6:17 ` Randy Dunlap
2025-09-01 19:27 ` Mauro Carvalho Chehab [this message]
2025-09-01 10:09 ` Jani Nikula
2025-09-01 16:51 ` Randy Dunlap
2025-09-01 17:52 ` Mark Brown
2025-09-01 18:15 ` Randy Dunlap
2025-09-01 18:20 ` Mark Brown
2025-09-01 18:25 ` Jonathan Corbet
2025-09-01 18:40 ` Mark Brown
2025-09-01 19:51 ` Jonathan Corbet
2025-09-01 22:52 ` Mauro Carvalho Chehab
2025-09-01 18:46 ` Mauro Carvalho Chehab
2025-09-01 18:52 ` Mark Brown
2025-09-01 22:56 ` Mauro Carvalho Chehab
2025-09-02 11:15 ` Mark Brown
2025-09-02 11:59 ` Mauro Carvalho Chehab
2025-09-02 12:14 ` Mauro Carvalho Chehab
2025-09-02 13:00 ` Mark Brown
2025-09-02 14:42 ` Mauro Carvalho Chehab
2025-09-02 15:15 ` Jonathan Corbet
2025-09-02 17:19 ` Mauro Carvalho Chehab
2025-09-02 18:52 ` Laurent Pinchart
2025-09-03 7:47 ` Jani Nikula
2025-09-03 10:04 ` Mauro Carvalho Chehab
2025-09-03 10:25 ` Jani Nikula
2025-09-02 18:58 ` Jonathan Corbet
2025-09-02 22:35 ` Mauro Carvalho Chehab
2025-09-03 6:29 ` Johannes Berg
2025-09-03 10:42 ` Mauro Carvalho Chehab
2025-09-03 10:45 ` Johannes Berg
2025-09-03 10:54 ` Johannes Berg
2025-09-03 14:57 ` Mauro Carvalho Chehab
2025-09-03 15:07 ` Laurent Pinchart
2025-09-03 15:17 ` Konstantin Ryabitsev
2025-09-03 15:22 ` Miguel Ojeda
2025-09-03 15:11 ` Johannes Berg
2025-09-03 15:25 ` Mauro Carvalho Chehab
2025-09-03 15:37 ` Jonathan Corbet
2025-09-03 15:52 ` Mauro Carvalho Chehab
2025-09-03 13:39 ` Mauro Carvalho Chehab
2025-09-03 13:51 ` Laurent Pinchart
2025-09-01 19:53 ` Jonathan Corbet
2025-09-01 23:15 ` Mauro Carvalho Chehab
2025-09-01 18:37 ` Mauro Carvalho Chehab
2025-09-01 19:05 ` Andrew Lunn
2025-09-01 19:17 ` Mark Brown
2025-09-02 10:42 ` Jani Nikula
2025-09-02 11:55 ` Mauro Carvalho Chehab
2025-09-02 12:07 ` Jani Nikula
2025-09-02 15:07 ` Mauro Carvalho Chehab
2025-09-01 18:26 ` Mauro Carvalho Chehab
2025-09-02 10:55 ` Jani Nikula
2025-09-02 12:04 ` Andrew Lunn
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=20250901212751.638cc4a8@foz.lan \
--to=mchehab+huawei@kernel.org \
--cc=akiyks@gmail.com \
--cc=bagasdotme@gmail.com \
--cc=corbet@lwn.net \
--cc=jani.nikula@intel.com \
--cc=ksummit@lists.linux.dev \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-doc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rdunlap@infradead.org \
--cc=vegard.nossum@oracle.com \
--cc=willy@infradead.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).