提交 acb2cf34 编写于 作者: J Jeff Dike 提交者: Linus Torvalds

uml: console driver cleanups

Console driver cleanups -
	Changed an instance of foo = bar + foo to foo += bar
	Removed checks of tty->stopped - I don't think the low-level
driver has any business looking at that
	Removed an annoying warning
Signed-off-by: NJeff Dike <jdike@linux.intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 054211ac
...@@ -48,7 +48,7 @@ static int write_room(struct line *line) ...@@ -48,7 +48,7 @@ static int write_room(struct line *line)
n = line->head - line->tail; n = line->head - line->tail;
if (n <= 0) if (n <= 0)
n = LINE_BUFSIZE + n; /* The other case */ n += LINE_BUFSIZE; /* The other case */
return n - 1; return n - 1;
} }
...@@ -58,17 +58,10 @@ int line_write_room(struct tty_struct *tty) ...@@ -58,17 +58,10 @@ int line_write_room(struct tty_struct *tty)
unsigned long flags; unsigned long flags;
int room; int room;
if (tty->stopped)
return 0;
spin_lock_irqsave(&line->lock, flags); spin_lock_irqsave(&line->lock, flags);
room = write_room(line); room = write_room(line);
spin_unlock_irqrestore(&line->lock, flags); spin_unlock_irqrestore(&line->lock, flags);
/*XXX: Warning to remove */
if (0 == room)
printk(KERN_DEBUG "%s: %s: no room left in buffer\n",
__FUNCTION__,tty->name);
return room; return room;
} }
...@@ -79,8 +72,7 @@ int line_chars_in_buffer(struct tty_struct *tty) ...@@ -79,8 +72,7 @@ int line_chars_in_buffer(struct tty_struct *tty)
int ret; int ret;
spin_lock_irqsave(&line->lock, flags); spin_lock_irqsave(&line->lock, flags);
/* write_room subtracts 1 for the needed NULL, so we readd it.*/
/*write_room subtracts 1 for the needed NULL, so we readd it.*/
ret = LINE_BUFSIZE - (write_room(line) + 1); ret = LINE_BUFSIZE - (write_room(line) + 1);
spin_unlock_irqrestore(&line->lock, flags); spin_unlock_irqrestore(&line->lock, flags);
...@@ -184,10 +176,6 @@ void line_flush_buffer(struct tty_struct *tty) ...@@ -184,10 +176,6 @@ void line_flush_buffer(struct tty_struct *tty)
unsigned long flags; unsigned long flags;
int err; int err;
/*XXX: copied from line_write, verify if it is correct!*/
if (tty->stopped)
return;
spin_lock_irqsave(&line->lock, flags); spin_lock_irqsave(&line->lock, flags);
err = flush_buffer(line); err = flush_buffer(line);
spin_unlock_irqrestore(&line->lock, flags); spin_unlock_irqrestore(&line->lock, flags);
...@@ -213,9 +201,6 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len) ...@@ -213,9 +201,6 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
unsigned long flags; unsigned long flags;
int n, ret = 0; int n, ret = 0;
if (tty->stopped)
return 0;
spin_lock_irqsave(&line->lock, flags); spin_lock_irqsave(&line->lock, flags);
if (line->head != line->tail) if (line->head != line->tail)
ret = buffer_data(line, buf, len); ret = buffer_data(line, buf, len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册