Commit ccfbc3e1 authored by Sonic Zhang's avatar Sonic Zhang Committed by Linus Torvalds

Blackfin Serial Driver: Fix bug - should suspend/resume/remove all uart ports.

Signed-off-by: default avatarSonic Zhang <sonic.zhang@analog.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c1113400
...@@ -1100,20 +1100,26 @@ static struct uart_driver bfin_serial_reg = { ...@@ -1100,20 +1100,26 @@ static struct uart_driver bfin_serial_reg = {
static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state) static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct bfin_serial_port *uart = platform_get_drvdata(dev); int i;
if (uart) for (i = 0; i < nr_ports; i++) {
uart_suspend_port(&bfin_serial_reg, &uart->port); if (bfin_serial_ports[i].port.dev != &dev->dev)
continue;
uart_suspend_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
}
return 0; return 0;
} }
static int bfin_serial_resume(struct platform_device *dev) static int bfin_serial_resume(struct platform_device *dev)
{ {
struct bfin_serial_port *uart = platform_get_drvdata(dev); int i;
if (uart) for (i = 0; i < nr_ports; i++) {
uart_resume_port(&bfin_serial_reg, &uart->port); if (bfin_serial_ports[i].port.dev != &dev->dev)
continue;
uart_resume_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
}
return 0; return 0;
} }
...@@ -1133,27 +1139,26 @@ static int bfin_serial_probe(struct platform_device *dev) ...@@ -1133,27 +1139,26 @@ static int bfin_serial_probe(struct platform_device *dev)
continue; continue;
bfin_serial_ports[i].port.dev = &dev->dev; bfin_serial_ports[i].port.dev = &dev->dev;
uart_add_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port); uart_add_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
platform_set_drvdata(dev, &bfin_serial_ports[i]);
} }
} }
return 0; return 0;
} }
static int bfin_serial_remove(struct platform_device *pdev) static int bfin_serial_remove(struct platform_device *dev)
{ {
struct bfin_serial_port *uart = platform_get_drvdata(pdev); int i;
for (i = 0; i < nr_ports; i++) {
if (bfin_serial_ports[i].port.dev != &dev->dev)
continue;
uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
bfin_serial_ports[i].port.dev = NULL;
#ifdef CONFIG_SERIAL_BFIN_CTSRTS #ifdef CONFIG_SERIAL_BFIN_CTSRTS
gpio_free(uart->cts_pin); gpio_free(bfin_serial_ports[i].cts_pin);
gpio_free(uart->rts_pin); gpio_free(bfin_serial_ports[i].rts_pin);
#endif #endif
}
platform_set_drvdata(pdev, NULL);
if (uart)
uart_remove_one_port(&bfin_serial_reg, &uart->port);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment