Re: randconfig build error with next-20140909, in drivers/tty/serial/serial_mctrl_gpio.c

From: Tobias Klauser
Date: Wed Sep 10 2014 - 04:06:21 EST


On 2014-09-10 at 00:32:25 +0200, Jim Davis <jim.epost@xxxxxxxxx> wrote:
> Building with the attached random configuration file,
>
> drivers/tty/serial/serial_mctrl_gpio.c:44:6: error: redefinition of
> âmctrl_gpio_setâ
> void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl)
> ^
> In file included from drivers/tty/serial/serial_mctrl_gpio.c:23:0:
> drivers/tty/serial/serial_mctrl_gpio.h:80:6: note: previous definition
> of âmctrl_gpio_setâ was here
> void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl)
> ^
> drivers/tty/serial/serial_mctrl_gpio.c:59:19: error: redefinition of
> âmctrl_gpio_to_gpiodâ
> struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios,
> ^
> In file included from drivers/tty/serial/serial_mctrl_gpio.c:23:0:
> drivers/tty/serial/serial_mctrl_gpio.h:91:19: note: previous
> definition of âmctrl_gpio_to_gpiodâ was here
> struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios,
> ^
> drivers/tty/serial/serial_mctrl_gpio.c:69:14: error: redefinition of
> âmctrl_gpio_getâ
> unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl)
> ^
> In file included from drivers/tty/serial/serial_mctrl_gpio.c:23:0:
> drivers/tty/serial/serial_mctrl_gpio.h:85:14: note: previous
> definition of âmctrl_gpio_getâ was here
> unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl)
> ^
> drivers/tty/serial/serial_mctrl_gpio.c:93:21: error: redefinition of
> âmctrl_gpio_initâ
> struct mctrl_gpios *mctrl_gpio_init(struct device *dev, unsigned int idx)
> ^
> In file included from drivers/tty/serial/serial_mctrl_gpio.c:23:0:
> drivers/tty/serial/serial_mctrl_gpio.h:98:21: note: previous
> definition of âmctrl_gpio_initâ was here
> struct mctrl_gpios *mctrl_gpio_init(struct device *dev, unsigned int idx)
> ^
> drivers/tty/serial/serial_mctrl_gpio.c:131:6: error: redefinition of
> âmctrl_gpio_freeâ
> void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios)
> ^
> In file included from drivers/tty/serial/serial_mctrl_gpio.c:23:0:
> drivers/tty/serial/serial_mctrl_gpio.h:104:6: note: previous
> definition of âmctrl_gpio_freeâ was here
> void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios)
> ^
> CC [M] drivers/net/wireless/ti/wl1251/io.o
> make[3]: *** [drivers/tty/serial/serial_mctrl_gpio.o] Error 1

The problem seems to be that if GPIOLIB is not selected, the noop
functions from serial_mctrl_gpio.h are pulled in, but
serial_mctrl_gpio.c is still compiled. Since all drivers that include
serial_mctrl_gpio.h also depend on SERIAL_MCTRL_GPIO I'd suggest adding
a "select GPIOLIB" to config SERIAL_MCTRL_GPIO and removing the
noop functions alltogether, see patch below:

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
--
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/