aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/8250.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r--drivers/serial/8250.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 54e5cc0dd5f8..fb610c3634a4 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -41,6 +41,7 @@
41#include <linux/serial.h> 41#include <linux/serial.h>
42#include <linux/serial_8250.h> 42#include <linux/serial_8250.h>
43#include <linux/nmi.h> 43#include <linux/nmi.h>
44#include <linux/mutex.h>
44 45
45#include <asm/io.h> 46#include <asm/io.h>
46#include <asm/irq.h> 47#include <asm/irq.h>
@@ -2467,7 +2468,7 @@ static struct platform_device *serial8250_isa_devs;
2467 * 16x50 serial ports to be configured at run-time, to support PCMCIA 2468 * 16x50 serial ports to be configured at run-time, to support PCMCIA
2468 * modems and PCI multiport cards. 2469 * modems and PCI multiport cards.
2469 */ 2470 */
2470static DECLARE_MUTEX(serial_sem); 2471static DEFINE_MUTEX(serial_mutex);
2471 2472
2472static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *port) 2473static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *port)
2473{ 2474{
@@ -2522,7 +2523,7 @@ int serial8250_register_port(struct uart_port *port)
2522 if (port->uartclk == 0) 2523 if (port->uartclk == 0)
2523 return -EINVAL; 2524 return -EINVAL;
2524 2525
2525 down(&serial_sem); 2526 mutex_lock(&serial_mutex);
2526 2527
2527 uart = serial8250_find_match_or_unused(port); 2528 uart = serial8250_find_match_or_unused(port);
2528 if (uart) { 2529 if (uart) {
@@ -2544,7 +2545,7 @@ int serial8250_register_port(struct uart_port *port)
2544 if (ret == 0) 2545 if (ret == 0)
2545 ret = uart->port.line; 2546 ret = uart->port.line;
2546 } 2547 }
2547 up(&serial_sem); 2548 mutex_unlock(&serial_mutex);
2548 2549
2549 return ret; 2550 return ret;
2550} 2551}
@@ -2561,7 +2562,7 @@ void serial8250_unregister_port(int line)
2561{ 2562{
2562 struct uart_8250_port *uart = &serial8250_ports[line]; 2563 struct uart_8250_port *uart = &serial8250_ports[line];
2563 2564
2564 down(&serial_sem); 2565 mutex_lock(&serial_mutex);
2565 uart_remove_one_port(&serial8250_reg, &uart->port); 2566 uart_remove_one_port(&serial8250_reg, &uart->port);
2566 if (serial8250_isa_devs) { 2567 if (serial8250_isa_devs) {
2567 uart->port.flags &= ~UPF_BOOT_AUTOCONF; 2568 uart->port.flags &= ~UPF_BOOT_AUTOCONF;
@@ -2571,7 +2572,7 @@ void serial8250_unregister_port(int line)
2571 } else { 2572 } else {
2572 uart->port.dev = NULL; 2573 uart->port.dev = NULL;
2573 } 2574 }
2574 up(&serial_sem); 2575 mutex_unlock(&serial_mutex);
2575} 2576}
2576EXPORT_SYMBOL(serial8250_unregister_port); 2577EXPORT_SYMBOL(serial8250_unregister_port);
2577 2578