| .. | .. |
|---|
| 29 | 29 | #include <linux/file.h> |
|---|
| 30 | 30 | #include <linux/ioctl.h> |
|---|
| 31 | 31 | #include <linux/compat.h> |
|---|
| 32 | +#include "tty.h" |
|---|
| 32 | 33 | |
|---|
| 33 | 34 | #undef TTY_DEBUG_HANGUP |
|---|
| 34 | 35 | #ifdef TTY_DEBUG_HANGUP |
|---|
| .. | .. |
|---|
| 100 | 101 | * pty_write - write to a pty |
|---|
| 101 | 102 | * @tty: the tty we write from |
|---|
| 102 | 103 | * @buf: kernel buffer of data |
|---|
| 103 | | - * @count: bytes to write |
|---|
| 104 | + * @c: bytes to write |
|---|
| 104 | 105 | * |
|---|
| 105 | 106 | * Our "hardware" write method. Data is coming from the ldisc which |
|---|
| 106 | 107 | * may be in a non sleeping state. We simply throw this at the other |
|---|
| .. | .. |
|---|
| 111 | 112 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) |
|---|
| 112 | 113 | { |
|---|
| 113 | 114 | struct tty_struct *to = tty->link; |
|---|
| 114 | | - unsigned long flags; |
|---|
| 115 | 115 | |
|---|
| 116 | | - if (tty->stopped) |
|---|
| 116 | + if (tty->stopped || !c) |
|---|
| 117 | 117 | return 0; |
|---|
| 118 | 118 | |
|---|
| 119 | | - if (c > 0) { |
|---|
| 120 | | - spin_lock_irqsave(&to->port->lock, flags); |
|---|
| 121 | | - /* Stuff the data into the input queue of the other end */ |
|---|
| 122 | | - c = tty_insert_flip_string(to->port, buf, c); |
|---|
| 123 | | - spin_unlock_irqrestore(&to->port->lock, flags); |
|---|
| 124 | | - /* And shovel */ |
|---|
| 125 | | - if (c) |
|---|
| 126 | | - tty_flip_buffer_push(to->port); |
|---|
| 127 | | - } |
|---|
| 128 | | - return c; |
|---|
| 119 | + return tty_insert_flip_string_and_push_buffer(to->port, buf, c); |
|---|
| 129 | 120 | } |
|---|
| 130 | 121 | |
|---|
| 131 | 122 | /** |
|---|