Re: [PATCH v1 1/2] doc: kdoc: Handle DEFINE_IDTENTRY_*() cases

From: Randy Dunlap

Date: Fri Nov 07 2025 - 00:47:05 EST


Hi,

On 11/6/25 2:12 AM, Andy Shevchenko wrote:
> We have an unparsed kernel-doc for spurious_interrupt() IDTENTRY.
> Update kdoc to handle that.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
> scripts/lib/kdoc/kdoc_parser.py | 27 +++++++++++++++++++++++----
> 1 file changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
> index f7dbb0868367..b583edd80a52 100644
> --- a/scripts/lib/kdoc/kdoc_parser.py
> +++ b/scripts/lib/kdoc/kdoc_parser.py
> @@ -1430,6 +1430,25 @@ class KernelDoc:
>
> return proto
>
> + def idtentry_munge(self, ln, proto):
> + """
> + Handle DEFINE_IDTENTRY_*() definitions
> + """
> +
> + name = None
> +
> + # Replace DEFINE_IDTENTRY_IRQ with correct return type & function name
> + r = KernRe(r'DEFINE_IDTENTRY_IRQ\((.*?)\)')
> + if r.search(proto):
> + name = r.group(1)
> +
> + if not name:
> + self.emit_msg(ln, f"Unrecognized IDTENTRY format:\n{proto}\n")
> + else:
> + proto = f"static inline void {name}((struct pt_regs *regs, unsigned long error_code)"

Seems to be an extra '(' here ...................^^^

Oh, weird: is the comma inside function parameters converted to a '#' somewhere?
See below in SYNOPSIS.


Output from testing says: (-man format output)

NAME
spurious_interrupt - Catch all for interrupts raised on unused vectors

SYNOPSIS
void spurious_interrupt ((struct pt_regs *regs# unsigned long error_code
);

ARGUMENTS
error_code The vector number

> +
> + return proto
> +
> def tracepoint_munge(self, ln, proto):
> """
> Handle tracepoint definitions
> @@ -1499,13 +1518,13 @@ class KernelDoc:
> # Handle special declaration syntaxes
> #
> if 'SYSCALL_DEFINE' in self.entry.prototype:
> - self.entry.prototype = self.syscall_munge(ln,
> - self.entry.prototype)
> + self.entry.prototype = self.syscall_munge(ln, self.entry.prototype)
> + elif 'DEFINE_IDTENTRY' in self.entry.prototype:
> + self.entry.prototype = self.idtentry_munge(ln, self.entry.prototype)
> else:
> r = KernRe(r'TRACE_EVENT|DEFINE_EVENT|DEFINE_SINGLE_EVENT')
> if r.search(self.entry.prototype):
> - self.entry.prototype = self.tracepoint_munge(ln,
> - self.entry.prototype)
> + self.entry.prototype = self.tracepoint_munge(ln, self.entry.prototype)
> #
> # ... and we're done
> #

--
~Randy