Re: [PATCH] [linux-next] serial: sc16is7xx: fix defined-but-not-used warnings

From: Alexander Shiyan
Date: Wed Apr 30 2014 - 09:12:26 EST


Wed, 30 Apr 2014 15:07:04 +0200 ÐÑ Jan Moskyto Matejka <mq@xxxxxxx>:
> drivers/tty/serial/sc16is7xx.c:1060:12: warning: 'sc16is7xx_probe' defined but not used [-Wunused-function]
> static int sc16is7xx_probe(struct device *dev,
> ^
> drivers/tty/serial/sc16is7xx.c:1176:12: warning: 'sc16is7xx_remove' defined but not used [-Wunused-function]
> static int sc16is7xx_remove(struct device *dev)
> ^
> drivers/tty/serial/sc16is7xx.c:1215:29: warning: 'regcfg' defined but not used [-Wunused-variable]
> static struct regmap_config regcfg = {
> ^
>
> Fixed these warnings by #ifdef-ing them to CONFIG_REGMAP_I2C and
> recursively #ifdef-ing also some other functions that got defined but not used.
>
> Signed-off-by: Jan Moskyto Matejka <mq@xxxxxxx>
> ---
> drivers/tty/serial/sc16is7xx.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
> index 7206a64..bd76277 100644
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
> @@ -389,6 +389,7 @@ static const struct sc16is7xx_devtype sc16is762_devtype = {
> .nr_uart = 2,
> };
>
> +#ifdef CONFIG_REGMAP_I2C
> static bool sc16is7xx_regmap_volatile(struct device *dev, unsigned int reg)

No. This is not a good way.
The Kconfig should be patched for dependency of I2C.

---

N‹§²æ¸›yú²X¬¶ÇvØ–)Þ{.nlj·¥Š{±‘êX§¶›¡Ü}©ž²ÆzÚj:+v‰¨¾«‘êZ+€Êzf£¢·hšˆ§~†­†Ûÿû®w¥¢¸?™¨è&¢)ßf”ùy§m…á«a¶Úÿ 0¶ìå