mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
scripts/kernel-doc.py: move modulename to man class
Only man output requires a modulename. Move its definition to the man class. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/583085e3885b0075d16ef9961b4f2ad870f30a55.1744106242.git.mchehab+huawei@kernel.org
This commit is contained in:
committed by
Jonathan Corbet
parent
78ea748f79
commit
2ab867a494
@@ -186,6 +186,7 @@ def main():
|
||||
help="Enable debug messages")
|
||||
|
||||
parser.add_argument("-M", "-modulename", "--modulename",
|
||||
default="Kernel API",
|
||||
help="Allow setting a module name at the output.")
|
||||
|
||||
parser.add_argument("-l", "-enable-lineno", "--enable_lineno",
|
||||
@@ -273,7 +274,7 @@ def main():
|
||||
logger.addHandler(handler)
|
||||
|
||||
if args.man:
|
||||
out_style = ManFormat()
|
||||
out_style = ManFormat(modulename=args.modulename)
|
||||
elif args.none:
|
||||
out_style = None
|
||||
else:
|
||||
@@ -282,8 +283,7 @@ def main():
|
||||
kfiles = KernelFiles(verbose=args.verbose,
|
||||
out_style=out_style, werror=args.werror,
|
||||
wreturn=args.wreturn, wshort_desc=args.wshort_desc,
|
||||
wcontents_before_sections=args.wcontents_before_sections,
|
||||
modulename=args.modulename)
|
||||
wcontents_before_sections=args.wcontents_before_sections)
|
||||
|
||||
kfiles.parse(args.files, export_file=args.export_file)
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ class KernelFiles():
|
||||
def __init__(self, verbose=False, out_style=None,
|
||||
werror=False, wreturn=False, wshort_desc=False,
|
||||
wcontents_before_sections=False,
|
||||
logger=None, modulename=None):
|
||||
logger=None):
|
||||
"""
|
||||
Initialize startup variables and parse all files
|
||||
"""
|
||||
@@ -134,9 +134,6 @@ class KernelFiles():
|
||||
if not verbose:
|
||||
verbose = bool(os.environ.get("KBUILD_VERBOSE", 0))
|
||||
|
||||
if not modulename:
|
||||
modulename = "Kernel API"
|
||||
|
||||
if out_style is None:
|
||||
out_style = OutputFormat()
|
||||
|
||||
@@ -168,7 +165,6 @@ class KernelFiles():
|
||||
self.config.wreturn = wreturn
|
||||
self.config.wshort_desc = wshort_desc
|
||||
self.config.wcontents_before_sections = wcontents_before_sections
|
||||
self.config.modulename = modulename
|
||||
|
||||
self.config.function_table = set()
|
||||
self.config.source_map = {}
|
||||
|
||||
@@ -586,7 +586,7 @@ class ManFormat(OutputFormat):
|
||||
)
|
||||
blankline = ""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, modulename):
|
||||
"""
|
||||
Creates class variables.
|
||||
|
||||
@@ -595,6 +595,7 @@ class ManFormat(OutputFormat):
|
||||
"""
|
||||
|
||||
super().__init__()
|
||||
self.modulename = modulename
|
||||
|
||||
dt = datetime.now()
|
||||
if os.environ.get("KBUILD_BUILD_TIMESTAMP", None):
|
||||
@@ -626,14 +627,13 @@ class ManFormat(OutputFormat):
|
||||
self.data += line + "\n"
|
||||
|
||||
def out_doc(self, fname, name, args):
|
||||
module = args.get('module')
|
||||
sectionlist = args.get('sectionlist', [])
|
||||
sections = args.get('sections', {})
|
||||
|
||||
if not self.check_doc(name, args):
|
||||
return
|
||||
|
||||
self.data += f'.TH "{module}" 9 "{module}" "{self.man_date}" "API Manual" LINUX' + "\n"
|
||||
self.data += f'.TH "{self.modulename}" 9 "{self.modulename}" "{self.man_date}" "API Manual" LINUX' + "\n"
|
||||
|
||||
for section in sectionlist:
|
||||
self.data += f'.SH "{section}"' + "\n"
|
||||
@@ -697,7 +697,7 @@ class ManFormat(OutputFormat):
|
||||
sectionlist = args.get('sectionlist', [])
|
||||
sections = args.get('sections', {})
|
||||
|
||||
self.data += f'.TH "{args["module"]}" 9 "enum {args["enum"]}" "{self.man_date}" "API Manual" LINUX' + "\n"
|
||||
self.data += f'.TH "{self.modulename}" 9 "enum {args["enum"]}" "{self.man_date}" "API Manual" LINUX' + "\n"
|
||||
|
||||
self.data += ".SH NAME\n"
|
||||
self.data += f"enum {args['enum']} \\- {args['purpose']}\n"
|
||||
@@ -727,7 +727,7 @@ class ManFormat(OutputFormat):
|
||||
self.output_highlight(sections[section])
|
||||
|
||||
def out_typedef(self, fname, name, args):
|
||||
module = args.get('module')
|
||||
module = self.modulename
|
||||
typedef = args.get('typedef')
|
||||
purpose = args.get('purpose')
|
||||
sectionlist = args.get('sectionlist', [])
|
||||
@@ -743,7 +743,7 @@ class ManFormat(OutputFormat):
|
||||
self.output_highlight(sections.get(section))
|
||||
|
||||
def out_struct(self, fname, name, args):
|
||||
module = args.get('module')
|
||||
module = self.modulename
|
||||
struct_type = args.get('type')
|
||||
struct_name = args.get('struct')
|
||||
purpose = args.get('purpose')
|
||||
|
||||
@@ -791,7 +791,6 @@ class KernelDoc:
|
||||
|
||||
self.output_declaration(decl_type, declaration_name,
|
||||
struct=declaration_name,
|
||||
module=self.entry.modulename,
|
||||
definition=declaration,
|
||||
parameterlist=self.entry.parameterlist,
|
||||
parameterdescs=self.entry.parameterdescs,
|
||||
@@ -869,7 +868,6 @@ class KernelDoc:
|
||||
|
||||
self.output_declaration('enum', declaration_name,
|
||||
enum=declaration_name,
|
||||
module=self.config.modulename,
|
||||
parameterlist=self.entry.parameterlist,
|
||||
parameterdescs=self.entry.parameterdescs,
|
||||
parameterdesc_start_lines=self.entry.parameterdesc_start_lines,
|
||||
@@ -1040,7 +1038,6 @@ class KernelDoc:
|
||||
self.output_declaration(decl_type, declaration_name,
|
||||
function=declaration_name,
|
||||
typedef=True,
|
||||
module=self.config.modulename,
|
||||
functiontype=return_type,
|
||||
parameterlist=self.entry.parameterlist,
|
||||
parameterdescs=self.entry.parameterdescs,
|
||||
@@ -1055,7 +1052,6 @@ class KernelDoc:
|
||||
self.output_declaration(decl_type, declaration_name,
|
||||
function=declaration_name,
|
||||
typedef=False,
|
||||
module=self.config.modulename,
|
||||
functiontype=return_type,
|
||||
parameterlist=self.entry.parameterlist,
|
||||
parameterdescs=self.entry.parameterdescs,
|
||||
@@ -1102,7 +1098,6 @@ class KernelDoc:
|
||||
self.output_declaration(decl_type, declaration_name,
|
||||
function=declaration_name,
|
||||
typedef=True,
|
||||
module=self.entry.modulename,
|
||||
functiontype=return_type,
|
||||
parameterlist=self.entry.parameterlist,
|
||||
parameterdescs=self.entry.parameterdescs,
|
||||
@@ -1130,7 +1125,6 @@ class KernelDoc:
|
||||
|
||||
self.output_declaration('typedef', declaration_name,
|
||||
typedef=declaration_name,
|
||||
module=self.entry.modulename,
|
||||
sectionlist=self.entry.sectionlist,
|
||||
sections=self.entry.sections,
|
||||
section_start_lines=self.entry.section_start_lines,
|
||||
@@ -1619,8 +1613,7 @@ class KernelDoc:
|
||||
self.output_declaration("doc", self.entry.identifier,
|
||||
sectionlist=self.entry.sectionlist,
|
||||
sections=self.entry.sections,
|
||||
section_start_lines=self.entry.section_start_lines,
|
||||
module=self.config.modulename)
|
||||
section_start_lines=self.entry.section_start_lines)
|
||||
self.reset_state(ln)
|
||||
|
||||
elif doc_content.search(line):
|
||||
|
||||
Reference in New Issue
Block a user