diff options
-rw-r--r-- | drivers/char/tty_port.c | 9 | ||||
-rw-r--r-- | include/linux/tty.h | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c index dd471d63fae2..3ef644a2e517 100644 --- a/drivers/char/tty_port.c +++ b/drivers/char/tty_port.c | |||
@@ -25,6 +25,7 @@ void tty_port_init(struct tty_port *port) | |||
25 | init_waitqueue_head(&port->close_wait); | 25 | init_waitqueue_head(&port->close_wait); |
26 | init_waitqueue_head(&port->delta_msr_wait); | 26 | init_waitqueue_head(&port->delta_msr_wait); |
27 | mutex_init(&port->mutex); | 27 | mutex_init(&port->mutex); |
28 | mutex_init(&port->buf_mutex); | ||
28 | spin_lock_init(&port->lock); | 29 | spin_lock_init(&port->lock); |
29 | port->close_delay = (50 * HZ) / 100; | 30 | port->close_delay = (50 * HZ) / 100; |
30 | port->closing_wait = (3000 * HZ) / 100; | 31 | port->closing_wait = (3000 * HZ) / 100; |
@@ -34,10 +35,10 @@ EXPORT_SYMBOL(tty_port_init); | |||
34 | int tty_port_alloc_xmit_buf(struct tty_port *port) | 35 | int tty_port_alloc_xmit_buf(struct tty_port *port) |
35 | { | 36 | { |
36 | /* We may sleep in get_zeroed_page() */ | 37 | /* We may sleep in get_zeroed_page() */ |
37 | mutex_lock(&port->mutex); | 38 | mutex_lock(&port->buf_mutex); |
38 | if (port->xmit_buf == NULL) | 39 | if (port->xmit_buf == NULL) |
39 | port->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL); | 40 | port->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL); |
40 | mutex_unlock(&port->mutex); | 41 | mutex_unlock(&port->buf_mutex); |
41 | if (port->xmit_buf == NULL) | 42 | if (port->xmit_buf == NULL) |
42 | return -ENOMEM; | 43 | return -ENOMEM; |
43 | return 0; | 44 | return 0; |
@@ -46,12 +47,12 @@ EXPORT_SYMBOL(tty_port_alloc_xmit_buf); | |||
46 | 47 | ||
47 | void tty_port_free_xmit_buf(struct tty_port *port) | 48 | void tty_port_free_xmit_buf(struct tty_port *port) |
48 | { | 49 | { |
49 | mutex_lock(&port->mutex); | 50 | mutex_lock(&port->buf_mutex); |
50 | if (port->xmit_buf != NULL) { | 51 | if (port->xmit_buf != NULL) { |
51 | free_page((unsigned long)port->xmit_buf); | 52 | free_page((unsigned long)port->xmit_buf); |
52 | port->xmit_buf = NULL; | 53 | port->xmit_buf = NULL; |
53 | } | 54 | } |
54 | mutex_unlock(&port->mutex); | 55 | mutex_unlock(&port->buf_mutex); |
55 | } | 56 | } |
56 | EXPORT_SYMBOL(tty_port_free_xmit_buf); | 57 | EXPORT_SYMBOL(tty_port_free_xmit_buf); |
57 | 58 | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index 6352ac257fcb..e9269ca1542a 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -212,6 +212,7 @@ struct tty_port { | |||
212 | wait_queue_head_t delta_msr_wait; /* Modem status change */ | 212 | wait_queue_head_t delta_msr_wait; /* Modem status change */ |
213 | unsigned long flags; /* TTY flags ASY_*/ | 213 | unsigned long flags; /* TTY flags ASY_*/ |
214 | struct mutex mutex; /* Locking */ | 214 | struct mutex mutex; /* Locking */ |
215 | struct mutex buf_mutex; /* Buffer alloc lock */ | ||
215 | unsigned char *xmit_buf; /* Optional buffer */ | 216 | unsigned char *xmit_buf; /* Optional buffer */ |
216 | unsigned int close_delay; /* Close port delay */ | 217 | unsigned int close_delay; /* Close port delay */ |
217 | unsigned int closing_wait; /* Delay for output */ | 218 | unsigned int closing_wait; /* Delay for output */ |