lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140910080558.GB14260@distanz.ch>
Date:	Wed, 10 Sep 2014 10:05:58 +0200
From:	Tobias Klauser <tklauser@...tanz.ch>
To:	Jim Davis <jim.epost@...il.com>
Cc:	Stephen Rothwell <sfr@...b.auug.org.au>,
	linux-next <linux-next@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	jslaby@...e.cz, linux-serial@...r.kernel.org
Subject: Re: randconfig build error with next-20140909, in
 drivers/tty/serial/serial_mctrl_gpio.c

On 2014-09-10 at 00:32:25 +0200, Jim Davis <jim.epost@...il.com> 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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ