[PATCH] tty: serial: serial_mctrl_gpio: Fix build error for !GPIOLIB

From: Tobias Klauser
Date: Wed Sep 10 2014 - 04:09:03 EST


If SERIAL_MCTRL_GPIO is selected but GPIOLIB is not, the noop functions
from serial_mctrl_gpio.h are pulled in. However, serial_mctrl_gpio.c is
still compiled, leading to function redefinition build errors. Since all
drivers that include serial_mctrl_gpio.h also depend on
SERIAL_MCTRL_GPIO, let it depend on GPIOLIB as well remove the noop
functions alltogether.

Reported-by: Jim Davis <jim.epost@xxxxxxxxx>
Signed-off-by: Tobias Klauser <tklauser@xxxxxxxxxx>
---
drivers/tty/serial/Kconfig | 1 +
drivers/tty/serial/serial_mctrl_gpio.h | 35 ----------------------------------
2 files changed, 1 insertion(+), 35 deletions(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 8079f52..5f1ea62 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1575,5 +1575,6 @@ endmenu

config SERIAL_MCTRL_GPIO
tristate
+ select GPIOLIB

endif # TTY
diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h
index 400ba04..5e4c96a 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.h
+++ b/drivers/tty/serial/serial_mctrl_gpio.h
@@ -40,8 +40,6 @@ enum mctrl_gpio_idx {
*/
struct mctrl_gpios;

-#ifdef CONFIG_GPIOLIB
-
/*
* Set state of the modem control output lines via GPIOs.
*/
@@ -74,37 +72,4 @@ struct mctrl_gpios *mctrl_gpio_init(struct device *dev, unsigned int idx);
*/
void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios);

-#else /* GPIOLIB */
-
-static inline
-void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl)
-{
-}
-
-static inline
-unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl)
-{
- return *mctrl;
-}
-
-static inline
-struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios,
- enum mctrl_gpio_idx gidx)
-{
- return ERR_PTR(-ENOSYS);
-}
-
-static inline
-struct mctrl_gpios *mctrl_gpio_init(struct device *dev, unsigned int idx)
-{
- return ERR_PTR(-ENOSYS);
-}
-
-static inline
-void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios)
-{
-}
-
-#endif /* GPIOLIB */
-
#endif
--
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/