mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 10:29:52 +00:00
docs: kdoc: remove the KernelEntry::descr pseudo member
The entry.descr value used in process_name() is not actually a member of the KernelEntry class; it is a bit of local state. So just manage it locally. A trim_whitespace() helper was added to clean up the code slightly. Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/20250606163438.229916-7-corbet@lwn.net
This commit is contained in:
@@ -60,6 +60,13 @@ export_symbol_ns = KernRe(r'^\s*EXPORT_SYMBOL_NS(_GPL)?\s*\(\s*(\w+)\s*,\s*"\S+"
|
||||
|
||||
type_param = KernRe(r"\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)", cache=False)
|
||||
|
||||
#
|
||||
# A little helper to get rid of excess white space
|
||||
#
|
||||
multi_space = KernRe(r'\s\s+')
|
||||
def trim_whitespace(s):
|
||||
return multi_space.sub(' ', s.strip())
|
||||
|
||||
class state:
|
||||
"""
|
||||
State machine enums
|
||||
@@ -1266,12 +1273,7 @@ class KernelDoc:
|
||||
|
||||
r = KernRe("[-:](.*)")
|
||||
if r.search(line):
|
||||
# strip leading/trailing/multiple spaces
|
||||
self.entry.descr = r.group(1).strip(" ")
|
||||
|
||||
r = KernRe(r"\s+")
|
||||
self.entry.descr = r.sub(" ", self.entry.descr)
|
||||
self.entry.declaration_purpose = self.entry.descr
|
||||
self.entry.declaration_purpose = trim_whitespace(r.group(1))
|
||||
self.state = state.BODY_MAYBE
|
||||
else:
|
||||
self.entry.declaration_purpose = ""
|
||||
|
||||
Reference in New Issue
Block a user