From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Linux Doc Mailing List <linux-doc@vger.kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Jakub Kicinski <kuba@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Johannes Berg <johannes@sipsolutions.net>,
Jonathan Cameron <jic23@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: Re: [PATCH 00/14] get rid of the remaining kernel-doc warnings when building the docs
Date: Mon, 5 Oct 2020 12:51:11 +0200 [thread overview]
Message-ID: <20201005125111.326ff7e2@coco.lan> (raw)
In-Reply-To: <20200910181208.GW6583@casper.infradead.org>
Em Thu, 10 Sep 2020 19:12:08 +0100
Matthew Wilcox <willy@infradead.org> escreveu:
> On Thu, Sep 10, 2020 at 12:23:53PM +0200, Mauro Carvalho Chehab wrote:
> > As described on its subject, this series finally get rid of all kernel-doc warnings.
> >
> > With this series applied (plus my last series fixing other warnings), building
> > the docs is now clean[1] against next-20200909:
>
> Thanks, this has been a truly heroic effort.
>
> I'd suggest that we change the kernel build to always run the CHKDOC
> instead of at W=1 (or rather, as the patch I just sent out demonstrates,
> not at all (oops)). Otherwise you're just going to have to continue
> doing this.
It sounds a good idea for me to run kernel-doc with W=1 - or even
better - with allyesconfig/allmodconfig (no matter if W=0/W=1/W=2).
> At some point, perhaps we can add some other warnings at W=1, like
> an EXPORT_SYMBOL of a function which doesn't have kernel-doc.
Makes sense, but I suspect that supporting it is not too trivial.
I mean, a script checking for EXPORT_SYMBOL* should check not
only the C file, but also the included header files, as the
kernel-doc markup can be on one of its includes.
An enhanced version of something like this:
</script>
#!/usr/bin/perl
my $file = shift or die "Need a file name";
my @files;
my @exports;
my $dir = $file;
$dir =~ s,[^\/]+$,,;
push @files, $file;
open IN, "<$file";
while (<IN>) {
push @exports, $1 if (m/^EXPORT_SYMBOL.*\(\s*(\S+)\s*\)/);
push @files, "include/$1" if (m/^\s*#\s*include\s+[\<](\S+)[\>]/);
push @files, "$dir/$1" if (m/^\s*#\s*include\s+[\"](\S+)[\"]/);
}
close IN;
my $doc;
foreach my $i (@files) {
$doc .= qx(./scripts/kernel-doc $i 2>/dev/null);
}
foreach my $e (@exports) {
print "$e doesn't have kernel-doc markups\n" if (!($doc =~ m/\b$e\b/));
}
</script>
On simple cases, the above script helps to check what's missing:
$ ./check_exports drivers/acpi/acpi_lpat.c
<nothing returned>
$ ./test drivers/media/v4l2-core/v4l2-common.c
__v4l2_find_nearest_size doesn't have kernel-doc markups
v4l2_apply_frmsize_constraints doesn't have kernel-doc markups
v4l2_fill_pixfmt_mp doesn't have kernel-doc markups
v4l2_fill_pixfmt doesn't have kernel-doc markups
Yet, it the actual script will also need to handle some special
cases:
- it should check if the Makefile used by the file has a "-I" directive.
This could be tricky, due to Makefile recursion.
- it should also check if there is a kernel-doc entry for such header.
a "git grep" could be used in this case.
- It should also handle the optional arguments of kernel-doc, like
:internal", :external", ":no-identifiers", "identifiers", as it is
possible that there is a kernel-doc entry, but this is excluded
by a kernel-doc modifier.
- It should also check if the exported symbol is a function,
in order to exclude static vars that are exported.
I suspect that there are several other border cases.
Thanks,
Mauro
next prev parent reply other threads:[~2020-10-05 10:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 10:23 [PATCH 00/14] get rid of the remaining kernel-doc warnings when building the docs Mauro Carvalho Chehab
2020-09-10 10:23 ` [PATCH 01/14] locking/refcount: document the new "oldp" pointer value Mauro Carvalho Chehab
2020-09-10 10:23 ` [PATCH 02/14] usb: docs: document altmode register/unregister functions Mauro Carvalho Chehab
2020-09-10 10:23 ` [PATCH 03/14] XArray: docs: add missing kernel-doc parameters for xas_split_alloc() Mauro Carvalho Chehab
2020-09-10 11:13 ` Matthew Wilcox
2020-09-10 12:38 ` Mauro Carvalho Chehab
2020-09-10 10:23 ` [PATCH 04/14] blk-mq: docs: add kernel-doc description for a new struct member Mauro Carvalho Chehab
2020-09-10 10:23 ` [PATCH 05/14] iio: docs: add description for a new function member Mauro Carvalho Chehab
2020-09-10 10:23 ` [PATCH 06/14] nl80211: docs: add a description for s1g_cap parameter Mauro Carvalho Chehab
2020-09-10 10:24 ` [PATCH 07/14] IB/srpt: docs: add a description for cq_size member Mauro Carvalho Chehab
2020-09-10 10:24 ` [PATCH 08/14] rcu/tree: docs: document bkvcache new members at struct kfree_rcu_cpu Mauro Carvalho Chehab
2020-09-10 10:24 ` [PATCH 09/14] Input: sparse-keymap: add a description for @sw Mauro Carvalho Chehab
2020-09-10 10:24 ` [PATCH 10/14] drm: amdgpu: kernel-doc: update some adev parameters Mauro Carvalho Chehab
2020-09-10 10:24 ` [PATCH 11/14] drm/amd/display: kernel-doc: document force_timing_sync Mauro Carvalho Chehab
2020-09-10 10:24 ` [PATCH 12/14] drm: kernel-doc: document drm_dp_set_subconnector_property() params Mauro Carvalho Chehab
2020-09-10 10:24 ` [PATCH 13/14] drm: kernel-doc: drm_dp_helper.h: fix a typo Mauro Carvalho Chehab
2020-09-10 10:24 ` [PATCH 14/14] gpu: docs: amdgpu.rst: get rid of wrong kernel-doc markups Mauro Carvalho Chehab
2020-09-10 18:12 ` [PATCH 00/14] get rid of the remaining kernel-doc warnings when building the docs Matthew Wilcox
2020-10-05 10:51 ` Mauro Carvalho Chehab [this message]
2020-10-05 10:59 ` Mauro Carvalho Chehab
2020-10-06 11:53 ` [PATCH RFC] script: add a script for checking doc problems with external functions Mauro Carvalho Chehab
2020-10-06 12:13 ` Mauro Carvalho Chehab
2020-10-07 8:23 ` Jani Nikula
2020-10-07 8:32 ` Joe Perches
2020-10-07 13:38 ` 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=20201005125111.326ff7e2@coco.lan \
--to=mchehab+huawei@kernel.org \
--cc=airlied@linux.ie \
--cc=axboe@kernel.dk \
--cc=corbet@lwn.net \
--cc=daniel@ffwll.ch \
--cc=davem@davemloft.net \
--cc=dmitry.torokhov@gmail.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=jic23@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
--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).