You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2f69335710
commit
92a19f9cec
@@ -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;
|
||||
|
||||
+9
-13
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user