From patchwork Wed Apr 11 22:44:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hartley Sweeten X-Patchwork-Id: 151913 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B34A0B706B for ; Thu, 12 Apr 2012 08:46:40 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SI6HZ-0006ZI-AV; Wed, 11 Apr 2012 22:44:57 +0000 Received: from mail127.messagelabs.com ([216.82.250.115]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SI6HW-0006XC-4c for linux-arm-kernel@lists.infradead.org; Wed, 11 Apr 2012 22:44:55 +0000 X-Env-Sender: hartleys@visionengravers.com X-Msg-Ref: server-6.tower-127.messagelabs.com!1334184283!2888710!6 X-Originating-IP: [216.166.12.99] X-StarScan-Version: 6.5.7; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12101 invoked from network); 11 Apr 2012 22:44:52 -0000 Received: from out001.collaborationhost.net (HELO out001.collaborationhost.net) (216.166.12.99) by server-6.tower-127.messagelabs.com with RC4-SHA encrypted SMTP; 11 Apr 2012 22:44:52 -0000 Received: from etch.local (10.2.3.210) by smtp.collaborationhost.net (10.2.0.100) with Microsoft SMTP Server (TLS) id 8.3.213.0; Wed, 11 Apr 2012 17:44:46 -0500 From: H Hartley Sweeten To: ARM Kernel Subject: [PATCH v3] arm: ep93xx: use gpio_led_register_device Date: Wed, 11 Apr 2012 15:44:42 -0700 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Disposition: inline Message-ID: <201204111544.43177.hartleys@visionengravers.com> X-Spam-Note: CRM114 invocation failed 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.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.82.250.115 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: rmallon@gmail.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Use gpio_led_register_device to register the two leds connected to the ep93xx. Since this is a common feature for all ep93xx based boards, create a new Kconfig option, EP93XX_SOC_COMMON, to select the LEDS_GPIO_REGISTER feature. The struct gpio_led and struct gpio_led_platform_data variables have been changed to const struct because of: commit 9517f925f2eb9ffca78b3f0f9389fc675bcb572c     leds: make *struct gpio_led_platform_data.leds const They have also been marked as __initconst because the helper function gpio_led_register_device makes a deep copy of the platform data to allow it to live in init memory: commit 4440673a95e63ad888a41db596edaa0c55d3a332     leds: provide helper to register "leds-gpio" devices Signed-off-by: Hartley Sweeten Cc: Ryan Mallon diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig index 97a2493..fe3c1fa 100644 --- a/arch/arm/mach-ep93xx/Kconfig +++ b/arch/arm/mach-ep93xx/Kconfig @@ -2,6 +2,11 @@ if ARCH_EP93XX menu "Cirrus EP93xx Implementation Options" +config EP93XX_SOC_COMMON + bool + default y + select LEDS_GPIO_REGISTER + config CRUNCH bool "Support for MaverickCrunch" help diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c index 8d25895..257a124 100644 --- a/arch/arm/mach-ep93xx/core.c +++ b/arch/arm/mach-ep93xx/core.c @@ -513,7 +513,7 @@ void __init ep93xx_register_spi(struct ep93xx_spi_info *info, /************************************************************************* * EP93xx LEDs *************************************************************************/ -static struct gpio_led ep93xx_led_pins[] = { +static const struct gpio_led ep93xx_led_pins[] __initconst = { { .name = "platform:grled", .gpio = EP93XX_GPIO_LINE_GRLED, @@ -523,20 +523,11 @@ static struct gpio_led ep93xx_led_pins[] = { }, }; -static struct gpio_led_platform_data ep93xx_led_data = { +static const struct gpio_led_platform_data ep93xx_led_data __initconst = { .num_leds = ARRAY_SIZE(ep93xx_led_pins), .leds = ep93xx_led_pins, }; -static struct platform_device ep93xx_leds = { - .name = "leds-gpio", - .id = -1, - .dev = { - .platform_data = &ep93xx_led_data, - }, -}; - - /************************************************************************* * EP93xx pwm peripheral handling *************************************************************************/ @@ -889,8 +880,9 @@ void __init ep93xx_init_devices(void) platform_device_register(&ep93xx_rtc_device); platform_device_register(&ep93xx_ohci_device); - platform_device_register(&ep93xx_leds); platform_device_register(&ep93xx_wdt_device); + + gpio_led_register_device(-1, &ep93xx_led_data); } void ep93xx_restart(char mode, const char *cmd)