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

docs: kdoc: various fixes for grammar, spelling, punctuation

Correct grammar, spelling, and punctuation in comments, strings,
print messages, logs.

Change two instances of two spaces between words to just one space.

codespell was used to find misspelled words.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20251124041011.3030571-1-rdunlap@infradead.org>

authored by

Randy Dunlap and committed by
Jonathan Corbet
5f88f44d 18182f97

+26 -26
+2 -2
tools/lib/python/kdoc/kdoc_files.py
··· 64 64 65 65 def parse_files(self, file_list, file_not_found_cb): 66 66 """ 67 - Define an interator to parse all source files from file_list, 67 + Define an iterator to parse all source files from file_list, 68 68 handling directories if any 69 69 """ 70 70 ··· 229 229 Return output messages from a file name using the output style 230 230 filtering. 231 231 232 - If output type was not handled by the syler, return None. 232 + If output type was not handled by the styler, return None. 233 233 """ 234 234 235 235 # NOTE: we can add rules here to filter out unwanted parts,
+4 -4
tools/lib/python/kdoc/kdoc_output.py
··· 8 8 Implement output filters to print kernel-doc documentation. 9 9 10 10 The implementation uses a virtual base class (OutputFormat) which 11 - contains a dispatches to virtual methods, and some code to filter 11 + contains dispatches to virtual methods, and some code to filter 12 12 out output messages. 13 13 14 14 The actual implementation is done on one separate class per each type ··· 59 59 OUTPUT_EXPORTED = 2 # output exported symbols 60 60 OUTPUT_INTERNAL = 3 # output non-exported symbols 61 61 62 - # Virtual member to be overriden at the inherited classes 62 + # Virtual member to be overridden at the inherited classes 63 63 highlights = [] 64 64 65 65 def __init__(self): ··· 85 85 def set_filter(self, export, internal, symbol, nosymbol, function_table, 86 86 enable_lineno, no_doc_sections): 87 87 """ 88 - Initialize filter variables according with the requested mode. 88 + Initialize filter variables according to the requested mode. 89 89 90 90 Only one choice is valid between export, internal and symbol. 91 91 ··· 208 208 return self.data 209 209 210 210 # Warn if some type requires an output logic 211 - self.config.log.warning("doesn't now how to output '%s' block", 211 + self.config.log.warning("doesn't know how to output '%s' block", 212 212 dtype) 213 213 214 214 return None
+7 -7
tools/lib/python/kdoc/kdoc_parser.py
··· 22 22 # 23 23 # Regular expressions used to parse kernel-doc markups at KernelDoc class. 24 24 # 25 - # Let's declare them in lowercase outside any class to make easier to 26 - # convert from the python script. 25 + # Let's declare them in lowercase outside any class to make it easier to 26 + # convert from the Perl script. 27 27 # 28 28 # As those are evaluated at the beginning, no need to cache them 29 29 # ··· 135 135 # TODO: use NestedMatch for FOO($1, $2, ...) matches 136 136 # 137 137 # it is better to also move those to the NestedMatch logic, 138 - # to ensure that parenthesis will be properly matched. 138 + # to ensure that parentheses will be properly matched. 139 139 # 140 140 (KernRe(r'__ETHTOOL_DECLARE_LINK_MODE_MASK\s*\(([^\)]+)\)', re.S), 141 141 r'DECLARE_BITMAP(\1, __ETHTOOL_LINK_MODE_MASK_NBITS)'), ··· 155 155 (KernRe(r'DEFINE_DMA_UNMAP_LEN\s*\(' + struct_args_pattern + r'\)', re.S), r'__u32 \1'), 156 156 ] 157 157 # 158 - # Regexes here are guaranteed to have the end limiter matching 158 + # Regexes here are guaranteed to have the end delimiter matching 159 159 # the start delimiter. Yet, right now, only one replace group 160 160 # is allowed. 161 161 # ··· 815 815 816 816 def dump_struct(self, ln, proto): 817 817 """ 818 - Store an entry for an struct or union 818 + Store an entry for a struct or union 819 819 """ 820 820 # 821 821 # Do the basic parse to get the pieces of the declaration. ··· 944 944 945 945 def dump_function(self, ln, prototype): 946 946 """ 947 - Stores a function of function macro inside self.entries array. 947 + Stores a function or function macro inside self.entries array. 948 948 """ 949 949 950 950 found = func_macro = False ··· 1179 1179 # 1180 1180 else: 1181 1181 self.emit_msg(ln, 1182 - f"This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst\n{line}") 1182 + f"This comment starts with '/**', but isn't a kernel-doc comment. Refer to Documentation/doc-guide/kernel-doc.rst\n{line}") 1183 1183 self.state = state.NORMAL 1184 1184 return 1185 1185 #
+12 -12
tools/lib/python/kdoc/kdoc_re.py
··· 16 16 17 17 class KernRe: 18 18 """ 19 - Helper class to simplify regex declaration and usage, 19 + Helper class to simplify regex declaration and usage. 20 20 21 21 It calls re.compile for a given pattern. It also allows adding 22 22 regular expressions and define sub at class init time. ··· 27 27 28 28 def _add_regex(self, string, flags): 29 29 """ 30 - Adds a new regex or re-use it from the cache. 30 + Adds a new regex or reuses it from the cache. 31 31 """ 32 32 self.regex = re_cache.get(string, None) 33 33 if not self.regex: ··· 114 114 115 115 '\\bSTRUCT_GROUP(\\(((?:(?>[^)(]+)|(?1))*)\\))[^;]*;' 116 116 117 - which is used to properly match open/close parenthesis of the 117 + which is used to properly match open/close parentheses of the 118 118 string search STRUCT_GROUP(), 119 119 120 120 Add a class that counts pairs of delimiters, using it to match and ··· 136 136 # \bSTRUCT_GROUP\( 137 137 # 138 138 # is similar to: STRUCT_GROUP\((.*)\) 139 - # except that the content inside the match group is delimiter's aligned. 139 + # except that the content inside the match group is delimiter-aligned. 140 140 # 141 - # The content inside parenthesis are converted into a single replace 141 + # The content inside parentheses is converted into a single replace 142 142 # group (e.g. r`\1'). 143 143 # 144 144 # It would be nice to change such definition to support multiple 145 - # match groups, allowing a regex equivalent to. 145 + # match groups, allowing a regex equivalent to: 146 146 # 147 147 # FOO\((.*), (.*), (.*)\) 148 148 # ··· 168 168 but I ended using a different implementation to align all three types 169 169 of delimiters and seek for an initial regular expression. 170 170 171 - The algorithm seeks for open/close paired delimiters and place them 172 - into a stack, yielding a start/stop position of each match when the 171 + The algorithm seeks for open/close paired delimiters and places them 172 + into a stack, yielding a start/stop position of each match when the 173 173 stack is zeroed. 174 174 175 - The algorithm shoud work fine for properly paired lines, but will 176 - silently ignore end delimiters that preceeds an start delimiter. 175 + The algorithm should work fine for properly paired lines, but will 176 + silently ignore end delimiters that precede a start delimiter. 177 177 This should be OK for kernel-doc parser, as unaligned delimiters 178 - would cause compilation errors. So, we don't need to rise exceptions 178 + would cause compilation errors. So, we don't need to raise exceptions 179 179 to cover such issues. 180 180 """ 181 181 ··· 203 203 stack.append(end) 204 204 continue 205 205 206 - # Does the end delimiter match what it is expected? 206 + # Does the end delimiter match what is expected? 207 207 if stack and d == stack[-1]: 208 208 stack.pop() 209 209
+1 -1
tools/lib/python/kdoc/python_version.py
··· 139 139 140 140 available_versions = PythonVersion.find_python(min_version) 141 141 if not available_versions: 142 - print(f"ERROR: Python version {python_ver} is not spported anymore\n") 142 + print(f"ERROR: Python version {python_ver} is not supported anymore\n") 143 143 print(" Can't find a new version. This script may fail") 144 144 return 145 145