Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

greybus: don't key on an enumerated constant

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>

authored by

Alex Elder and committed by
Akash Choudhari
365d79fc 8fb76c3c

+7 -1
+7 -1
drivers/staging/greybus/kernel_ver.h
··· 328 328 } 329 329 #endif 330 330 331 - #ifdef PWMF_ENABLED 331 + #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) 332 + #include <linux/pwm.h> 333 + /* 334 + * pwm_is_enabled() was first defined in 4.2-rc1 (first commit!). 335 + * PWMF_ENABLED was first defined in 3.5-rc2, but our code is 336 + * always newer than that. 337 + */ 332 338 static inline bool pwm_is_enabled(const struct pwm_device *pwm) 333 339 { 334 340 return test_bit(PWMF_ENABLED, &pwm->flags);