aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mxs/mach-mx28evk.c
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2011-09-14 10:20:25 -0300
committerSascha Hauer <s.hauer@pengutronix.de>2011-09-20 09:45:09 +0200
commita35b91474c329ecefa793e4e7bb4103c88f4a16f (patch)
tree88aeed0fdc3806404bf2d2eed7c9bb75bdf7fd9a /arch/arm/mach-mxs/mach-mx28evk.c
parentARM i.MX: remove ARCH_MX* macros from Makefile (diff)
downloadlinux-dev-a35b91474c329ecefa793e4e7bb4103c88f4a16f.tar.xz
linux-dev-a35b91474c329ecefa793e4e7bb4103c88f4a16f.zip
ARM: mach-mxs/mx28evk: Only register devices if their GPIO requests succeeded
Currently framebuffer and MMC devices are registered even if their associated GPIO pins fail to be requested. Change the logic so that the registration of such devices only occurs if their GPIO requests succeeded. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mxs/mach-mx28evk.c')
-rw-r--r--arch/arm/mach-mxs/mach-mx28evk.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index 3f86e7a4d2cc..8b3aa7afdae0 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -351,6 +351,11 @@ static struct mxs_mmc_platform_data mx28evk_mmc_pdata[] __initdata = {
},
};
+static struct gpio mx28evk_lcd_gpios[] = {
+ { MX28EVK_LCD_ENABLE, GPIOF_OUT_INIT_HIGH, "lcd-enable" },
+ { MX28EVK_BL_ENABLE, GPIOF_OUT_INIT_HIGH, "bl-enable" },
+};
+
static void __init mx28evk_init(void)
{
int ret;
@@ -377,19 +382,12 @@ static void __init mx28evk_init(void)
mx28_add_flexcan(1, &mx28evk_flexcan_pdata[1]);
}
- ret = gpio_request_one(MX28EVK_LCD_ENABLE, GPIOF_DIR_OUT, "lcd-enable");
+ ret = gpio_request_array(mx28evk_lcd_gpios,
+ ARRAY_SIZE(mx28evk_lcd_gpios));
if (ret)
- pr_warn("failed to request gpio lcd-enable: %d\n", ret);
+ pr_warn("failed to request gpio pins for lcd: %d\n", ret);
else
- gpio_set_value(MX28EVK_LCD_ENABLE, 1);
-
- ret = gpio_request_one(MX28EVK_BL_ENABLE, GPIOF_DIR_OUT, "bl-enable");
- if (ret)
- pr_warn("failed to request gpio bl-enable: %d\n", ret);
- else
- gpio_set_value(MX28EVK_BL_ENABLE, 1);
-
- mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
+ mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
/* power on mmc slot by writing 0 to the gpio */
ret = gpio_request_one(MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW,
@@ -402,7 +400,8 @@ static void __init mx28evk_init(void)
"mmc1-slot-power");
if (ret)
pr_warn("failed to request gpio mmc1-slot-power: %d\n", ret);
- mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]);
+ else
+ mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]);
gpio_led_register_device(0, &mx28evk_led_data);
}