Commit 6a639bb83b751bfed61be13c0e3df17e5a970a94

Authored by Mike Dunn
Committed by Haojian Zhuang
1 parent 2c33727a62

ARM: palmtreo: fix #ifdefs for leds-gpio device

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 <mikedunn@newsguy.com>
Acked-by: Tomas Cech <sleep_walker@suse.cz>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>

Showing 2 changed files with 2 additions and 9 deletions Side-by-side Diff

arch/arm/mach-pxa/include/mach/palmtreo.h
... ... @@ -38,7 +38,6 @@
38 38 #define GPIO_NR_TREO_LCD_POWER 25
39 39  
40 40 /* Treo680 specific GPIOs */
41   -#ifdef CONFIG_MACH_TREO680
42 41 #define GPIO_NR_TREO680_SD_READONLY 33
43 42 #define GPIO_NR_TREO680_SD_POWER 42
44 43 #define GPIO_NR_TREO680_VIBRATE_EN 44
... ... @@ -47,7 +46,6 @@
47 46 #define GPIO_NR_TREO680_LCD_POWER 77
48 47 #define GPIO_NR_TREO680_LCD_EN 86
49 48 #define GPIO_NR_TREO680_LCD_EN_N 25
50   -#endif /* CONFIG_MACH_TREO680 */
51 49  
52 50 /* Centro685 specific GPIOs */
53 51 #define GPIO_NR_CENTRO_SD_POWER 21
arch/arm/mach-pxa/palmtreo.c
... ... @@ -334,7 +334,6 @@
334 334 /******************************************************************************
335 335 * Vibra and LEDs
336 336 ******************************************************************************/
337   -#ifdef CONFIG_MACH_TREO680
338 337 static struct gpio_led treo680_gpio_leds[] = {
339 338 {
340 339 .name = "treo680:vibra:vibra",
341 340  
342 341  
... ... @@ -385,21 +384,17 @@
385 384 static struct platform_device palmtreo_leds = {
386 385 .name = "leds-gpio",
387 386 .id = -1,
388   - .dev = {
389   - .platform_data = &treo680_gpio_led_info,
390   - }
391 387 };
392 388  
393 389 static void __init palmtreo_leds_init(void)
394 390 {
395 391 if (machine_is_centro())
396 392 palmtreo_leds.dev.platform_data = &centro_gpio_led_info;
  393 + else if (machine_is_treo680())
  394 + palmtreo_leds.dev.platform_data = &treo680_gpio_led_info;
397 395  
398 396 platform_device_register(&palmtreo_leds);
399 397 }
400   -#else
401   -static inline void palmtreo_leds_init(void) {}
402   -#endif
403 398  
404 399 /******************************************************************************
405 400 * Machine init