Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 227434f8 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

TTY: switch tty_buffer_request_room to tty_port



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

Here we start with tty_buffer_request_room.

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ea28fd56
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -524,7 +524,8 @@ static int mask_test_and_clear(volatile u8 *ptr, u8 mask)
static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
{
	struct uart_icount *icount = &port->uart.icount;
	struct tty_struct *tty = port->uart.state->port.tty;
	struct tty_port *port = &port->uart.state->port;
	struct tty_struct *tty = port->tty;
	unsigned ix;
	int count;
	u8 st, ch, push, status, overrun;
@@ -534,7 +535,7 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
	push = 0;

	count = CIRC_CNT(port->rx_inp, port->rx_outp, MNSC_BUFFER_SIZE);
	count = tty_buffer_request_room(tty, count);
	count = tty_buffer_request_room(port, count);
	if (count == 0) {
		if (!tty->low_latency)
			tty_flip_buffer_push(tty);
+2 −1
Original line number Diff line number Diff line
@@ -554,6 +554,7 @@ int parse_chan_pair(char *str, struct line *line, int device,

void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
{
	struct tty_port *port = &line->port;
	struct chan *chan = line->chan_in;
	int err;
	char c;
@@ -562,7 +563,7 @@ void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
		goto out;

	do {
		if (tty && !tty_buffer_request_room(tty, 1)) {
		if (!tty_buffer_request_room(port, 1)) {
			schedule_delayed_work(&line->task, 1);
			goto out;
		}
+2 −1
Original line number Diff line number Diff line
@@ -888,6 +888,7 @@ static void rx_ready_hdlc(MGSLPC_INFO *info, int eom)

static void rx_ready_async(MGSLPC_INFO *info, int tcd, struct tty_struct *tty)
{
	struct tty_port *port = &info->port;
	unsigned char data, status, flag;
	int fifo_count;
	int work = 0;
@@ -913,7 +914,7 @@ static void rx_ready_async(MGSLPC_INFO *info, int tcd, struct tty_struct *tty)
	} else
		fifo_count = 32;

	tty_buffer_request_room(tty, fifo_count);
	tty_buffer_request_room(port, fifo_count);
	/* Flush received async data to receive data buffer. */
	while (fifo_count) {
		data   = read_reg(info, CHA + RXFIFO);
+2 −1
Original line number Diff line number Diff line
@@ -878,6 +878,7 @@ isdn_readbchan(int di, int channel, u_char *buf, u_char *fp, int len, wait_queue
int
isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
{
	struct tty_port *port = tty->port;
	int count;
	int count_pull;
	int count_put;
@@ -891,7 +892,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
	if (skb_queue_empty(&dev->drv[di]->rpqueue[channel]))
		return 0;

	len = tty_buffer_request_room(tty, dev->drv[di]->rcvcount[channel]);
	len = tty_buffer_request_room(port, dev->drv[di]->rcvcount[channel]);
	if (len == 0)
		return len;

+7 −5
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ static int si2bit[8] =
static int
isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
{
	struct tty_port *port = &info->port;
	int c;
	int len;
	struct tty_struct *tty;
@@ -68,7 +69,7 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
	if (!info->online)
		return 0;

	tty = info->port.tty;
	tty = port->tty;
	if (!tty)
		return 0;

@@ -81,7 +82,7 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
#endif
		;

	c = tty_buffer_request_room(tty, len);
	c = tty_buffer_request_room(port, len);
	if (c < len)
		return 0;

@@ -2230,6 +2231,7 @@ void
isdn_tty_at_cout(char *msg, modem_info *info)
{
	struct tty_struct *tty;
	struct tty_port *port = &info->port;
	atemu *m = &info->emu;
	char *p;
	char c;
@@ -2246,15 +2248,15 @@ isdn_tty_at_cout(char *msg, modem_info *info)
	l = strlen(msg);

	spin_lock_irqsave(&info->readlock, flags);
	tty = info->port.tty;
	if ((info->port.flags & ASYNC_CLOSING) || (!tty)) {
	tty = port->tty;
	if ((port->flags & ASYNC_CLOSING) || (!tty)) {
		spin_unlock_irqrestore(&info->readlock, flags);
		return;
	}

	/* use queue instead of direct, if online and */
	/* data is in queue or buffer is full */
	if (info->online && ((tty_buffer_request_room(tty, l) < l) ||
	if (info->online && ((tty_buffer_request_room(port, l) < l) ||
			     !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) {
		skb = alloc_skb(l, GFP_ATOMIC);
		if (!skb) {
Loading