summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorRui Miguel Silva <rui.silva@linaro.org>2015-08-14 13:58:18 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2015-08-14 14:41:06 -0700
commit13fcfbb6c5bbd7aee7e9980313dc29469357c5cd (patch)
treef98bcb57c363cae66fead5d8f96b2ad530ede047 /drivers/staging
parentdc366f8e397c41ba582821e24abdc2bc4ae80a47 (diff)
greybus: makefile: add needed config options for lights
Add a function to check kernel versions and append the necessary options to support LEDS_CLASS, LEDS_CLASS_FLASH and V4L2_FLASH_LED_CLASS depending of the kernel version. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/greybus/Makefile15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile
index 11627035222c..3006edef7e7b 100644
--- a/drivers/staging/greybus/Makefile
+++ b/drivers/staging/greybus/Makefile
@@ -49,13 +49,26 @@ INSTALL_MOD_PATH ?= /..
PWD := $(shell pwd)
# kernel config option that shall be enable
-CONFIG_OPTIONS_ENABLE := SYSFS SPI USB SND_SOC MMC
+CONFIG_OPTIONS_ENABLE := SYSFS SPI USB SND_SOC MMC LEDS_CLASS
# kernel config option that shall be disable
CONFIG_OPTIONS_DISABLE :=
# this only run in kbuild part of the makefile
ifneq ($(KERNELRELEASE),)
+# This function returns the argument version if current kernel version is minor
+# than the passed version, return 1 if equal or the current kernel version if it
+# is greater than argument version.
+kvers_cmp=$(shell [[ "$(KERNELVERSION)" == "$(1)" ]] && echo 1 || echo -e "$(1)\n$(KERNELVERSION)" | sort -V | tail -1)
+
+ifneq ($(call kvers_cmp,"3.19.0"),3.19.0)
+ CONFIG_OPTIONS_ENABLE += LEDS_CLASS_FLASH
+endif
+
+ifneq ($(call kvers_cmp,"4.2.0"),4.2.0)
+ CONFIG_OPTIONS_ENABLE += V4L2_FLASH_LED_CLASS
+endif
+
$(foreach opt,$(CONFIG_OPTIONS_ENABLE),$(if $(CONFIG_$(opt)),, \
$(error CONFIG_$(opt) is disabled in the kernel configuration and must be enable \
to continue compilation)))