diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2008-10-13 05:32:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:38 -0400 |
commit | ccfbc3e1c860cce62e0b1c6c291647ecfe9ef296 (patch) | |
tree | 0c3a7cd0f970d4b2308bab61742aef5042a8a67f | |
parent | c111340002278c0425841b19477a1fd290a6f532 (diff) |
Blackfin Serial Driver: Fix bug - should suspend/resume/remove all uart ports.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/serial/bfin_5xx.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 4a023c65e9f4..04eeef05e93c 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
@@ -1100,20 +1100,26 @@ static struct uart_driver bfin_serial_reg = { | |||
1100 | 1100 | ||
1101 | static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state) | 1101 | static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state) |
1102 | { | 1102 | { |
1103 | struct bfin_serial_port *uart = platform_get_drvdata(dev); | 1103 | int i; |
1104 | 1104 | ||
1105 | if (uart) | 1105 | for (i = 0; i < nr_ports; i++) { |
1106 | uart_suspend_port(&bfin_serial_reg, &uart->port); | 1106 | if (bfin_serial_ports[i].port.dev != &dev->dev) |
1107 | continue; | ||
1108 | uart_suspend_port(&bfin_serial_reg, &bfin_serial_ports[i].port); | ||
1109 | } | ||
1107 | 1110 | ||
1108 | return 0; | 1111 | return 0; |
1109 | } | 1112 | } |
1110 | 1113 | ||
1111 | static int bfin_serial_resume(struct platform_device *dev) | 1114 | static int bfin_serial_resume(struct platform_device *dev) |
1112 | { | 1115 | { |
1113 | struct bfin_serial_port *uart = platform_get_drvdata(dev); | 1116 | int i; |
1114 | 1117 | ||
1115 | if (uart) | 1118 | for (i = 0; i < nr_ports; i++) { |
1116 | uart_resume_port(&bfin_serial_reg, &uart->port); | 1119 | if (bfin_serial_ports[i].port.dev != &dev->dev) |
1120 | continue; | ||
1121 | uart_resume_port(&bfin_serial_reg, &bfin_serial_ports[i].port); | ||
1122 | } | ||
1117 | 1123 | ||
1118 | return 0; | 1124 | return 0; |
1119 | } | 1125 | } |
@@ -1133,27 +1139,26 @@ static int bfin_serial_probe(struct platform_device *dev) | |||
1133 | continue; | 1139 | continue; |
1134 | bfin_serial_ports[i].port.dev = &dev->dev; | 1140 | bfin_serial_ports[i].port.dev = &dev->dev; |
1135 | uart_add_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port); | 1141 | uart_add_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port); |
1136 | platform_set_drvdata(dev, &bfin_serial_ports[i]); | ||
1137 | } | 1142 | } |
1138 | } | 1143 | } |
1139 | 1144 | ||
1140 | return 0; | 1145 | return 0; |
1141 | } | 1146 | } |
1142 | 1147 | ||
1143 | static int bfin_serial_remove(struct platform_device *pdev) | 1148 | static int bfin_serial_remove(struct platform_device *dev) |
1144 | { | 1149 | { |
1145 | struct bfin_serial_port *uart = platform_get_drvdata(pdev); | 1150 | int i; |
1146 | |||
1147 | 1151 | ||
1152 | for (i = 0; i < nr_ports; i++) { | ||
1153 | if (bfin_serial_ports[i].port.dev != &dev->dev) | ||
1154 | continue; | ||
1155 | uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port); | ||
1156 | bfin_serial_ports[i].port.dev = NULL; | ||
1148 | #ifdef CONFIG_SERIAL_BFIN_CTSRTS | 1157 | #ifdef CONFIG_SERIAL_BFIN_CTSRTS |
1149 | gpio_free(uart->cts_pin); | 1158 | gpio_free(bfin_serial_ports[i].cts_pin); |
1150 | gpio_free(uart->rts_pin); | 1159 | gpio_free(bfin_serial_ports[i].rts_pin); |
1151 | #endif | 1160 | #endif |
1152 | 1161 | } | |
1153 | platform_set_drvdata(pdev, NULL); | ||
1154 | |||
1155 | if (uart) | ||
1156 | uart_remove_one_port(&bfin_serial_reg, &uart->port); | ||
1157 | 1162 | ||
1158 | return 0; | 1163 | return 0; |
1159 | } | 1164 | } |