All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] pinctrl: renesas: Fix linker error when PINCTRL_PFC=n
@ 2019-04-02 13:18 Eugeniu Rosca
  2019-04-02 13:34 ` Marek Vasut
  0 siblings, 1 reply; 15+ messages in thread
From: Eugeniu Rosca @ 2019-04-02 13:18 UTC (permalink / raw)
  To: 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 <dirk.behme@de.bosch.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
---
 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;
-- 
2.21.0

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

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

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 13:18 [U-Boot] [PATCH] pinctrl: renesas: Fix linker error when PINCTRL_PFC=n Eugeniu Rosca
2019-04-02 13:34 ` Marek Vasut
2019-04-02 15:17   ` Dirk Behme
2019-04-02 15:28     ` Marek Vasut
2019-04-02 15:40       ` Eugeniu Rosca
2019-04-02 16:02         ` Marek Vasut
2019-04-02 17:02           ` Eugeniu Rosca
2019-04-03 12:11             ` Marek Vasut
2019-04-03 12:30               ` Dirk Behme
2019-04-03 14:01                 ` Marek Vasut
2019-04-04  1:36                   ` Marek Vasut
2019-04-04 12:42                     ` Eugeniu Rosca
2019-04-21 22:23                       ` Marek Vasut
2019-04-02 17:58         ` Dirk Behme
2019-04-03 12:08           ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.