* [PATCH 0/3] Some kernel-doc fixes
@ 2026-01-27 8:03 Mauro Carvalho Chehab
2026-01-27 8:03 ` [PATCH 1/3] docs: kdoc: Fix pdfdocs build for tools Mauro Carvalho Chehab
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2026-01-27 8:03 UTC (permalink / raw)
To: Jonathan Corbet, Mauro Carvalho Chehab
Cc: Mauro Carvalho Chehab, linux-doc, linux-kernel, Randy Dunlap,
Shuah Khan
Hi Jon,
This small series contain 3 patches:
- patch 1 fixes PDF docs build, as reported by Akira;
(I'm resending this one as-is from its v2)
- patch 2 addresses a complain from Jani about not being able
of disabling "-q" flag when building docs with V=0;
- patch 3 addresses an issue indirectly reported by Jani that
it the env vars that affects the wrapper aren't documented.
With regards to patch 2, docs build honours V=0 by adding a
"-q" flag.
When V=1 is set, there are two effects in place:
1. sphix-build will be called without "-q";
2. Sphinx extensions will increase their verbosity levels.
Sometimes, it is desired to just remove "-q" without increasing
extensions verbosity. That's what patch 2 does.
IMO, at least patch 1 should be merged during Kernel v6.21
development cycle.
Mauro Carvalho Chehab (3):
docs: kdoc: Fix pdfdocs build for tools
docs: sphinx-build-wrapper: allow -v override -q
tools: sphinx-build-wrapper: improve its help message
tools/docs/sphinx-build-wrapper | 42 +++++++++++++++++++++++++++-----
tools/lib/python/kdoc/kdoc_re.py | 10 +++++---
2 files changed, 43 insertions(+), 9 deletions(-)
--
2.52.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] docs: kdoc: Fix pdfdocs build for tools
2026-01-27 8:03 [PATCH 0/3] Some kernel-doc fixes Mauro Carvalho Chehab
@ 2026-01-27 8:03 ` Mauro Carvalho Chehab
2026-01-27 8:03 ` [PATCH 2/3] docs: sphinx-build-wrapper: allow -v override -q Mauro Carvalho Chehab
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2026-01-27 8:03 UTC (permalink / raw)
To: Linux Doc Mailing List
Cc: Mauro Carvalho Chehab, linux-kernel, Akira Yokosawa, Jani Nikula,
Jonathan Corbet, Mauro Carvalho Chehab, Randy Dunlap
the "\1" inside a docstring requires proper scaping to not be
considered a hex character and break the build.
Reported-by: Akira Yokosawa <akiyks@gmail.com>
Closes: https://lore.kernel.org/linux-doc/63e99049-cc72-4156-83af-414fdde34312@gmail.com/
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
tools/lib/python/kdoc/kdoc_re.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/lib/python/kdoc/kdoc_re.py b/tools/lib/python/kdoc/kdoc_re.py
index 2816bd9f90f8..0bf9e01cdc57 100644
--- a/tools/lib/python/kdoc/kdoc_re.py
+++ b/tools/lib/python/kdoc/kdoc_re.py
@@ -228,14 +228,18 @@ class NestedMatch:
yield line[t[0]:t[2]]
def sub(self, regex, sub, line, count=0):
- """
+ r"""
This is similar to re.sub:
It matches a regex that it is followed by a delimiter,
replacing occurrences only if all delimiters are paired.
- if r'\1' is used, it works just like re: it places there the
- matched paired data with the delimiter stripped.
+ if the sub argument contains::
+
+ r'\1'
+
+ it will work just like re: it places there the matched paired data
+ with the delimiter stripped.
If count is different than zero, it will replace at most count
items.
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] docs: sphinx-build-wrapper: allow -v override -q
2026-01-27 8:03 [PATCH 0/3] Some kernel-doc fixes Mauro Carvalho Chehab
2026-01-27 8:03 ` [PATCH 1/3] docs: kdoc: Fix pdfdocs build for tools Mauro Carvalho Chehab
@ 2026-01-27 8:03 ` Mauro Carvalho Chehab
2026-01-27 8:03 ` [PATCH 3/3] tools: sphinx-build-wrapper: improve its help message Mauro Carvalho Chehab
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2026-01-27 8:03 UTC (permalink / raw)
To: Linux Doc Mailing List, Mauro Carvalho Chehab
Cc: Mauro Carvalho Chehab, linux-kernel, Akira Yokosawa, Jani Nikula,
Jonathan Corbet, Shuah Khan
Documentation builds were using "-q" for a long time, but sometimes
it is nice to see the Sphinx progress, without increasing build
verbosity - which would also turn on kernel-doc verbosity.
Instead of doing that, let's parse the sphinx-build already-existing
-v: each time it is used, it increases the verbosity level.
With that, if the default is to use -q, a single -v will disable
quiet mode. Passing more -v will keep increasing its verbosity.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
tools/docs/sphinx-build-wrapper | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrapper
index 78ff7ac202ef..8080ace60680 100755
--- a/tools/docs/sphinx-build-wrapper
+++ b/tools/docs/sphinx-build-wrapper
@@ -168,6 +168,7 @@ class SphinxBuilder:
parser = argparse.ArgumentParser()
parser.add_argument('-j', '--jobs', type=int)
parser.add_argument('-q', '--quiet', action='store_true')
+ parser.add_argument('-v', '--verbose', default=0, action='count')
#
# Other sphinx-build arguments go as-is, so place them
@@ -179,10 +180,14 @@ class SphinxBuilder:
# Build a list of sphinx args, honoring verbosity here if specified
#
- verbose = self.verbose
sphinx_args, self.sphinxopts = parser.parse_known_args(sphinxopts)
+
+ verbose = sphinx_args.verbose
+ if self.verbose:
+ verbose += 1
+
if sphinx_args.quiet is True:
- verbose = False
+ verbose = 0
#
# If the user explicitly sets "-j" at command line, use it.
@@ -195,8 +200,11 @@ class SphinxBuilder:
else:
self.n_jobs = None
- if not verbose:
+ if verbose < 1:
self.sphinxopts += ["-q"]
+ else:
+ for i in range(1, sphinx_args.verbose):
+ self.sphinxopts += ["-v"]
def __init__(self, builddir, venv=None, verbose=False, n_jobs=None,
interactive=None):
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] tools: sphinx-build-wrapper: improve its help message
2026-01-27 8:03 [PATCH 0/3] Some kernel-doc fixes Mauro Carvalho Chehab
2026-01-27 8:03 ` [PATCH 1/3] docs: kdoc: Fix pdfdocs build for tools Mauro Carvalho Chehab
2026-01-27 8:03 ` [PATCH 2/3] docs: sphinx-build-wrapper: allow -v override -q Mauro Carvalho Chehab
@ 2026-01-27 8:03 ` Mauro Carvalho Chehab
2026-01-27 17:34 ` [PATCH 0/3] Some kernel-doc fixes Jonathan Corbet
2026-02-02 17:01 ` Jonathan Corbet
4 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2026-01-27 8:03 UTC (permalink / raw)
To: Jonathan Corbet, Linux Doc Mailing List
Cc: Mauro Carvalho Chehab, linux-kernel, Akira Yokosawa, Jani Nikula,
Mauro Carvalho Chehab, Shuah Khan
Besides the parameters that are passed via command line arguments,
the wrapper's behavior is affected by several environment variables.
Document that. While here, use __doc__ for its description.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
tools/docs/sphinx-build-wrapper | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrapper
index 8080ace60680..b7c149dff06b 100755
--- a/tools/docs/sphinx-build-wrapper
+++ b/tools/docs/sphinx-build-wrapper
@@ -814,20 +814,42 @@ def jobs_type(value):
except ValueError:
raise argparse.ArgumentTypeError(f"Must be 'auto' or positive integer, got {value}") # pylint: disable=W0707
+EPILOG="""
+Besides the command line arguments, several environment variables affect its
+default behavior, meant to be used when called via Kernel Makefile:
+
+- KERNELVERSION: Kernel major version
+- KERNELRELEASE: Kernel release
+- KBUILD_VERBOSE: Contains the value of "make V=[0|1] variable.
+ When V=0 (KBUILD_VERBOSE=0), sets verbose level to "-q".
+- SPHINXBUILD: Documentation build tool (default: "sphinx-build").
+- SPHINXOPTS: Extra options pased to SPHINXBUILD
+ (default: "-j auto" and "-q" if KBUILD_VERBOSE=0).
+ The "-v" flag can be used to increase verbosity.
+ If V=0, the first "-v" will drop "-q".
+- PYTHON3: Python command to run SPHINXBUILD
+- PDFLATEX: LaTeX PDF engine. (default: "xelatex")
+- LATEXOPTS: Optional set of command line arguments to the LaTeX engine
+- srctree: Location of the Kernel root directory (default: ".").
+
+"""
+
def main():
"""
Main function. The only mandatory argument is the target. If not
specified, the other arguments will use default values if not
specified at os.environ.
"""
- parser = argparse.ArgumentParser(description="Kernel documentation builder")
+ parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
+ description=__doc__,
+ epilog=EPILOG)
parser.add_argument("target", choices=list(TARGETS.keys()),
help="Documentation target to build")
parser.add_argument("--sphinxdirs", nargs="+",
help="Specific directories to build")
parser.add_argument("--builddir", default="output",
- help="Sphinx configuration file")
+ help="Sphinx configuration file (default: %(default)s)")
parser.add_argument("--theme", help="Sphinx theme to use")
@@ -843,7 +865,7 @@ def main():
help="place build in verbose mode")
parser.add_argument('-j', '--jobs', type=jobs_type,
- help="Sets number of jobs to use with sphinx-build")
+ help="Sets number of jobs to use with sphinx-build(default: auto)")
parser.add_argument('-i', '--interactive', action='store_true',
help="Change latex default to run in interactive mode")
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] Some kernel-doc fixes
2026-01-27 8:03 [PATCH 0/3] Some kernel-doc fixes Mauro Carvalho Chehab
` (2 preceding siblings ...)
2026-01-27 8:03 ` [PATCH 3/3] tools: sphinx-build-wrapper: improve its help message Mauro Carvalho Chehab
@ 2026-01-27 17:34 ` Jonathan Corbet
2026-02-02 17:01 ` Jonathan Corbet
4 siblings, 0 replies; 6+ messages in thread
From: Jonathan Corbet @ 2026-01-27 17:34 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mauro Carvalho Chehab
Cc: Mauro Carvalho Chehab, linux-doc, linux-kernel, Randy Dunlap,
Shuah Khan
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:
> Hi Jon,
>
> This small series contain 3 patches:
> - patch 1 fixes PDF docs build, as reported by Akira;
> (I'm resending this one as-is from its v2)
> - patch 2 addresses a complain from Jani about not being able
> of disabling "-q" flag when building docs with V=0;
> - patch 3 addresses an issue indirectly reported by Jani that
> it the env vars that affects the wrapper aren't documented.
>
> With regards to patch 2, docs build honours V=0 by adding a
> "-q" flag.
>
> When V=1 is set, there are two effects in place:
>
> 1. sphix-build will be called without "-q";
> 2. Sphinx extensions will increase their verbosity levels.
>
> Sometimes, it is desired to just remove "-q" without increasing
> extensions verbosity. That's what patch 2 does.
>
> IMO, at least patch 1 should be merged during Kernel v6.21
> development cycle.
6.21? I'm kind of assuming you mean the *next* cycle, which will be
7.0?
Thanks,
jon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] Some kernel-doc fixes
2026-01-27 8:03 [PATCH 0/3] Some kernel-doc fixes Mauro Carvalho Chehab
` (3 preceding siblings ...)
2026-01-27 17:34 ` [PATCH 0/3] Some kernel-doc fixes Jonathan Corbet
@ 2026-02-02 17:01 ` Jonathan Corbet
4 siblings, 0 replies; 6+ messages in thread
From: Jonathan Corbet @ 2026-02-02 17:01 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mauro Carvalho Chehab
Cc: Mauro Carvalho Chehab, linux-doc, linux-kernel, Randy Dunlap,
Shuah Khan
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:
> Hi Jon,
>
> This small series contain 3 patches:
> - patch 1 fixes PDF docs build, as reported by Akira;
> (I'm resending this one as-is from its v2)
> - patch 2 addresses a complain from Jani about not being able
> of disabling "-q" flag when building docs with V=0;
> - patch 3 addresses an issue indirectly reported by Jani that
> it the env vars that affects the wrapper aren't documented.
>
> With regards to patch 2, docs build honours V=0 by adding a
> "-q" flag.
>
> When V=1 is set, there are two effects in place:
>
> 1. sphix-build will be called without "-q";
> 2. Sphinx extensions will increase their verbosity levels.
>
> Sometimes, it is desired to just remove "-q" without increasing
> extensions verbosity. That's what patch 2 does.
>
> IMO, at least patch 1 should be merged during Kernel v6.21
> development cycle.
>
> Mauro Carvalho Chehab (3):
> docs: kdoc: Fix pdfdocs build for tools
> docs: sphinx-build-wrapper: allow -v override -q
> tools: sphinx-build-wrapper: improve its help message
>
> tools/docs/sphinx-build-wrapper | 42 +++++++++++++++++++++++++++-----
> tools/lib/python/kdoc/kdoc_re.py | 10 +++++---
> 2 files changed, 43 insertions(+), 9 deletions(-)
I've applied this set, thanks.
jon
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-02 17:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27 8:03 [PATCH 0/3] Some kernel-doc fixes Mauro Carvalho Chehab
2026-01-27 8:03 ` [PATCH 1/3] docs: kdoc: Fix pdfdocs build for tools Mauro Carvalho Chehab
2026-01-27 8:03 ` [PATCH 2/3] docs: sphinx-build-wrapper: allow -v override -q Mauro Carvalho Chehab
2026-01-27 8:03 ` [PATCH 3/3] tools: sphinx-build-wrapper: improve its help message Mauro Carvalho Chehab
2026-01-27 17:34 ` [PATCH 0/3] Some kernel-doc fixes Jonathan Corbet
2026-02-02 17:01 ` Jonathan Corbet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox