linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: trigger: stm32-timer: fix build issue when disabled
@ 2019-04-15  9:47 Fabrice Gasnier
  2019-04-22 10:14 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Gasnier @ 2019-04-15  9:47 UTC (permalink / raw)
  To: jic23, rdunlap
  Cc: sfr, lars, olivier.moysan, benjamin.gaignard, linux-iio, pmeerw,
	arnaud.pouliquen, linux-kernel, linux-next, mcoquelin.stm32,
	knaack.h, fabrice.gasnier, linux-stm32, linux-arm-kernel,
	alexandre.torgue

This fixes a build issue when CONFIG_IIO_STM32_TIMER_TRIGGER isn't set but
used in stm32-dfsdm-adc driver (e.g. CONFIG_STM32_DFSDM_ADC is set):
ERROR: "is_stm32_timer_trigger" [drivers/iio/adc/stm32-dfsdm-adc.ko]
undefined!

There are two possible options to fix this issue:
- select IIO_STM32_TIMER_TRIGGER along with CONFIG_STM32_DFSDM_ADC.
  This is what's being done currently for CONFIG_STM32_ADC.
- stub "is_stm32_timer_trigger" function

Choice is made to stub this function as suggested in [1]. This is also
inspired by similar "is_stm32_lptim_trigger" function (see [2]) in
include/linux/iio/timer/stm32-lptim-trigger.h

[1]
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1977377.html
[2] https://lkml.org/lkml/2017/9/10/124

Fixes: 11646e81d775 ("iio: adc: stm32-dfsdm: add support for buffer modes")

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Fix-suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 include/linux/iio/timer/stm32-timer-trigger.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/linux/iio/timer/stm32-timer-trigger.h b/include/linux/iio/timer/stm32-timer-trigger.h
index d68add8..cbb7c7a 100644
--- a/include/linux/iio/timer/stm32-timer-trigger.h
+++ b/include/linux/iio/timer/stm32-timer-trigger.h
@@ -73,6 +73,15 @@
 
 #define TIM17_OC1	"tim17_oc1"
 
+#if IS_REACHABLE(CONFIG_IIO_STM32_TIMER_TRIGGER)
 bool is_stm32_timer_trigger(struct iio_trigger *trig);
-
+#else
+static inline bool is_stm32_timer_trigger(struct iio_trigger *trig)
+{
+#if IS_ENABLED(CONFIG_IIO_STM32_TIMER_TRIGGER)
+	pr_warn_once("stm32-timer-trigger not linked in\n");
+#endif
+	return false;
+}
+#endif
 #endif
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-22 10:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-15  9:47 [PATCH] iio: trigger: stm32-timer: fix build issue when disabled Fabrice Gasnier
2019-04-22 10:14 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).