From patchwork Tue Apr 2 13:18:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 1074420 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=de.adit-jv.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44YVCw3nSRz9sQr for ; Wed, 3 Apr 2019 00:19:08 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id B67F7C21DCA; Tue, 2 Apr 2019 13:19:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 68CD8C21DCA; Tue, 2 Apr 2019 13:19:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DCDB2C21DCA; Tue, 2 Apr 2019 13:18:59 +0000 (UTC) Received: from smtp1.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lists.denx.de (Postfix) with ESMTPS id 50844C21DA2 for ; Tue, 2 Apr 2019 13:18:59 +0000 (UTC) Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id 82EA73C013A; Tue, 2 Apr 2019 15:18:55 +0200 (CEST) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GCaw_7sf8CWF; Tue, 2 Apr 2019 15:18:48 +0200 (CEST) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id B42EB3C00C3; Tue, 2 Apr 2019 15:18:48 +0200 (CEST) Received: from vmlxhi-102.adit-jv.com (10.72.93.184) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 2 Apr 2019 15:18:48 +0200 From: Eugeniu Rosca To: Marek Vasut , Takeshi Kihara , Nobuhiro Iwamatsu , Dirk Behme , Date: Tue, 2 Apr 2019 15:18:23 +0200 Message-ID: <20190402131823.15841-1-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Originating-IP: [10.72.93.184] Cc: Eugeniu Rosca , Eugeniu Rosca Subject: [U-Boot] [PATCH] pinctrl: renesas: Fix linker error when PINCTRL_PFC=n X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" With CONFIG_PINCTRL_PFC=n, aarch64-linux-gnu-ld reports: -----8<----- LD u-boot drivers/gpio/built-in.o: In function `rcar_gpio_request': drivers/gpio/gpio-rcar.c:128: undefined reference to `sh_pfc_config_mux_for_gpio' -----8<----- Fix it in the least intrusive way and *avoid* ifdefs in the *.c code. Some recent Linux commits sharing the same approach: - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=23222f8f8dce ("acpi, nfit: Add function to look up nvdimm device and provide SMBIOS handle") - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5f143af7501e ("spi: make OF helper available for others") - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bccd06223f21 ("IB/uverbs: Add UVERBS_ATTR_FLAGS_IN to the specs language") Fixes: f6e545a73f88 ("pfc: rmobile: Add hook to configure pin as GPIO") Reported-by: Dirk Behme Signed-off-by: Eugeniu Rosca --- drivers/pinctrl/renesas/sh_pfc.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pinctrl/renesas/sh_pfc.h b/drivers/pinctrl/renesas/sh_pfc.h index b98c2f185d26..3d95d3c725cf 100644 --- a/drivers/pinctrl/renesas/sh_pfc.h +++ b/drivers/pinctrl/renesas/sh_pfc.h @@ -261,7 +261,15 @@ void sh_pfc_write(struct sh_pfc *pfc, u32 reg, u32 data); const struct pinmux_bias_reg * sh_pfc_pin_to_bias_reg(const struct sh_pfc *pfc, unsigned int pin, unsigned int *bit); +#if IS_ENABLED(CONFIG_PINCTRL_PFC) int sh_pfc_config_mux_for_gpio(struct udevice *dev, unsigned pin_selector); +#else +static inline +int sh_pfc_config_mux_for_gpio(struct udevice *dev, unsigned pin_selector) +{ + return -ENODEV; +} +#endif extern const struct sh_pfc_soc_info r8a7790_pinmux_info; extern const struct sh_pfc_soc_info r8a7791_pinmux_info;