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

Commit a108bfcb authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman
Browse files

USB: tty: Prune uses of tty_request_room in the USB layer



We have lots of callers that do not need to do this in the first place.
Remove the calls as they both cost CPU and for big buffers can mess up the
multi-page allocation avoidance.

Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2832fc11
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -733,7 +733,6 @@ static void ark3116_read_bulk_callback(struct urb *urb)

		tty = tty_port_tty_get(&port->port);
		if (tty) {
			tty_buffer_request_room(tty, urb->actual_length + 1);
			/* overrun is special, not associated with a char */
			if (unlikely(lsr & UART_LSR_OE))
				tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+0 −1
Original line number Diff line number Diff line
@@ -395,7 +395,6 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
		return;
	}
	if (urb->actual_length) {
		tty_buffer_request_room(tty, urb->actual_length);
		tty_insert_flip_string(tty, data, urb->actual_length);
		tty_flip_buffer_push(tty);
	}
+3 −7
Original line number Diff line number Diff line
@@ -1307,13 +1307,9 @@ static void cypress_read_int_callback(struct urb *urb)
		spin_unlock_irqrestore(&priv->lock, flags);

	/* process read if there is data other than line status */
	if (tty && (bytes > i)) {
		bytes = tty_buffer_request_room(tty, bytes);
		for (; i < bytes ; ++i) {
			dbg("pushing byte number %d - %d - %c", i, data[i],
					data[i]);
			tty_insert_flip_char(tty, data[i], tty_flag);
		}
	if (tty && bytes > i) {
		tty_insert_flip_string_fixed_flag(tty, data + i,
				bytes - i, tty_flag);
		tty_flip_buffer_push(tty);
	}

+2 −11
Original line number Diff line number Diff line
@@ -1658,7 +1658,6 @@ static int digi_read_inb_callback(struct urb *urb)
	int port_status = ((unsigned char *)urb->transfer_buffer)[2];
	unsigned char *data = ((unsigned char *)urb->transfer_buffer) + 3;
	int flag, throttled;
	int i;
	int status = urb->status;

	/* do not process callbacks on closed ports */
@@ -1705,17 +1704,9 @@ static int digi_read_inb_callback(struct urb *urb)

		/* data length is len-1 (one byte of len is port_status) */
		--len;

		len = tty_buffer_request_room(tty, len);
		if (len > 0) {
			/* Hot path */
			if (flag == TTY_NORMAL)
				tty_insert_flip_string(tty, data, len);
			else {
				for (i = 0; i < len; i++)
					tty_insert_flip_char(tty,
								data[i], flag);
			}
			tty_insert_flip_string_fixed_flag(tty, data, len,
									flag);
			tty_flip_buffer_push(tty);
		}
	}
+0 −1
Original line number Diff line number Diff line
@@ -346,7 +346,6 @@ static void empeg_read_bulk_callback(struct urb *urb)
	tty = tty_port_tty_get(&port->port);

	if (urb->actual_length) {
		tty_buffer_request_room(tty, urb->actual_length);
		tty_insert_flip_string(tty, data, urb->actual_length);
		tty_flip_buffer_push(tty);
		bytes_in += urb->actual_length;
Loading