public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Markus Heiser <markus.heiser@darmarit.de>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Grant Likely <grant.likely@secretlab.ca>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Dan Allen <dan@opendevise.io>,
	Russel Winder <russel@winder.org.uk>,
	Keith Packard <keithp@keithp.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-doc@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [PATCH 00/10] Documentation/Sphinx
Date: Sat, 04 Jun 2016 15:54:34 +0300	[thread overview]
Message-ID: <87k2i5867p.fsf@intel.com> (raw)
In-Reply-To: <20160603141618.56417305@lwn.net>

On Fri, 03 Jun 2016, Jonathan Corbet <corbet@lwn.net> wrote:
> [So I'm finally trying to get into this for real, hopefully I won't be
> interrupted too many times...expect a few mails as I catch up.]
>
> On Fri, 20 May 2016 16:39:31 +0300
> Jani Nikula <jani.nikula@intel.com> wrote:
>
>> There are a few tradeoffs, of course. First, this requires that the
>> EXPORT_SYMBOL markers are placed immediately after the function being
>> exported, as kernel-doc will only look at one file at a time. This is
>> the recommendation anyway. 
>
> As I understand it, the technical reasons that kept some markers in
> separate files should no longer be relevant, so this is probably OK.  It
> would be nice to have a sense for how many sites need to be fixed.

Actually, mostly this is not a problem due to EXPORT_SYMBOL placement,
but rather due to kernel-doc comments being placed in header files above
function declarations while EXPORT_SYMBOL is where it should be next to
the function definition.

I don't think we can force people to move the kernel-doc comments for
exported functions from header files next to the function definitions.

The straightforward fix to this is to add an optional filename parameter
to the kernel-doc extension :export: argument, to pass additional files
to kernel-doc where to look for the EXPORT_SYMBOLs. For example:

.. kernel-doc:: include/drm/foo.h
   :export: drivers/gpu/drm/foo/foo.c drivers/gpu/drm/foo/bar.c

This would instruct kernel-doc to extract documentation from
include/drm/foo.h for all functions that have been exported using
EXPORT_SYMBOL (or _GPL) in include/drm/foo.h, drivers/gpu/drm/foo/foo.c,
or drivers/gpu/drm/foo/bar.c.

We have something along these lines in docproc already with the !D
directive, so nothing altogether surprising.

If my quick grep-fu serves me right, there are about a thousand exported
symbols with kernel-doc comments in the headers. It's a ballpark
figure. They come in batches; a small fraction of that many filenames in
a fraction of the :export: statements would cover most of them.

Before this fix, the workaround is to name the functions with
:functions: argument instead of using :export:.

I'm hoping this is not a blocker for merging the series. If the proposed
fix is acceptable, I'll get it done before v4.8.

BR,
Jani.


The ugly greps:

$ git grep "^EXPORT_SYMBOL" | sed 's/^[^(]*(\([a-zA-Z0-9_]*\)).*/\1/' | sort > exports
$ git grep -h -A1 "^/\*\*$" -- *.h | grep -v "^\(/\*\*\|--\)" | sed 's/^ \*[         ]*\([a-zA-Z0-9_][a-zA-Z0-9_]*\).*/\1/;' | sort > comments
$ comm -1 -2 comments exports | wc -l
952




-- 
Jani Nikula, Intel Open Source Technology Center

      parent reply	other threads:[~2016-06-04 12:55 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20 13:39 [PATCH 00/10] Documentation/Sphinx Jani Nikula
2016-05-20 13:39 ` [PATCH 01/10] kernel-doc: fix use of uninitialized value Jani Nikula
2016-05-20 13:39 ` [PATCH 02/10] kernel-doc: support printing exported and non-exported symbols Jani Nikula
2016-05-20 13:39 ` [PATCH 03/10] Documentation/sphinx: add basic working Sphinx configuration and build Jani Nikula
2016-05-20 13:39 ` [PATCH 04/10] Documentation: add .gitignore Jani Nikula
2016-05-20 13:39 ` [PATCH 05/10] Documentation/sphinx: add Sphinx kernel-doc directive extension Jani Nikula
2016-06-03 20:35   ` Jonathan Corbet
2016-06-04  6:57     ` Markus Heiser
2016-05-20 13:39 ` [PATCH 06/10] Documentation/sphinx: configure the kernel-doc extension Jani Nikula
2016-05-20 13:39 ` [PATCH 07/10] sphinx: cheesy script to convert .tmpl files Jani Nikula
2016-05-20 13:39 ` [PATCH 08/10] Documentation: add kernel hacking rst Jani Nikula
2016-05-20 13:39 ` [PATCH 09/10] Documentation: add kernel api rst Jani Nikula
2016-05-20 13:39 ` [PATCH 10/10] Documentation: moar files Jani Nikula
2016-05-29 20:33 ` [PATCH 00/10] Documentation/Sphinx Jani Nikula
2016-05-30  9:10   ` Daniel Vetter
2016-05-30 10:47     ` Markus Heiser
2016-05-30 14:46       ` Jani Nikula
2016-05-30 15:29         ` Daniel Vetter
2016-05-30 16:39         ` Markus Heiser
2016-05-30 20:05           ` Jani Nikula
2016-05-30 21:23             ` Mauro Carvalho Chehab
2016-05-31 10:16               ` Markus Heiser
2016-06-24 10:40                 ` Mauro Carvalho Chehab
2016-06-27  6:15                   ` Markus Heiser
2016-06-27 17:08                     ` Mauro Carvalho Chehab
2016-06-29 12:41                       ` Markus Heiser
2016-05-31  7:27             ` Markus Heiser
2016-05-31  8:07               ` Daniel Vetter
2016-05-31  9:39                 ` Markus Heiser
2016-05-31 10:30                   ` Jani Nikula
2016-05-31 11:12                     ` Markus Heiser
2016-06-03 20:47             ` rst2pdf (was [PATCH 00/10] Documentation/Sphinx) Jonathan Corbet
2016-06-07  6:02               ` Markus Heiser
2016-06-07  6:44                 ` Jani Nikula
2016-06-10 17:08                   ` Markus Heiser
2016-06-03 21:04             ` [PATCH 00/10] Documentation/Sphinx Jonathan Corbet
2016-06-03 22:54               ` Daniel Vetter
2016-06-04 11:45               ` Jani Nikula
2016-06-01  1:07     ` Jonathan Corbet
2016-06-01  6:42       ` Daniel Vetter
2016-06-03 20:16 ` Jonathan Corbet
2016-06-03 20:24   ` Daniel Vetter
2016-06-03 20:27     ` Jonathan Corbet
2016-06-04 13:01       ` Jani Nikula
2016-06-04 12:54   ` Jani Nikula [this message]

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=87k2i5867p.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=corbet@lwn.net \
    --cc=dan@opendevise.io \
    --cc=daniel.vetter@ffwll.ch \
    --cc=grant.likely@secretlab.ca \
    --cc=hverkuil@xs4all.nl \
    --cc=keithp@keithp.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus.heiser@darmarit.de \
    --cc=mchehab@osg.samsung.com \
    --cc=russel@winder.org.uk \
    /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