Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 248657
b: refs/heads/master
c: a664ec9
h: refs/heads/master
i:
  248655: f19f3f5
v: v3
  • Loading branch information
Tobias Klauser authored and Greg Kroah-Hartman committed Apr 19, 2011
1 parent ea14095 commit 2fe38f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0259894c732837c801565d038eaecdcf8fc5bbe7
refs/heads/master: a664ec9675d77aa2196e797afa5516d3e476da77
26 changes: 15 additions & 11 deletions trunk/drivers/tty/serial/altera_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,14 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
int i = pdev->id;
int ret;

/* -1 emphasizes that the platform must have one port, no .N suffix */
if (i == -1)
i = 0;
/* if id is -1 scan for a free id and use that one */
if (i == -1) {
for (i = 0; i < CONFIG_SERIAL_ALTERA_UART_MAXPORTS; i++)
if (altera_uart_ports[i].port.mapbase == 0)
break;
}

if (i >= CONFIG_SERIAL_ALTERA_UART_MAXPORTS)
if (i < 0 || i >= CONFIG_SERIAL_ALTERA_UART_MAXPORTS)
return -EINVAL;

port = &altera_uart_ports[i].port;
Expand Down Expand Up @@ -587,21 +590,22 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
port->ops = &altera_uart_ops;
port->flags = UPF_BOOT_AUTOCONF;

dev_set_drvdata(&pdev->dev, port);

uart_add_one_port(&altera_uart_driver, port);

return 0;
}

static int __devexit altera_uart_remove(struct platform_device *pdev)
{
struct uart_port *port;
int i = pdev->id;
struct uart_port *port = dev_get_drvdata(&pdev->dev);

if (i == -1)
i = 0;

port = &altera_uart_ports[i].port;
uart_remove_one_port(&altera_uart_driver, port);
if (port) {
uart_remove_one_port(&altera_uart_driver, port);
dev_set_drvdata(&pdev->dev, NULL);
port->mapbase = 0;
}

return 0;
}
Expand Down

0 comments on commit 2fe38f2

Please sign in to comment.