0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 if ! [ -d "Documentation" ]; then
0016 echo "Run from top level of kernel tree"
0017 exit 1
0018 fi
0019
0020 if [ "$#" -ne 1 ]; then
0021 echo "Usage: scripts/find-unused-docs.sh directory"
0022 exit 1
0023 fi
0024
0025 if ! [ -d "$1" ]; then
0026 echo "Directory $1 doesn't exist"
0027 exit 1
0028 fi
0029
0030 cd "$( dirname "${BASH_SOURCE[0]}" )"
0031 cd ..
0032
0033 cd Documentation/
0034
0035 echo "The following files contain kerneldoc comments for exported functions \
0036 that are not used in the formatted documentation"
0037
0038
0039
0040 files_included=($(grep -rHR ".. kernel-doc" --include \*.rst | cut -d " " -f 3))
0041
0042 declare -A FILES_INCLUDED
0043
0044 for each in "${files_included[@]}"; do
0045 FILES_INCLUDED[$each]="$each"
0046 done
0047
0048 cd ..
0049
0050
0051
0052 for file in `find $1 -name '*.c'`; do
0053
0054 if [[ ${FILES_INCLUDED[$file]+_} ]]; then
0055 continue;
0056 fi
0057 str=$(scripts/kernel-doc -export "$file" 2>/dev/null)
0058 if [[ -n "$str" ]]; then
0059 echo "$file"
0060 fi
0061 done
0062