From d3f311d9ac96632be1fe60f653bb5ad6e46032ad Mon Sep 17 00:00:00 2001 From: Syed Rameez Mustafa Date: Fri, 20 Sep 2013 11:22:32 -0700 Subject: [PATCH] Revert "msm: tty: update receive room just before writing data to the ldisc" This reverts commit 913565a83d74fe1da0914e8c355345bc616131c4. This change seems to be a hack introduced for some corner cases seen on certain old fusion targets. The change is no longer applicable and is being reverted to bring the driver closer to the upstream implementation. The presence of this causes several merge conflicts when pulling upstream fixes. It has already been reverted on mainline. Change-Id: I9c08c96d77f478d21ca0b91ef2a8a3d5bf06cb00 Signed-off-by: Syed Rameez Mustafa --- drivers/tty/tty_buffer.c | 28 ++-------------------------- drivers/usb/serial/usb_wwan.c | 1 - include/linux/tty.h | 2 -- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 81bc0f0ff4e..24b18cbdd37 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -463,8 +463,6 @@ static void flush_to_ldisc(struct work_struct *work) int count; char *char_buf; unsigned char *flag_buf; - unsigned int left = 0; - unsigned int max_space; count = head->commit - head->read; if (!count) { @@ -475,32 +473,10 @@ static void flush_to_ldisc(struct work_struct *work) continue; } - /* update receive room */ - spin_lock(&tty->read_lock); - if (tty->update_room_in_ldisc) { - if ((tty->read_cnt == N_TTY_BUF_SIZE - 1) && - (tty->receive_room == - N_TTY_BUF_SIZE - 1)) - tty->rr_bug++; - left = N_TTY_BUF_SIZE - tty->read_cnt - 1; - } - spin_unlock(&tty->read_lock); - if (!tty->receive_room) break; - - if (tty->update_room_in_ldisc && !left) { - schedule_work(&tty->buf.work); - break; - } - - if (tty->update_room_in_ldisc) - max_space = min(left, tty->receive_room); - else - max_space = tty->receive_room; - - if (count > max_space) - count = max_space; + if (count > tty->receive_room) + count = tty->receive_room; char_buf = head->char_buf_ptr + head->read; flag_buf = head->flag_buf_ptr + head->read; head->read += count; diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index 1c8664cea13..ebe8c6e2491 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -516,7 +516,6 @@ int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port) /* explicitly set the driver mode to raw */ tty->raw = 1; tty->real_raw = 1; - tty->update_room_in_ldisc = 1; set_bit(TTY_NO_WRITE_SPLIT, &tty->flags); dbg("%s", __func__); diff --git a/include/linux/tty.h b/include/linux/tty.h index 6fcafa8fe38..6a0259d94c9 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -282,10 +282,8 @@ struct tty_struct { struct winsize winsize; /* termios mutex */ unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; unsigned char low_latency:1, warned:1; - unsigned char update_room_in_ldisc:1; unsigned char ctrl_status; /* ctrl_lock */ unsigned int receive_room; /* Bytes free for queue */ - unsigned int rr_bug; struct tty_struct *link; struct fasync_struct *fasync;