Skip to content

Commit

Permalink
TTY: switch tty_insert_flip_string
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_string this time.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Jan 16, 2013
1 parent 92a19f9 commit 05c7cd3
Show file tree
Hide file tree
Showing 62 changed files with 130 additions and 127 deletions.
2 changes: 1 addition & 1 deletion drivers/isdn/gigaset/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ void gigaset_if_receive(struct cardstate *cs,
return;
}

tty_insert_flip_string(tty, buffer, len);
tty_insert_flip_string(&cs->port, buffer, len);
tty_flip_buffer_push(tty);
tty_kref_put(tty);
}
Expand Down
5 changes: 2 additions & 3 deletions drivers/isdn/i4l/isdn_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,8 @@ isdn_readbchan(int di, int channel, u_char *buf, u_char *fp, int len, wait_queue
* of the mapping (di,ch)<->minor, happen during the sleep? --he
*/
int
isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
isdn_readbchan_tty(int di, int channel, struct tty_port *port, int cisco_hack)
{
struct tty_port *port = tty->port;
int count;
int count_pull;
int count_put;
Expand Down Expand Up @@ -941,7 +940,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
}
count_put = count_pull;
if (count_put > 1)
tty_insert_flip_string(tty, skb->data, count_put - 1);
tty_insert_flip_string(port, skb->data, count_put - 1);
last = skb->data[count_put - 1];
len -= count_put;
#ifdef CONFIG_ISDN_AUDIO
Expand Down
2 changes: 1 addition & 1 deletion drivers/isdn/i4l/isdn_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern void isdn_timer_ctrl(int tf, int onoff);
extern void isdn_unexclusive_channel(int di, int ch);
extern int isdn_getnum(char **);
extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *);
extern int isdn_readbchan_tty(int, int, struct tty_struct *, int);
extern int isdn_readbchan_tty(int, int, struct tty_port *, int);
extern int isdn_get_free_channel(int, int, int, int, int, char *);
extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *);
extern int register_isdn(isdn_if *i);
Expand Down
6 changes: 3 additions & 3 deletions drivers/isdn/i4l/isdn_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
} else {
#endif
if (len > 1)
tty_insert_flip_string(tty, skb->data, len - 1);
tty_insert_flip_string(port, skb->data, len - 1);
last = skb->data[len - 1];
#ifdef CONFIG_ISDN_AUDIO
}
Expand Down Expand Up @@ -150,9 +150,9 @@ isdn_tty_readmodem(void)
if (info->mcr & UART_MCR_RTS) {
/* CISCO AsyncPPP Hack */
if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP))
r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, tty, 0);
r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, &info->port, 0);
else
r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, tty, 1);
r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, &info->port, 1);
if (r)
tty_flip_buffer_push(tty);
} else
Expand Down
7 changes: 3 additions & 4 deletions drivers/net/usb/hso.c
Original file line number Diff line number Diff line change
Expand Up @@ -2044,10 +2044,9 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
tty_kref_put(tty);
return -1;
}
curr_write_len = tty_insert_flip_string
(tty, urb->transfer_buffer +
serial->curr_rx_urb_offset,
write_length_remaining);
curr_write_len = tty_insert_flip_string(&serial->port,
urb->transfer_buffer + serial->curr_rx_urb_offset,
write_length_remaining);
serial->curr_rx_urb_offset += curr_write_len;
write_length_remaining -= curr_write_len;
tty_flip_buffer_push(tty);
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 @@ -425,7 +425,8 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
count++;
} else
count -= 2;
tty_insert_flip_string(tty, raw->inbuf, count);
tty_insert_flip_string(&raw->port, raw->inbuf,
count);
tty_flip_buffer_push(tty);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/s390/char/sclp_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@ sclp_tty_input(unsigned char* buf, unsigned int count)
(strncmp((const char *) buf + count - 2, "^n", 2) &&
strncmp((const char *) buf + count - 2, "\252n", 2))) {
/* add the auto \n */
tty_insert_flip_string(tty, buf, count);
tty_insert_flip_string(&sclp_port, buf, count);
tty_insert_flip_char(&sclp_port, '\n', TTY_NORMAL);
} else
tty_insert_flip_string(tty, buf, count - 2);
tty_insert_flip_string(&sclp_port, buf, count - 2);
tty_flip_buffer_push(tty);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/char/sclp_vt220.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ sclp_vt220_receiver_fn(struct evbuf_header *evbuf)
/* Send input to line discipline */
buffer++;
count--;
tty_insert_flip_string(tty, buffer, count);
tty_insert_flip_string(&sclp_vt220_port, buffer, count);
tty_flip_buffer_push(tty);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/ccg/u_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static void gs_rx_push(unsigned long _port)
size -= n;
}

count = tty_insert_flip_string(tty, packet, size);
count = tty_insert_flip_string(&port->port, packet, size);
if (count)
do_push = true;
if (count != size) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/bfin_jtag_comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bfin_jc_emudat_manager(void *arg)
size_t num_chars = (4 <= inbound_len ? 4 : inbound_len);
pr_debug(" incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars);
inbound_len -= num_chars;
tty_insert_flip_string(tty, (unsigned char *)&emudat, num_chars);
tty_insert_flip_string(&port, (unsigned char *)&emudat, num_chars);
tty_flip_buffer_push(tty);
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/ehv_bytechan.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ static irqreturn_t ehv_bc_tty_rx_isr(int irq, void *data)
*/

/* Pass the received data to the tty layer. */
ret = tty_insert_flip_string(ttys, buffer, len);
ret = tty_insert_flip_string(&bc->port, buffer, len);

/* 'ret' is the number of bytes that the TTY layer accepted.
* If it's not equal to 'len', then it means the buffer is
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/hvc/hvcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ static int hvcs_io(struct hvcs_struct *hvcsd)
got = hvc_get_chars(unit_address,
&buf[0],
HVCS_BUFF_LEN);
tty_insert_flip_string(tty, buf, got);
tty_insert_flip_string(&hvcsd->port, buf, got);
}

/* Give the TTY time to process the data we just sent. */
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/ipwireless/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data,
}
mutex_unlock(&tty->ipw_tty_mutex);

work = tty_insert_flip_string(linux_tty, data, length);
work = tty_insert_flip_string(&tty->port, data, length);

if (work != length)
printk(KERN_DEBUG IPWIRELESS_PCCARD_NAME
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/n_gsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int clen)
/* Line state will go via DLCI 0 controls only */
case 1:
default:
tty_insert_flip_string(tty, data, len);
tty_insert_flip_string(port, data, len);
tty_flip_buffer_push(tty);
}
tty_kref_put(tty);
Expand Down
14 changes: 5 additions & 9 deletions drivers/tty/nozomi.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,15 +827,10 @@ static int receive_data(enum port_type index, struct nozomi *dc)
struct tty_struct *tty = tty_port_tty_get(&port->port);
int i, ret;

if (unlikely(!tty)) {
DBG1("tty not open for port: %d?", index);
return 1;
}

read_mem32((u32 *) &size, addr, 4);
/* DBG1( "%d bytes port: %d", size, index); */

if (test_bit(TTY_THROTTLED, &tty->flags)) {
if (tty && test_bit(TTY_THROTTLED, &tty->flags)) {
DBG1("No room in tty, don't read data, don't ack interrupt, "
"disable interrupt");

Expand All @@ -858,10 +853,11 @@ static int receive_data(enum port_type index, struct nozomi *dc)
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);
size -= tty_insert_flip_string(&port->port,
(char *)buf, size);
} else {
i = tty_insert_flip_string(tty, \
(char *) buf, RECEIVE_BUF_MAX);
i = tty_insert_flip_string(&port->port,
(char *)buf, RECEIVE_BUF_MAX);
size -= i;
offset += i;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)

if (c > 0) {
/* Stuff the data into the input queue of the other end */
c = tty_insert_flip_string(to, buf, c);
c = tty_insert_flip_string(to->port, buf, c);
/* And shovel */
if (c) {
tty_flip_buffer_push(to);
Expand Down
6 changes: 3 additions & 3 deletions drivers/tty/serial/amba-pl011.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,8 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap,
u32 pending, bool use_buf_b,
bool readfifo)
{
struct tty_struct *tty = uap->port.state->port.tty;
struct tty_port *port = &uap->port.state->port;
struct tty_struct *tty = port->tty;
struct pl011_sgbuf *sgbuf = use_buf_b ?
&uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a;
struct device *dev = uap->dmarx.chan->device->dev;
Expand All @@ -715,8 +716,7 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap,
* Note that tty_insert_flip_buf() tries to take as many chars
* as it can.
*/
dma_count = tty_insert_flip_string(uap->port.state->port.tty,
sgbuf->buf, pending);
dma_count = tty_insert_flip_string(port, sgbuf->buf, pending);

/* Return buffer to device */
dma_sync_sg_for_device(dev, &sgbuf->sg, 1, DMA_FROM_DEVICE);
Expand Down
6 changes: 4 additions & 2 deletions drivers/tty/serial/atmel_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,8 @@ static void atmel_rx_from_ring(struct uart_port *port)
static void atmel_rx_from_dma(struct uart_port *port)
{
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
struct tty_struct *tty = port->state->port.tty;
struct tty_port *tport = &port->state->port;
struct tty_struct *tty = tport->tty;
struct atmel_dma_buffer *pdc;
int rx_idx = atmel_port->pdc_rx_idx;
unsigned int head;
Expand Down Expand Up @@ -820,7 +821,8 @@ static void atmel_rx_from_dma(struct uart_port *port)
*/
count = head - tail;

tty_insert_flip_string(tty, pdc->buf + pdc->ofs, count);
tty_insert_flip_string(tport, pdc->buf + pdc->ofs,
count);

dma_sync_single_for_device(port->dev, pdc->dma_addr,
pdc->dma_size, DMA_FROM_DEVICE);
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/crisv10.c
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ static void flush_to_flip_buffer(struct e100_serial *info)
while ((buffer = info->first_recv_buffer) != NULL) {
unsigned int count = buffer->length;

tty_insert_flip_string(tty, buffer->buffer, count);
tty_insert_flip_string(&info->port, buffer->buffer, count);
info->recv_cnt -= count;

if (count == buffer->length) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/icom.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port)
/* Block copy all but the last byte as this may have status */
if (count > 0) {
first = icom_port->recv_buf[offset];
tty_insert_flip_string(tty, icom_port->recv_buf + offset, count - 1);
tty_insert_flip_string(port, icom_port->recv_buf + offset, count - 1);
}

icount = &icom_port->uart_port.icount;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/ifx6x60.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev,
struct tty_struct *tty = tty_port_tty_get(&ifx_dev->tty_port);
if (!tty)
return;
tty_insert_flip_string(tty, chars, size);
tty_insert_flip_string(&ifx_dev->tty_port, chars, size);
tty_flip_buffer_push(tty);
tty_kref_put(tty);
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/tty/serial/ioc3_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,8 @@ static int receive_chars(struct uart_port *the_port)
read_count = do_read(the_port, ch, MAX_CHARS);
if (read_count > 0) {
flip = 1;
read_room = tty_insert_flip_string(tty, ch, read_count);
read_room = tty_insert_flip_string(&state->port, ch,
read_count);
the_port->icount.rx += read_count;
}
spin_unlock_irqrestore(&the_port->lock, pflags);
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/ioc4_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -2362,7 +2362,7 @@ static void receive_chars(struct uart_port *the_port)
icount = &the_port->icount;
read_count = do_read(the_port, ch, request_count);
if (read_count > 0) {
tty_insert_flip_string(tty, ch, read_count);
tty_insert_flip_string(&state->port, ch, read_count);
icount->rx += read_count;
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/jsm/jsm_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ void jsm_input(struct jsm_channel *ch)
tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_NORMAL);
}
} else {
tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ;
tty_insert_flip_string(port, ch->ch_rqueue + tail, s);
}
tail += s;
n -= s;
Expand Down
5 changes: 3 additions & 2 deletions drivers/tty/serial/mfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
struct hsu_dma_buffer *dbuf = &up->rxbuf;
struct hsu_dma_chan *chan = up->rxc;
struct uart_port *port = &up->port;
struct tty_struct *tty = port->state->port.tty;
struct tty_port *tport = &port->state->port;
struct tty_struct *tty = tport->tty;
int count;

if (!tty)
Expand Down Expand Up @@ -423,7 +424,7 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
* explicitly set tail to 0. So head will
* always be greater than tail.
*/
tty_insert_flip_string(tty, dbuf->buf, count);
tty_insert_flip_string(tport, dbuf->buf, count);
port->icount.rx += count;

dma_sync_single_for_device(up->port.dev, dbuf->dma_addr,
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/mrst_max3110.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
for (r = 0; w; r += usable, w -= usable) {
usable = tty_buffer_request_room(tport, w);
if (usable) {
tty_insert_flip_string(tty, buf + r, usable);
tty_insert_flip_string(tport, buf + r, usable);
port->icount.rx += usable;
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/msm_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr)
port->icount.frame++;

/* TODO: handle sysrq */
tty_insert_flip_string(tty, (char *) &c,
tty_insert_flip_string(tport, (char *)&c,
(count > 4) ? 4 : count);
count -= 4;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/msm_serial_hs.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr,
rx_count = msm_hs_read(uport, UARTDM_RX_TOTAL_SNAP_ADDR);

if (0 != (uport->read_status_mask & CREAD)) {
retval = tty_insert_flip_string(tty, msm_uport->rx.buffer,
retval = tty_insert_flip_string(port, msm_uport->rx.buffer,
rx_count);
BUG_ON(retval != rx_count);
}
Expand Down
5 changes: 3 additions & 2 deletions drivers/tty/serial/mxs-auart.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ static int mxs_auart_dma_prep_rx(struct mxs_auart_port *s);
static void dma_rx_callback(void *arg)
{
struct mxs_auart_port *s = (struct mxs_auart_port *) arg;
struct tty_struct *tty = s->port.state->port.tty;
struct tty_port *port = &s->port.state->port;
struct tty_struct *tty = port->tty;
int count;
u32 stat;

Expand All @@ -468,7 +469,7 @@ static void dma_rx_callback(void *arg)
AUART_STAT_PERR | AUART_STAT_FERR);

count = stat & AUART_STAT_RXCOUNT_MASK;
tty_insert_flip_string(tty, s->rx_dma_buf, count);
tty_insert_flip_string(port, s->rx_dma_buf, count);

writel(stat, s->port.membase + AUART_STAT);
tty_flip_buffer_push(tty);
Expand Down
10 changes: 5 additions & 5 deletions drivers/tty/serial/pch_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,17 +591,17 @@ static void pch_uart_hal_set_break(struct eg20t_port *priv, int on)
static int push_rx(struct eg20t_port *priv, const unsigned char *buf,
int size)
{
struct uart_port *port;
struct uart_port *port = &priv->port;
struct tty_port *tport = &port->state->port;
struct tty_struct *tty;

port = &priv->port;
tty = tty_port_tty_get(&port->state->port);
tty = tty_port_tty_get(tport);
if (!tty) {
dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
return -EBUSY;
}

tty_insert_flip_string(tty, buf, size);
tty_insert_flip_string(tport, buf, size);
tty_flip_buffer_push(tty);
tty_kref_put(tty);

Expand Down Expand Up @@ -646,7 +646,7 @@ static int dma_push_rx(struct eg20t_port *priv, int size)
if (!room)
return room;

tty_insert_flip_string(tty, sg_virt(&priv->sg_rx), size);
tty_insert_flip_string(tport, sg_virt(&priv->sg_rx), size);

port->icount.rx += room;
tty_kref_put(tty);
Expand Down
Loading

0 comments on commit 05c7cd3

Please sign in to comment.