Commit 92a19f9c authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

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: 's avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2f693357
......@@ -46,13 +46,14 @@ typedef union _srmcons_result {
static int
srmcons_do_receive_chars(struct tty_struct *tty)
{
struct tty_port *port = tty->port;
srmcons_result result;
int count = 0, loops = 0;
do {
result.as_long = callback_getc(0);
if (result.bits.status < 2) {
tty_insert_flip_char(tty, (char)result.bits.c, 0);
tty_insert_flip_char(port, (char)result.bits.c, 0);
count++;
}
} while((result.bits.status & 1) && (++loops < 10));
......
......@@ -55,6 +55,7 @@ static struct console *console;
static void receive_chars(struct tty_struct *tty)
{
struct tty_port *port = tty->port;
unsigned char ch;
static unsigned char seen_esc = 0;
......@@ -81,7 +82,7 @@ static void receive_chars(struct tty_struct *tty)
}
seen_esc = 0;
if (tty_insert_flip_char(tty, ch, TTY_NORMAL) == 0)
if (tty_insert_flip_char(port, ch, TTY_NORMAL) == 0)
break;
}
tty_flip_buffer_push(tty);
......
......@@ -667,14 +667,14 @@ insert:
else
flag = TTY_NORMAL;
tty_insert_flip_char(tty, ch, flag);
tty_insert_flip_char(port, ch, flag);
}
/* overrun is special, since it's reported immediately, and doesn't
* affect the current character
*/
if (overrun)
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
tty_insert_flip_char(port, 0, TTY_OVERRUN);
count--;
if (count <= 0) {
......
......@@ -147,7 +147,7 @@ static void pdc_console_poll(unsigned long unused)
data = pdc_console_poll_key(NULL);
if (data == -1)
break;
tty_insert_flip_char(tty, data & 0xFF, TTY_NORMAL);
tty_insert_flip_char(&tty_port, data & 0xFF, TTY_NORMAL);
count ++;
}
......
......@@ -81,12 +81,6 @@ static const struct chan_ops not_configged_ops = {
};
#endif /* CONFIG_NOCONFIG_CHAN */
static void tty_receive_char(struct tty_struct *tty, char ch)
{
if (tty)
tty_insert_flip_char(tty, ch, TTY_NORMAL);
}
static int open_one_chan(struct chan *chan)
{
int fd, err;
......@@ -569,7 +563,7 @@ void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
}
err = chan->ops->read(chan->fd, &c, chan->data);
if (err > 0)
tty_receive_char(tty, c);
tty_insert_flip_char(port, c, TTY_NORMAL);
} while (err > 0);
if (err == 0)
......
......@@ -98,6 +98,7 @@ static int rs_write(struct tty_struct * tty,
static void rs_poll(unsigned long priv)
{
struct tty_struct* tty = (struct tty_struct*) priv;
struct tty_port *port = tty->port;
struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
int i = 0;
......@@ -107,7 +108,7 @@ static void rs_poll(unsigned long priv)
while (__simc(SYS_select_one, 0, XTISS_SELECT_ONE_READ, (int)&tv,0,0)){
__simc (SYS_read, 0, (unsigned long)&c, 1, 0, 0);
tty_insert_flip_char(tty, c, TTY_NORMAL);
tty_insert_flip_char(port, c, TTY_NORMAL);
i++;
}
......
......@@ -945,7 +945,7 @@ static void rx_ready_async(MGSLPC_INFO *info, int tcd, struct tty_struct *tty)
else if (status & BIT6)
flag = TTY_FRAME;
}
work += tty_insert_flip_char(tty, data, flag);
work += tty_insert_flip_char(port, data, flag);
}
issue_command(info, CHA, CMD_RXFIFO);
......
......@@ -136,6 +136,7 @@ static int ipoctal_get_icount(struct tty_struct *tty,
static void ipoctal_irq_rx(struct ipoctal_channel *channel,
struct tty_struct *tty, u8 sr)
{
struct tty_port *port = &channel->tty_port;
unsigned char value;
unsigned char flag = TTY_NORMAL;
u8 isr;
......@@ -149,7 +150,7 @@ static void ipoctal_irq_rx(struct ipoctal_channel *channel,
if (sr & SR_OVERRUN_ERROR) {
channel->stats.overrun_err++;
/* Overrun doesn't affect the current character*/
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
tty_insert_flip_char(port, 0, TTY_OVERRUN);
}
if (sr & SR_PARITY_ERROR) {
channel->stats.parity_err++;
......@@ -165,7 +166,7 @@ static void ipoctal_irq_rx(struct ipoctal_channel *channel,
flag = TTY_BREAK;
}
}
tty_insert_flip_char(tty, value, flag);
tty_insert_flip_char(port, value, flag);
/* Check if there are more characters in RX FIFO
* If there are more, the isr register for this channel
......
......@@ -913,7 +913,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
while ((count_pull < skb->len) && (len > 0)) {
/* push every character but the last to the tty buffer directly */
if (count_put)
tty_insert_flip_char(tty, last, TTY_NORMAL);
tty_insert_flip_char(port, last, TTY_NORMAL);
len--;
if (dev->drv[di]->DLEflag & DLEmask) {
last = DLE;
......@@ -953,16 +953,16 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
* Now we can dequeue it.
*/
if (cisco_hack)
tty_insert_flip_char(tty, last, 0xFF);
tty_insert_flip_char(port, last, 0xFF);
else
tty_insert_flip_char(tty, last, TTY_NORMAL);
tty_insert_flip_char(port, last, TTY_NORMAL);
#ifdef CONFIG_ISDN_AUDIO
ISDN_AUDIO_SKB_LOCK(skb) = 0;
#endif
skb = skb_dequeue(&dev->drv[di]->rpqueue[channel]);
dev_kfree_skb(skb);
} else {
tty_insert_flip_char(tty, last, TTY_NORMAL);
tty_insert_flip_char(port, last, TTY_NORMAL);
/* Not yet emptied this buff, so it
* must stay in the queue, for further calls
* but we pull off the data we got until now.
......
......@@ -92,11 +92,11 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
unsigned char *dp = skb->data;
while (--l) {
if (*dp == DLE)
tty_insert_flip_char(tty, DLE, 0);
tty_insert_flip_char(tty, *dp++, 0);
tty_insert_flip_char(port, DLE, 0);
tty_insert_flip_char(port, *dp++, 0);
}
if (*dp == DLE)
tty_insert_flip_char(tty, DLE, 0);
tty_insert_flip_char(port, DLE, 0);
last = *dp;
} else {
#endif
......@@ -107,9 +107,9 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
}
#endif
if (info->emu.mdmreg[REG_CPPP] & BIT_CPPP)
tty_insert_flip_char(tty, last, 0xFF);
tty_insert_flip_char(port, last, 0xFF);
else
tty_insert_flip_char(tty, last, TTY_NORMAL);
tty_insert_flip_char(port, last, TTY_NORMAL);
tty_flip_buffer_push(tty);
kfree_skb(skb);
......@@ -2287,7 +2287,7 @@ isdn_tty_at_cout(char *msg, modem_info *info)
if (skb) {
*sp++ = c;
} else {
if (tty_insert_flip_char(tty, c, TTY_NORMAL) == 0)
if (tty_insert_flip_char(port, c, TTY_NORMAL) == 0)
break;
}
}
......
......@@ -419,7 +419,7 @@ static void sdio_uart_receive_chars(struct sdio_uart_port *port,
if ((*status & port->ignore_status_mask & ~UART_LSR_OE) == 0)
if (tty)
tty_insert_flip_char(tty, ch, flag);
tty_insert_flip_char(&port->port, ch, flag);
/*
* Overrun is special. Since it's reported immediately,
......@@ -427,7 +427,8 @@ static void sdio_uart_receive_chars(struct sdio_uart_port *port,
*/
if (*status & ~port->ignore_status_mask & UART_LSR_OE)
if (tty)
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
tty_insert_flip_char(&port->port, 0,
TTY_OVERRUN);
*status = sdio_in(port, UART_LSR);
} while ((*status & UART_LSR_DR) && (max_count-- > 0));
......
......@@ -411,7 +411,8 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
break;
case CTRLCHAR_CTRL:
tty_insert_flip_char(tty, cchar, TTY_NORMAL);
tty_insert_flip_char(&raw->port, cchar,
TTY_NORMAL);
tty_flip_buffer_push(tty);
break;
......
......@@ -46,7 +46,7 @@ kbd_put_queue(struct tty_port *port, int ch)
struct tty_struct *tty = tty_port_tty_get(port);
if (!tty)
return;
tty_insert_flip_char(tty, ch, 0);
tty_insert_flip_char(port, ch, 0);
tty_schedule_flip(tty);
tty_kref_put(tty);
}
......@@ -58,7 +58,7 @@ kbd_puts_queue(struct tty_port *port, char *cp)
if (!tty)
return;
while (*cp)
tty_insert_flip_char(tty, *cp++, 0);
tty_insert_flip_char(port, *cp++, 0);
tty_schedule_flip(tty);
tty_kref_put(tty);
}
......@@ -342,7 +342,7 @@ sclp_tty_input(unsigned char* buf, unsigned int count)
case CTRLCHAR_SYSRQ:
break;
case CTRLCHAR_CTRL:
tty_insert_flip_char(tty, cchar, TTY_NORMAL);
tty_insert_flip_char(&sclp_port, cchar, TTY_NORMAL);
tty_flip_buffer_push(tty);
break;
case CTRLCHAR_NONE:
......@@ -352,7 +352,7 @@ sclp_tty_input(unsigned char* buf, unsigned int count)
strncmp((const char *) buf + count - 2, "\252n", 2))) {
/* add the auto \n */
tty_insert_flip_string(tty, buf, count);
tty_insert_flip_char(tty, '\n', TTY_NORMAL);
tty_insert_flip_char(&sclp_port, '\n', TTY_NORMAL);
} else
tty_insert_flip_string(tty, buf, count - 2);
tty_flip_buffer_push(tty);
......
......@@ -2957,7 +2957,7 @@ check_query:
!(I_IGNBRK(ch->ch_tun.un_tty))) {
tty_buffer_request_room(&ch->port, 1);
tty_insert_flip_char(ch->ch_tun.un_tty, 0, TTY_BREAK);
tty_insert_flip_char(&ch->port, 0, TTY_BREAK);
tty_flip_buffer_push(ch->ch_tun.un_tty);
}
......
......@@ -617,7 +617,7 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len)
lsr &= port->status_mask;
if (lsr & ~port->ignore_mask & UART_LSR_OE) {
if (!tty_insert_flip_char(tty, 0, TTY_OVERRUN)) {
if (!tty_insert_flip_char(&port->port, 0, TTY_OVERRUN)) {
err = -EIO;
goto out;
}
......
......@@ -255,12 +255,11 @@ static void ProcessModemStatus(struct quatech_port *qt_port,
wake_up_interruptible(&qt_port->wait);
}
static void ProcessRxChar(struct tty_struct *tty, struct usb_serial_port *port,
unsigned char data)
static void ProcessRxChar(struct usb_serial_port *port, unsigned char data)
{
struct urb *urb = port->read_urb;
if (urb->actual_length)
tty_insert_flip_char(tty, data, TTY_NORMAL);
tty_insert_flip_char(&port->port, data, TTY_NORMAL);
}
static void qt_write_bulk_callback(struct urb *urb)
......@@ -335,8 +334,8 @@ static void qt_status_change_check(struct tty_struct *tty,
case 0xff:
dev_dbg(&port->dev, "No status sequence.\n");
ProcessRxChar(tty, port, data[i]);
ProcessRxChar(tty, port, data[i + 1]);
ProcessRxChar(port, data[i]);
ProcessRxChar(port, data[i + 1]);
i += 2;
break;
......@@ -345,8 +344,8 @@ static void qt_status_change_check(struct tty_struct *tty,
continue;
}
if (tty && urb->actual_length)
tty_insert_flip_char(tty, data[i], TTY_NORMAL);
if (urb->actual_length)
tty_insert_flip_char(&port->port, data[i], TTY_NORMAL);
}
tty_flip_buffer_push(tty);
......
......@@ -328,9 +328,9 @@ static void receive_chars(struct serial_state *info)
oe = 1;
}
}
tty_insert_flip_char(tty, ch, flag);
tty_insert_flip_char(&info->tport, ch, flag);
if (oe == 1)
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
tty_insert_flip_char(&info->tport, 0, TTY_OVERRUN);
tty_flip_buffer_push(tty);
out:
return;
......
......@@ -492,34 +492,34 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
if (tty_buffer_request_room(port, 1)) {
if (data & info->read_status_mask) {
if (data & CyBREAK) {
tty_insert_flip_char(tty,
tty_insert_flip_char(port,
cyy_readb(info, CyRDSR),
TTY_BREAK);
info->icount.rx++;
if (port->flags & ASYNC_SAK)
do_SAK(tty);
} else if (data & CyFRAME) {
tty_insert_flip_char(tty,
tty_insert_flip_char(port,
cyy_readb(info, CyRDSR),
TTY_FRAME);
info->icount.rx++;
info->idle_stats.frame_errs++;
} else if (data & CyPARITY) {
/* Pieces of seven... */
tty_insert_flip_char(tty,
tty_insert_flip_char(port,
cyy_readb(info, CyRDSR),
TTY_PARITY);
info->icount.rx++;
info->idle_stats.parity_errs++;
} else if (data & CyOVERRUN) {
tty_insert_flip_char(tty, 0,
tty_insert_flip_char(port, 0,
TTY_OVERRUN);
info->icount.rx++;
/* If the flip buffer itself is
overflowing, we still lose
the next incoming character.
*/
tty_insert_flip_char(tty,
tty_insert_flip_char(port,
cyy_readb(info, CyRDSR),
TTY_FRAME);
info->icount.rx++;
......@@ -529,12 +529,12 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
/* } else if(data & CyTIMEOUT) { */
/* } else if(data & CySPECHAR) { */
} else {
tty_insert_flip_char(tty, 0,
tty_insert_flip_char(port, 0,
TTY_NORMAL);
info->icount.rx++;
}
} else {
tty_insert_flip_char(tty, 0, TTY_NORMAL);
tty_insert_flip_char(port, 0, TTY_NORMAL);
info->icount.rx++;
}
} else {
......@@ -557,7 +557,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
len = tty_buffer_request_room(port, char_count);
while (len--) {
data = cyy_readb(info, CyRDSR);
tty_insert_flip_char(tty, data, TTY_NORMAL);
tty_insert_flip_char(port, data, TTY_NORMAL);
info->idle_stats.recv_bytes++;
info->icount.rx++;
#ifdef CY_16Y_HACK
......@@ -992,7 +992,7 @@ static void cyz_handle_rx(struct cyclades_port *info, struct tty_struct *tty)
new_rx_get);
new_rx_get = (new_rx_get + 1) &
(rx_bufsize - 1);
tty_insert_flip_char(tty, data, TTY_NORMAL);
tty_insert_flip_char(port, data, TTY_NORMAL);
info->idle_stats.recv_bytes++;
info->icount.rx++;
}
......@@ -1117,17 +1117,17 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
switch (cmd) {
case C_CM_PR_ERROR:
tty_insert_flip_char(tty, 0, TTY_PARITY);
tty_insert_flip_char(&info->port, 0, TTY_PARITY);
info->icount.rx++;
special_count++;
break;
case C_CM_FR_ERROR:
tty_insert_flip_char(tty, 0, TTY_FRAME);
tty_insert_flip_char(&info->port, 0, TTY_FRAME);
info->icount.rx++;
special_count++;
break;
case C_CM_RXBRK:
tty_insert_flip_char(tty, 0, TTY_BREAK);
tty_insert_flip_char(&info->port, 0, TTY_BREAK);
info->icount.rx++;
special_count++;
break;
......
......@@ -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;
......
......@@ -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);
......
......@@ -634,7 +634,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
break;
case 1: /* Received Break !!! */
tty_insert_flip_char(tty, 0, TTY_BREAK);
tty_insert_flip_char(&port->port, 0, TTY_BREAK);
if (port->port.flags & ASYNC_SAK)
do_SAK(tty);
tty_flip_buffer_push(tty);
......@@ -658,7 +658,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
insw(base, rp, word_count);
byte_count -= (word_count << 1);
if (count & 0x0001) {
tty_insert_flip_char(tty, inw(base) & 0xff,
tty_insert_flip_char(&port->port, inw(base) & 0xff,
TTY_NORMAL);
byte_count -= 2;
}
......
......@@ -1429,7 +1429,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle,
goto put;
if (tty && (intr & IntrBreak) && !I_IGNBRK(tty)) { /* BREAK */
tty_insert_flip_char(tty, 0, TTY_BREAK);
tty_insert_flip_char(&p->port, 0, TTY_BREAK);
tty_schedule_flip(tty);
}
......
......@@ -2079,7 +2079,7 @@ static void mxser_receive_chars(struct tty_struct *tty,
}
while (gdl--) {
ch = inb(port->ioaddr + UART_RX);
tty_insert_flip_char(tty, ch, 0);
tty_insert_flip_char(&port->port, ch, 0);
cnt++;
}
goto end_intr;
......@@ -2118,7 +2118,7 @@ intr_old:
} else
flag = TTY_BREAK;
}
tty_insert_flip_char(tty, ch, flag);
tty_insert_flip_char(&port->port, ch, flag);
cnt++;
if (cnt >= recv_room) {
if (!port->ldisc_stop_rx)
......
......@@ -1070,9 +1070,9 @@ static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
if ((mlines & TIOCM_CD) == 0 && (dlci->modem_rx & TIOCM_CD))
if (!(tty->termios.c_cflag & CLOCAL))
tty_hangup(tty);
if (brk & 0x01)
tty_insert_flip_char(tty, 0, TTY_BREAK);
}
if (brk & 0x01)
tty_insert_flip_char(&dlci->port, 0, TTY_BREAK);
dlci->modem_rx = mlines;
}
......@@ -1140,6 +1140,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen)
static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen)
{
struct tty_port *port;
struct tty_struct *tty;
unsigned int addr = 0 ;
u8 bits;
......@@ -1163,16 +1164,19 @@ static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen)
bits = *dp;
if ((bits & 1) == 0)
return;
/* See if we have an uplink tty */
tty = tty_port_tty_get(&gsm->dlci[addr]->port);
port = &gsm->dlci[addr]->port;
if (bits & 2)
tty_insert_flip_char(port, 0, TTY_OVERRUN);
if (bits & 4)
tty_insert_flip_char(port, 0, TTY_PARITY);
if (bits & 8)
tty_insert_flip_char(port, 0, TTY_FRAME);
/* See if we have an uplink tty */
tty = tty_port_tty_get(port);
if (tty) {
if (bits & 2)
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
if (bits & 4)
tty_insert_flip_char(tty, 0, TTY_PARITY);
if (bits & 8)
tty_insert_flip_char(tty, 0, TTY_FRAME);
tty_flip_buffer_push(tty);
tty_kref_put(tty);
}
......
......@@ -855,7 +855,7 @@ static int receive_data(enum port_type index, struct nozomi *dc)
read_mem32((u32 *) buf, addr + offset, RECEIVE_BUF_MAX);
if (size == 1) {
tty_insert_flip_char(tty, buf[0], TTY_NORMAL);
tty_insert_flip_char(&port->port, buf[0], TTY_NORMAL);
size = 0;
} else if (size < RECEIVE_BUF_MAX) {
size -= tty_insert_flip_string(tty, (char *) buf, size);
......
......@@ -379,7 +379,8 @@ static void rp_do_receive(struct r_port *info,
flag = TTY_OVERRUN;
else
flag = TTY_NORMAL;
tty_insert_flip_char(tty, CharNStat & 0xff, flag);
tty_insert_flip_char(&info->port, CharNStat & 0xff,
flag);
ToRecv--;
}
......
......@@ -305,7 +305,7 @@ static void receive_chars(struct m68k_serial *info, struct tty_struct *tty,
else if (rx & URX_FRAME_ERROR)
flag = TTY_FRAME;
tty_insert_flip_char(tty, ch, flag);
tty_insert_flip_char(&info->tport, ch, flag);
#ifndef CONFIG_XCOPILOT_BUGS
} while((rx = uart->urx.w) & URX_DATA_READY);
#endif
......
......@@ -297,10 +297,11 @@ static void ar933x_uart_set_termios(struct uart_port *port,
static void ar933x_uart_rx_chars(struct ar933x_uart_port *up)
{
struct tty_port *port = &up->port.state->port;
struct tty_struct *tty;
int max_count = 256;
tty = tty_port_tty_get(&up->port.state->port);
tty = tty_port_tty_get(port);
do {
unsigned int rdata;
unsigned char ch;
......@@ -313,11 +314,6 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up)
ar933x_uart_write(up, AR933X_UART_DATA_REG,
AR933X_UART_DATA_RX_CSR);
if (!tty) {
/* discard the data if no tty available */
continue;
}
up->port.icount.rx++;
ch = rdata & AR933X_UART_DATA_TX_RX_MASK;
......@@ -325,7 +321,7 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up)
continue;
if ((up->port.ignore_status_mask & AR933X_DUMMY_STATUS_RD) == 0)
tty_insert_flip_char(tty, ch, TTY_NORMAL);
tty_insert_flip_char(port, ch, TTY_NORMAL);
} while (max_count-- > 0);
if (tty) {
......
......@@ -235,6 +235,7 @@ static const char *bcm_uart_type(struct uart_port *port)
*/
static void bcm_uart_do_rx(struct uart_port *port)
{
struct tty_port *port = &port->state->port;
struct tty_struct *tty;
unsigned int max_count;
......@@ -242,7 +243,7 @@ static void bcm_uart_do_rx(struct uart_port *port)
* higher than fifo size anyway since we're much faster than
* serial port */
max_count = 32;
tty = port->state->port.tty;
tty = port->tty;
do {
unsigned int iestat, c, cstat;
char flag;
......@@ -261,7 +262,7 @@ static void bcm_uart_do_rx(struct uart_port *port)
bcm_uart_writel(port, val, UART_CTL_REG);
port->icount.overrun++;
tty_insert_flip_char(tty, 0, TTY_OVERRUN);