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>
This commit is contained in:
parent
2c33727a62
commit
6a639bb83b
2 changed files with 2 additions and 9 deletions
|
@ -38,7 +38,6 @@
|
||||||
#define GPIO_NR_TREO_LCD_POWER 25
|
#define GPIO_NR_TREO_LCD_POWER 25
|
||||||
|
|
||||||
/* Treo680 specific GPIOs */
|
/* Treo680 specific GPIOs */
|
||||||
#ifdef CONFIG_MACH_TREO680
|
|
||||||
#define GPIO_NR_TREO680_SD_READONLY 33
|
#define GPIO_NR_TREO680_SD_READONLY 33
|
||||||
#define GPIO_NR_TREO680_SD_POWER 42
|
#define GPIO_NR_TREO680_SD_POWER 42
|
||||||
#define GPIO_NR_TREO680_VIBRATE_EN 44
|
#define GPIO_NR_TREO680_VIBRATE_EN 44
|
||||||
|
@ -47,7 +46,6 @@
|
||||||
#define GPIO_NR_TREO680_LCD_POWER 77
|
#define GPIO_NR_TREO680_LCD_POWER 77
|
||||||
#define GPIO_NR_TREO680_LCD_EN 86
|
#define GPIO_NR_TREO680_LCD_EN 86
|
||||||
#define GPIO_NR_TREO680_LCD_EN_N 25
|
#define GPIO_NR_TREO680_LCD_EN_N 25
|
||||||
#endif /* CONFIG_MACH_TREO680 */
|
|
||||||
|
|
||||||
/* Centro685 specific GPIOs */
|
/* Centro685 specific GPIOs */
|
||||||
#define GPIO_NR_CENTRO_SD_POWER 21
|
#define GPIO_NR_CENTRO_SD_POWER 21
|
||||||
|
|
|
@ -334,7 +334,6 @@ static inline void palmtreo_uhc_init(void) {}
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Vibra and LEDs
|
* Vibra and LEDs
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#ifdef CONFIG_MACH_TREO680
|
|
||||||
static struct gpio_led treo680_gpio_leds[] = {
|
static struct gpio_led treo680_gpio_leds[] = {
|
||||||
{
|
{
|
||||||
.name = "treo680:vibra:vibra",
|
.name = "treo680:vibra:vibra",
|
||||||
|
@ -385,21 +384,17 @@ static struct gpio_led_platform_data centro_gpio_led_info = {
|
||||||
static struct platform_device palmtreo_leds = {
|
static struct platform_device palmtreo_leds = {
|
||||||
.name = "leds-gpio",
|
.name = "leds-gpio",
|
||||||
.id = -1,
|
.id = -1,
|
||||||
.dev = {
|
|
||||||
.platform_data = &treo680_gpio_led_info,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init palmtreo_leds_init(void)
|
static void __init palmtreo_leds_init(void)
|
||||||
{
|
{
|
||||||
if (machine_is_centro())
|
if (machine_is_centro())
|
||||||
palmtreo_leds.dev.platform_data = ¢ro_gpio_led_info;
|
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);
|
platform_device_register(&palmtreo_leds);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
static inline void palmtreo_leds_init(void) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Machine init
|
* Machine init
|
||||||
|
|
Loading…
Add table
Reference in a new issue