diff options
author | Paul Fulghum <paulkf@microgate.com> | 2006-01-11 18:51:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-11 19:12:16 -0500 |
commit | 607f4e3864a4306be0d0ad11ff34284c239aad1b (patch) | |
tree | c3bfaa2abc5fb7cc33fc28d8606a0d4721d1700b | |
parent | 4cec87361462d570d6a67888feda41e77e0a9562 (diff) |
[PATCH] new tty buffering access fix
Fix typos in new tty buffering that incorrectly
access and update buffers in pending queue.
Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/char/tty_io.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 1eda82b31a61..eb8b5be4e249 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -312,7 +312,7 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) | |||
312 | 312 | ||
313 | int tty_buffer_request_room(struct tty_struct *tty, size_t size) | 313 | int tty_buffer_request_room(struct tty_struct *tty, size_t size) |
314 | { | 314 | { |
315 | struct tty_buffer *b = tty->buf.head, *n; | 315 | struct tty_buffer *b = tty->buf.tail, *n; |
316 | int left = 0; | 316 | int left = 0; |
317 | 317 | ||
318 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to | 318 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to |
@@ -326,7 +326,6 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) | |||
326 | n = tty_buffer_find(tty, size); | 326 | n = tty_buffer_find(tty, size); |
327 | if(n == NULL) | 327 | if(n == NULL) |
328 | return left; | 328 | return left; |
329 | n->next = b; | ||
330 | if(b != NULL) | 329 | if(b != NULL) |
331 | b->next = n; | 330 | b->next = n; |
332 | else | 331 | else |
@@ -2751,6 +2750,8 @@ static void flush_to_ldisc(void *private_) | |||
2751 | spin_lock_irqsave(&tty->read_lock, flags); | 2750 | spin_lock_irqsave(&tty->read_lock, flags); |
2752 | while((tbuf = tty->buf.head) != NULL) { | 2751 | while((tbuf = tty->buf.head) != NULL) { |
2753 | tty->buf.head = tbuf->next; | 2752 | tty->buf.head = tbuf->next; |
2753 | if (tty->buf.head == NULL) | ||
2754 | tty->buf.tail = NULL; | ||
2754 | spin_unlock_irqrestore(&tty->read_lock, flags); | 2755 | spin_unlock_irqrestore(&tty->read_lock, flags); |
2755 | /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */ | 2756 | /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */ |
2756 | disc->receive_buf(tty, tbuf->char_buf_ptr, | 2757 | disc->receive_buf(tty, tbuf->char_buf_ptr, |
@@ -2759,7 +2760,6 @@ static void flush_to_ldisc(void *private_) | |||
2759 | spin_lock_irqsave(&tty->read_lock, flags); | 2760 | spin_lock_irqsave(&tty->read_lock, flags); |
2760 | tty_buffer_free(tty, tbuf); | 2761 | tty_buffer_free(tty, tbuf); |
2761 | } | 2762 | } |
2762 | tty->buf.tail = NULL; | ||
2763 | spin_unlock_irqrestore(&tty->read_lock, flags); | 2763 | spin_unlock_irqrestore(&tty->read_lock, flags); |
2764 | out: | 2764 | out: |
2765 | tty_ldisc_deref(disc); | 2765 | tty_ldisc_deref(disc); |