diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2008-10-13 05:33:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:38 -0400 |
commit | c9607ecc6ee50445e4d6bd3165f372a0f20f91ce (patch) | |
tree | 5f9f858516645f50ae46dc71bdb0ed8ed80a5687 | |
parent | d273e201717af57ae56299ef1e6e2f7a1f812020 (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>
6 files changed, 10 insertions, 20 deletions
diff --git a/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h index 2526b6ed6faa..a23d04750810 100644 --- a/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h +++ b/arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h | |||
@@ -119,7 +119,6 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) | |||
119 | bfin_write16(uart->port.membase + OFFSET_LSR, -1); | 119 | bfin_write16(uart->port.membase + OFFSET_LSR, -1); |
120 | } | 120 | } |
121 | 121 | ||
122 | struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS]; | ||
123 | struct bfin_serial_res { | 122 | struct bfin_serial_res { |
124 | unsigned long uart_base_addr; | 123 | unsigned long uart_base_addr; |
125 | int uart_irq; | 124 | int uart_irq; |
@@ -164,8 +163,6 @@ struct bfin_serial_res bfin_serial_resource[] = { | |||
164 | #endif | 163 | #endif |
165 | }; | 164 | }; |
166 | 165 | ||
167 | int nr_ports = ARRAY_SIZE(bfin_serial_resource); | ||
168 | |||
169 | #define DRIVER_NAME "bfin-uart" | 166 | #define DRIVER_NAME "bfin-uart" |
170 | 167 | ||
171 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) | 168 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) |
diff --git a/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h index ebf592b59aab..20471cd5ebfe 100644 --- a/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h +++ b/arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h | |||
@@ -111,7 +111,6 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) | |||
111 | bfin_write16(uart->port.membase + OFFSET_LSR, -1); | 111 | bfin_write16(uart->port.membase + OFFSET_LSR, -1); |
112 | } | 112 | } |
113 | 113 | ||
114 | struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS]; | ||
115 | struct bfin_serial_res { | 114 | struct bfin_serial_res { |
116 | unsigned long uart_base_addr; | 115 | unsigned long uart_base_addr; |
117 | int uart_irq; | 116 | int uart_irq; |
@@ -142,7 +141,6 @@ struct bfin_serial_res bfin_serial_resource[] = { | |||
142 | 141 | ||
143 | #define DRIVER_NAME "bfin-uart" | 142 | #define DRIVER_NAME "bfin-uart" |
144 | 143 | ||
145 | int nr_ports = BFIN_UART_NR_PORTS; | ||
146 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) | 144 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) |
147 | { | 145 | { |
148 | 146 | ||
diff --git a/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h index 1bf56ffa22f9..08dfe30300b0 100644 --- a/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h +++ b/arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h | |||
@@ -119,7 +119,6 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) | |||
119 | bfin_write16(uart->port.membase + OFFSET_LSR, -1); | 119 | bfin_write16(uart->port.membase + OFFSET_LSR, -1); |
120 | } | 120 | } |
121 | 121 | ||
122 | struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS]; | ||
123 | struct bfin_serial_res { | 122 | struct bfin_serial_res { |
124 | unsigned long uart_base_addr; | 123 | unsigned long uart_base_addr; |
125 | int uart_irq; | 124 | int uart_irq; |
@@ -164,8 +163,6 @@ struct bfin_serial_res bfin_serial_resource[] = { | |||
164 | #endif | 163 | #endif |
165 | }; | 164 | }; |
166 | 165 | ||
167 | int nr_ports = ARRAY_SIZE(bfin_serial_resource); | ||
168 | |||
169 | #define DRIVER_NAME "bfin-uart" | 166 | #define DRIVER_NAME "bfin-uart" |
170 | 167 | ||
171 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) | 168 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) |
diff --git a/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h index 5e29446a8e03..76976b17b530 100644 --- a/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h +++ b/arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h | |||
@@ -105,7 +105,6 @@ struct bfin_serial_port { | |||
105 | #endif | 105 | #endif |
106 | }; | 106 | }; |
107 | 107 | ||
108 | struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS]; | ||
109 | struct bfin_serial_res { | 108 | struct bfin_serial_res { |
110 | unsigned long uart_base_addr; | 109 | unsigned long uart_base_addr; |
111 | int uart_irq; | 110 | int uart_irq; |
@@ -170,8 +169,6 @@ struct bfin_serial_res bfin_serial_resource[] = { | |||
170 | #endif | 169 | #endif |
171 | }; | 170 | }; |
172 | 171 | ||
173 | int nr_ports = ARRAY_SIZE(bfin_serial_resource); | ||
174 | |||
175 | #define DRIVER_NAME "bfin-uart" | 172 | #define DRIVER_NAME "bfin-uart" |
176 | 173 | ||
177 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) | 174 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) |
diff --git a/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h b/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h index 8aa02780e642..6cddca4aa182 100644 --- a/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h +++ b/arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h | |||
@@ -111,7 +111,6 @@ static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) | |||
111 | bfin_write16(uart->port.membase + OFFSET_LSR, -1); | 111 | bfin_write16(uart->port.membase + OFFSET_LSR, -1); |
112 | } | 112 | } |
113 | 113 | ||
114 | struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS]; | ||
115 | struct bfin_serial_res { | 114 | struct bfin_serial_res { |
116 | unsigned long uart_base_addr; | 115 | unsigned long uart_base_addr; |
117 | int uart_irq; | 116 | int uart_irq; |
@@ -142,7 +141,6 @@ struct bfin_serial_res bfin_serial_resource[] = { | |||
142 | 141 | ||
143 | #define DRIVER_NAME "bfin-uart" | 142 | #define DRIVER_NAME "bfin-uart" |
144 | 143 | ||
145 | int nr_ports = BFIN_UART_NR_PORTS; | ||
146 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) | 144 | static void bfin_serial_hw_init(struct bfin_serial_port *uart) |
147 | { | 145 | { |
148 | 146 | ||
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 | ||
45 | static struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS]; | ||
46 | static 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); |