[media] doc-rst: Fix conversion for v4l2 core functions
The conversion from DocBook lead into some conversion issues,
basically due to the lack of proper support at kernel-doc.
So, address them:
- Now, the C files with the exported symbols also need to be
added. So, all headers need to be included twice: one to
get the structs/enums/.. and another one for the functions;
- Notes should use the ReST tag, as kernel-doc doesn't
recognizes it anymore;
- Identation needs to be fixed, as ReST uses it to identify
when a format "tag" ends.
- kernel-doc doesn't escape things like *pointer, so we
need to manually add a escape char before it.
- On some cases, kernel-doc conversion requires violating
the 80-cols, as otherwise it won't properly parse the
source code.
[media] doc-rst: split media_drivers.rst into one file per API type
Just like the uAPI book is split into parts, let's split the
kAPI documentation. That should make easier to maintain, and
will split the final documentation into smaller html files.
Btw, with the standard Sphinx version shipped on Fedora 24 (Sphinx
1.3.1), rst2pdf doesn't build even the simple kernel-documentation,
failing with this error:
writing Kernel... [ERROR] pdfbuilder.py:130 list index out of range
This is a known bug:
https://github.com/sphinx-doc/sphinx/issues/1844
So, maybe we should just disable pdf generation from RST for good,
as I suspect that maintaining it with a broken toolchain will be a
big headache.
Merge branch 'docs-next' of git://git.lwn.net/linux into devel/docs-next
* 'docs-next' of git://git.lwn.net/linux:
doc-rst: add an option to ignore DocBooks when generating docs
workqueue: Fix a typo in workqueue.txt
Doc: ocfs: Fix typo in filesystems/ocfs2-online-filecheck.txt
Documentation/sphinx: skip build if user requested specific DOCBOOKS
Documentation: add cleanmediadocs to the documentation targets
Those fixes came from patchs from Andrea for the old DocBook
documentation.
As we're removing it on Kernel 4.8, it doesn't make sense to
apply the original patches, but, as the typos were ported
to ReST, let's fix the issues there.
Suggested-by: Andrea Gelmini <andrea.gelmini@gelma.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
It is useful to have an index with all the book contents somewhere,
as it makes easier to seek for something. So, increase maxdepth
to 5 for the main index at the beginning of the book.
While here, remove the genindex content, as it is bogus.
Documentation/media/uapi/cec/cec-ioc-dqevent.rst:43: WARNING: undefined label: cec_event_state_change (if the link has no caption the label must precede a section header)
Fix those warnings:
Documentation/output/videodev2.h.rst:6: WARNING: undefined label: vidioc_unsubscribe_event (if the link has no caption the label must precede a section header)
Documentation/media/uapi/v4l/dev-overlay.rst:248: WARNING: Title underline too short.
Put each ioctl on its own page and improve documentation, adding
cross-references for LIRC_SET_REC_CARRIER_RANGE and LIRC_SET_REC_CARRIER,
with can be used together to set a carrier frequency range.
Improve the documentation for those ioctls, adding them to
a separate file, in order to look like the rest of the
book, and to later allow to generate a man page for those
ioctls.
Improve the documentation for this ioctl, adding it to
a separate file, in order to look like the rest of the
book, and to later allow to generate a man page for this
ioctl.
[media] doc-rst: improve display of notes and warnings
There are several notes and warning mesages in the middle of
the media docbook. Use the ReST tags for that, as it makes
them visually better and hightlights them.
While here, modify a few ones to make them clearer.
Unfortunately, captions are new on Sphinx for c blocks: it was
added only on version 1.3. Also, it were already bad enough
not being able to auto-numerate them.
So, let's give up and use, instead, titles before the examples.
Not much is lost, and, as a side track, we don't need to
numerate them anymore.
The lirc syscall documentation uses a very different and
simplified way than the rest of the media book. make it
closer. Still, there's just one page for all ioctls.
doc-rst: add an option to ignore DocBooks when generating docs
Sometimes, we want to do a partial build, instead of building
everything. However, right now, if one wants to build just
Sphinx books, it will build also the DocBooks.
Add an option to allow to ignore all DocBooks when building
documentation.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
[media] doc-rst: make CEC look more like other parts of the book
Better organize the contents of the CEC part, moving the
introduction to chapter 1, placing all ioctls at chapter 2
and numerating all chapters and items.
[media] doc-rst: add CEC header file to the documentation
Adding the header file is interesting for several reasons:
1) It makes MC documentation consistend with other parts;
2) The header file can be used as a quick index to all API
elements;
3) The cross-reference check helps to identify symbols that
aren't documented.
[media] doc-rst: add media.h header to media contrller
Adding the header file is interesting for several reasons:
1) It makes MC documentation consistend with other parts;
2) The header file can be used as a quick index to all API
elements;
3) The cross-reference check helps to identify symbols that
aren't documented.
The function that replace references add a "\ " at the end of
references, to avoid the ReST markup parser to not identify
them as references. That works fine except for the end of lines,
as a sequence of { '\', ' ', '\n' } characters makes Sphinx
to ignore the end of line. So, strip those escape/spaces at the
end of lines.
Changesets: eaa0b96bbb65 ("[media] media: Add video statistics computation functions")
and 1179aab13db3 ("[media] media: Add video processing entity functions")
added some new elements to the "media entity types" table at the
DocBook. We need to do the same at the reST version, in order to
keep it in sync with the DocBook version.
[media] doc-rst: mention the memory type to be set for all streaming I/O
Changeset 8c9f46095176 ("[media] DocBook: mention the memory type to
be set for all streaming I/O") updated the media DocBook to mention
the need of filling the memory types. We need to keep the ReST
doc updated to such change.
[media] doc-rst: add dmabuf as streaming I/O in VIDIOC_REQBUFS description
Commit 707e65831d3b("[media] DocBook: add dmabuf as streaming I/O
in VIDIOC_REQBUFS description") added DMABUF to reqbufs description,
but, as we're migrating to ReST markup, we need to keep it in sync
with the change.
doc_rst: rename the media Sphinx suff to Documentation/media
The name of the subsystem is "media", and not "linux_tv". Also,
as we plan to add other stuff there in the future, let's
rename also the media uAPI book to media_uapi, to make it
clearer.
Markus Heiser [Fri, 8 Jul 2016 12:15:04 +0000 (14:15 +0200)]
doc-rst: add kernel-include directive
The kernel-include directive is needed to include the auto generated rst
content from a build (pre-) process. E.g. the linux_tv Makefile
generates intermediate reST-files from header files. Since there is a O=
option:
make O=dir [targets] Locate all output files in "dir"
We need to include intermediate reST files from arbitrary (O=/tmp/foo)
locations:
The 'kernel-include' reST-directive is a replacement for the 'include'
directive. The 'kernel-include' directive expand environment variables
in the path name and allows to include files from arbitrary locations.
.. hint::
Including files from arbitrary locations (e.g. from '/etc') is a
security risk for builders. This is why the 'include' directive from
docutils *prohibit* pathnames pointing to locations *above* the
filesystem tree where the reST document with the include directive is
placed.
Substrings of the form $name or ${name} are replaced by the value of
environment variable name. Malformed variable names and references to
non-existing variables are left unchanged.
Signed-off-by: Markus Heiser <markus.heiser@darmarIT.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
After checking that all enum fields are documented at the
corresponding table on the rst file, let's point to the
table, instead of ignore the symbols.
A few symbols are not meant to be documented, as they're
deprecated stuff. keep ignoring them.
One enum field is not documented. Either it is obsolete
or a documentation gap. So, produce warnings for it.
This file comes from the uAPI definitions for V4L2, with is dynamic
and updated on almost every Kernel version. So, this file
needs to be auto-updated, as otherwise the documentation will
become obsolete too early.
doc-rst: parse-headers: don't do substituition references
Add one extra escape character to avoid those warnings:
Documentation/linux_tv/videodev2.h.rst:6: WARNING: Inline substitution_reference start-string without end-string.
doc-rst: parse-headers: better handle comments at the source code
We should not let comments to mangle with the symbols
parsing. Unfortunately, videodev2.h has lots of those
in the middle of enums and structs. So, we need to improve
our parser to discard them.
The typedef handler should do two things to be generic:
1) parse typedef enums;
2) accept both possible syntaxes:
typedef struct foo { .. } foo_t;
typedef struct { .. } foo_t;
Unfortunately, this is needed to parse some legacy DVB
files, like dvb/audio.h.
doc-rst: parse-headers: improve delimiters to detect symbols
As we had to escape the symbols for the ReST markup to not do
the wrong thing, the logic to discover start/end of strings
are not trivial. Improve the end delimiter detection, in order
to highlight more occurrences of the strings.
The V4L2 is the only part of the doc that has the word "Specification"
and mentions its version on the title.
Having the version there was important in the past, while we were
getting rid of V4L version 1. But, as v1 is long gone, all it lasts
is history (with is, btw, covered on the spec). So, no need to keep
the version on its title.
So, rename it, to be more generic and look like the remaining
of the document.