aboutsummaryrefslogtreecommitdiff
path: root/arch/um/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers')
-rw-r--r--arch/um/drivers/chan_kern.c3
-rw-r--r--arch/um/drivers/chan_user.c11
-rw-r--r--arch/um/drivers/line.c9
3 files changed, 16 insertions, 7 deletions
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index c09dbdfa298..db3082b4da4 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -291,6 +291,9 @@ int write_chan(struct list_head *chans, const char *buf, int len,
struct chan *chan = NULL;
int n, ret = 0;
+ if (len == 0)
+ return 0;
+
list_for_each(ele, chans) {
chan = list_entry(ele, struct chan, list);
if (!chan->output || (chan->ops->write == NULL))
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 77557e233f5..d29e56d8ced 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -38,7 +38,16 @@ int generic_read(int fd, char *c_out, void *unused)
int generic_write(int fd, const char *buf, int n, void *unused)
{
- return write(fd, buf, n);
+ int err;
+
+ err = write(fd, buf, n);
+ if (err > 0)
+ return err;
+ else if (errno == EAGAIN)
+ return 0;
+ else if (err == 0)
+ return -EIO;
+ return -errno;
}
int generic_window_size(int fd, void *unused, unsigned short *rows_out,
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 3e0b68e297f..b4538dfb482 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -216,18 +216,15 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
{
struct line *line = tty->driver_data;
unsigned long flags;
- int n, err, ret = 0;
+ int n, ret = 0;
if(tty->stopped)
return 0;
spin_lock_irqsave(&line->lock, flags);
- if (line->head != line->tail) {
+ if (line->head != line->tail)
ret = buffer_data(line, buf, len);
- err = flush_buffer(line);
- if (err <= 0 && (err != -EAGAIN || !ret))
- ret = err;
- } else {
+ else {
n = write_chan(&line->chan_list, buf, len,
line->driver->write_irq);
if (n < 0) {