04 Jul, 2016

1 commit

  • The conversion script added some comments at the end.
    They point to the original DocBook files, with will be
    removed after the manual fixes. So, they'll be pointing
    to nowere. So, remove those comments.

    They'll be forever stored at the Kernel tree. So, if
    someone wants the references, it is just a matter of
    looking at the backlog.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

03 Jul, 2016

1 commit

  • The c language parser checks if there are duplicated object
    definitions. That causes lots of warnings like:
    WARNING: duplicate C object description of ioctl

    Let's remove those by telling Sphinx that the language for
    those objects are c++. The look of the descriptions will
    be close, and the warnings will be gone.

    Please notice that we had to keep a few of them as C, as
    the c++ parser seems to be broken when it finds an enum.

    Yet, this reduced from 219 warnings to 143, with is
    a good thing.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

10 Jun, 2016

7 commits


04 Jun, 2016

1 commit

  • Opt-in since this wreaks the rst output and must be removed
    by consumers again. This is useful to adjust the linenumbers
    for included kernel-doc snippets in shinx. With that sphinx
    error message will be accurate when there's issues with the
    rst-ness of the kernel-doc comments.

    Especially when transitioning a new docbook .tmpl to .rst this
    is extremely useful, since you can just use your editors compilation
    quickfix list to accurately jump from error to error.

    v2:
    - Also make sure that we filter the LINENO for purpose/at declaration
    start so it only shows for selected blocks, not all of them (Jani).
    While at it make it a notch more accurate.
    - Avoid undefined $lineno issues. I tried filtering these out at the
    callsite, but Jani spotted more when linting the entire kernel.
    Unamed unions and similar things aren't stored consistently and end
    up with an undefined line number (but also no kernel-doc text, just
    the parameter type). Simplify things and filter undefined line
    numbers in print_lineno() to catch them all.

    v3: Fix LINENO 0 issue for kernel-doc comments without @param: lines
    or any other special sections that directly jump to the description
    after the "name - purpose" line. Only really possible for functions
    without parameters. Noticed by Jani.

    Cc: Jani Nikula
    Cc: linux-doc@vger.kernel.org
    Cc: Jonathan Corbet
    Signed-off-by: Daniel Vetter
    Signed-off-by: Jani Nikula

    Daniel Vetter
     

03 Jun, 2016

2 commits

  • state3 = prototype parsing, so name them accordingly.

    Cc: Jani Nikula
    Cc: linux-doc@vger.kernel.org
    Cc: Jonathan Corbet
    Signed-off-by: Daniel Vetter
    Signed-off-by: Jani Nikula

    Daniel Vetter
     
  • Further up in the state machinery we switch from STATE_NAME to
    STATE_DOCBLOCK when we match /$doc_block/. Which means this block of
    code here is entirely unreachable, unless there are multiple DOC:
    sections within a single kernel-doc comment.

    Getting a list of all the files with more than one DOC: section using

    $ git grep -c " * DOC:" | grep -v ":1$"

    and then doing a full audit of them reveals there are no such comment
    blocks in the kernel.

    Supporting multiple DOC: sections in a single kernel-doc comment does
    not seem like a recommended way of doing things anyway, so nuke the code
    for simplicity.

    Cc: Jani Nikula
    Cc: linux-doc@vger.kernel.org
    Cc: Jonathan Corbet
    Signed-off-by: Daniel Vetter
    [Jani: amended the commit message]
    Signed-off-by: Jani Nikula

    Daniel Vetter
     

30 May, 2016

23 commits

  • If the documentation comment does not have params or sections, the
    section heading may leak from the previous documentation comment.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • If there are multiple sections with the same section name, the current
    implementation results in several sections by the same heading, with the
    content duplicated from the last section to all. Even if there's the
    error message, a more graceful approach is to combine all the
    identically named sections into one, with concatenated contents.

    With the supported sections already limited to select few, there are
    massively fewer collisions than there used to be, but this is still
    useful for e.g. when function parameters are documented in the middle of
    a documentation comment, with description spread out above and
    below. (This is not a recommended documentation style, but used in the
    kernel nonetheless.)

    We can now also demote the error to a warning.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • kernel-doc currently identifies anything matching "section header:"
    (specifically a string of word characters and spaces followed by a
    colon) as a new section in the documentation comment, and renders the
    section header accordingly.

    Unfortunately, this turns all uses of colon into sections, mostly
    unintentionally. Considering the output, erroneously creating sections
    when not intended is always worse than erroneously not creating sections
    when intended. For example, a line with "http://example.com" turns into
    a "http" heading followed by "//example.com" in normal text style, which
    is quite ugly. OTOH, "WARNING: Beware of the Leopard" is just fine even
    if "WARNING" does not turn into a heading.

    It is virtually impossible to change all the kernel-doc comments, either
    way. The compromise is to pick the most commonly used and depended on
    section headers (with variants) and accept them as section headers.

    The accepted section headers are, case insensitive:

    * description:
    * context:
    * return:
    * returns:

    Additionally, case sensitive:

    * @return:

    All of the above are commonly used in the kernel-doc comments, and will
    result in worse output if not identified as section headers. Also,
    kernel-doc already has some special handling for all of them, so there's
    nothing particularly controversial in adding more special treatment for
    them.

    While at it, improve the whitespace handling surrounding section
    names. Do not consider the whitespace as part of the name.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Yes, for our purposes the type should contain typedef.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • The latter isn't special to rst.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • If a param description spans multiple lines, check any leading
    whitespace in the first continuation line, and remove same amount of
    whitespace from following lines.

    This allows indentation in the multi-line parameter descriptions for
    aesthetical reasons while not causing accidentally significant
    indentation in the rst output.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Handle whitespace on the first line of param text as if it was the empty
    string. There is no need to add the newline in this case. This improves
    the rst output in particular, where blank lines may be problematic in
    parameter lists.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Move away from field lists, and simply use **strong emphasis** for
    section headings on lines of their own. Do not use rst section headings,
    because their nesting depth depends on the surrounding context, which
    kernel-doc has no knowledge of. Also, they do not need to end up in any
    table of contexts or indexes.

    There are two related immediate benefits. Field lists are typically
    rendered in two columns, while the new style uses the horizontal width
    better. With no extra indent on the left, there's no need to be as fussy
    about it. Field lists are more susceptible to indentation problems than
    the new style.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • The inline member markup allows whitespace lines before the actual
    documentation starts. Strip the leading blank lines. This improves the
    rst output.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Current approach leads to two blank lines, while one is enough.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • No functional changes.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • The use of these is confusing in the script, and per this grep, they're
    not used anywhere anyway:

    $ git grep " \* [%$&][a-zA-Z0-9_]*:" -- *.[ch] | grep -v "\$\(Id\|Revision\|Date\)"

    While at it, throw out the constants array, nothing is ever put there
    again.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Let the user use @foo, &bar, %baz, etc. in the first kernel-doc purpose
    line too.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • This bit is already done by xml_unescape() above.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Link "&foo->bar", "&foo->bar()", "&foo.bar", and "&foo.bar()" to the
    struct/union/enum foo definition. The members themselves do not
    currently have anchors to link to, but this is better than nothing, and
    promotes a universal notation.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Let the user use "&union foo" and "&typedef foo" to reference foo. The
    difference to using "union &foo", "typedef &foo", or just "&foo" (which
    are valid too) is that "union" and "typedef" become part of the link
    text.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • It's possible to use &foo to reference structs, enums, typedefs, etc. in
    the Sphinx C domain. Thus do not prefix the links with "struct".

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • The Sphinx C domain spec says function references should include the
    parens ().

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • If the user requests a specific DOC: section by name, do not output its
    section title. In these cases, the surrounding context already has a
    heading, and the DOC: section title is only used as an identifier and a
    heading for clarity in the source file.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Make the output selection a bit more readable by adding constants for
    the various types of output selection. While at it, actually call the
    variable for choosing what to output $output_selection.

    No functional changes.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Make the state machine a bit more readable by adding constants for
    parser states and inline member documentation parser substates. While at
    it, rename the "split" documentation to "inline" documentation.

    No functional changes.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • Currently we use docproc to figure out which symbols are exported, and
    then docproc calls kernel-doc on specific functions, to get
    documentation on exported functions. According to git blame and docproc
    comments, this is due to historical reasons, as functions and their
    corresponding EXPORT_SYMBOL* may have been in different files. However
    for more than ten years the recommendation in CodingStyle has been to
    place the EXPORT_SYMBOL* immediately after the closing function brace
    line.

    Additionally, the kernel-doc comments for functions are generally placed
    above the function definition in the .c files (i.e. where the
    EXPORT_SYMBOL* is) rather than above the declaration in the .h
    files. There are some exceptions to this, but AFAICT none of these are
    included in DocBook documentation using the "!E" docproc directive.

    Therefore, assuming the EXPORT_SYMBOL* and kernel-doc are with the
    function definition, kernel-doc can extract the exported vs. not
    information by making two passes on the input file. Add support for that
    via the new -export and -internal parameters.

    Signed-off-by: Jani Nikula

    Jani Nikula
     
  • I'm not quite sure why the errors below are happening, but this fixes
    them.

    Use of uninitialized value in string ne at ./scripts/kernel-doc line 1819, line 6494.
    Use of uninitialized value $_[0] in join or string at ./scripts/kernel-doc line 1759, line 6494.

    Signed-off-by: Jani Nikula

    Jani Nikula
     

27 May, 2016

3 commits

  • Pull misc kbuild updates from Michal Marek:
    "This is the non-critical part of kbuild:

    - Coccinelle fixes, one semantic patch less in this round [Vaishali
    Thakkar, Wolfram Sang, Kees Cook]

    - rpm-pkg support for (open)SUSE's update-bootloader [Jiří Kosian]

    - rpm-pkg restored support for $RPMOPTS [Srinivas Pandruvada]

    - deb-pkg fixes for the linux-headers package [Bjørn Mork, Azriel
    Samson]"

    * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    coccicheck: Fix missing 0 index in kill loop
    scripts/package/Makefile: rpmbuild add support of RPMOPTS
    builddeb: fix missing headers in linux-headers package
    builddeb: include objtool binary in headers package
    kbuild/mkspec: support 'update-bootloader'-based systems
    scripts: coccinelle: remove check to move constants to right
    Coccinelle: setup_timer: Add space in front of parentheses

    Linus Torvalds
     
  • Pull kconfig update from Michal Marek:

    - fix for behavior of tristate choice items and fix for documentation
    of existing kconfig behavior [Dirk Gouders]

    - more helpful "unexpected data" kconfig warning [Paul Bolle]

    * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    kconfig/symbol.c: handle choice_values that depend on 'm' symbols
    kconfig-language: elaborate on the type of a choice
    kconfig-language: fix comment on dependency-generated menu structures.
    kconfig: add unexpected data itself to warning

    Linus Torvalds
     
  • Pull kbuild updates from Michal Marek:

    - new option CONFIG_TRIM_UNUSED_KSYMS which does a two-pass build and
    unexports symbols which are not used in the current config [Nicolas
    Pitre]

    - several kbuild rule cleanups [Masahiro Yamada]

    - warning option adjustments for gcov etc [Arnd Bergmann]

    - a few more small fixes

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: (31 commits)
    kbuild: move -Wunused-const-variable to W=1 warning level
    kbuild: fix if_change and friends to consider argument order
    kbuild: fix adjust_autoksyms.sh for modules that need only one symbol
    kbuild: fix ksym_dep_filter when multiple EXPORT_SYMBOL() on the same line
    gcov: disable -Wmaybe-uninitialized warning
    gcov: disable tree-loop-im to reduce stack usage
    gcov: disable for COMPILE_TEST
    Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES
    Kbuild: change CC_OPTIMIZE_FOR_SIZE definition
    kbuild: forbid kernel directory to contain spaces and colons
    kbuild: adjust ksym_dep_filter for some cmd_* renames
    kbuild: Fix dependencies for final vmlinux link
    kbuild: better abstract vmlinux sequential prerequisites
    kbuild: fix call to adjust_autoksyms.sh when output directory specified
    kbuild: Get rid of KBUILD_STR
    kbuild: rename cmd_as_s_S to cmd_cpp_s_S
    kbuild: rename cmd_cc_i_c to cmd_cpp_i_c
    kbuild: drop redundant "PHONY += FORCE"
    kbuild: delete unnecessary "@:"
    kbuild: mark help target as PHONY
    ...

    Linus Torvalds
     

24 May, 2016

2 commits

  • A recent addition to the DRM tree for 4.7 added 'extern "C"' guards
    for c++ to all the DRM headers, and that now causes warnings
    in 'make headers_check':

    usr/include/drm/amdgpu_drm.h:38: userspace cannot reference function or variable defined in the kernel
    usr/include/drm/drm.h:63: userspace cannot reference function or variable defined in the kernel
    usr/include/drm/drm.h:699: userspace cannot reference function or variable defined in the kernel
    usr/include/drm/drm_fourcc.h:30: userspace cannot reference function or variable defined in the kernel
    usr/include/drm/drm_mode.h:33: userspace cannot reference function or variable defined in the kernel
    usr/include/drm/drm_sarea.h:38: userspace cannot reference function or variable defined in the kernel
    usr/include/drm/exynos_drm.h:21: userspace cannot reference function or variable defined in the kernel
    usr/include/drm/i810_drm.h:7: userspace cannot reference function or variable defined in the kernel

    This changes the headers_check.pl script to not warn about this.
    I'm listing the merge commit as introducing the problem, because
    there are several patches in this branch that each do this for
    one file.

    Signed-off-by: Arnd Bergmann
    Fixes: 7c10ddf87472 ("Merge branch 'drm-uapi-extern-c-fixes' of https://github.com/evelikov/linux into drm-next")
    Reviewed-by: Emil Velikov
    Signed-off-by: Dave Airlie

    Arnd Bergmann
     
  • The recent fixes to lx-dmesg, now allow the command to print
    successfully on Python3, however the python interpreter wraps the bytes
    for each line with a b'' marker.

    To remove this, we need to decode the line, where .decode() will default
    to 'UTF-8'

    Link: http://lkml.kernel.org/r/d67ccf93f2479c94cb3399262b9b796e0dbefcf2.1462865983.git.jan.kiszka@siemens.com
    Signed-off-by: Kieran Bingham
    Acked-by: Dom Cote
    Tested-by: Dom Cote
    Signed-off-by: Jan Kiszka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kieran Bingham