[19.08,2/3] kernel/linux: reduce unneeded indents in meson build file

Message ID 20190430140325.45537-3-bruce.richardson@intel.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • cleanup kernel meson.build file for linux
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson April 30, 2019, 2:03 p.m.
Since meson 0.46, meson has supported the subdir_done() function, which
allows us to abort processing of a file early. Using this we can reduce the
indentation in our files by eliminating unnecessary else blocks.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
Note: though the diff here seems fairly big, a lot of it is whitespace
change due to reduced indentation. Using "git diff -w" is recommended for
easier review.
---
 kernel/linux/meson.build | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

Patch

diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
index bf8f085b0..d31fc8f80 100644
--- a/kernel/linux/meson.build
+++ b/kernel/linux/meson.build
@@ -9,25 +9,25 @@  WARN_NO_HEADERS='Cannot compile kernel modules as requested - are kernel headers
 # if we are cross-compiling we need kernel_dir specified
 if get_option('kernel_dir') == '' and meson.is_cross_build()
 	warning(WARN_CROSS_COMPILE)
-else
+	subdir_done()
+endif
 
-	kernel_dir = get_option('kernel_dir')
-	if kernel_dir == ''
-		# use default path for native builds
-		kernel_version = run_command('uname', '-r').stdout().strip()
-		kernel_dir = '/lib/modules/' + kernel_version + '/build'
-	endif
+kernel_dir = get_option('kernel_dir')
+if kernel_dir == ''
+	# use default path for native builds
+	kernel_version = run_command('uname', '-r').stdout().strip()
+	kernel_dir = '/lib/modules/' + kernel_version + '/build'
+endif
 
-	# test running make in kernel directory, using "make kernelversion"
-	make_returncode = run_command('make', '-sC', kernel_dir,
-			'kernelversion').returncode()
-	if make_returncode != 0
-		warning(WARN_NO_HEADERS)
-	else # returncode == 0
+# test running make in kernel directory, using "make kernelversion"
+make_returncode = run_command('make', '-sC', kernel_dir,
+		'kernelversion').returncode()
+if make_returncode != 0
+	warning(WARN_NO_HEADERS)
+	subdir_done()
+endif
 
 # DO ACTUAL MODULE BUILDING
-		foreach d:subdirs
-			subdir(d)
-		endforeach
-	endif
-endif
+foreach d:subdirs
+	subdir(d)
+endforeach