greybus: don't key on an enumerated constant
authorAlex Elder <elder@linaro.org>
Wed, 8 Jun 2016 19:44:22 +0000 (12:44 -0700)
committerAkash Choudhari <akashtc@google.com>
Wed, 8 Jun 2016 19:44:48 +0000 (12:44 -0700)
The symbol PWMF_ENABLED is defined via an enum, which is not defined
at the time the preprocessor passes through "kernel_ver.h".  So we
can't use it in an #if statement expression.

Use the Linux kernel version instead.

Change-Id: Id427224b1dfecfd886fcdae89c4bcf711b616439
Signed-off-by: Alex Elder <elder@linaro.org>
drivers/staging/greybus/kernel_ver.h

index 9819c3e..fd5a6cc 100644 (file)
@@ -328,7 +328,13 @@ static inline void reinit_completion(struct completion *x)
 }
 #endif
 
-#ifdef PWMF_ENABLED
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
+#include <linux/pwm.h>
+/*
+ * pwm_is_enabled() was first defined in 4.2-rc1 (first commit!).
+ * PWMF_ENABLED was first defined in 3.5-rc2, but our code is
+ * always newer than that.
+*/
 static inline bool pwm_is_enabled(const struct pwm_device *pwm)
 {
        return test_bit(PWMF_ENABLED, &pwm->flags);