diff options
author | Alan Cox <alan@linux.intel.com> | 2009-11-30 08:16:41 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 18:18:06 -0500 |
commit | 44e4909e453eaa09c7de409fc9ee4ebefd986c1c (patch) | |
tree | 5bad1ed70f24c7cedd61a7664afe3706abab4e2f /drivers | |
parent | 1f100b323d19469b06a63ccd6130ed71760145cc (diff) |
tty: tty_port: Change the buffer allocator locking
We want to be able to do this without regard for the activate/own open
method being used which causes a problem using port->mutex. Add another
mutex for now. Once everything uses port_open to do buffer allocs we can
kill it back off
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/tty_port.c | 9 |
1 files changed, 5 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 | ||