diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-06-23 11:57:19 +0200 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-06-30 09:01:01 +0200 |
commit | 5109a4597f7e758b8d20694392d0361a0b4c43b1 (patch) | |
tree | f4a3553afd4c682a1ac0c19577a94f7208485c0f /arch/arm/mach-mx3/mach-mx31moboard.c | |
parent | 6eafde5f02b1f34b7e083d1d6522f40e850bf355 (diff) |
ARM: mx3: complement uart init routine with an exit routine
moboard_uart0_init requests a gpio. Without an exit function that
frees that gpio again binding the uart a second time doesn't work.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3/mach-mx31moboard.c')
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31moboard.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c index 95633bb063b..67776bc61c3 100644 --- a/arch/arm/mach-mx3/mach-mx31moboard.c +++ b/arch/arm/mach-mx3/mach-mx31moboard.c @@ -125,13 +125,25 @@ static struct platform_device mx31moboard_flash = { static int moboard_uart0_init(struct platform_device *pdev) { - gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack"); - gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0); - return 0; + int ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack"); + if (ret) + return ret; + + ret = gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0); + if (ret) + gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1)); + + return ret; +} + +static void moboard_uart0_exit(struct platform_device *pdev) +{ + gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1)); } static const struct imxuart_platform_data uart0_pdata __initconst = { .init = moboard_uart0_init, + .exit = moboard_uart0_exit, }; static const struct imxuart_platform_data uart4_pdata __initconst = { |