TTY: switch tty_schedule_flip

Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.

This is the last one: tty_schedule_flip

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby
2013-01-03 15:53:07 +01:00
committed by Greg Kroah-Hartman
parent 2e124b4a39
commit 6732c8bb86
11 changed files with 51 additions and 100 deletions

View File

@@ -44,9 +44,8 @@ typedef union _srmcons_result {
/* called with callback_lock held */
static int
srmcons_do_receive_chars(struct tty_struct *tty)
srmcons_do_receive_chars(struct tty_port *port)
{
struct tty_port *port = tty->port;
srmcons_result result;
int count = 0, loops = 0;
@@ -59,7 +58,7 @@ srmcons_do_receive_chars(struct tty_struct *tty)
} while((result.bits.status & 1) && (++loops < 10));
if (count)
tty_schedule_flip(tty);
tty_schedule_flip(port);
return count;
}
@@ -74,7 +73,7 @@ srmcons_receive_chars(unsigned long data)
local_irq_save(flags);
if (spin_trylock(&srmcons_callback_lock)) {
if (!srmcons_do_receive_chars(port->tty))
if (!srmcons_do_receive_chars(port))
incr = 100;
spin_unlock(&srmcons_callback_lock);
}
@@ -89,7 +88,7 @@ srmcons_receive_chars(unsigned long data)
/* called with callback_lock held */
static int
srmcons_do_write(struct tty_struct *tty, const char *buf, int count)
srmcons_do_write(struct tty_port *port, const char *buf, int count)
{
static char str_cr[1] = "\r";
long c, remaining = count;
@@ -114,10 +113,10 @@ srmcons_do_write(struct tty_struct *tty, const char *buf, int count)
cur += result.bits.c;
/*
* Check for pending input iff a tty was provided
* Check for pending input iff a tty port was provided
*/
if (tty)
srmcons_do_receive_chars(tty);
if (port)
srmcons_do_receive_chars(port);
}
while (need_cr) {
@@ -136,7 +135,7 @@ srmcons_write(struct tty_struct *tty,
unsigned long flags;
spin_lock_irqsave(&srmcons_callback_lock, flags);
srmcons_do_write(tty, (const char *) buf, count);
srmcons_do_write(tty->port, (const char *) buf, count);
spin_unlock_irqrestore(&srmcons_callback_lock, flags);
return count;