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

Commit 2f693357 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

TTY: convert more flipping functions



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.

Now 4 string flipping ones are on turn:
* tty_insert_flip_string_flags
* tty_insert_flip_string_fixed_flag
* tty_prepare_flip_string
* tty_prepare_flip_string_flags

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 227434f8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ static void dgrp_input(struct ch_struct *ch)
		    (nd->nd_dpa_port == PORT_NUM(MINOR(tty_devnum(tty)))))
			dgrp_dpa_data(nd, 1, myflipbuf, len);

		tty_insert_flip_string_flags(tty, myflipbuf,
		tty_insert_flip_string_flags(&ch->port, myflipbuf,
					     myflipflagbuf, len);
		tty_flip_buffer_push(tty);

+5 −3
Original line number Diff line number Diff line
@@ -507,7 +507,8 @@ static void fwtty_emit_breaks(struct work_struct *work)

	while (n) {
		t = min(n, 16);
		c = tty_insert_flip_string_fixed_flag(tty, buf, TTY_BREAK, t);
		c = tty_insert_flip_string_fixed_flag(&port->port, buf,
				TTY_BREAK, t);
		n -= c;
		brk += c;
		if (c < t)
@@ -535,7 +536,7 @@ static void fwtty_pushrx(struct work_struct *work)

	spin_lock_bh(&port->lock);
	list_for_each_entry_safe(buf, next, &port->buf_list, list) {
		n = tty_insert_flip_string_fixed_flag(tty, buf->data,
		n = tty_insert_flip_string_fixed_flag(&port->port, buf->data,
						      TTY_NORMAL, buf->n);
		c += n;
		port->buffered -= n;
@@ -630,7 +631,8 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len)
	}

	if (!test_bit(BUFFERING_RX, &port->flags)) {
		c = tty_insert_flip_string_fixed_flag(tty, data, TTY_NORMAL, n);
		c = tty_insert_flip_string_fixed_flag(&port->port, data,
				TTY_NORMAL, n);
		if (c > 0)
			tty_flip_buffer_push(tty);
		n -= c;
+1 −1
Original line number Diff line number Diff line
@@ -968,7 +968,7 @@ static void cyz_handle_rx(struct cyclades_port *info, struct tty_struct *tty)
		   for performance, but because of buffer boundaries, there
		   may be several steps to the operation */
			while (1) {
				len = tty_prepare_flip_string(tty, &buf,
				len = tty_prepare_flip_string(port, &buf,
						char_count);
				if (!len)
					break;
+2 −2
Original line number Diff line number Diff line
@@ -650,8 +650,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
			break;
		}
	} else {				/* Data   Packet */

		count = tty_prepare_flip_string(tty, &rp, byte_count & ~1);
		count = tty_prepare_flip_string(&port->port, &rp,
				byte_count & ~1);
		pr_debug("%s: Can rx %d of %d bytes.\n",
			 __func__, count, byte_count);
		word_count = count >> 1;
+2 −2
Original line number Diff line number Diff line
@@ -1966,7 +1966,7 @@ static int MoxaPortReadData(struct moxa_port *port)
			ofs = baseAddr + DynPage_addr + bufhead + head;
			len = (tail >= head) ? (tail - head) :
					(rx_mask + 1 - head);
			len = tty_prepare_flip_string(tty, &dst,
			len = tty_prepare_flip_string(&port->port, &dst,
					min(len, count));
			memcpy_fromio(dst, ofs, len);
			head = (head + len) & rx_mask;
@@ -1978,7 +1978,7 @@ static int MoxaPortReadData(struct moxa_port *port)
		while (count > 0) {
			writew(pageno, baseAddr + Control_reg);
			ofs = baseAddr + DynPage_addr + pageofs;
			len = tty_prepare_flip_string(tty, &dst,
			len = tty_prepare_flip_string(&port->port, &dst,
					min(Page_size - pageofs, count));
			memcpy_fromio(dst, ofs, len);

Loading