Skip to content

Commit

Permalink
ARM: mx3: complement uart init routine with an exit routine
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Uwe Kleine-König committed Jun 30, 2010
1 parent 6eafde5 commit 5109a45
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions arch/arm/mach-mx3/mach-mx31moboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 5109a45

Please sign in to comment.