scripts: coccicheck: Add support for SPFLAGS

SPFLAGS allows to pass additional flags supported by
spatch during transformation.

Both short notation `-f=` and `--sp-flag=` can be used
to pass the flag to the coccicheck.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
diff --git a/scripts/coccicheck b/scripts/coccicheck
index b662006..c95c9de 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -1,8 +1,6 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 #
-# Read doc/application/coccinelle.rst
-#
 
 ZEPHYR_BASE=$( builtin cd "$( dirname "$DIR" )" && pwd ${PWD_OPT})
 DIR="$(dirname $(readlink -f $0))/.."
@@ -24,6 +22,7 @@
 -j= , --jobs=		number of jobs to use {0 - `nproc`}
 -c= , --cocci=		specify cocci script to use
 -d= , --debug=		specify file to store debug log
+-f= , --sp-flag=	pass additional flag to spatch
 -h  , --help		display help and exit
 
 Default values if any OPTION is not supplied:
@@ -61,6 +60,10 @@
 			DEBUG_FILE="${i#*=}"
 			shift
 			;;
+		-f=*|--sp-flag=*)
+			SPFLAGS="${i#*=}"
+			shift
+			;;
 		-h|--help)
 			echo "$usage"
 			exit 1
@@ -133,6 +136,9 @@
 	fi
 }
 
+# You can override heuristics with SPFLAGS, these must always go last
+OPTIONS="$OPTIONS $SPFLAGS"
+
 coccinelle () {
     COCCI="$1"
     OPT=`grep "Options:" $COCCI | cut -d':' -f2`