From 227434f8986c3827a1faedd1feb437acd6285315 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 3 Jan 2013 15:53:01 +0100 Subject: TTY: switch tty_buffer_request_room to tty_port Now, we start converting tty buffer functions to actually use tty_port. This will allow us to get rid of the need of tty pointer in many call sites. Only tty_port will be needed and hence no more tty_port_tty_get calls in those paths. Here we start with tty_buffer_request_room. Signed-off-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- arch/mn10300/kernel/mn10300-serial.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'arch/mn10300') diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c index 81d5cb9b6569..9b2232a78ff9 100644 --- a/arch/mn10300/kernel/mn10300-serial.c +++ b/arch/mn10300/kernel/mn10300-serial.c @@ -524,7 +524,8 @@ static int mask_test_and_clear(volatile u8 *ptr, u8 mask) static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) { struct uart_icount *icount = &port->uart.icount; - struct tty_struct *tty = port->uart.state->port.tty; + struct tty_port *port = &port->uart.state->port; + struct tty_struct *tty = port->tty; unsigned ix; int count; u8 st, ch, push, status, overrun; @@ -534,7 +535,7 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) push = 0; count = CIRC_CNT(port->rx_inp, port->rx_outp, MNSC_BUFFER_SIZE); - count = tty_buffer_request_room(tty, count); + count = tty_buffer_request_room(port, count); if (count == 0) { if (!tty->low_latency) tty_flip_buffer_push(tty); -- cgit v1.2.3 From 92a19f9cec9a80ad93c06e115822deb729e2c6ad Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 3 Jan 2013 15:53:03 +0100 Subject: 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: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- arch/mn10300/kernel/mn10300-serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/mn10300') diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c index 9b2232a78ff9..54ef40ceaaed 100644 --- a/arch/mn10300/kernel/mn10300-serial.c +++ b/arch/mn10300/kernel/mn10300-serial.c @@ -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) { -- cgit v1.2.3 From d6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 3 Jan 2013 15:53:05 +0100 Subject: TTY: move low_latency to tty_port One point is to have less places where we actually need tty pointer. The other is that low_latency is bound to buffer processing and buffers are now in tty_port. So it makes sense to move low_latency to tty_port too. Signed-off-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- arch/mn10300/kernel/mn10300-serial.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'arch/mn10300') diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c index 54ef40ceaaed..ae61bd692b4b 100644 --- a/arch/mn10300/kernel/mn10300-serial.c +++ b/arch/mn10300/kernel/mn10300-serial.c @@ -537,7 +537,7 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) count = CIRC_CNT(port->rx_inp, port->rx_outp, MNSC_BUFFER_SIZE); count = tty_buffer_request_room(port, count); if (count == 0) { - if (!tty->low_latency) + if (!port->low_latency) tty_flip_buffer_push(tty); return; } @@ -546,7 +546,7 @@ try_again: /* pull chars out of the hat */ ix = ACCESS_ONCE(port->rx_outp); if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) { - if (push && !tty->low_latency) + if (push && !port->low_latency) tty_flip_buffer_push(tty); return; } @@ -678,7 +678,7 @@ insert: count--; if (count <= 0) { - if (!tty->low_latency) + if (!port->low_latency) tty_flip_buffer_push(tty); return; } -- cgit v1.2.3 From 2e124b4a390ca85325fae75764bef92f0547fa25 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 3 Jan 2013 15:53:06 +0100 Subject: TTY: switch tty_flip_buffer_push 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. Now, the one where most of tty_port_tty_get gets removed: tty_flip_buffer_push. IOW we also closed all the races in drivers not using tty_port_tty_get at all yet. Also we move tty_flip_buffer_push declaration from include/linux/tty.h to include/linux/tty_flip.h to all others while we are changing it anyway. Signed-off-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- arch/mn10300/kernel/mn10300-serial.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'arch/mn10300') diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c index ae61bd692b4b..1dd20dbfd098 100644 --- a/arch/mn10300/kernel/mn10300-serial.c +++ b/arch/mn10300/kernel/mn10300-serial.c @@ -525,7 +525,6 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) { struct uart_icount *icount = &port->uart.icount; struct tty_port *port = &port->uart.state->port; - struct tty_struct *tty = port->tty; unsigned ix; int count; u8 st, ch, push, status, overrun; @@ -538,7 +537,7 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) count = tty_buffer_request_room(port, count); if (count == 0) { if (!port->low_latency) - tty_flip_buffer_push(tty); + tty_flip_buffer_push(port); return; } @@ -547,7 +546,7 @@ try_again: ix = ACCESS_ONCE(port->rx_outp); if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) { if (push && !port->low_latency) - tty_flip_buffer_push(tty); + tty_flip_buffer_push(port); return; } @@ -679,7 +678,7 @@ insert: count--; if (count <= 0) { if (!port->low_latency) - tty_flip_buffer_push(tty); + tty_flip_buffer_push(port); return; } -- cgit v1.2.3 From 59c5f92427efa2bcf2a1ff6566027a5876d5dfa7 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 16 Jan 2013 14:45:07 +0100 Subject: TTY: mn10300-serial, fix build breakage By the recent `switch flipping' patches we introduced a build failure in the driver: mn10300-serial.c:527:19: error: 'port' redeclared as different kind of symbol I did not notice because I did not even find a compiler for that new architecture. Hopefully everything is all right now as I cannot test it. Signed-off-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- arch/mn10300/kernel/mn10300-serial.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'arch/mn10300') diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c index 1dd20dbfd098..bf6e949a2f87 100644 --- a/arch/mn10300/kernel/mn10300-serial.c +++ b/arch/mn10300/kernel/mn10300-serial.c @@ -524,7 +524,7 @@ static int mask_test_and_clear(volatile u8 *ptr, u8 mask) static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) { struct uart_icount *icount = &port->uart.icount; - struct tty_port *port = &port->uart.state->port; + struct tty_port *tport = &port->uart.state->port; unsigned ix; int count; u8 st, ch, push, status, overrun; @@ -534,10 +534,10 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) push = 0; count = CIRC_CNT(port->rx_inp, port->rx_outp, MNSC_BUFFER_SIZE); - count = tty_buffer_request_room(port, count); + count = tty_buffer_request_room(tport, count); if (count == 0) { - if (!port->low_latency) - tty_flip_buffer_push(port); + if (!tport->low_latency) + tty_flip_buffer_push(tport); return; } @@ -545,8 +545,8 @@ try_again: /* pull chars out of the hat */ ix = ACCESS_ONCE(port->rx_outp); if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) { - if (push && !port->low_latency) - tty_flip_buffer_push(port); + if (push && !tport->low_latency) + tty_flip_buffer_push(tport); return; } @@ -666,19 +666,19 @@ insert: else flag = TTY_NORMAL; - tty_insert_flip_char(port, ch, flag); + tty_insert_flip_char(tport, ch, flag); } /* overrun is special, since it's reported immediately, and doesn't * affect the current character */ if (overrun) - tty_insert_flip_char(port, 0, TTY_OVERRUN); + tty_insert_flip_char(tport, 0, TTY_OVERRUN); count--; if (count <= 0) { - if (!port->low_latency) - tty_flip_buffer_push(port); + if (!tport->low_latency) + tty_flip_buffer_push(tport); return; } -- cgit v1.2.3