Skip to content

Commit 5f88f44

Browse files
rddunlapJonathan Corbet
authored andcommitted
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>
1 parent 18182f9 commit 5f88f44

5 files changed

Lines changed: 26 additions & 26 deletions

File tree

tools/lib/python/kdoc/kdoc_files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _parse_dir(self, dirname):
6464

6565
def parse_files(self, file_list, file_not_found_cb):
6666
"""
67-
Define an interator to parse all source files from file_list,
67+
Define an iterator to parse all source files from file_list,
6868
handling directories if any
6969
"""
7070

@@ -229,7 +229,7 @@ def out_msg(self, fname, name, arg):
229229
Return output messages from a file name using the output style
230230
filtering.
231231
232-
If output type was not handled by the syler, return None.
232+
If output type was not handled by the styler, return None.
233233
"""
234234

235235
# NOTE: we can add rules here to filter out unwanted parts,

tools/lib/python/kdoc/kdoc_output.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Implement output filters to print kernel-doc documentation.
99
1010
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
1212
out output messages.
1313
1414
The actual implementation is done on one separate class per each type
@@ -59,7 +59,7 @@ class OutputFormat:
5959
OUTPUT_EXPORTED = 2 # output exported symbols
6060
OUTPUT_INTERNAL = 3 # output non-exported symbols
6161

62-
# Virtual member to be overriden at the inherited classes
62+
# Virtual member to be overridden at the inherited classes
6363
highlights = []
6464

6565
def __init__(self):
@@ -85,7 +85,7 @@ def set_config(self, config):
8585
def set_filter(self, export, internal, symbol, nosymbol, function_table,
8686
enable_lineno, no_doc_sections):
8787
"""
88-
Initialize filter variables according with the requested mode.
88+
Initialize filter variables according to the requested mode.
8989
9090
Only one choice is valid between export, internal and symbol.
9191
@@ -208,7 +208,7 @@ def msg(self, fname, name, args):
208208
return self.data
209209

210210
# 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",
212212
dtype)
213213

214214
return None

tools/lib/python/kdoc/kdoc_parser.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#
2323
# Regular expressions used to parse kernel-doc markups at KernelDoc class.
2424
#
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.
2727
#
2828
# As those are evaluated at the beginning, no need to cache them
2929
#
@@ -135,7 +135,7 @@
135135
# TODO: use NestedMatch for FOO($1, $2, ...) matches
136136
#
137137
# 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.
139139
#
140140
(KernRe(r'__ETHTOOL_DECLARE_LINK_MODE_MASK\s*\(([^\)]+)\)', re.S),
141141
r'DECLARE_BITMAP(\1, __ETHTOOL_LINK_MODE_MASK_NBITS)'),
@@ -155,7 +155,7 @@
155155
(KernRe(r'DEFINE_DMA_UNMAP_LEN\s*\(' + struct_args_pattern + r'\)', re.S), r'__u32 \1'),
156156
]
157157
#
158-
# Regexes here are guaranteed to have the end limiter matching
158+
# Regexes here are guaranteed to have the end delimiter matching
159159
# the start delimiter. Yet, right now, only one replace group
160160
# is allowed.
161161
#
@@ -815,7 +815,7 @@ def format_struct_decl(self, declaration):
815815

816816
def dump_struct(self, ln, proto):
817817
"""
818-
Store an entry for an struct or union
818+
Store an entry for a struct or union
819819
"""
820820
#
821821
# Do the basic parse to get the pieces of the declaration.
@@ -944,7 +944,7 @@ def dump_declaration(self, ln, prototype):
944944

945945
def dump_function(self, ln, prototype):
946946
"""
947-
Stores a function of function macro inside self.entries array.
947+
Stores a function or function macro inside self.entries array.
948948
"""
949949

950950
found = func_macro = False
@@ -1179,7 +1179,7 @@ def process_name(self, ln, line):
11791179
#
11801180
else:
11811181
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}")
11831183
self.state = state.NORMAL
11841184
return
11851185
#

tools/lib/python/kdoc/kdoc_re.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class KernRe:
1818
"""
19-
Helper class to simplify regex declaration and usage,
19+
Helper class to simplify regex declaration and usage.
2020
2121
It calls re.compile for a given pattern. It also allows adding
2222
regular expressions and define sub at class init time.
@@ -27,7 +27,7 @@ class KernRe:
2727

2828
def _add_regex(self, string, flags):
2929
"""
30-
Adds a new regex or re-use it from the cache.
30+
Adds a new regex or reuses it from the cache.
3131
"""
3232
self.regex = re_cache.get(string, None)
3333
if not self.regex:
@@ -114,7 +114,7 @@ class NestedMatch:
114114
115115
'\\bSTRUCT_GROUP(\\(((?:(?>[^)(]+)|(?1))*)\\))[^;]*;'
116116
117-
which is used to properly match open/close parenthesis of the
117+
which is used to properly match open/close parentheses of the
118118
string search STRUCT_GROUP(),
119119
120120
Add a class that counts pairs of delimiters, using it to match and
@@ -136,13 +136,13 @@ class NestedMatch:
136136
# \bSTRUCT_GROUP\(
137137
#
138138
# 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.
140140
#
141-
# The content inside parenthesis are converted into a single replace
141+
# The content inside parentheses is converted into a single replace
142142
# group (e.g. r`\1').
143143
#
144144
# 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:
146146
#
147147
# FOO\((.*), (.*), (.*)\)
148148
#
@@ -168,14 +168,14 @@ def _search(self, regex, line):
168168
but I ended using a different implementation to align all three types
169169
of delimiters and seek for an initial regular expression.
170170
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
173173
stack is zeroed.
174174
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.
177177
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
179179
to cover such issues.
180180
"""
181181

@@ -203,7 +203,7 @@ def _search(self, regex, line):
203203
stack.append(end)
204204
continue
205205

206-
# Does the end delimiter match what it is expected?
206+
# Does the end delimiter match what is expected?
207207
if stack and d == stack[-1]:
208208
stack.pop()
209209

tools/lib/python/kdoc/python_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def check_python(min_version, show_alternatives=False, bail_out=False,
139139

140140
available_versions = PythonVersion.find_python(min_version)
141141
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")
143143
print(" Can't find a new version. This script may fail")
144144
return
145145

0 commit comments

Comments
 (0)