History

kernel-doc: output source file name at SEE ALSO

for man pages, it is helpful to know from where the man page were generated.

Mauro Carvalho Chehab committed 1 year ago

Commit 2bd22191 parent 0a4cd1c3 files · +9 −5Browse files

Unified · Split

3 files
  1. scripts/lib/kdoc/kdoc_item.py +2 −1
  2. scripts/lib/kdoc/kdoc_output.py +2 −1
  3. scripts/lib/kdoc/kdoc_parser.py +5 −3
scripts/lib/kdoc/kdoc_item.py+2−1
@@ -5,8 +5,9 @@ · 4 unmodified lines
55 #
66
77 class KdocItem:
8− def __init__(self, name, type, start_line, **other_stuff):
8+ def __init__(self, name, fname, type, start_line, **other_stuff):
99 self.name = name
10+ self.fname = fname
1011 self.type = type
1112 self.declaration_start_line = start_line
1213 self.sections = {}
scripts/lib/kdoc/kdoc_output.py+2−1
@@ -630,10 +630,11 @@ class ManFormat(OutputFormat): · 629 unmodified lines
630630 """Adds a tail for all man pages"""
631631
632632 # SEE ALSO section
633+ self.data += f'.SH "SEE ALSO"' + "\n.PP\n"
634+ self.data += (f"Kernel file \\fB{args.fname}\\fR\n")
633635 if len(self.symbols) >= 2:
634636 cur_name = self.arg_name(args, name)
635637
636− self.data += f'.SH "SEE ALSO"' + "\n.PP\n"
637638 related = []
638639 for arg in self.symbols:
639640 out_name = self.arg_name(arg, arg.name)
scripts/lib/kdoc/kdoc_parser.py+5−3
@@ -254,8 +254,9 @@ SECTION_DEFAULT = "Description" # default section · 253 unmodified lines
254254
255255 class KernelEntry:
256256
257− def __init__(self, config, ln):
257+ def __init__(self, config, fname, ln):
258258 self.config = config
259+ self.fname = fname
259260
260261 self._contents = []
261262 self.prototype = ""
@@ -422,7 +423,8 @@ class KernelDoc: · 160 unmodified lines
422423 The actual output and output filters will be handled elsewhere
423424 """
424425
425− item = KdocItem(name, dtype, self.entry.declaration_start_line, **args)
426+ item = KdocItem(name, self.fname, dtype,
427+ self.entry.declaration_start_line, **args)
426428 item.warnings = self.entry.warnings
427429
428430 # Drop empty sections
@@ -445,7 +447,7 @@ class KernelDoc: · 16 unmodified lines
445447 variables used by the state machine.
446448 """
447449
448− self.entry = KernelEntry(self.config, ln)
450+ self.entry = KernelEntry(self.config, self.fname, ln)
449451
450452 # State flags
451453 self.state = state.NORMAL