mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fabrice Gasnier <fabrice.gasnier@st.com>
To: Arnd Bergmann <arnd@arndb.de>, Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Lee Jones <lee.jones@linaro.org>, <linux-iio@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iio: stm32: fix adc/trigger link error
Date: Wed, 6 Sep 2017 18:16:33 +0200	[thread overview]
Message-ID: <50ec54e0-85f7-8c32-475c-9b27a4e6ebd3@st.com> (raw)
In-Reply-To: <20170906125722.2522781-1-arnd@arndb.de>

On 09/06/2017 02:56 PM, Arnd Bergmann wrote:
> The ADC driver can trigger on either the timer or the lptim
> trigger, but it only uses a Kconfig 'select' statement
> to ensure that the first of the two is present. When the lptim
> trigger is enabled as a loadable module, and the adc driver
> is built-in, we now get a link error:
> 
> drivers/iio/adc/stm32-adc.o: In function `stm32_adc_get_trig_extsel':
> stm32-adc.c:(.text+0x4e0): undefined reference to `is_stm32_lptim_trigger'
> 
> We could use a second 'select' statement and always have both
> trigger drivers enabled when the adc driver is, but it seems that
> the lptimer trigger was intentionally left optional, so it seems
> better to keep it that way.
Hi Arnd,

This is correct, not all stm32 have this hardware.
> 
> This adds a hack to use 'IS_REACHABLE()' rather than 'IS_ENABLED()',
> which avoids the link error, but instead leads to the lptimer trigger
> not being used in the broken configuration. I've added a runtime
> warning for this case to help users figure out what they did wrong
> if this should ever be done by accident.
> 
> Fixes: f0b638a7f6db ("iio: adc: stm32: add support for lptimer triggers")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Fabrice Gasnier <fabrice.gasnier@st.com>

Many thanks for the fix,
Best Regards,
Fabrice
> ---
>  include/linux/iio/timer/stm32-lptim-trigger.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/iio/timer/stm32-lptim-trigger.h b/include/linux/iio/timer/stm32-lptim-trigger.h
> index 34d59bfdce2d..464458d20b16 100644
> --- a/include/linux/iio/timer/stm32-lptim-trigger.h
> +++ b/include/linux/iio/timer/stm32-lptim-trigger.h
> @@ -16,11 +16,14 @@
>  #define LPTIM2_OUT	"lptim2_out"
>  #define LPTIM3_OUT	"lptim3_out"
>  
> -#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER)
> +#if IS_REACHABLE(CONFIG_IIO_STM32_LPTIMER_TRIGGER)
>  bool is_stm32_lptim_trigger(struct iio_trigger *trig);
>  #else
>  static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig)
>  {
> +#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER)
> +	pr_warn_once("stm32 lptim_trigger not linked in\n");
> +#endif
>  	return false;
>  }
>  #endif
> 

  reply	other threads:[~2017-09-06 16:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-06 12:56 Arnd Bergmann
2017-09-06 16:16 ` Fabrice Gasnier [this message]
2017-09-10 16:00   ` Jonathan Cameron
2017-09-25  9:54     ` Fabrice Gasnier
2017-09-25 10:16       ` Jonathan Cameron
2017-09-25 17:26         ` Jonathan Cameron
2017-11-27  9:09           ` Fabrice Gasnier
2017-12-02 11:22             ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50ec54e0-85f7-8c32-475c-9b27a4e6ebd3@st.com \
    --to=fabrice.gasnier@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=arnd@arndb.de \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®