aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorMike Frysinger <vapier.adi@gmail.com>2008-10-13 05:33:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:38 -0400
commitc9607ecc6ee50445e4d6bd3165f372a0f20f91ce (patch)
tree5f9f858516645f50ae46dc71bdb0ed8ed80a5687 /drivers/serial
parentd273e201717af57ae56299ef1e6e2f7a1f812020 (diff)
Blackfin Serial Driver: move common variables out of serial headers and into the serial driver
move common variables out of serial headers and into the serial driver and rename "nr_ports" to "nr_active_ports" so as to easily differentiate between BFIN_UART_NR_PORTS (the # of available) and nr_ports (the # of enabled) Signed-off-by: Mike Frysinger <vapier.adi@gmail.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>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/bfin_5xx.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 976de91307c3..382fb8d728df 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -42,6 +42,9 @@
42#define BFIN_SERIAL_MAJOR 204 42#define BFIN_SERIAL_MAJOR 204
43#define BFIN_SERIAL_MINOR 64 43#define BFIN_SERIAL_MINOR 64
44 44
45static struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS];
46static int nr_active_ports = ARRAY_SIZE(bfin_serial_resource);
47
45/* 48/*
46 * Setup for console. Argument comes from the menuconfig 49 * Setup for console. Argument comes from the menuconfig
47 */ 50 */
@@ -859,7 +862,7 @@ static void __init bfin_serial_init_ports(void)
859 return; 862 return;
860 first = 0; 863 first = 0;
861 864
862 for (i = 0; i < nr_ports; i++) { 865 for (i = 0; i < nr_active_ports; i++) {
863 bfin_serial_ports[i].port.uartclk = get_sclk(); 866 bfin_serial_ports[i].port.uartclk = get_sclk();
864 bfin_serial_ports[i].port.ops = &bfin_serial_pops; 867 bfin_serial_ports[i].port.ops = &bfin_serial_pops;
865 bfin_serial_ports[i].port.line = i; 868 bfin_serial_ports[i].port.line = i;
@@ -961,7 +964,7 @@ bfin_serial_console_setup(struct console *co, char *options)
961 * if so, search for the first available port that does have 964 * if so, search for the first available port that does have
962 * console support. 965 * console support.
963 */ 966 */
964 if (co->index == -1 || co->index >= nr_ports) 967 if (co->index == -1 || co->index >= nr_active_ports)
965 co->index = 0; 968 co->index = 0;
966 uart = &bfin_serial_ports[co->index]; 969 uart = &bfin_serial_ports[co->index];
967 970
@@ -1072,7 +1075,7 @@ struct console __init *bfin_earlyserial_init(unsigned int port,
1072 struct bfin_serial_port *uart; 1075 struct bfin_serial_port *uart;
1073 struct ktermios t; 1076 struct ktermios t;
1074 1077
1075 if (port == -1 || port >= nr_ports) 1078 if (port == -1 || port >= nr_active_ports)
1076 port = 0; 1079 port = 0;
1077 bfin_serial_init_ports(); 1080 bfin_serial_init_ports();
1078 bfin_early_serial_console.index = port; 1081 bfin_early_serial_console.index = port;
@@ -1102,7 +1105,7 @@ static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state)
1102{ 1105{
1103 int i; 1106 int i;
1104 1107
1105 for (i = 0; i < nr_ports; i++) { 1108 for (i = 0; i < nr_active_ports; i++) {
1106 if (bfin_serial_ports[i].port.dev != &dev->dev) 1109 if (bfin_serial_ports[i].port.dev != &dev->dev)
1107 continue; 1110 continue;
1108 uart_suspend_port(&bfin_serial_reg, &bfin_serial_ports[i].port); 1111 uart_suspend_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
@@ -1115,7 +1118,7 @@ static int bfin_serial_resume(struct platform_device *dev)
1115{ 1118{
1116 int i; 1119 int i;
1117 1120
1118 for (i = 0; i < nr_ports; i++) { 1121 for (i = 0; i < nr_active_ports; i++) {
1119 if (bfin_serial_ports[i].port.dev != &dev->dev) 1122 if (bfin_serial_ports[i].port.dev != &dev->dev)
1120 continue; 1123 continue;
1121 uart_resume_port(&bfin_serial_reg, &bfin_serial_ports[i].port); 1124 uart_resume_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
@@ -1134,7 +1137,7 @@ static int bfin_serial_probe(struct platform_device *dev)
1134 break; 1137 break;
1135 1138
1136 if (i < dev->num_resources) { 1139 if (i < dev->num_resources) {
1137 for (i = 0; i < nr_ports; i++, res++) { 1140 for (i = 0; i < nr_active_ports; i++, res++) {
1138 if (bfin_serial_ports[i].port.mapbase != res->start) 1141 if (bfin_serial_ports[i].port.mapbase != res->start)
1139 continue; 1142 continue;
1140 bfin_serial_ports[i].port.dev = &dev->dev; 1143 bfin_serial_ports[i].port.dev = &dev->dev;
@@ -1149,7 +1152,7 @@ static int bfin_serial_remove(struct platform_device *dev)
1149{ 1152{
1150 int i; 1153 int i;
1151 1154
1152 for (i = 0; i < nr_ports; i++) { 1155 for (i = 0; i < nr_active_ports; i++) {
1153 if (bfin_serial_ports[i].port.dev != &dev->dev) 1156 if (bfin_serial_ports[i].port.dev != &dev->dev)
1154 continue; 1157 continue;
1155 uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port); 1158 uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);