From 46eab13d3391718e41f3d4283fef20e5a6685b0e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Nov 2018 04:28:28 +0000 Subject: [PATCH] Merge r7442 from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7695 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/Makefile_in-tree | 4 ++++ qla2x00t/generate-in-tree-patches | 24 ++++++++++++------- scripts/kernel-functions | 5 ++++ scripts/run-regression-tests | 39 +++++++++++++++++-------------- scripts/specialize-patch | 7 +++--- 5 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 qla2x00t/Makefile_in-tree diff --git a/qla2x00t/Makefile_in-tree b/qla2x00t/Makefile_in-tree new file mode 100644 index 000000000..790426600 --- /dev/null +++ b/qla2x00t/Makefile_in-tree @@ -0,0 +1,4 @@ +qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \ + qla_dbg.o qla_sup.o qla_attr.o qla_mid.o qla_dfs.o qla_bsg.o qla_nx.o + +obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx.o diff --git a/qla2x00t/generate-in-tree-patches b/qla2x00t/generate-in-tree-patches index 660908d40..239484e8a 100755 --- a/qla2x00t/generate-in-tree-patches +++ b/qla2x00t/generate-in-tree-patches @@ -7,23 +7,29 @@ if [ "$1" = "" ]; then exit 1 fi -if [ "${1#2.6.26}" = "$1" ]; then - # Exit silently for other kernel versions than 2.6.26.x. - exit 0 -fi - if [ ! -e qla2xxx-orig/$1 ]; then ./extract-qla2xxx-orig "$1" fi mkdir -p in-tree-patches/"${kernel_version}" -for f in qla2xxx-orig/"${kernel_version}"/* -do - g="${f#qla2xxx-orig/${kernel_version}/}" - f1="$f" +for g in Kconfig *.[ch]; do + f1="qla2xxx-orig/${kernel_version}/$g" f2="$g" f3="in-tree-patches/${kernel_version}/$g.patch" + if [ "$f1" -nt "$f3" -o "$f2" -nt "$f3" ]; then + if [ -e "$f1" ]; then + diff -up "$f1" "$f2" > "$f3" + else + diff -up /dev/null "$f2" > "$f3" + fi + fi +done + +for g in Makefile; do + f1="qla2xxx-orig/${kernel_version}/$g" + f2="${g}_in-tree" + f3="in-tree-patches/${kernel_version}/$g.patch" if [ "$f1" -nt "$f3" -o "$f2" -nt "$f3" ]; then diff -up "$f1" "$f2" > "$f3" fi diff --git a/scripts/kernel-functions b/scripts/kernel-functions index 6e5605c04..b66b368ff 100644 --- a/scripts/kernel-functions +++ b/scripts/kernel-functions @@ -5,6 +5,11 @@ kernel_mirror="http://cdn.kernel.org/pub/linux/kernel" kernel_sources="$HOME/software/downloads" +# Whether or not kernel version $1 is lower than or equal kernel version $2. +function kernel_version_le { + awk -v "v1=$1" -v "v2=$2" 'BEGIN { n1 = split(v1, v1a, "."); n2 = split(v2, v2a, "."); for (i=1;;i++) { e1 = i <= n1 ? v1a[i] : 0; e2 = i <= n2 ? v2a[i] : 0; if (e1 < e2 || i >= n1 && i >= n2) exit 0; if (e1 > e2) exit 1; }}' +} + # Kernel version number. function kernel_version { if [ "${1#2.}" != "$1" ]; then diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 53fe20e4f..37a49c37b 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -210,7 +210,6 @@ function generate_kernel_patch { kver="$(kernel_version "$1")" driver_options=(-l) [ "${mpt_scst}" = "true" ] && driver_options+=("-m") - [ "${qla2x00t}" = "true" ] && driver_options+=("-q") "${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" "$2" "$1" > "${patchfile}" @@ -343,19 +342,20 @@ function compile_patched_kernel { return 0 } -# Compile subdirectory $2 of the patched kernel tree linux-$1. +# Compile subdirectories $2..$n of the patched kernel tree linux-$1. function compile_kernel { local kver plevel + local k=$1 kver="$(kernel_version "$1")" plevel="$(patchlevel "$1")" local outputfile="${outputdir}/compilation-$1-output.txt" - local subdir="$2" + shift echo "Compiling the patched kernel ..." - if (cd "${outputdir}/linux-$1" \ + if (cd "${outputdir}/linux-$k" \ && make -s prepare \ && make -s scripts \ - && LC_ALL=C make -k M="${subdir}" + && for subdir; do LC_ALL=C make -k M="${subdir}"; done ) &> "${outputfile}" then local errors warnings @@ -379,16 +379,16 @@ function run_sparse { kver="$(kernel_version "$1")" plevel="$(patchlevel "$1")" local outputfile="${outputdir}/sparse-$1-output.txt" - local subdir="$2" - shift shift - echo "Running sparse on the patched kernel in ${subdir} $* ..." + echo "Running sparse on the patched kernel in $* ..." if (cd "${outputdir}/linux-$k" \ && make -s prepare \ && make -s scripts \ && if grep -q '^CONFIG_PPC=y$' .config; then LC_ALL=C make -k M=arch/powerpc/lib; fi \ - && LC_ALL=C make -k C=2 CF="-D__CHECK_ENDIAN__ -DCONFIG_SPARSE_RCU_POINTER" M="${subdir}" "$@" + && for subdir; do + LC_ALL=C make -k C=2 CF="-D__CHECK_ENDIAN__ -DCONFIG_SPARSE_RCU_POINTER" M="${subdir}" + done ) &> "${outputfile}" then local errors warnings @@ -410,25 +410,26 @@ function run_sparse { return 0 } +# Run smatch for kernel version $1 on directories $2..$n function run_smatch { local k="$1" local kver plevel kver="$(kernel_version "$1")" plevel="$(patchlevel "$1")" local outputfile="${outputdir}/smatch-$1-output.txt" - local subdir="$2" local disable="CONFIG_DYNAMIC_DEBUG" shift - shift - echo "Running smatch on the patched kernel in ${subdir} $* ..." + echo "Running smatch on the patched kernel in $* ..." if (cd "${outputdir}/linux-$k" && for c in $disable; do sed -i.tmp "s/^$c=y\$/$c=n/" .config; done && make -s oldconfig "${outputfile}" then local errors warnings @@ -542,7 +543,7 @@ outputdir="${PWD}/regression-test-output-$(date +%Y-%m-%d_%Hh%Mm%Ss)" # Driver configuration. mpt_scst="false" multiple_patches="false" -qla2x00t="false" +qla2x00t="true" remove_temporary_files_at_end="false" run_local_compilation="true" quiet_download="false" @@ -668,8 +669,9 @@ do run_checkpatch "$k" fi patch_and_configure_kernel "$k" + subdirs=(drivers/scst) if [ "${run_sparse}" = "true" ]; then - run_sparse "$k" drivers/scst + run_sparse "$k" "${subdirs[@]}" mv "${outputdir}/sparse-$k-output.txt" \ "${outputdir}/sparse-$k-scst-output.txt" if [ "${ibmvio}" = "true" ]; then @@ -685,9 +687,12 @@ do fi fi if [ "${run_smatch}" = "true" ]; then - run_smatch "$k" drivers/scst + run_smatch "$k" "${subdirs[@]}" fi - compile_kernel "$k" drivers/scst + if [ "${qla2x00t}" = "true" ] && $(kernel_version_le 2.6.37 $k); then + subdirs+=(drivers/scsi/qla2xxx) + fi + compile_kernel "$k" "${subdirs[@]}" if [ "${full_check}" = "true" ]; then run_headers_check "$k" compile_patched_kernel "$k" diff --git a/scripts/specialize-patch b/scripts/specialize-patch index 147ef87b0..d827d21c4 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -587,7 +587,7 @@ BEGIN { config_scst_proc_undefined = 0 # Variable initialization. - is_c_source = 0 + process_file = 0 reset_hunk_state_variables() } @@ -599,10 +599,11 @@ BEGIN { # Start of new file. dump_lines() reset_hunk_state_variables() - is_c_source = match(filename[1], "\\.[ch]$") != 0 + process_file = match(filename[1], "\\.[ch]$") != 0 && + match(filename[1], "drivers/scsi/qla2xxx/") == 0 } - if (!is_c_source) + if (!process_file) { print next