* make mandocs questions
@ 2025-09-25 18:37 Randy Dunlap
2025-09-26 11:18 ` Mauro Carvalho Chehab
2025-09-26 16:00 ` Mauro Carvalho Chehab
0 siblings, 2 replies; 5+ messages in thread
From: Randy Dunlap @ 2025-09-25 18:37 UTC (permalink / raw)
To: open list:DOCUMENTATION, Mauro Carvalho Chehab
Hi Mauro,
I'm happy to see that you added mandocs as a docs build target.
Would it make sense to place the man output files into various
subdirectories? On linux-next-20250925, I have 76402 files in
the man/ subdirectory. One time 'ls' told me something like
"command line argument list too long" but I can't reproduce that.
Is the output produced just by scanning the entire kernel
directory structure? That may be too much subdirectory structure
for the man output.
Or would it make sense to include the source file path in each
man page? E.g., if I am looking at fsl_asrc_sel_proc.9,
include something like "[from sound/soc/fsl/fsl_asrc.c]"
at the top or the bottom of the man page?
Can we get more meaningful output info for warnings like these?
Warning: 385
Warning: 389
I see 9 warnings like these.
Thanks.
--
~Randy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: make mandocs questions
2025-09-25 18:37 make mandocs questions Randy Dunlap
@ 2025-09-26 11:18 ` Mauro Carvalho Chehab
2025-09-26 11:32 ` Mauro Carvalho Chehab
2025-09-26 16:00 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2025-09-26 11:18 UTC (permalink / raw)
To: Randy Dunlap; +Cc: open list:DOCUMENTATION, Mauro Carvalho Chehab
Em Thu, 25 Sep 2025 11:37:24 -0700
Randy Dunlap <rdunlap@infradead.org> escreveu:
> Hi Mauro,
>
> I'm happy to see that you added mandocs as a docs build target.
>
> Would it make sense to place the man output files into various
> subdirectories?
I'm not sure if manpages supports reading man(9) pages from
different drectories, but see more below.
> On linux-next-20250925, I have 76402 files in
> the man/ subdirectory. One time 'ls' told me something like
> "command line argument list too long" but I can't reproduce that.
you probably did something like:
$ ls Documentation/output/man/*.9
bash: /usr/bin/ls: Argument list too long
> Is the output produced just by scanning the entire kernel
> directory structure? That may be too much subdirectory structure
> for the man output.
By default, yes. It runs:
$ ./scripts/kernel-doc . --man
and then splits its output into one man file per man page.
The behavior changes if you set SPHINXDIRS
You can specify just the directories you want with:
$ make SPHINXDIRS="core-api driver-api" mandocs
$ tree -d Documentation/output/
Documentation/output/
├── core-api
│ └── man
└── driver-api
└── man
$ for i in Documentation/output/*; do echo -n "$i: "; ls $i/man|wc -l; done
Documentation/output/core-api: 2464
Documentation/output/driver-api: 6875
On such case, the algorithm changes: it will produce man pages
using only the files that are inside a .. kernel-doc markup from
Documentation, and using SPHINXDIRS normal behavior, each book
will be on its own directory, which is somewhat similar to what
you wanted.
Yet, notice that if you make SPHINXDIRS=<alldirs>, the output
will contain less man pages, as it won't include "orphaned"
descriptions(*).
(*) e.g. files with kernel-doc markups that aren't mentioned by any
Documentation/* rest file.
> Or would it make sense to include the source file path in each
> man page? E.g., if I am looking at fsl_asrc_sel_proc.9,
> include something like "[from sound/soc/fsl/fsl_asrc.c]"
> at the top or the bottom of the man page?
It shouldn't be hard to add it. See a quickhack patch example below.
> Can we get more meaningful output info for warnings like these?
>
> Warning: 385
> Warning: 389
I'm not getting those here on docs tree. will try later to check
with linux-next.
>
> I see 9 warnings like these.
>
> Thanks.
Thanks,
Mauro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: make mandocs questions
2025-09-26 11:18 ` Mauro Carvalho Chehab
@ 2025-09-26 11:32 ` Mauro Carvalho Chehab
2025-09-26 20:08 ` Randy Dunlap
0 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2025-09-26 11:32 UTC (permalink / raw)
To: Randy Dunlap; +Cc: open list:DOCUMENTATION, Mauro Carvalho Chehab
Em Fri, 26 Sep 2025 13:18:58 +0200
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> escreveu:
> Em Thu, 25 Sep 2025 11:37:24 -0700
> Randy Dunlap <rdunlap@infradead.org> escreveu:
>
> > Hi Mauro,
> >
> > I'm happy to see that you added mandocs as a docs build target.
> >
> > Would it make sense to place the man output files into various
> > subdirectories?
>
> I'm not sure if manpages supports reading man(9) pages from
> different drectories, but see more below.
>
> > On linux-next-20250925, I have 76402 files in
> > the man/ subdirectory. One time 'ls' told me something like
> > "command line argument list too long" but I can't reproduce that.
>
> you probably did something like:
>
> $ ls Documentation/output/man/*.9
> bash: /usr/bin/ls: Argument list too long
>
> > Is the output produced just by scanning the entire kernel
> > directory structure? That may be too much subdirectory structure
> > for the man output.
>
> By default, yes. It runs:
>
> $ ./scripts/kernel-doc . --man
>
> and then splits its output into one man file per man page.
>
> The behavior changes if you set SPHINXDIRS
> You can specify just the directories you want with:
>
> $ make SPHINXDIRS="core-api driver-api" mandocs
> $ tree -d Documentation/output/
> Documentation/output/
> ├── core-api
> │ └── man
> └── driver-api
> └── man
>
> $ for i in Documentation/output/*; do echo -n "$i: "; ls $i/man|wc -l; done
> Documentation/output/core-api: 2464
> Documentation/output/driver-api: 6875
>
> On such case, the algorithm changes: it will produce man pages
> using only the files that are inside a .. kernel-doc markup from
> Documentation, and using SPHINXDIRS normal behavior, each book
> will be on its own directory, which is somewhat similar to what
> you wanted.
>
> Yet, notice that if you make SPHINXDIRS=<alldirs>, the output
> will contain less man pages, as it won't include "orphaned"
> descriptions(*).
>
> (*) e.g. files with kernel-doc markups that aren't mentioned by any
> Documentation/* rest file.
>
> > Or would it make sense to include the source file path in each
> > man page? E.g., if I am looking at fsl_asrc_sel_proc.9,
> > include something like "[from sound/soc/fsl/fsl_asrc.c]"
> > at the top or the bottom of the man page?
>
> It shouldn't be hard to add it. See a quickhack patch example below.
patch attached.
One issue with the patch below is that it should probably
need to check the filename before output. Right now, for
$ ./scripts/kernel-doc --man include/linux/irq.h
it outputs:
...
.SH "SEE ALSO"
.PP
Kernel file \fBinclude/linux/irq.h\fR
...
This one should likely be ok (or something similar to it), but
for files that are at /usr/include/linux/, it should probably
print:
.SH "SEE ALSO"
.PP
\fB/usr/include/linux/vhost.h\fR
Thanks,
Mauro
-
[PATCH] [RFC] kernel-doc: output source file name at SEE ALSO
for man pages, it is helpful to know from where the man page
were generated.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff --git a/scripts/lib/kdoc/kdoc_item.py b/scripts/lib/kdoc/kdoc_item.py
index b3b225764550..19805301cb2c 100644
--- a/scripts/lib/kdoc/kdoc_item.py
+++ b/scripts/lib/kdoc/kdoc_item.py
@@ -5,8 +5,9 @@
#
class KdocItem:
- def __init__(self, name, type, start_line, **other_stuff):
+ def __init__(self, name, fname, type, start_line, **other_stuff):
self.name = name
+ self.fname = fname
self.type = type
self.declaration_start_line = start_line
self.sections = {}
diff --git a/scripts/lib/kdoc/kdoc_output.py b/scripts/lib/kdoc/kdoc_output.py
index 1eca9a918558..58f115059e93 100644
--- a/scripts/lib/kdoc/kdoc_output.py
+++ b/scripts/lib/kdoc/kdoc_output.py
@@ -630,10 +630,11 @@ class ManFormat(OutputFormat):
"""Adds a tail for all man pages"""
# SEE ALSO section
+ self.data += f'.SH "SEE ALSO"' + "\n.PP\n"
+ self.data += (f"Kernel file \\fB{args.fname}\\fR\n")
if len(self.symbols) >= 2:
cur_name = self.arg_name(args, name)
- self.data += f'.SH "SEE ALSO"' + "\n.PP\n"
related = []
for arg in self.symbols:
out_name = self.arg_name(arg, arg.name)
diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
index 89d920e0b65c..6e5c115cbdf3 100644
--- a/scripts/lib/kdoc/kdoc_parser.py
+++ b/scripts/lib/kdoc/kdoc_parser.py
@@ -254,8 +254,9 @@ SECTION_DEFAULT = "Description" # default section
class KernelEntry:
- def __init__(self, config, ln):
+ def __init__(self, config, fname, ln):
self.config = config
+ self.fname = fname
self._contents = []
self.prototype = ""
@@ -422,7 +423,8 @@ class KernelDoc:
The actual output and output filters will be handled elsewhere
"""
- item = KdocItem(name, dtype, self.entry.declaration_start_line, **args)
+ item = KdocItem(name, self.fname, dtype,
+ self.entry.declaration_start_line, **args)
item.warnings = self.entry.warnings
# Drop empty sections
@@ -445,7 +447,7 @@ class KernelDoc:
variables used by the state machine.
"""
- self.entry = KernelEntry(self.config, ln)
+ self.entry = KernelEntry(self.config, self.fname, ln)
# State flags
self.state = state.NORMAL
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: make mandocs questions
2025-09-25 18:37 make mandocs questions Randy Dunlap
2025-09-26 11:18 ` Mauro Carvalho Chehab
@ 2025-09-26 16:00 ` Mauro Carvalho Chehab
1 sibling, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2025-09-26 16:00 UTC (permalink / raw)
To: Randy Dunlap; +Cc: open list:DOCUMENTATION, Mauro Carvalho Chehab
> Can we get more meaningful output info for warnings like these?
>
> Warning: 385
> Warning: 389
>
> I see 9 warnings like these.
This is actually a kernel-doc issue at its parser:
$ scripts/kernel-doc ./arch/mips/include/asm/mach-au1x00/gpio-au1000.h -none
Warning: 385
Warning: 389
The problem is due to the duplicated NOTE sections here:
/**
* alchemy_gpio2_enable_int - Enable a GPIO2 pins' shared irq contribution.
* @gpio2: The GPIO2 pin to activate (200...215).
*
* GPIO208-215 have one shared interrupt line to the INTC. They are
* and'ed with a per-pin enable bit and finally or'ed together to form
* a single irq request (useful for active-high sources).
* With this function, a pins' individual contribution to the int request
* can be enabled. As with all other GPIO-based interrupts, the INTC
* must be programmed to accept the GPIO208_215 interrupt as well.
*
* NOTE: Calling this macro is only necessary for GPIO208-215; all other
* GPIO2-based interrupts have their own request to the INTC. Please
* consult your Alchemy databook for more information!
*
* NOTE: On the Au1550, GPIOs 201-205 also have a shared interrupt request
* line to the INTC, GPIO201_205. This function can be used for those
* as well.
*
* NOTE: 'gpio2' parameter must be in range of the GPIO2 numberspace
* (200-215 by default). No sanity checks are made,
*/
which is generated when this is called:
if name in self.sections and self.sections[name] != "":
# Only warn on user-specified duplicate section names
if name != SECTION_DEFAULT:
self.emit_msg(self.new_start_line,
f"duplicate section name '{name}'\n")
The problem is that this emit_msg() call is using the wrong parameters.
Just sent a fix.
--
Thanks,
Mauro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: make mandocs questions
2025-09-26 11:32 ` Mauro Carvalho Chehab
@ 2025-09-26 20:08 ` Randy Dunlap
0 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2025-09-26 20:08 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: open list:DOCUMENTATION, Mauro Carvalho Chehab
Hi Mauro,
On 9/26/25 4:32 AM, Mauro Carvalho Chehab wrote:
> Em Fri, 26 Sep 2025 13:18:58 +0200
> Mauro Carvalho Chehab <mchehab+huawei@kernel.org> escreveu:
>
>> Em Thu, 25 Sep 2025 11:37:24 -0700
>> Randy Dunlap <rdunlap@infradead.org> escreveu:
>>
>>> Hi Mauro,
>>>
>>> I'm happy to see that you added mandocs as a docs build target.
>>>
>>> Would it make sense to place the man output files into various
>>> subdirectories?
>>
>> I'm not sure if manpages supports reading man(9) pages from
>> different drectories, but see more below.
>>
>>> On linux-next-20250925, I have 76402 files in
>>> the man/ subdirectory. One time 'ls' told me something like
>>> "command line argument list too long" but I can't reproduce that.
>>
>> you probably did something like:
>>
>> $ ls Documentation/output/man/*.9
>> bash: /usr/bin/ls: Argument list too long
>>
>>> Is the output produced just by scanning the entire kernel
>>> directory structure? That may be too much subdirectory structure
>>> for the man output.
>>
>> By default, yes. It runs:
>>
>> $ ./scripts/kernel-doc . --man
>>
>> and then splits its output into one man file per man page.
>>
>> The behavior changes if you set SPHINXDIRS
>> You can specify just the directories you want with:
>>
>> $ make SPHINXDIRS="core-api driver-api" mandocs
>> $ tree -d Documentation/output/
>> Documentation/output/
>> ├── core-api
>> │ └── man
>> └── driver-api
>> └── man
>>
>> $ for i in Documentation/output/*; do echo -n "$i: "; ls $i/man|wc -l; done
>> Documentation/output/core-api: 2464
>> Documentation/output/driver-api: 6875
>>
>> On such case, the algorithm changes: it will produce man pages
>> using only the files that are inside a .. kernel-doc markup from
>> Documentation, and using SPHINXDIRS normal behavior, each book
>> will be on its own directory, which is somewhat similar to what
>> you wanted.
>>
>> Yet, notice that if you make SPHINXDIRS=<alldirs>, the output
>> will contain less man pages, as it won't include "orphaned"
>> descriptions(*).
>>
>> (*) e.g. files with kernel-doc markups that aren't mentioned by any
>> Documentation/* rest file.
Thanks for that explanation.
>>> Or would it make sense to include the source file path in each
>>> man page? E.g., if I am looking at fsl_asrc_sel_proc.9,
>>> include something like "[from sound/soc/fsl/fsl_asrc.c]"
>>> at the top or the bottom of the man page?
>>
>> It shouldn't be hard to add it. See a quickhack patch example below.
>
> patch attached.
>
> One issue with the patch below is that it should probably
> need to check the filename before output. Right now, for
>
> $ ./scripts/kernel-doc --man include/linux/irq.h
>
> it outputs:
>
> ...
> .SH "SEE ALSO"
> .PP
> Kernel file \fBinclude/linux/irq.h\fR
> ...
>
> This one should likely be ok (or something similar to it), but
> for files that are at /usr/include/linux/, it should probably
> print:
>
> .SH "SEE ALSO"
> .PP
> \fB/usr/include/linux/vhost.h\fR
>
> Thanks,
> Mauro
>
> -
>
> [PATCH] [RFC] kernel-doc: output source file name at SEE ALSO
>
> for man pages, it is helpful to know from where the man page
> were generated.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
>
> diff --git a/scripts/lib/kdoc/kdoc_item.py b/scripts/lib/kdoc/kdoc_item.py
> index b3b225764550..19805301cb2c 100644
> --- a/scripts/lib/kdoc/kdoc_item.py
> +++ b/scripts/lib/kdoc/kdoc_item.py
> @@ -5,8 +5,9 @@
> #
>
> class KdocItem:
> - def __init__(self, name, type, start_line, **other_stuff):
> + def __init__(self, name, fname, type, start_line, **other_stuff):
> self.name = name
> + self.fname = fname
> self.type = type
> self.declaration_start_line = start_line
> self.sections = {}
> diff --git a/scripts/lib/kdoc/kdoc_output.py b/scripts/lib/kdoc/kdoc_output.py
> index 1eca9a918558..58f115059e93 100644
> --- a/scripts/lib/kdoc/kdoc_output.py
> +++ b/scripts/lib/kdoc/kdoc_output.py
> @@ -630,10 +630,11 @@ class ManFormat(OutputFormat):
> """Adds a tail for all man pages"""
>
> # SEE ALSO section
> + self.data += f'.SH "SEE ALSO"' + "\n.PP\n"
> + self.data += (f"Kernel file \\fB{args.fname}\\fR\n")
> if len(self.symbols) >= 2:
> cur_name = self.arg_name(args, name)
>
> - self.data += f'.SH "SEE ALSO"' + "\n.PP\n"
> related = []
> for arg in self.symbols:
> out_name = self.arg_name(arg, arg.name)
> diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
> index 89d920e0b65c..6e5c115cbdf3 100644
> --- a/scripts/lib/kdoc/kdoc_parser.py
> +++ b/scripts/lib/kdoc/kdoc_parser.py
> @@ -254,8 +254,9 @@ SECTION_DEFAULT = "Description" # default section
>
> class KernelEntry:
>
> - def __init__(self, config, ln):
> + def __init__(self, config, fname, ln):
> self.config = config
> + self.fname = fname
>
> self._contents = []
> self.prototype = ""
> @@ -422,7 +423,8 @@ class KernelDoc:
> The actual output and output filters will be handled elsewhere
> """
>
> - item = KdocItem(name, dtype, self.entry.declaration_start_line, **args)
> + item = KdocItem(name, self.fname, dtype,
> + self.entry.declaration_start_line, **args)
> item.warnings = self.entry.warnings
>
> # Drop empty sections
> @@ -445,7 +447,7 @@ class KernelDoc:
> variables used by the state machine.
> """
>
> - self.entry = KernelEntry(self.config, ln)
> + self.entry = KernelEntry(self.config, self.fname, ln)
>
> # State flags
> self.state = state.NORMAL
>
I'm seeing the source file name mixed into the SEE ALSO area, like this:
SEE ALSO
Kernel file ../drivers/spi/spi-zynq-qspi.c struct zynq_qspi(9),
zynq_qspi_init_hw(9), zynq_qspi_rxfifo_op(9), zynq_qspi_txfifo_op(9),
zynq_qspi_chipselect(9), zynq_qspi_config_op(9), zynq_qspi_setup_op(9),
zynq_qspi_write_op(9), zynq_qspi_read_op(9), zynq_qspi_irq(9),
zynq_qspi_exec_mem_op(9), zynq_qspi_remove(9)
Please put it on a separate line.
Thanks.
--
~Randy
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-26 20:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 18:37 make mandocs questions Randy Dunlap
2025-09-26 11:18 ` Mauro Carvalho Chehab
2025-09-26 11:32 ` Mauro Carvalho Chehab
2025-09-26 20:08 ` Randy Dunlap
2025-09-26 16:00 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox