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/ia64/hp/sim/simserial.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/ia64/hp') diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index fc3924d18c1f..f8ae5d8eb106 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c @@ -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); -- cgit 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/ia64/hp/sim/simserial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/ia64/hp') diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index f8ae5d8eb106..942022a5bc86 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c @@ -436,7 +436,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) struct tty_port *port = &info->port; tty->driver_data = info; - tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; + port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; /* * figure out which console to use (should be one already) -- cgit 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/ia64/hp/sim/simserial.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'arch/ia64/hp') diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 942022a5bc86..da2f319fb71d 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c @@ -53,9 +53,8 @@ struct tty_driver *hp_simserial_driver; static struct console *console; -static void receive_chars(struct tty_struct *tty) +static void receive_chars(struct tty_port *port) { - struct tty_port *port = tty->port; unsigned char ch; static unsigned char seen_esc = 0; @@ -85,7 +84,7 @@ static void receive_chars(struct tty_struct *tty) if (tty_insert_flip_char(port, ch, TTY_NORMAL) == 0) break; } - tty_flip_buffer_push(tty); + tty_flip_buffer_push(port); } /* @@ -94,18 +93,9 @@ static void receive_chars(struct tty_struct *tty) static irqreturn_t rs_interrupt_single(int irq, void *dev_id) { struct serial_state *info = dev_id; - struct tty_struct *tty = tty_port_tty_get(&info->port); - if (!tty) { - printk(KERN_INFO "%s: tty=0 problem\n", __func__); - return IRQ_NONE; - } - /* - * pretty simple in our case, because we only get interrupts - * on inbound traffic - */ - receive_chars(tty); - tty_kref_put(tty); + receive_chars(&info->port); + return IRQ_HANDLED; } -- cgit From 4f73bc4dd3e8563ef4109f293a092820dff66d92 Mon Sep 17 00:00:00 2001 From: Joe Millenbach Date: Thu, 17 Jan 2013 22:44:22 -0800 Subject: tty: Added a CONFIG_TTY option to allow removal of TTY The option allows you to remove TTY and compile without errors. This saves space on systems that won't support TTY interfaces anyway. bloat-o-meter output is below. The bulk of this patch consists of Kconfig changes adding "depends on TTY" to various serial devices and similar drivers that require the TTY layer. Ideally, these dependencies would occur on a common intermediate symbol such as SERIO, but most drivers "select SERIO" rather than "depends on SERIO", and "select" does not respect dependencies. bloat-o-meter output comparing our previous minimal to new minimal by removing TTY. The list is filtered to not show removed entries with awk '$3 != "-"' as the list was very long. add/remove: 0/226 grow/shrink: 2/14 up/down: 6/-35356 (-35350) function old new delta chr_dev_init 166 170 +4 allow_signal 80 82 +2 static.__warned 143 142 -1 disallow_signal 63 62 -1 __set_special_pids 95 94 -1 unregister_console 126 121 -5 start_kernel 546 541 -5 register_console 593 588 -5 copy_from_user 45 40 -5 sys_setsid 128 120 -8 sys_vhangup 32 19 -13 do_exit 1543 1526 -17 bitmap_zero 60 40 -20 arch_local_irq_save 137 117 -20 release_task 674 652 -22 static.spin_unlock_irqrestore 308 260 -48 Signed-off-by: Joe Millenbach Reviewed-by: Jamey Sharp Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- arch/ia64/hp/sim/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/ia64/hp') diff --git a/arch/ia64/hp/sim/Kconfig b/arch/ia64/hp/sim/Kconfig index 8d513a8c5266..d84707d55203 100644 --- a/arch/ia64/hp/sim/Kconfig +++ b/arch/ia64/hp/sim/Kconfig @@ -8,6 +8,7 @@ config HP_SIMETH config HP_SIMSERIAL bool "Simulated serial driver support" + depends on TTY config HP_SIMSERIAL_CONSOLE bool "Console for HP simulator" -- cgit