projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
[firefly-linux-kernel-4.4.55.git]
/
drivers
/
tty
/
pty.c
diff --git
a/drivers/tty/pty.c
b/drivers/tty/pty.c
index abfd9908978188ffe3bfd7a9c3aa3e8c6700c5d9..25c9bc7837229abc2fb527732386111fb21194f0 100644
(file)
--- a/
drivers/tty/pty.c
+++ b/
drivers/tty/pty.c
@@
-89,17
+89,13
@@
static void pty_unthrottle(struct tty_struct *tty)
* pty_space - report space left for writing
* @to: tty we are writing into
*
* pty_space - report space left for writing
* @to: tty we are writing into
*
- * The tty buffers allow 64K but we sneak a peak and clip at 8K this
- * allows a lot of overspill room for echo and other fun messes to
- * be handled properly
+ * Limit the buffer space used by ptys to 8k.
*/
static int pty_space(struct tty_struct *to)
{
*/
static int pty_space(struct tty_struct *to)
{
- int n = 8192 - to->port->buf.memory_used;
- if (n < 0)
- return 0;
- return n;
+ int n = tty_buffer_space_avail(to->port);
+ return min(n, 8192);
}
/**
}
/**
@@
-125,10
+121,8
@@
static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
/* Stuff the data into the input queue of the other end */
c = tty_insert_flip_string(to->port, buf, c);
/* And shovel */
/* Stuff the data into the input queue of the other end */
c = tty_insert_flip_string(to->port, buf, c);
/* And shovel */
- if (c)
{
+ if (c)
tty_flip_buffer_push(to->port);
tty_flip_buffer_push(to->port);
- tty_wakeup(tty);
- }
}
return c;
}
}
return c;
}
@@
-287,7
+281,7
@@
static int pty_resize(struct tty_struct *tty, struct winsize *ws)
struct tty_struct *pty = tty->link;
/* For a PTY we need to lock the tty side */
struct tty_struct *pty = tty->link;
/* For a PTY we need to lock the tty side */
- mutex_lock(&tty->
termios
_mutex);
+ mutex_lock(&tty->
winsize
_mutex);
if (!memcmp(ws, &tty->winsize, sizeof(*ws)))
goto done;
if (!memcmp(ws, &tty->winsize, sizeof(*ws)))
goto done;
@@
-314,7
+308,7
@@
static int pty_resize(struct tty_struct *tty, struct winsize *ws)
tty->winsize = *ws;
pty->winsize = *ws; /* Never used so will go away soon */
done:
tty->winsize = *ws;
pty->winsize = *ws; /* Never used so will go away soon */
done:
- mutex_unlock(&tty->
termios
_mutex);
+ mutex_unlock(&tty->
winsize
_mutex);
return 0;
}
return 0;
}