Skip to content

Commit

Permalink
TTY: switch tty_insert_flip_char
Browse files Browse the repository at this point in the history
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: Jiri Slaby <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Jiri Slaby authored and gregkh committed Jan 16, 2013
1 parent 2f69335 commit 92a19f9
Show file tree
Hide file tree
Showing 76 changed files with 297 additions and 286 deletions.
3 changes: 2 additions & 1 deletion arch/alpha/kernel/srmcons.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion arch/ia64/hp/sim/simserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions arch/mn10300/kernel/mn10300-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,14 +667,14 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
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) {
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/pdc_cons.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ++;
}

Expand Down
8 changes: 1 addition & 7 deletions arch/um/drivers/chan_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion arch/xtensa/platforms/iss/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/char/pcmcia/synclink_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 3 additions & 2 deletions drivers/ipack/devices/ipoctal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++;
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions drivers/isdn/i4l/isdn_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions drivers/isdn/i4l/isdn_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down Expand Up @@ -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;
}
}
Expand Down
5 changes: 3 additions & 2 deletions drivers/mmc/card/sdio_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,16 @@ 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,
* it doesn't affect the current character.
*/
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));
Expand Down
3 changes: 2 additions & 1 deletion drivers/s390/char/con3215.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions drivers/s390/char/keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
4 changes: 2 additions & 2 deletions drivers/s390/char/sclp_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/dgrp/dgrp_net_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -2957,7 +2957,7 @@ static void dgrp_receive(struct nd_struct *nd)
!(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);

}
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/fwserial/fwserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
13 changes: 6 additions & 7 deletions drivers/staging/serqt_usb2/serqt_usb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/amiserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 92a19f9

Please sign in to comment.