Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) #!/bin/bash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) # Linux kernel coccicheck
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) # Read Documentation/dev-tools/coccinelle.rst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) # This script requires at least spatch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) # version 1.0.0-rc11.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) DIR="$(dirname $(readlink -f $0))/.."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) SPATCH="`which ${SPATCH:=spatch}`"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) if [ ! -x "$SPATCH" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)     echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)     exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) SPATCH_VERSION=$($SPATCH --version | head -1 | awk '{print $3}')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) SPATCH_VERSION_NUM=$(echo $SPATCH_VERSION | ${DIR}/scripts/ld-version.sh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) USE_JOBS="no"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) $SPATCH --help | grep "\-\-jobs" > /dev/null && USE_JOBS="yes"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) # The verbosity may be set by the environmental parameter V=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) # as for example with 'make V=1 coccicheck'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) if [ -n "$V" -a "$V" != "0" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	VERBOSE="$V"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	VERBOSE=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) FLAGS="--very-quiet"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) # You can use SPFLAGS to append extra arguments to coccicheck or override any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) # heuristics done in this file as Coccinelle accepts the last options when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) # options conflict.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) # A good example for use of SPFLAGS is if you want to debug your cocci script,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) # you can for instance use the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) # $ export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) # $ make coccicheck MODE=report DEBUG_FILE="all.err" SPFLAGS="--profile --show-trying" M=./drivers/mfd/arizona-irq.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) # "--show-trying" should show you what rule is being processed as it goes to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) # stdout, you do not need a debug file for that. The profile output will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) # be sent to stdout, if you provide a DEBUG_FILE the profiling data can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) # inspected there.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) # --profile will not output if --very-quiet is used, so avoid it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) echo $SPFLAGS | egrep -e "--profile|--show-trying" 2>&1 > /dev/null
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) if [ $? -eq 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	FLAGS="--quiet"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) # spatch only allows include directories with the syntax "-I include"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) # while gcc also allows "-Iinclude" and "-include include"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) COCCIINCLUDE=${COCCIINCLUDE// -include/ --include}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) if [ "$C" = "1" -o "$C" = "2" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)     ONLINE=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)     # Take only the last argument, which is the C file to test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)     shift $(( $# - 1 ))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)     OPTIONS="$COCCIINCLUDE $1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)     # No need to parallelize Coccinelle since this mode takes one input file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)     NPROC=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)     ONLINE=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)     if [ "$KBUILD_EXTMOD" = "" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)         OPTIONS="--dir $srctree $COCCIINCLUDE"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)     else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)         OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)     fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)     # Use only one thread per core by default if hyperthreading is enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)     THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)     if [ -z "$J" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)         NPROC=$(getconf _NPROCESSORS_ONLN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 4 ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		NPROC=$((NPROC/2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)     else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)         NPROC="$J"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)     fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) if [ "$KBUILD_EXTMOD" != "" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)     OPTIONS="--patch $srctree $OPTIONS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) # You can override by using SPFLAGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) if [ "$USE_JOBS" = "no" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	trap kill_running SIGTERM SIGINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	declare -a SPATCH_PID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) elif [ "$NPROC" != "1" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	# Using 0 should work as well, refer to _SC_NPROCESSORS_ONLN use on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	# https://github.com/rdicosmo/parmap/blob/master/setcore_stubs.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	OPTIONS="$OPTIONS --jobs $NPROC --chunksize 1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) if [ "$MODE" = "" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)     if [ "$ONLINE" = "0" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	echo 'You have not explicitly specified the mode to use. Using default "report" mode.'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	echo 'Available modes are the following: patch, report, context, org, chain'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	echo 'You can specify the mode with "make coccicheck MODE=<mode>"'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	echo 'Note however that some modes are not implemented by some semantic patches.'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)     fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)     MODE="report"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) if [ "$MODE" = "chain" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)     if [ "$ONLINE" = "0" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	echo 'You have selected the "chain" mode.'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	echo 'All available modes will be tried (in that order): patch, report, context, org'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)     fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) elif [ "$MODE" = "report" -o "$MODE" = "org" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)     FLAGS="--no-show-diff $FLAGS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) if [ "$ONLINE" = "0" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)     echo ''
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)     echo 'Please check for false positives in the output before submitting a patch.'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)     echo 'When using "patch" mode, carefully review the patch before submitting it.'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)     echo ''
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) run_cmd_parmap() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	if [ $VERBOSE -ne 0 ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		echo "Running ($NPROC in parallel): $@"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)                 echo $@>>$DEBUG_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)                 $@ 2>>$DEBUG_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)         else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)                 echo $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)                 $@ 2>&1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	err=$?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	if [[ $err -ne 0 ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		echo "coccicheck failed"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		exit $err
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) run_cmd_old() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	local i
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	if [ $VERBOSE -ne 0 ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		echo "Running ($NPROC in parallel): $@"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	for i in $(seq 0 $(( NPROC - 1)) ); do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		eval "$@ --max $NPROC --index $i &"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		SPATCH_PID[$i]=$!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		if [ $VERBOSE -eq 2 ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 			echo "${SPATCH_PID[$i]} running"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	wait
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) run_cmd() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	if [ "$USE_JOBS" = "yes" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 		run_cmd_parmap $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		run_cmd_old $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) kill_running() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	for i in $(seq 0 $(( NPROC - 1 )) ); do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		if [ $VERBOSE -eq 2 ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 			echo "Killing ${SPATCH_PID[$i]}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		kill ${SPATCH_PID[$i]} 2>/dev/null
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) # You can override heuristics with SPFLAGS, these must always go last
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) OPTIONS="$OPTIONS $SPFLAGS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) coccinelle () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)     COCCI="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)     OPT=`grep "Options:" $COCCI | cut -d':' -f2`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)     REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)     REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)     if [ "$REQ_NUM" != "0" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	    if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		    echo "Skipping coccinelle SmPL patch: $COCCI"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		    echo "You have coccinelle:           $SPATCH_VERSION"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		    echo "This SmPL patch requires:      $REQ"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		    return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	    fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)     fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) #   The option '--parse-cocci' can be used to syntactically check the SmPL files.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #    $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)     if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	FILE=${COCCI#$srctree/}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	echo "Processing `basename $COCCI`"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	echo "with option(s) \"$OPT\""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	echo ''
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	echo 'Message example to submit a patch:'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	sed -ne 's|^///||p' $COCCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	if [ "$MODE" = "patch" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	    echo ' The semantic patch that makes this change is available'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	elif [ "$MODE" = "report" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	    echo ' The semantic patch that makes this report is available'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	elif [ "$MODE" = "context" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	    echo ' The semantic patch that spots this code is available'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	elif [ "$MODE" = "org" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	    echo ' The semantic patch that makes this Org report is available'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	    echo ' The semantic patch that makes this output is available'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	echo " in $FILE."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	echo ''
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	echo ' More information about semantic patching is available at'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	echo ' http://coccinelle.lip6.fr/'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	echo ''
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	if [ "`sed -ne 's|^//#||p' $COCCI`" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	    echo 'Semantic patch information:'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	    sed -ne 's|^//#||p' $COCCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	    echo ''
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)     fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)     if [ "$MODE" = "chain" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	run_cmd $SPATCH -D patch   \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		$FLAGS --cocci-file $COCCI $OPT $OPTIONS               || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	run_cmd $SPATCH -D report  \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		$FLAGS --cocci-file $COCCI $OPT $OPTIONS --no-show-diff || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	run_cmd $SPATCH -D context \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 		$FLAGS --cocci-file $COCCI $OPT $OPTIONS               || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	run_cmd $SPATCH -D org     \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 		$FLAGS --cocci-file $COCCI $OPT $OPTIONS --no-show-diff || exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)     elif [ "$MODE" = "rep+ctxt" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	run_cmd $SPATCH -D report  \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 		$FLAGS --cocci-file $COCCI $OPT $OPTIONS --no-show-diff && \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	run_cmd $SPATCH -D context \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		$FLAGS --cocci-file $COCCI $OPT $OPTIONS || exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)     else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	run_cmd $SPATCH -D $MODE   $FLAGS --cocci-file $COCCI $OPT $OPTIONS || exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)     fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	if [ -f $DEBUG_FILE ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 		echo "Debug file $DEBUG_FILE exists, bailing"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 		exit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	DEBUG_FILE="/dev/null"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) if [ "$COCCI" = "" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)     for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	coccinelle $f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)     done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)     coccinelle $COCCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) fi