docs: kdoc: tidy up space removal in create_parameter_list()

Remove a redundant test and add a comment describing what the space removal
is doing.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20250814154035.328769-3-corbet@lwn.net
This commit is contained in:
Jonathan Corbet
2025-08-14 09:40:30 -06:00
parent 670ec7333a
commit f51b42b99e

View File

@@ -545,12 +545,14 @@ class KernelDoc:
arg, declaration_name)
elif arg:
#
# Clean up extraneous spaces and split the string at commas; the first
# element of the resulting list will also include the type information.
#
arg = KernRe(r'\s*:\s*').sub(":", arg)
arg = KernRe(r'\s*\[').sub('[', arg)
args = KernRe(r'\s*,\s*').split(arg)
if args[0] and '*' in args[0]:
args[0] = re.sub(r'(\*+)\s*', r' \1', args[0])
args[0] = re.sub(r'(\*+)\s*', r' \1', args[0])
first_arg = []
r = KernRe(r'^(.*\s+)(.*?\[.*\].*)$')