From patchwork Wed Sep 6 12:56:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 111766 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp825686qge; Wed, 6 Sep 2017 05:58:21 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6eZ7X24tCGO5Pa5UPFQCqs8B+2nFCI08VrnhhUeBSsLqFpFslprJEvI2yRhfxjZwKKFztL X-Received: by 10.99.131.193 with SMTP id h184mr7373742pge.288.1504702701265; Wed, 06 Sep 2017 05:58:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504702701; cv=none; d=google.com; s=arc-20160816; b=oEzXAcog408ps6bE5ShmWznZZyxznfo8twCMe3VSZpdcSIC5xG6XUtK80mJX4YJts2 DlaH7BgX7Qdo5FqT/6DALN77+K7FvkBOdoz6xhAOTQLubNKc7yQrDabS1cpIZ+vHpgnv 5NUy7K4cOftR0U16WFUXZv0rleifjO2a7g32vE8DRrbjFqVyN0RuySA0b8EH4zW7yeWQ K3ggcxRWaxRCL7UizqObXlMImNI72cqsEgj05xF1WmkPag9C90nWdY9e2Szy6CPEQuRN DauKw5ZY2HbVvyTKci6nIa9jqxhKq29xh+k/V9zzDN/B2+LdLoGQa+lgz6GU1xqdGeu4 JMOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+ONdIP5mxdFW0ZaAyZo5ENmHhsVuK+OnYM3zrQwSasc=; b=NAVHIHVPvw4+BKT7ZOym7tDwf2sneW+5xhh778IIyu5Qk9NNMqMHTx4PjQUPKV6hNi w78mWje6ypGYPL8G5E26AKR1Biv0wAbZ55+uqLCvOnAg8a+K6iYRwh9dTE1ksMECBLeb orR156UhVZVr16bmTDunTARwhUijX2JuGgjzenZAjN4JYkx6Ntms5WDXO0WIwde4Bgqw xJlmkcZJlBUIfBhYGQdEnHQRjmBtz/SohPLstSx1/zHgz4kESjqzBPIu4Y7RxD1yXS0h LR9DJBVQND8U6S/Wj+oE67unCxwxoMHVccLp0ORE/UyIsN4Ek1AUYipBr/eoXtFe+3xv +aew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si1132767pgc.512.2017.09.06.05.58.20; Wed, 06 Sep 2017 05:58:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754298AbdIFM6S (ORCPT + 26 others); Wed, 6 Sep 2017 08:58:18 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:55509 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754067AbdIFM6O (ORCPT ); Wed, 6 Sep 2017 08:58:14 -0400 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0MDTqb-1dhZ8L2jAj-00GmPi; Wed, 06 Sep 2017 14:57:24 +0200 From: Arnd Bergmann To: Jonathan Cameron Cc: Arnd Bergmann , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Maxime Coquelin , Alexandre Torgue , Fabrice Gasnier , Lee Jones , linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: stm32: fix adc/trigger link error Date: Wed, 6 Sep 2017 14:56:50 +0200 Message-Id: <20170906125722.2522781-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:kc/jUjBV0zkuGyonxHhYSrZ92Q3gFtANPfAW39/qzUFTxVVhkA/ EMrYvF+qFaHdSo5UO6MmccEWHn9uemgg2l91EUbW46BtcEAXLtlG5Q+y3/jP2GUC89GwOMw OVZa5VNhHh7m2d5LOHpGgeJGxekLOqy57n4TLOpJODI6gLaezeQw58AzrisW6rwtRvyHCAs 9k4FoUSUQ4prRPPPtCt4Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:PP1EyyHUKnU=:8KTeBQMhECVyb/dGiFYx69 Je2RYcnM7icmNqxGn2Q1UWFznjAAKP0NPY4PPIKZX4iM6QDCpRQ3yIoQmSTrIkbo4i6juK5CH sceL2V9Az4sYpEfSsVgOG3uvv3U+yIg6LCGgTL8cB0mkiCVV5AMhOyvNjIdX4iWE/7LsW5jk1 HSTrJ6jkIuxuucVvK4IGYD8XL7O5vxMeCfZget3Vk7ygUIHNj2Mn0k0x4A8cOdzbBrHPNgU6Y UZif41jRpGWGSoHIYgxKrnTNLh9GhyYCqWbdPeWNhwonWMDHNGxOLnPtBSJl8Ffru4ERxWWul bAFDrsdWElUWnfO+6rI2V+m9w27OCLNdu99SfdpQEzvP88+v9X3Xzl9OQXrdAX6YmQXi0b8zp G+aBmh4Nz4n8+3h90BT26eo21WvQBrXwSG54QLd/lMxfS4/0jkcJGpLEGcYfQEJvFUgQKJiDa KWXh00juZ91rapgpI4Id09yGZWexVcqW3WuiIe7bn2MEwDkYy0bzJ3aeTTcODmAt+k99cMP6a +l2wIb2sWtvZs4NkH1EBwn9AQmyOUx5p1+Hs0NCsd9ZY+po4t0BXWmBNs+I468UO6Hl1AApvx j/Q4l/PnZMmbdK0+z//RHBB0Qnj6dCGn6QwIjulxeD2ow+UhuJk3oShOfHVpGxp8+rsyQ8XWc ffVhz82tVG0SBb9vr4Mzocf5PU4xE9y/5kauOEzK+QrwtwwnPITwubTYuL/j4QL1+nVfMxKVK Q1v0JVWx+IpthDA11s2r//48CR3LRyFqJ8cgaQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 --- include/linux/iio/timer/stm32-lptim-trigger.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.9.0 Tested-by: Fabrice Gasnier 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