From patchwork Tue May 15 12:08:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 8648 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 36C7423E1B for ; Tue, 15 May 2012 12:08:34 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id E7C02A181BB for ; Tue, 15 May 2012 12:08:33 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id q6so6599173yen.11 for ; Tue, 15 May 2012 05:08:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to :subject:date:user-agent:cc:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id:x-provags-id :x-gm-message-state; bh=zQ0QJPlOaIZUlcbwL5aoOQiIDq15IvfOHcrPdio0/ro=; b=TBjIQIVrAHp9R+jHjzD0pRItSNOkzfnJfoehhXTLzh3DjXezDqXpHGhXhpBRSrAGi6 +SfQ1HkXQwWIcWK+8oprcBhTqbUyUaZ0CUOfzeq4gIw+ukKv1JjqMyxFcYrQ0iSg/qjf v+hEIsxHXDCx4a/0FkeJBFcTO7AeMyzFW5TSGhE4E876u26cFqMr7mXXK1n7pvJzQueo 7UjrNj5r2pMAqLcWL7K8SQ451P0YLVZ38C/WCS8QnZXm2ynWl2Fmet62Ac+api5wS1ok WDFZU31sD/aqhXDL2frNDIHL7EFaX1wSzUKjBE2cKq2YLHfkqz+hFfeRHBLBFDD4CKsm 3HaA== Received: by 10.42.88.135 with SMTP id c7mr5817959icm.57.1337083713549; Tue, 15 May 2012 05:08:33 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.35.72 with SMTP id o8csp416375ibd; Tue, 15 May 2012 05:08:32 -0700 (PDT) Received: by 10.180.8.69 with SMTP id p5mr29587672wia.17.1337083711878; Tue, 15 May 2012 05:08:31 -0700 (PDT) Received: from moutng.kundenserver.de (moutng.kundenserver.de. [212.227.126.186]) by mx.google.com with ESMTP id v40si22699553weq.113.2012.05.15.05.08.31; Tue, 15 May 2012 05:08:31 -0700 (PDT) Received-SPF: neutral (google.com: 212.227.126.186 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=212.227.126.186; Authentication-Results: mx.google.com; spf=neutral (google.com: 212.227.126.186 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mail=arnd@arndb.de Received: from klappe2.localnet (deibp9eh1--blueice3n2.emea.ibm.com [195.212.29.180]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Mc8Rz-1Smc7G2eVr-00Jb0g; Tue, 15 May 2012 14:08:29 +0200 From: Arnd Bergmann To: Grant Likely Subject: Re: [PATCH] gpio/exynos: Fix compiler warnings when non-exynos machines are selected Date: Tue, 15 May 2012 12:08:26 +0000 User-Agent: KMail/1.12.2 (Linux/3.4.0-rc3; KDE/4.3.2; x86_64; ; ) Cc: Linus Walleij , Sachin Kamat , linux-kernel@vger.kernel.org, linus.walleij@stericsson.com, patches@linaro.org References: <1335768768-10231-1-git-send-email-sachin.kamat@linaro.org> <20120512002912.8A0A23E0791@localhost> In-Reply-To: <20120512002912.8A0A23E0791@localhost> MIME-Version: 1.0 Message-Id: <201205151208.26551.arnd@arndb.de> X-Provags-ID: V02:K0:x9FXTixr58HfP3U6TpBmWBt1h4xFnqh9b0A3Aicbqx5 YCiF/3+BwlAyLeK8rB4HkxXXgSj2JL/M1J5ymD3uhAyO/Z5g/S eBWwJ1pqI/wgtx+13e2wifCYaKCF8CI6aCkdcuGP96i/w2yUaH 9VYq51D0IYQh3CSXATI97q1J7HutTJ13cVJRgtXF+3jU/nM0KS 2PvdycaMy9zu/fuhBjaT+96URaD/Nom0eeymiIFtblo2fuHsq5 DEyXBU+a7y2XCT6AYLRyYSkZV2pcKnYaxIX7B4+eY75z7A2518 3mUgN+YUm/G20B6pFkxuaApXjd3NxQ3Mdz4YrsveCndyIyAwK/ z+9ffbIAKE9UnkITNpX0= X-Gm-Message-State: ALoCoQl+J5l4P6krd3ehVCiQYQtq4OJ1V+F8qiWm43jqQRSeUZQuqjuyQKXbIYV2rhEGpHq/z6zQ On Saturday 12 May 2012, Grant Likely wrote: > On Wed, 2 May 2012 01:26:12 +0200, Linus Walleij wrote: > > On Mon, Apr 30, 2012 at 8:52 AM, Sachin Kamat 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 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: