diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index dbb170172..5e4308b9b 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -180,16 +180,31 @@ do esac done +if [ $# != 1 ]; then + usage + exit 1 +fi + +# Strip patch level from the kernel version number. +if [ "${1#[0-9]*.[0-9]*.[0-9]*.[0-9]*}" != "$1" ]; then + kernel_version="${1%.[0-9]*}" + patch_level="${1#${kernel_version}.}" +else + kernel_version="$1" +fi + +# Make sure that for kernel 2.6.33 and later the line +# "#define CONFIG_SCST_PROC" is removed from scst/include/scst.h. +if grep -qw scst_sysfs scst/kernel/in-tree/Makefile.scst-${kernel_version} \ + || [ "${generating_upstream_patch}" = "true" ]; +then + specialize_patch_options="${specialize_patch_options} -v config_scst_proc_undefined=1" +fi if [ "${debug_specialize}" = "true" ]; then specialize_patch_options="${specialize_patch_options} -v debug=1" fi if [ "${generating_upstream_patch}" = "true" ]; then - specialize_patch_options="${specialize_patch_options} -v generating_upstream_patch_defined=1 -v config_tcp_zero_copy_transfer_completion_notification_undefined=1 -v config_scst_proc_undefined=1" -fi - -if [ $# != 1 ]; then - usage - exit 1 + specialize_patch_options="${specialize_patch_options} -v generating_upstream_patch_defined=1 -v config_tcp_zero_copy_transfer_completion_notification_undefined=1" fi if [ "${multiple_patches}" = "" ]; then @@ -206,14 +221,6 @@ fi # Patch Generation # #################### -# Strip patch level from the kernel version number. -if [ "${1#[0-9]*.[0-9]*.[0-9]*.[0-9]*}" != "$1" ]; then - kernel_version="${1%.[0-9]*}" - patch_level="${1#${kernel_version}.}" -else - kernel_version="$1" -fi - for f in fcst/linux-patches/series-${kernel_version}* do if [ -e "$f" ]; then @@ -221,13 +228,6 @@ do fi done -# Make sure that for kernel 2.6.33 and later the line -# "#define CONFIG_SCST_PROC" is removed from scst/include/scst.h. -if grep -qw scst_sysfs scst/kernel/in-tree/Makefile.scst-${kernel_version}; -then - specialize_patch_options="${specialize_patch_options} -v config_scst_proc_undefined=1" -fi - if [ "${multiple_patches}" = "false" ]; then echo "Signed-off-by: ${SIGNED_OFF_BY}" echo "" diff --git a/scripts/specialize-patch b/scripts/specialize-patch index cdef92484..5ba9f6d40 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -129,11 +129,9 @@ function evaluate(stmnt) { gsub("defined *\\( *CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION *\\)", 0, stmnt) } - if (config_scst_proc_undefined) - { - gsub("defined *CONFIG_SCST_PROC", 0, stmnt) - gsub("defined *\\( *CONFIG_SCST_PROC *\\)", 0, stmnt) - } + gsub("defined *CONFIG_SCST_PROC", !config_scst_proc_undefined, stmnt) + gsub("defined *\\( *CONFIG_SCST_PROC *\\)", !config_scst_proc_undefined, + stmnt) if (debug) printf "/* debug specialize-patch: (b) %s */\n", stmnt