Skip to content

Commit 6dd16f4

Browse files
rddunlapSam Ravnborg
authored andcommitted
docproc: style & typo cleanups
- fix typos/spellos in docproc.c and Makefile - add a little whitespace {while, switch} (coding style) - use NULL instead of 0 for pointer testing Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent 70f7524 commit 6dd16f4

2 files changed

Lines changed: 22 additions & 20 deletions

File tree

scripts/basic/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
###
2-
# Makefile.basic list the most basic programs used during the build process.
3-
# The programs listed herein is what is needed to do the basic stuff,
4-
# such as fix dependency file.
2+
# Makefile.basic lists the most basic programs used during the build process.
3+
# The programs listed herein are what are needed to do the basic stuff,
4+
# such as fix file dependencies.
55
# This initial step is needed to avoid files to be recompiled
66
# when kernel configuration changes (which is what happens when
77
# .config is included by main Makefile.
88
# ---------------------------------------------------------------------------
99
# fixdep: Used to generate dependency information during build process
10-
# docproc: Used in Documentation/docbook
10+
# docproc: Used in Documentation/DocBook
1111

1212
hostprogs-y := fixdep docproc
1313
always := $(hostprogs-y)

scripts/basic/docproc.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
* documentation-frontend
1111
* Scans the template file and call kernel-doc for
1212
* all occurrences of ![EIF]file
13-
* Beforehand each referenced file are scanned for
14-
* any exported sympols "EXPORT_SYMBOL()" statements.
13+
* Beforehand each referenced file is scanned for
14+
* any symbols that are exported via these macros:
15+
* EXPORT_SYMBOL(), EXPORT_SYMBOL_GPL(), &
16+
* EXPORT_SYMBOL_GPL_FUTURE()
1517
* This is used to create proper -function and
1618
* -nofunction arguments in calls to kernel-doc.
1719
* Usage: docproc doc file.tmpl
@@ -73,7 +75,7 @@ void usage (void)
7375
}
7476

7577
/*
76-
* Execute kernel-doc with parameters givin in svec
78+
* Execute kernel-doc with parameters given in svec
7779
*/
7880
void exec_kernel_doc(char **svec)
7981
{
@@ -82,7 +84,7 @@ void exec_kernel_doc(char **svec)
8284
char real_filename[PATH_MAX + 1];
8385
/* Make sure output generated so far are flushed */
8486
fflush(stdout);
85-
switch(pid=fork()) {
87+
switch (pid=fork()) {
8688
case -1:
8789
perror("fork");
8890
exit(1);
@@ -133,6 +135,7 @@ struct symfile * add_new_file(char * filename)
133135
symfilelist[symfilecnt++].filename = strdup(filename);
134136
return &symfilelist[symfilecnt - 1];
135137
}
138+
136139
/* Check if file already are present in the list */
137140
struct symfile * filename_exist(char * filename)
138141
{
@@ -156,8 +159,8 @@ void noaction2(char * file, char * line) { file = file; line = line; }
156159
void printline(char * line) { printf("%s", line); }
157160

158161
/*
159-
* Find all symbols exported with EXPORT_SYMBOL and EXPORT_SYMBOL_GPL
160-
* in filename.
162+
* Find all symbols in filename that are exported with EXPORT_SYMBOL &
163+
* EXPORT_SYMBOL_GPL (& EXPORT_SYMBOL_GPL_FUTURE implicitly).
161164
* All symbols located are stored in symfilelist.
162165
*/
163166
void find_export_symbols(char * filename)
@@ -179,15 +182,15 @@ void find_export_symbols(char * filename)
179182
perror(real_filename);
180183
exit(1);
181184
}
182-
while(fgets(line, MAXLINESZ, fp)) {
185+
while (fgets(line, MAXLINESZ, fp)) {
183186
char *p;
184187
char *e;
185-
if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != 0) ||
186-
((p = strstr(line, "EXPORT_SYMBOL")) != 0)) {
188+
if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != NULL) ||
189+
((p = strstr(line, "EXPORT_SYMBOL")) != NULL)) {
187190
/* Skip EXPORT_SYMBOL{_GPL} */
188191
while (isalnum(*p) || *p == '_')
189192
p++;
190-
/* Remove paranteses and additional ws */
193+
/* Remove parentheses & additional whitespace */
191194
while (isspace(*p))
192195
p++;
193196
if (*p != '(')
@@ -211,7 +214,7 @@ void find_export_symbols(char * filename)
211214
* Document all external or internal functions in a file.
212215
* Call kernel-doc with following parameters:
213216
* kernel-doc -docbook -nofunction function_name1 filename
214-
* function names are obtained from all the src files
217+
* Function names are obtained from all the src files
215218
* by find_export_symbols.
216219
* intfunc uses -nofunction
217220
* extfunc uses -function
@@ -262,7 +265,7 @@ void singfunc(char * filename, char * line)
262265
vec[idx++] = KERNELDOC;
263266
vec[idx++] = DOCBOOK;
264267

265-
/* Split line up in individual parameters preceeded by FUNCTION */
268+
/* Split line up in individual parameters preceded by FUNCTION */
266269
for (i=0; line[i]; i++) {
267270
if (isspace(line[i])) {
268271
line[i] = '\0';
@@ -292,7 +295,7 @@ void parse_file(FILE *infile)
292295
{
293296
char line[MAXLINESZ];
294297
char * s;
295-
while(fgets(line, MAXLINESZ, infile)) {
298+
while (fgets(line, MAXLINESZ, infile)) {
296299
if (line[0] == '!') {
297300
s = line + 2;
298301
switch (line[1]) {
@@ -351,9 +354,9 @@ int main(int argc, char *argv[])
351354
{
352355
/* Need to do this in two passes.
353356
* First pass is used to collect all symbols exported
354-
* in the various files.
357+
* in the various files;
355358
* Second pass generate the documentation.
356-
* This is required because function are declared
359+
* This is required because some functions are declared
357360
* and exported in different files :-((
358361
*/
359362
/* Collect symbols */
@@ -396,4 +399,3 @@ int main(int argc, char *argv[])
396399
fflush(stdout);
397400
return exitstatus;
398401
}
399-

0 commit comments

Comments
 (0)