diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-01-03 15:53:03 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-15 22:21:36 -0800 |
commit | 92a19f9cec9a80ad93c06e115822deb729e2c6ad (patch) | |
tree | 80e1550ac1647a1cdf20a0b568554c0c50a63f75 /drivers/tty/hvc | |
parent | 2f69335710884ae6112fc8196ebe29b5cda7b79b (diff) |
TTY: switch tty_insert_flip_char
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.
tty_insert_flip_char is the next one to proceed. This one is used all
over the code, so the patch is huge.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/hvc')
-rw-r--r-- | drivers/tty/hvc/hvc_console.c | 2 | ||||
-rw-r--r-- | drivers/tty/hvc/hvsi.c | 22 |
2 files changed, 10 insertions, 14 deletions
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 3d2ea92b850..8c2fe3a0e09 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c @@ -672,7 +672,7 @@ int hvc_poll(struct hvc_struct *hp) } } #endif /* CONFIG_MAGIC_SYSRQ */ - tty_insert_flip_char(tty, buf[i], 0); + tty_insert_flip_char(&hp->port, buf[i], 0); } read_total += n; diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index 68357a6e4de..1f528b8ebf5 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c @@ -329,8 +329,7 @@ static void hvsi_recv_query(struct hvsi_struct *hp, uint8_t *packet) } } -static void hvsi_insert_chars(struct hvsi_struct *hp, struct tty_struct *tty, - const char *buf, int len) +static void hvsi_insert_chars(struct hvsi_struct *hp, const char *buf, int len) { int i; @@ -346,7 +345,7 @@ static void hvsi_insert_chars(struct hvsi_struct *hp, struct tty_struct *tty, continue; } #endif /* CONFIG_MAGIC_SYSRQ */ - tty_insert_flip_char(tty, c, 0); + tty_insert_flip_char(&hp->port, c, 0); } } @@ -359,8 +358,7 @@ static void hvsi_insert_chars(struct hvsi_struct *hp, struct tty_struct *tty, * revisited. */ #define TTY_THRESHOLD_THROTTLE 128 -static bool hvsi_recv_data(struct hvsi_struct *hp, struct tty_struct *tty, - const uint8_t *packet) +static bool hvsi_recv_data(struct hvsi_struct *hp, const uint8_t *packet) { const struct hvsi_header *header = (const struct hvsi_header *)packet; const uint8_t *data = packet + sizeof(struct hvsi_header); @@ -377,7 +375,7 @@ static bool hvsi_recv_data(struct hvsi_struct *hp, struct tty_struct *tty, datalen = TTY_THRESHOLD_THROTTLE; } - hvsi_insert_chars(hp, tty, data, datalen); + hvsi_insert_chars(hp, data, datalen); if (overflow > 0) { /* @@ -438,9 +436,7 @@ static int hvsi_load_chunk(struct hvsi_struct *hp, struct tty_struct *tty, case VS_DATA_PACKET_HEADER: if (!is_open(hp)) break; - if (tty == NULL) - break; /* no tty buffer to put data in */ - flip = hvsi_recv_data(hp, tty, packet); + flip = hvsi_recv_data(hp, packet); break; case VS_CONTROL_PACKET_HEADER: hvsi_recv_control(hp, packet, tty, handshake); @@ -474,12 +470,12 @@ static int hvsi_load_chunk(struct hvsi_struct *hp, struct tty_struct *tty, return 1; } -static void hvsi_send_overflow(struct hvsi_struct *hp, struct tty_struct *tty) +static void hvsi_send_overflow(struct hvsi_struct *hp) { pr_debug("%s: delivering %i bytes overflow\n", __func__, hp->n_throttle); - hvsi_insert_chars(hp, tty, hp->throttle_buf, hp->n_throttle); + hvsi_insert_chars(hp, hp->throttle_buf, hp->n_throttle); hp->n_throttle = 0; } @@ -514,7 +510,7 @@ static irqreturn_t hvsi_interrupt(int irq, void *arg) if (tty && hp->n_throttle && !test_bit(TTY_THROTTLED, &tty->flags)) { /* we weren't hung up and we weren't throttled, so we can * deliver the rest now */ - hvsi_send_overflow(hp, tty); + hvsi_send_overflow(hp); tty_flip_buffer_push(tty); } spin_unlock_irqrestore(&hp->lock, flags); @@ -1001,7 +997,7 @@ static void hvsi_unthrottle(struct tty_struct *tty) spin_lock_irqsave(&hp->lock, flags); if (hp->n_throttle) { - hvsi_send_overflow(hp, tty); + hvsi_send_overflow(hp); tty_flip_buffer_push(tty); } spin_unlock_irqrestore(&hp->lock, flags); |