Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
2ab867a4 78ea748f

+11 -22
+3 -3
scripts/kernel-doc.py
··· 186 186 help="Enable debug messages") 187 187 188 188 parser.add_argument("-M", "-modulename", "--modulename", 189 + default="Kernel API", 189 190 help="Allow setting a module name at the output.") 190 191 191 192 parser.add_argument("-l", "-enable-lineno", "--enable_lineno", ··· 274 273 logger.addHandler(handler) 275 274 276 275 if args.man: 277 - out_style = ManFormat() 276 + out_style = ManFormat(modulename=args.modulename) 278 277 elif args.none: 279 278 out_style = None 280 279 else: ··· 283 282 kfiles = KernelFiles(verbose=args.verbose, 284 283 out_style=out_style, werror=args.werror, 285 284 wreturn=args.wreturn, wshort_desc=args.wshort_desc, 286 - wcontents_before_sections=args.wcontents_before_sections, 287 - modulename=args.modulename) 285 + wcontents_before_sections=args.wcontents_before_sections) 288 286 289 287 kfiles.parse(args.files, export_file=args.export_file) 290 288
+1 -5
scripts/lib/kdoc/kdoc_files.py
··· 126 126 def __init__(self, verbose=False, out_style=None, 127 127 werror=False, wreturn=False, wshort_desc=False, 128 128 wcontents_before_sections=False, 129 - logger=None, modulename=None): 129 + logger=None): 130 130 """ 131 131 Initialize startup variables and parse all files 132 132 """ 133 133 134 134 if not verbose: 135 135 verbose = bool(os.environ.get("KBUILD_VERBOSE", 0)) 136 - 137 - if not modulename: 138 - modulename = "Kernel API" 139 136 140 137 if out_style is None: 141 138 out_style = OutputFormat() ··· 165 168 self.config.wreturn = wreturn 166 169 self.config.wshort_desc = wshort_desc 167 170 self.config.wcontents_before_sections = wcontents_before_sections 168 - self.config.modulename = modulename 169 171 170 172 self.config.function_table = set() 171 173 self.config.source_map = {}
+6 -6
scripts/lib/kdoc/kdoc_output.py
··· 586 586 ) 587 587 blankline = "" 588 588 589 - def __init__(self): 589 + def __init__(self, modulename): 590 590 """ 591 591 Creates class variables. 592 592 ··· 595 595 """ 596 596 597 597 super().__init__() 598 + self.modulename = modulename 598 599 599 600 dt = datetime.now() 600 601 if os.environ.get("KBUILD_BUILD_TIMESTAMP", None): ··· 627 626 self.data += line + "\n" 628 627 629 628 def out_doc(self, fname, name, args): 630 - module = args.get('module') 631 629 sectionlist = args.get('sectionlist', []) 632 630 sections = args.get('sections', {}) 633 631 634 632 if not self.check_doc(name, args): 635 633 return 636 634 637 - self.data += f'.TH "{module}" 9 "{module}" "{self.man_date}" "API Manual" LINUX' + "\n" 635 + self.data += f'.TH "{self.modulename}" 9 "{self.modulename}" "{self.man_date}" "API Manual" LINUX' + "\n" 638 636 639 637 for section in sectionlist: 640 638 self.data += f'.SH "{section}"' + "\n" ··· 697 697 sectionlist = args.get('sectionlist', []) 698 698 sections = args.get('sections', {}) 699 699 700 - self.data += f'.TH "{args["module"]}" 9 "enum {args["enum"]}" "{self.man_date}" "API Manual" LINUX' + "\n" 700 + self.data += f'.TH "{self.modulename}" 9 "enum {args["enum"]}" "{self.man_date}" "API Manual" LINUX' + "\n" 701 701 702 702 self.data += ".SH NAME\n" 703 703 self.data += f"enum {args['enum']} \\- {args['purpose']}\n" ··· 727 727 self.output_highlight(sections[section]) 728 728 729 729 def out_typedef(self, fname, name, args): 730 - module = args.get('module') 730 + module = self.modulename 731 731 typedef = args.get('typedef') 732 732 purpose = args.get('purpose') 733 733 sectionlist = args.get('sectionlist', []) ··· 743 743 self.output_highlight(sections.get(section)) 744 744 745 745 def out_struct(self, fname, name, args): 746 - module = args.get('module') 746 + module = self.modulename 747 747 struct_type = args.get('type') 748 748 struct_name = args.get('struct') 749 749 purpose = args.get('purpose')
+1 -8
scripts/lib/kdoc/kdoc_parser.py
··· 791 791 792 792 self.output_declaration(decl_type, declaration_name, 793 793 struct=declaration_name, 794 - module=self.entry.modulename, 795 794 definition=declaration, 796 795 parameterlist=self.entry.parameterlist, 797 796 parameterdescs=self.entry.parameterdescs, ··· 868 869 869 870 self.output_declaration('enum', declaration_name, 870 871 enum=declaration_name, 871 - module=self.config.modulename, 872 872 parameterlist=self.entry.parameterlist, 873 873 parameterdescs=self.entry.parameterdescs, 874 874 parameterdesc_start_lines=self.entry.parameterdesc_start_lines, ··· 1038 1040 self.output_declaration(decl_type, declaration_name, 1039 1041 function=declaration_name, 1040 1042 typedef=True, 1041 - module=self.config.modulename, 1042 1043 functiontype=return_type, 1043 1044 parameterlist=self.entry.parameterlist, 1044 1045 parameterdescs=self.entry.parameterdescs, ··· 1052 1055 self.output_declaration(decl_type, declaration_name, 1053 1056 function=declaration_name, 1054 1057 typedef=False, 1055 - module=self.config.modulename, 1056 1058 functiontype=return_type, 1057 1059 parameterlist=self.entry.parameterlist, 1058 1060 parameterdescs=self.entry.parameterdescs, ··· 1098 1102 self.output_declaration(decl_type, declaration_name, 1099 1103 function=declaration_name, 1100 1104 typedef=True, 1101 - module=self.entry.modulename, 1102 1105 functiontype=return_type, 1103 1106 parameterlist=self.entry.parameterlist, 1104 1107 parameterdescs=self.entry.parameterdescs, ··· 1125 1130 1126 1131 self.output_declaration('typedef', declaration_name, 1127 1132 typedef=declaration_name, 1128 - module=self.entry.modulename, 1129 1133 sectionlist=self.entry.sectionlist, 1130 1134 sections=self.entry.sections, 1131 1135 section_start_lines=self.entry.section_start_lines, ··· 1613 1619 self.output_declaration("doc", self.entry.identifier, 1614 1620 sectionlist=self.entry.sectionlist, 1615 1621 sections=self.entry.sections, 1616 - section_start_lines=self.entry.section_start_lines, 1617 - module=self.config.modulename) 1622 + section_start_lines=self.entry.section_start_lines) 1618 1623 self.reset_state(ln) 1619 1624 1620 1625 elif doc_content.search(line):