diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-13 11:25:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-13 11:25:06 -0500 |
commit | 7832681b365f220151d1c33cc1a8891f10ecdb6f (patch) | |
tree | eeabbcd88f1a9b87b61469857c63a2fcb571115b /scripts | |
parent | 516fb7f2e73dcc303fb97fc3593209fcacf2d982 (diff) | |
parent | 47427379ea80f1368ccec6ba20874fc19a9f0cc4 (diff) |
Merge tag 'docs-4.15' of git://git.lwn.net/linux
Pull documentation updates from Jonathan Corbet:
"A relatively calm cycle for the docs tree again.
- The old driver statement has been added to the kernel docs.
- We have a couple of new helper scripts. find-unused-docs.sh from
Sayli Karnic will point out kerneldoc comments that are not actually
used in the documentation. Jani Nikula's
documentation-file-ref-check finds references to non-existing files.
- A new ftrace document from Steve Rostedt.
- Vinod Koul converted the dmaengine docs to RST
Beyond that, it's mostly simple fixes.
This set reaches outside of Documentation/ a bit more than most. In
all cases, the changes are to comment docs, mostly from Randy, in
places where there didn't seem to be anybody better to take them"
* tag 'docs-4.15' of git://git.lwn.net/linux: (52 commits)
documentation: fb: update list of available compiled-in fonts
MAINTAINERS: update DMAengine documentation location
dmaengine: doc: ReSTize pxa_dma doc
dmaengine: doc: ReSTize dmatest doc
dmaengine: doc: ReSTize client API doc
dmaengine: doc: ReSTize provider doc
dmaengine: doc: Add ReST style dmaengine document
ftrace/docs: Add documentation on how to use ftrace from within the kernel
bug-hunting.rst: Fix an example and a typo in a Sphinx tag
scripts: Add a script to find unused documentation
samples: Convert timers to use timer_setup()
documentation: kernel-api: add more info on bitmap functions
Documentation: fix selftests related file refs
Documentation: fix ref to power basic-pm-debugging
Documentation: fix ref to trace stm content
Documentation: fix ref to coccinelle content
Documentation: fix ref to workqueue content
Documentation: fix ref to sphinx/kerneldoc.py
Documentation: fix locking rt-mutex doc refs
docs: dev-tools: correct Coccinelle version number
...
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/documentation-file-ref-check | 15 | ||||
-rwxr-xr-x | scripts/find-unused-docs.sh | 62 | ||||
-rwxr-xr-x | scripts/kernel-doc | 17 |
3 files changed, 90 insertions, 4 deletions
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check new file mode 100755 index 000000000000..bc1659900e89 --- /dev/null +++ b/scripts/documentation-file-ref-check | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/bin/sh | ||
2 | # Treewide grep for references to files under Documentation, and report | ||
3 | # non-existing files in stderr. | ||
4 | |||
5 | for f in $(git ls-files); do | ||
6 | for ref in $(grep -ho "Documentation/[A-Za-z0-9_.,~/*+-]*" "$f"); do | ||
7 | # presume trailing . and , are not part of the name | ||
8 | ref=${ref%%[.,]} | ||
9 | |||
10 | # use ls to handle wildcards | ||
11 | if ! ls $ref >/dev/null 2>&1; then | ||
12 | echo "$f: $ref" >&2 | ||
13 | fi | ||
14 | done | ||
15 | done | ||
diff --git a/scripts/find-unused-docs.sh b/scripts/find-unused-docs.sh new file mode 100755 index 000000000000..3f46f8977dc4 --- /dev/null +++ b/scripts/find-unused-docs.sh | |||
@@ -0,0 +1,62 @@ | |||
1 | #!/bin/bash | ||
2 | # (c) 2017, Jonathan Corbet <corbet@lwn.net> | ||
3 | # sayli karnik <karniksayli1995@gmail.com> | ||
4 | # | ||
5 | # This script detects files with kernel-doc comments for exported functions | ||
6 | # that are not included in documentation. | ||
7 | # | ||
8 | # usage: Run 'scripts/find-unused-docs.sh directory' from top level of kernel | ||
9 | # tree. | ||
10 | # | ||
11 | # example: $scripts/find-unused-docs.sh drivers/scsi | ||
12 | # | ||
13 | # Licensed under the terms of the GNU GPL License | ||
14 | |||
15 | if ! [ -d "Documentation" ]; then | ||
16 | echo "Run from top level of kernel tree" | ||
17 | exit 1 | ||
18 | fi | ||
19 | |||
20 | if [ "$#" -ne 1 ]; then | ||
21 | echo "Usage: scripts/find-unused-docs.sh directory" | ||
22 | exit 1 | ||
23 | fi | ||
24 | |||
25 | if ! [ -d "$1" ]; then | ||
26 | echo "Directory $1 doesn't exist" | ||
27 | exit 1 | ||
28 | fi | ||
29 | |||
30 | cd "$( dirname "${BASH_SOURCE[0]}" )" | ||
31 | cd .. | ||
32 | |||
33 | cd Documentation/ | ||
34 | |||
35 | echo "The following files contain kerneldoc comments for exported functions \ | ||
36 | that are not used in the formatted documentation" | ||
37 | |||
38 | # FILES INCLUDED | ||
39 | |||
40 | files_included=($(grep -rHR ".. kernel-doc" --include \*.rst | cut -d " " -f 3)) | ||
41 | |||
42 | declare -A FILES_INCLUDED | ||
43 | |||
44 | for each in "${files_included[@]}"; do | ||
45 | FILES_INCLUDED[$each]="$each" | ||
46 | done | ||
47 | |||
48 | cd .. | ||
49 | |||
50 | # FILES NOT INCLUDED | ||
51 | |||
52 | for file in `find $1 -name '*.c'`; do | ||
53 | |||
54 | if [[ ${FILES_INCLUDED[$file]+_} ]]; then | ||
55 | continue; | ||
56 | fi | ||
57 | str=$(scripts/kernel-doc -text -export "$file" 2>/dev/null) | ||
58 | if [[ -n "$str" ]]; then | ||
59 | echo "$file" | ||
60 | fi | ||
61 | done | ||
62 | |||
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 9d3eafea58f0..67d051edd615 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -2168,7 +2168,7 @@ sub dump_struct($$) { | |||
2168 | my $nested; | 2168 | my $nested; |
2169 | 2169 | ||
2170 | if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { | 2170 | if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { |
2171 | #my $decl_type = $1; | 2171 | my $decl_type = $1; |
2172 | $declaration_name = $2; | 2172 | $declaration_name = $2; |
2173 | my $members = $3; | 2173 | my $members = $3; |
2174 | 2174 | ||
@@ -2194,7 +2194,7 @@ sub dump_struct($$) { | |||
2194 | $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos; | 2194 | $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos; |
2195 | 2195 | ||
2196 | create_parameterlist($members, ';', $file); | 2196 | create_parameterlist($members, ';', $file); |
2197 | check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); | 2197 | check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual, $nested); |
2198 | 2198 | ||
2199 | output_declaration($declaration_name, | 2199 | output_declaration($declaration_name, |
2200 | 'struct', | 2200 | 'struct', |
@@ -2226,6 +2226,8 @@ sub dump_enum($$) { | |||
2226 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { | 2226 | if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { |
2227 | $declaration_name = $1; | 2227 | $declaration_name = $1; |
2228 | my $members = $2; | 2228 | my $members = $2; |
2229 | my %_members; | ||
2230 | |||
2229 | $members =~ s/\s+$//; | 2231 | $members =~ s/\s+$//; |
2230 | 2232 | ||
2231 | foreach my $arg (split ',', $members) { | 2233 | foreach my $arg (split ',', $members) { |
@@ -2236,9 +2238,16 @@ sub dump_enum($$) { | |||
2236 | print STDERR "${file}:$.: warning: Enum value '$arg' ". | 2238 | print STDERR "${file}:$.: warning: Enum value '$arg' ". |
2237 | "not described in enum '$declaration_name'\n"; | 2239 | "not described in enum '$declaration_name'\n"; |
2238 | } | 2240 | } |
2239 | 2241 | $_members{$arg} = 1; | |
2240 | } | 2242 | } |
2241 | 2243 | ||
2244 | while (my ($k, $v) = each %parameterdescs) { | ||
2245 | if (!exists($_members{$k})) { | ||
2246 | print STDERR "${file}:$.: warning: Excess enum value " . | ||
2247 | "'$k' description in '$declaration_name'\n"; | ||
2248 | } | ||
2249 | } | ||
2250 | |||
2242 | output_declaration($declaration_name, | 2251 | output_declaration($declaration_name, |
2243 | 'enum', | 2252 | 'enum', |
2244 | {'enum' => $declaration_name, | 2253 | {'enum' => $declaration_name, |
@@ -2506,7 +2515,7 @@ sub check_sections($$$$$$) { | |||
2506 | } else { | 2515 | } else { |
2507 | if ($nested !~ m/\Q$sects[$sx]\E/) { | 2516 | if ($nested !~ m/\Q$sects[$sx]\E/) { |
2508 | print STDERR "${file}:$.: warning: " . | 2517 | print STDERR "${file}:$.: warning: " . |
2509 | "Excess struct/union/enum/typedef member " . | 2518 | "Excess $decl_type member " . |
2510 | "'$sects[$sx]' " . | 2519 | "'$sects[$sx]' " . |
2511 | "description in '$decl_name'\n"; | 2520 | "description in '$decl_name'\n"; |
2512 | ++$warnings; | 2521 | ++$warnings; |