From patchwork Thu Dec 27 18:02:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Dunn X-Patchwork-Id: 1913481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 33780DF2A2 for ; Thu, 27 Dec 2012 18:06:51 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1ToHoa-0004wr-4u; Thu, 27 Dec 2012 18:04:20 +0000 Received: from smtp.newsguy.com ([74.209.136.69]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1ToHoO-0004tz-MJ for linux-arm-kernel@lists.infradead.org; Thu, 27 Dec 2012 18:04:09 +0000 Received: from localhost.localdomain (62.sub-70-199-234.myvzw.com [70.199.234.62]) by smtp.newsguy.com (8.14.3/8.14.3) with ESMTP id qBRI2pFT099268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Dec 2012 10:04:03 -0800 (PST) (envelope-from mikedunn@newsguy.com) From: Mike Dunn To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/4] ARM: palmtreo: fix #ifdefs for leds-gpio device Date: Thu, 27 Dec 2012 10:02:18 -0800 Message-Id: <1356631340-30328-3-git-send-email-mikedunn@newsguy.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1356631340-30328-1-git-send-email-mikedunn@newsguy.com> References: <1356631340-30328-1-git-send-email-mikedunn@newsguy.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121227_130408_963565_9393BE60 X-CRM114-Status: GOOD ( 17.49 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Marek Vasut , Eric Miao , Tomas Cech , Mike Dunn , Haojian Zhuang X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The #ifdefs around the leds-gpio device platform data are erroneous. Currently the device is not instantiated on the centro unless CONFIG_MACH_TREO680 is defined. This patch eliminates the #ifdefs, and uses the machine_is_* macros to initialize the data based on which machine the code is running on and the build-time configuration. Unused data is optimized out by the build tools if build configuration does not enable support for both machines. Tested on my palm treo 680, and compile-tested for all three combinations of treo680/centro build configurations. Signed-off-by: Mike Dunn --- arch/arm/mach-pxa/include/mach/palmtreo.h | 2 -- arch/arm/mach-pxa/palmtreo.c | 9 ++------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-pxa/include/mach/palmtreo.h b/arch/arm/mach-pxa/include/mach/palmtreo.h index 3266194..714b657 100644 --- a/arch/arm/mach-pxa/include/mach/palmtreo.h +++ b/arch/arm/mach-pxa/include/mach/palmtreo.h @@ -38,7 +38,6 @@ #define GPIO_NR_TREO_LCD_POWER 25 /* Treo680 specific GPIOs */ -#ifdef CONFIG_MACH_TREO680 #define GPIO_NR_TREO680_SD_READONLY 33 #define GPIO_NR_TREO680_SD_POWER 42 #define GPIO_NR_TREO680_VIBRATE_EN 44 @@ -47,7 +46,6 @@ #define GPIO_NR_TREO680_LCD_POWER 77 #define GPIO_NR_TREO680_LCD_EN 86 #define GPIO_NR_TREO680_LCD_EN_N 25 -#endif /* CONFIG_MACH_TREO680 */ /* Centro685 specific GPIOs */ #define GPIO_NR_CENTRO_SD_POWER 21 diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c index 4441216..5775128 100644 --- a/arch/arm/mach-pxa/palmtreo.c +++ b/arch/arm/mach-pxa/palmtreo.c @@ -334,7 +334,6 @@ static inline void palmtreo_uhc_init(void) {} /****************************************************************************** * Vibra and LEDs ******************************************************************************/ -#ifdef CONFIG_MACH_TREO680 static struct gpio_led treo680_gpio_leds[] = { { .name = "treo680:vibra:vibra", @@ -385,21 +384,17 @@ static struct gpio_led_platform_data centro_gpio_led_info = { static struct platform_device palmtreo_leds = { .name = "leds-gpio", .id = -1, - .dev = { - .platform_data = &treo680_gpio_led_info, - } }; static void __init palmtreo_leds_init(void) { if (machine_is_centro()) palmtreo_leds.dev.platform_data = ¢ro_gpio_led_info; + else if (machine_is_treo680()) + palmtreo_leds.dev.platform_data = &treo680_gpio_led_info; platform_device_register(&palmtreo_leds); } -#else -static inline void palmtreo_leds_init(void) {} -#endif /****************************************************************************** * Machine init