diff options
author | Ryan Bradetich <rbrad@parisc-linux.org> | 2006-11-03 00:38:39 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@ubuntu.com> | 2006-12-08 00:34:05 -0500 |
commit | 4bd5d82779466a2969c631ce283bef926680c9f5 (patch) | |
tree | 05a71af0da4438f85a03ade6f00a8b457a306b40 /drivers/serial | |
parent | 075b8783da0db700868c7b391636a85c06a89678 (diff) |
[PARISC] [MUX] Mux driver bug fix
This patch addresses the problems identified by Russell King in the
following email:
http://lists.parisc-linux.org/pipermail/parisc-linux/2005-December/027912.html
Signed-off-by: Ryan Bradetich <rbrad@parisc-linux.org>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/mux.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 8ad1b8c5ec5d..ec57a616788b 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c | |||
@@ -51,7 +51,11 @@ | |||
51 | 51 | ||
52 | #define MUX_NR 256 | 52 | #define MUX_NR 256 |
53 | static unsigned int port_cnt __read_mostly; | 53 | static unsigned int port_cnt __read_mostly; |
54 | static struct uart_port mux_ports[MUX_NR]; | 54 | struct mux_port { |
55 | struct uart_port port; | ||
56 | int enabled; | ||
57 | }; | ||
58 | static struct mux_port mux_ports[MUX_NR]; | ||
55 | 59 | ||
56 | static struct uart_driver mux_driver = { | 60 | static struct uart_driver mux_driver = { |
57 | .owner = THIS_MODULE, | 61 | .owner = THIS_MODULE, |
@@ -250,7 +254,7 @@ static void mux_read(struct uart_port *port) | |||
250 | */ | 254 | */ |
251 | static int mux_startup(struct uart_port *port) | 255 | static int mux_startup(struct uart_port *port) |
252 | { | 256 | { |
253 | mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); | 257 | mux_ports[port->line].enabled = 1; |
254 | return 0; | 258 | return 0; |
255 | } | 259 | } |
256 | 260 | ||
@@ -262,6 +266,7 @@ static int mux_startup(struct uart_port *port) | |||
262 | */ | 266 | */ |
263 | static void mux_shutdown(struct uart_port *port) | 267 | static void mux_shutdown(struct uart_port *port) |
264 | { | 268 | { |
269 | mux_ports[port->line].enabled = 0; | ||
265 | } | 270 | } |
266 | 271 | ||
267 | /** | 272 | /** |
@@ -319,7 +324,7 @@ static int mux_request_port(struct uart_port *port) | |||
319 | * @port: Ptr to the uart_port. | 324 | * @port: Ptr to the uart_port. |
320 | * @type: Bitmask of required configurations. | 325 | * @type: Bitmask of required configurations. |
321 | * | 326 | * |
322 | * Perform any autoconfiguration steps for the port. This functino is | 327 | * Perform any autoconfiguration steps for the port. This function is |
323 | * called if the UPF_BOOT_AUTOCONF flag is specified for the port. | 328 | * called if the UPF_BOOT_AUTOCONF flag is specified for the port. |
324 | * [Note: This is required for now because of a bug in the Serial core. | 329 | * [Note: This is required for now because of a bug in the Serial core. |
325 | * rmk has already submitted a patch to linus, should be available for | 330 | * rmk has already submitted a patch to linus, should be available for |
@@ -357,11 +362,11 @@ static void mux_poll(unsigned long unused) | |||
357 | int i; | 362 | int i; |
358 | 363 | ||
359 | for(i = 0; i < port_cnt; ++i) { | 364 | for(i = 0; i < port_cnt; ++i) { |
360 | if(!mux_ports[i].info) | 365 | if(!mux_ports[i].enabled) |
361 | continue; | 366 | continue; |
362 | 367 | ||
363 | mux_read(&mux_ports[i]); | 368 | mux_read(&mux_ports[i].port); |
364 | mux_write(&mux_ports[i]); | 369 | mux_write(&mux_ports[i].port); |
365 | } | 370 | } |
366 | 371 | ||
367 | mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); | 372 | mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); |
@@ -456,7 +461,7 @@ static int __init mux_probe(struct parisc_device *dev) | |||
456 | } | 461 | } |
457 | 462 | ||
458 | for(i = 0; i < ports; ++i, ++port_cnt) { | 463 | for(i = 0; i < ports; ++i, ++port_cnt) { |
459 | port = &mux_ports[port_cnt]; | 464 | port = &mux_ports[port_cnt].port; |
460 | port->iobase = 0; | 465 | port->iobase = 0; |
461 | port->mapbase = dev->hpa.start + MUX_OFFSET + | 466 | port->mapbase = dev->hpa.start + MUX_OFFSET + |
462 | (i * MUX_LINE_OFFSET); | 467 | (i * MUX_LINE_OFFSET); |
@@ -484,6 +489,8 @@ static int __init mux_probe(struct parisc_device *dev) | |||
484 | #ifdef CONFIG_SERIAL_MUX_CONSOLE | 489 | #ifdef CONFIG_SERIAL_MUX_CONSOLE |
485 | register_console(&mux_console); | 490 | register_console(&mux_console); |
486 | #endif | 491 | #endif |
492 | mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); | ||
493 | |||
487 | return 0; | 494 | return 0; |
488 | } | 495 | } |
489 | 496 | ||
@@ -520,9 +527,9 @@ static void __exit mux_exit(void) | |||
520 | int i; | 527 | int i; |
521 | 528 | ||
522 | for (i = 0; i < port_cnt; i++) { | 529 | for (i = 0; i < port_cnt; i++) { |
523 | uart_remove_one_port(&mux_driver, &mux_ports[i]); | 530 | uart_remove_one_port(&mux_driver, &mux_ports[i].port); |
524 | if (mux_ports[i].membase) | 531 | if (mux_ports[i].port.membase) |
525 | iounmap(mux_ports[i].membase); | 532 | iounmap(mux_ports[i].port.membase); |
526 | } | 533 | } |
527 | 534 | ||
528 | uart_unregister_driver(&mux_driver); | 535 | uart_unregister_driver(&mux_driver); |