[PATCH v2 0/3] Some kernel-doc fixes

Mauro Carvalho Chehab posted 3 patches 6 months, 3 weeks ago
There is a newer version of this series
Documentation/sphinx/kerneldoc.py | 108 +++++++++++++-----------------
MAINTAINERS                       |   5 +-
scripts/lib/kdoc/kdoc_files.py    |   4 ++
3 files changed, 53 insertions(+), 64 deletions(-)
[PATCH v2 0/3] Some kernel-doc fixes
Posted by Mauro Carvalho Chehab 6 months, 3 weeks ago
Hi Jon,

That's the second version of the kernel-doc fixup patch series.

I discovered the root cause why Sphinx logger was not working: there
was a call there for logger.verbose(). According with:

	https://www.sphinx-doc.org/en/master/extdev/logging.html

This is a valid call, but it doesn't verbose messages. Instead, it is
crashing with modern Sphinx versions, causing the log to not work.

I got rid of it, replacing by logger.info().  I took the time to also
address an issue pointed by Andy: not having the same log message
placed everywhere. With such change, we can keep using Sphinx
logger (which produces colored messages) inside kernel-doc
classes.

With that, we have:

Patch 1:	makes Lore and kernel-doc ML receive patches related
	to kernel-doc.py and get_abi.py.
Patch 2:	cleanup try/except logic and get rid of logger.verbose();
Patch 3:	fix a KeyError when trying to acess data from non-existing files;

If you test just patch 1 on the top of next-20250516, you'll see the
keyerror message (in red):

	ERROR: Cannot find file ./drivers/gpio/gpiolib-acpi.c
	ERROR: Cannot find file ./drivers/gpio/gpiolib-acpi.c
	WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno -export ./drivers/gpio/gpiolib-acpi.c' processing failed with: KeyError('./drivers/gpio/gpiolib-acpi.c')

And the script doesn't crash anymore. After patch 2, the try/except
warning gets replaced by a proper message:

	ERROR: Cannot find file ./drivers/gpio/gpiolib-acpi.c
	ERROR: Cannot find file ./drivers/gpio/gpiolib-acpi.c
	WARNING: No kernel-doc for file ./drivers/gpio/gpiolib-acpi.c

Please apply it to solve the issues that are reported by Stephen and Akira.

Regards,
Mauro
Mauro Carvalho Chehab (3):
  MAINTAINERS: update linux-doc entry to cover new Python scripts
  docs: kerneldoc.py: simplify exception handling logic
  scripts: kernel-doc: prevent a KeyError when checking output

 Documentation/sphinx/kerneldoc.py | 108 +++++++++++++-----------------
 MAINTAINERS                       |   5 +-
 scripts/lib/kdoc/kdoc_files.py    |   4 ++
 3 files changed, 53 insertions(+), 64 deletions(-)

-- 
2.49.0
Re: [PATCH v2 0/3] Some kernel-doc fixes
Posted by Akira Yokosawa 6 months, 3 weeks ago
Hi,

On Wed, 21 May 2025 08:59:30 +0200, Mauro Carvalho Chehab wrote:
> Hi Jon,
> 
> That's the second version of the kernel-doc fixup patch series.
> 
> I discovered the root cause why Sphinx logger was not working: there
> was a call there for logger.verbose(). According with:
> 
> 	https://www.sphinx-doc.org/en/master/extdev/logging.html
> 
> This is a valid call, but it doesn't verbose messages. Instead, it is
> crashing with modern Sphinx versions, causing the log to not work.
> 
> I got rid of it, replacing by logger.info().  I took the time to also
> address an issue pointed by Andy: not having the same log message
> placed everywhere. With such change, we can keep using Sphinx
> logger (which produces colored messages) inside kernel-doc
> classes.
> 
> With that, we have:
> 
> Patch 1:	makes Lore and kernel-doc ML receive patches related
> 	to kernel-doc.py and get_abi.py.
> Patch 2:	cleanup try/except logic and get rid of logger.verbose();
> Patch 3:	fix a KeyError when trying to acess data from non-existing files;
> 
> If you test just patch 1 on the top of next-20250516, you'll see the
> keyerror message (in red):
> 
> 	ERROR: Cannot find file ./drivers/gpio/gpiolib-acpi.c
> 	ERROR: Cannot find file ./drivers/gpio/gpiolib-acpi.c
> 	WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno -export ./drivers/gpio/gpiolib-acpi.c' processing failed with: KeyError('./drivers/gpio/gpiolib-acpi.c')
> 
> And the script doesn't crash anymore. After patch 2, the try/except
> warning gets replaced by a proper message:
> 
> 	ERROR: Cannot find file ./drivers/gpio/gpiolib-acpi.c
> 	ERROR: Cannot find file ./drivers/gpio/gpiolib-acpi.c
> 	WARNING: No kernel-doc for file ./drivers/gpio/gpiolib-acpi.c
> 
> Please apply it to solve the issues that are reported by Stephen and Akira.

Other than the small typo in 1/3, this looks promising.

For the series,
Acked-by: Akira Yokosawa <akiyks@gmail.com>

Regards,
Akira

> 
> Regards,
> Mauro
> Mauro Carvalho Chehab (3):
>   MAINTAINERS: update linux-doc entry to cover new Python scripts
>   docs: kerneldoc.py: simplify exception handling logic
>   scripts: kernel-doc: prevent a KeyError when checking output
> 
>  Documentation/sphinx/kerneldoc.py | 108 +++++++++++++-----------------
>  MAINTAINERS                       |   5 +-
>  scripts/lib/kdoc/kdoc_files.py    |   4 ++
>  3 files changed, 53 insertions(+), 64 deletions(-)
>