From: Arnd Bergmann <arnd@arndb.de>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Sachin Kamat <sachin.kamat@linaro.org>,
linux-kernel@vger.kernel.org, linus.walleij@stericsson.com,
patches@linaro.org
Subject: Re: [PATCH] gpio/exynos: Fix compiler warnings when non-exynos machines are selected
Date: Tue, 15 May 2012 12:08:26 +0000 [thread overview]
Message-ID: <201205151208.26551.arnd@arndb.de> (raw)
In-Reply-To: <20120512002912.8A0A23E0791@localhost>
On Saturday 12 May 2012, Grant Likely wrote:
> On Wed, 2 May 2012 01:26:12 +0200, Linus Walleij <linus.walleij@linaro.org> wrote:
> > On Mon, Apr 30, 2012 at 8:52 AM, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> >
> > > +#if defined(CONFIG_ARCH_EXYNOS4) || defined(CONFIG_ARCH_EXYNOS5)
> > > +#endif
> > > -static struct samsung_gpio_chip exynos4_gpios_1[] = {
> > > Â #ifdef CONFIG_ARCH_EXYNOS4
> > > +static struct samsung_gpio_chip exynos4_gpios_1[] = {
> > > -#endif
> > > +#endif
> > > -static struct samsung_gpio_chip exynos4_gpios_2[] = {
> > > Â #ifdef CONFIG_ARCH_EXYNOS4
> > > +static struct samsung_gpio_chip exynos4_gpios_2[] = {
> > > -#endif
> > > +#endif
> > > -static struct samsung_gpio_chip exynos4_gpios_3[] = {
> > > Â #ifdef CONFIG_ARCH_EXYNOS4
> > > +static struct samsung_gpio_chip exynos4_gpios_3[] = {
> > > -#endif
> > > +#endif
> > > Â #ifdef CONFIG_ARCH_EXYNOS5
> > > +#if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250)
> > > +#endif
> > > +#if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250)
> > > +#endif
> >
> > We really want to get rid of this kind of stuff from all drivers, #ifdefs are
> > declared ugly already in Documentation/CodingStyle.
> >
> > Any chance you could solve this problem by reworking the driver to
> > pass some flag in platform data tell which exynos it's for
> > and jist adapt at runtime instead of the compile-time quirkiness?
> >
> > Besides looking better, it helps us to get to a single zImage for the
> > exynoses too..
>
> I don't see any single-zImage issues here. There are no #else clauses
> in the #ifdef blocks so all it does it compile out unused code when
> exynos4 & 5 is not enabled. I'm going to apply it.
I needed another fixup on top of this to build exynos4_defconfig without
warnings.
8<---
gpio/samsung: define gpio_base4 variable only for exynos5
Avoids this warning:
drivers/gpio/gpio-samsung.c: In function 'samsung_gpiolib_init':
drivers/gpio/gpio-samsung.c:2979:1: warning: label 'err_ioremap4' defined but not used [-Wunused-label]
drivers/gpio/gpio-samsung.c:2725:47: warning: unused variable 'gpio_base4' [-Wunused-variable]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index e991d91..c80356d 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -2722,7 +2722,10 @@ static __init int samsung_gpiolib_init(void)
struct samsung_gpio_chip *chip;
int i, nr_chips;
#if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250)
- void __iomem *gpio_base1, *gpio_base2, *gpio_base3, *gpio_base4;
+ void __iomem *gpio_base1, *gpio_base2, *gpio_base3;
+#endif
+#if defined(CONFIG_SOC_EXYNOS5250)
+ void __iomem *gpio_base4;
#endif
int group = 0;
@@ -2975,9 +2978,11 @@ static __init int samsung_gpiolib_init(void)
return 0;
-#if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250)
+#if defined(CONFIG_SOC_EXYNOS5250)
err_ioremap4:
iounmap(gpio_base3);
+#endif
+#if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250)
err_ioremap3:
iounmap(gpio_base2);
err_ioremap2:
prev parent reply other threads:[~2012-05-15 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 6:52 [PATCH] gpio/exynos: Fix compiler warnings when non-exynos machines are selected Sachin Kamat
2012-05-01 23:26 ` Linus Walleij
2012-05-02 4:00 ` Sachin Kamat
2012-05-12 0:29 ` Grant Likely
2012-05-15 12:08 ` Arnd Bergmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201205151208.26551.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=grant.likely@secretlab.ca \
--cc=linus.walleij@linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
--cc=sachin.kamat@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.