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 +++-- arch/um/drivers/chan_kern.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'arch') 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); diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index e9a0abc6a32f..4ff2503a1bb8 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c @@ -554,6 +554,7 @@ int parse_chan_pair(char *str, struct line *line, int device, void chan_interrupt(struct line *line, struct tty_struct *tty, int irq) { + struct tty_port *port = &line->port; struct chan *chan = line->chan_in; int err; char c; @@ -562,7 +563,7 @@ void chan_interrupt(struct line *line, struct tty_struct *tty, int irq) goto out; do { - if (tty && !tty_buffer_request_room(tty, 1)) { + if (!tty_buffer_request_room(port, 1)) { schedule_delayed_work(&line->task, 1); goto out; } -- cgit 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/alpha/kernel/srmcons.c | 3 ++- arch/ia64/hp/sim/simserial.c | 3 ++- arch/mn10300/kernel/mn10300-serial.c | 4 ++-- arch/parisc/kernel/pdc_cons.c | 2 +- arch/um/drivers/chan_kern.c | 8 +------- arch/xtensa/platforms/iss/console.c | 3 ++- 6 files changed, 10 insertions(+), 13 deletions(-) (limited to 'arch') diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c index 59b7bbad8394..21b57a66e809 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c @@ -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)); 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); 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) { diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index efc5e7d30530..4d92a379eb21 100644 --- a/arch/parisc/kernel/pdc_cons.c +++ b/arch/parisc/kernel/pdc_cons.c @@ -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 ++; } diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 4ff2503a1bb8..795bd8102205 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c @@ -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) diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c index 8207a119eee9..62447d63890c 100644 --- a/arch/xtensa/platforms/iss/console.c +++ b/arch/xtensa/platforms/iss/console.c @@ -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++; } -- 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 +- arch/mn10300/kernel/mn10300-serial.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'arch') 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) 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 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 ++++-------------- arch/mn10300/kernel/mn10300-serial.c | 7 +++---- arch/parisc/kernel/pdc_cons.c | 8 +------- arch/um/drivers/chan.h | 3 +-- arch/um/drivers/chan_kern.c | 14 +++++++------- arch/um/drivers/line.c | 7 +++---- arch/xtensa/platforms/iss/console.c | 9 ++++----- 7 files changed, 23 insertions(+), 43 deletions(-) (limited to 'arch') 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; } 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; } diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index 4d92a379eb21..d5cae55195ec 100644 --- a/arch/parisc/kernel/pdc_cons.c +++ b/arch/parisc/kernel/pdc_cons.c @@ -138,10 +138,6 @@ static const struct tty_operations pdc_console_tty_ops = { static void pdc_console_poll(unsigned long unused) { int data, count = 0; - struct tty_struct *tty = tty_port_tty_get(&tty_port); - - if (!tty) - return; while (1) { data = pdc_console_poll_key(NULL); @@ -152,9 +148,7 @@ static void pdc_console_poll(unsigned long unused) } if (count) - tty_flip_buffer_push(tty); - - tty_kref_put(tty); + tty_flip_buffer_push(&tty_port); if (pdc_cons.flags & CON_ENABLED) mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY); diff --git a/arch/um/drivers/chan.h b/arch/um/drivers/chan.h index 02b5a76e98d9..78f1b8999964 100644 --- a/arch/um/drivers/chan.h +++ b/arch/um/drivers/chan.h @@ -27,8 +27,7 @@ struct chan { void *data; }; -extern void chan_interrupt(struct line *line, - struct tty_struct *tty, int irq); +extern void chan_interrupt(struct line *line, int irq); extern int parse_chan_pair(char *str, struct line *line, int device, const struct chan_opts *opts, char **error_out); extern int write_chan(struct chan *chan, const char *buf, int len, diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 795bd8102205..15c553c239a1 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c @@ -131,11 +131,9 @@ void chan_enable_winch(struct chan *chan, struct tty_struct *tty) static void line_timer_cb(struct work_struct *work) { struct line *line = container_of(work, struct line, task.work); - struct tty_struct *tty = tty_port_tty_get(&line->port); if (!line->throttled) - chan_interrupt(line, tty, line->driver->read_irq); - tty_kref_put(tty); + chan_interrupt(line, line->driver->read_irq); } int enable_chan(struct line *line) @@ -546,7 +544,7 @@ int parse_chan_pair(char *str, struct line *line, int device, return 0; } -void chan_interrupt(struct line *line, struct tty_struct *tty, int irq) +void chan_interrupt(struct line *line, int irq) { struct tty_port *port = &line->port; struct chan *chan = line->chan_in; @@ -570,8 +568,11 @@ void chan_interrupt(struct line *line, struct tty_struct *tty, int irq) reactivate_fd(chan->fd, irq); if (err == -EIO) { if (chan->primary) { - if (tty != NULL) + struct tty_struct *tty = tty_port_tty_get(&line->port); + if (tty != NULL) { tty_hangup(tty); + tty_kref_put(tty); + } if (line->chan_out != chan) close_one_chan(line->chan_out, 1); } @@ -580,6 +581,5 @@ void chan_interrupt(struct line *line, struct tty_struct *tty, int irq) return; } out: - if (tty) - tty_flip_buffer_push(tty); + tty_flip_buffer_push(port); } diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 9ffc28bd4b7a..f1b38571f94e 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -19,11 +19,10 @@ static irqreturn_t line_interrupt(int irq, void *data) { struct chan *chan = data; struct line *line = chan->line; - struct tty_struct *tty = tty_port_tty_get(&line->port); if (line) - chan_interrupt(line, tty, irq); - tty_kref_put(tty); + chan_interrupt(line, irq); + return IRQ_HANDLED; } @@ -234,7 +233,7 @@ void line_unthrottle(struct tty_struct *tty) struct line *line = tty->driver_data; line->throttled = 0; - chan_interrupt(line, tty, line->driver->read_irq); + chan_interrupt(line, line->driver->read_irq); /* * Maybe there is enough stuff pending that calling the interrupt diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c index 62447d63890c..da9866f7fecf 100644 --- a/arch/xtensa/platforms/iss/console.c +++ b/arch/xtensa/platforms/iss/console.c @@ -58,7 +58,8 @@ static int rs_open(struct tty_struct *tty, struct file * filp) tty->port = &serial_port; spin_lock(&timer_lock); if (tty->count == 1) { - setup_timer(&serial_timer, rs_poll, (unsigned long)tty); + setup_timer(&serial_timer, rs_poll, + (unsigned long)&serial_port); mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); } spin_unlock(&timer_lock); @@ -97,9 +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 tty_port *port = (struct tty_port *)priv; struct timeval tv = { .tv_sec = 0, .tv_usec = 0 }; int i = 0; unsigned char c; @@ -113,7 +112,7 @@ static void rs_poll(unsigned long priv) } if (i) - tty_flip_buffer_push(tty); + tty_flip_buffer_push(port); mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); -- cgit From 6732c8bb8671acbdac6cdc93dd72ddd581dd5e25 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 3 Jan 2013 15:53:07 +0100 Subject: TTY: switch tty_schedule_flip 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. This is the last one: tty_schedule_flip Signed-off-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- arch/alpha/kernel/srmcons.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'arch') diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c index 21b57a66e809..6f01d9ad7b81 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c @@ -44,9 +44,8 @@ typedef union _srmcons_result { /* called with callback_lock held */ static int -srmcons_do_receive_chars(struct tty_struct *tty) +srmcons_do_receive_chars(struct tty_port *port) { - struct tty_port *port = tty->port; srmcons_result result; int count = 0, loops = 0; @@ -59,7 +58,7 @@ srmcons_do_receive_chars(struct tty_struct *tty) } while((result.bits.status & 1) && (++loops < 10)); if (count) - tty_schedule_flip(tty); + tty_schedule_flip(port); return count; } @@ -74,7 +73,7 @@ srmcons_receive_chars(unsigned long data) local_irq_save(flags); if (spin_trylock(&srmcons_callback_lock)) { - if (!srmcons_do_receive_chars(port->tty)) + if (!srmcons_do_receive_chars(port)) incr = 100; spin_unlock(&srmcons_callback_lock); } @@ -89,7 +88,7 @@ srmcons_receive_chars(unsigned long data) /* called with callback_lock held */ static int -srmcons_do_write(struct tty_struct *tty, const char *buf, int count) +srmcons_do_write(struct tty_port *port, const char *buf, int count) { static char str_cr[1] = "\r"; long c, remaining = count; @@ -114,10 +113,10 @@ srmcons_do_write(struct tty_struct *tty, const char *buf, int count) cur += result.bits.c; /* - * Check for pending input iff a tty was provided + * Check for pending input iff a tty port was provided */ - if (tty) - srmcons_do_receive_chars(tty); + if (port) + srmcons_do_receive_chars(port); } while (need_cr) { @@ -136,7 +135,7 @@ srmcons_write(struct tty_struct *tty, unsigned long flags; spin_lock_irqsave(&srmcons_callback_lock, flags); - srmcons_do_write(tty, (const char *) buf, count); + srmcons_do_write(tty->port, (const char *) buf, count); spin_unlock_irqrestore(&srmcons_callback_lock, flags); return count; -- cgit From 463dcc42e4832150eb3de804682b924f9b73a91a Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Mon, 3 Dec 2012 22:23:32 +0400 Subject: serial: sccnxp: Rename header file to match functionality Signed-off-by: Alexander Shiyan Signed-off-by: Greg Kroah-Hartman --- arch/mips/sni/a20r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/mips/sni/a20r.c b/arch/mips/sni/a20r.c index 9cb9d43a3a0e..e05ad4da44d9 100644 --- a/arch/mips/sni/a20r.c +++ b/arch/mips/sni/a20r.c @@ -118,7 +118,7 @@ static struct resource sc26xx_rsrc[] = { } }; -#include +#include static struct sccnxp_pdata sccnxp_data = { .reg_shift = 2, -- cgit 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') 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 From 12faa35ae5cbfbd0d90e2103688e87ceb46c5886 Mon Sep 17 00:00:00 2001 From: Tony Prisk Date: Fri, 18 Jan 2013 15:05:31 +1300 Subject: serial: vt8500: UART uses gated clock rather than 24Mhz reference UART modules on Wondermedia SoCs are connected via a gated clock source, rather than directly to the 24Mhz reference clock. While uboot enables UART0 for debugging, other UART ports are unavailable until the clock is enabled. This patch checks that a valid clock is actually passed from devicetree, enables the clock in probe. This change removes the fallback when a clock was not specified as it doesn't apply any longer (and would only work if the UART clock was already enabled). DTSI files are updated for VT8500, WM8505 and WM8650. Signed-off-by: Tony Prisk Signed-off-by: Greg Kroah-Hartman --- arch/arm/boot/dts/vt8500.dtsi | 40 ++++++++++++++++++++++++++--- arch/arm/boot/dts/wm8505.dtsi | 60 ++++++++++++++++++++++++++++++++++++++----- arch/arm/boot/dts/wm8650.dtsi | 20 +++++++++++++-- 3 files changed, 108 insertions(+), 12 deletions(-) (limited to 'arch') diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi index d8645e990b21..cf31ced46602 100644 --- a/arch/arm/boot/dts/vt8500.dtsi +++ b/arch/arm/boot/dts/vt8500.dtsi @@ -45,6 +45,38 @@ compatible = "fixed-clock"; clock-frequency = <24000000>; }; + + clkuart0: uart0 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <1>; + }; + + clkuart1: uart1 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <2>; + }; + + clkuart2: uart2 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <3>; + }; + + clkuart3: uart3 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <4>; + }; }; }; @@ -83,28 +115,28 @@ compatible = "via,vt8500-uart"; reg = <0xd8200000 0x1040>; interrupts = <32>; - clocks = <&ref24>; + clocks = <&clkuart0>; }; uart@d82b0000 { compatible = "via,vt8500-uart"; reg = <0xd82b0000 0x1040>; interrupts = <33>; - clocks = <&ref24>; + clocks = <&clkuart1>; }; uart@d8210000 { compatible = "via,vt8500-uart"; reg = <0xd8210000 0x1040>; interrupts = <47>; - clocks = <&ref24>; + clocks = <&clkuart2>; }; uart@d82c0000 { compatible = "via,vt8500-uart"; reg = <0xd82c0000 0x1040>; interrupts = <50>; - clocks = <&ref24>; + clocks = <&clkuart3>; }; rtc@d8100000 { diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi index 330f833ac3b0..e74a1c0fb9a2 100644 --- a/arch/arm/boot/dts/wm8505.dtsi +++ b/arch/arm/boot/dts/wm8505.dtsi @@ -59,6 +59,54 @@ compatible = "fixed-clock"; clock-frequency = <24000000>; }; + + clkuart0: uart0 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <1>; + }; + + clkuart1: uart1 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <2>; + }; + + clkuart2: uart2 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <3>; + }; + + clkuart3: uart3 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <4>; + }; + + clkuart4: uart4 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <22>; + }; + + clkuart5: uart5 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <23>; + }; }; }; @@ -96,42 +144,42 @@ compatible = "via,vt8500-uart"; reg = <0xd8200000 0x1040>; interrupts = <32>; - clocks = <&ref24>; + clocks = <&clkuart0>; }; uart@d82b0000 { compatible = "via,vt8500-uart"; reg = <0xd82b0000 0x1040>; interrupts = <33>; - clocks = <&ref24>; + clocks = <&clkuart1>; }; uart@d8210000 { compatible = "via,vt8500-uart"; reg = <0xd8210000 0x1040>; interrupts = <47>; - clocks = <&ref24>; + clocks = <&clkuart2>; }; uart@d82c0000 { compatible = "via,vt8500-uart"; reg = <0xd82c0000 0x1040>; interrupts = <50>; - clocks = <&ref24>; + clocks = <&clkuart3>; }; uart@d8370000 { compatible = "via,vt8500-uart"; reg = <0xd8370000 0x1040>; interrupts = <31>; - clocks = <&ref24>; + clocks = <&clkuart4>; }; uart@d8380000 { compatible = "via,vt8500-uart"; reg = <0xd8380000 0x1040>; interrupts = <30>; - clocks = <&ref24>; + clocks = <&clkuart5>; }; rtc@d8100000 { diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi index 83b9467559bb..db3c0a12e052 100644 --- a/arch/arm/boot/dts/wm8650.dtsi +++ b/arch/arm/boot/dts/wm8650.dtsi @@ -75,6 +75,22 @@ reg = <0x204>; }; + clkuart0: uart0 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <1>; + }; + + clkuart1: uart1 { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&ref24>; + enable-reg = <0x250>; + enable-bit = <2>; + }; + arm: arm { #clock-cells = <0>; compatible = "via,vt8500-device-clock"; @@ -128,14 +144,14 @@ compatible = "via,vt8500-uart"; reg = <0xd8200000 0x1040>; interrupts = <32>; - clocks = <&ref24>; + clocks = <&clkuart0>; }; uart@d82b0000 { compatible = "via,vt8500-uart"; reg = <0xd82b0000 0x1040>; interrupts = <33>; - clocks = <&ref24>; + clocks = <&clkuart1>; }; rtc@d8100000 { -- 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/alpha/Kconfig | 2 ++ arch/ia64/hp/sim/Kconfig | 1 + arch/m68k/Kconfig.devices | 2 +- arch/parisc/Kconfig | 1 + arch/tile/Kconfig | 1 + arch/um/Kconfig.common | 1 + arch/xtensa/Kconfig | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 9d5904cc7712..1ef196ddadeb 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -125,6 +125,7 @@ choice config ALPHA_GENERIC bool "Generic" + depends on TTY help A generic kernel will run on all supported Alpha hardware. @@ -491,6 +492,7 @@ config VGA_HOSE config ALPHA_SRM bool "Use SRM as bootloader" if ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_NAUTILUS || ALPHA_NONAME + depends on TTY default y if ALPHA_JENSEN || ALPHA_MIKASA || ALPHA_SABLE || ALPHA_LYNX || ALPHA_NORITAKE || ALPHA_DP264 || ALPHA_RAWHIDE || ALPHA_EIGER || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_SHARK || ALPHA_MARVEL ---help--- There are two different types of booting firmware on Alphas: SRM, 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" diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices index c4cdfe444c64..4bc945dfe467 100644 --- a/arch/m68k/Kconfig.devices +++ b/arch/m68k/Kconfig.devices @@ -41,7 +41,7 @@ config NFBLOCK config NFCON tristate "NatFeat console driver" - depends on NATFEAT + depends on TTY && NATFEAT help Say Y to include support for the ARAnyM NatFeat console driver which allows the console output to be redirected to the stderr diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index b77feffbadea..df5beb639760 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -23,6 +23,7 @@ config PARISC select HAVE_MOD_ARCH_SPECIFIC select MODULES_USE_ELF_RELA select CLONE_BACKWARDS + select TTY # Needed for pdc_cons.c help The PA-RISC microprocessor is designed by Hewlett-Packard and used diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index 875d008828b8..ae8a7ca67fa4 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig @@ -121,6 +121,7 @@ config DEBUG_COPY_FROM_USER def_bool n config HVC_TILE + depends on TTY select HVC_DRIVER def_bool y diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common index 648121b037d5..bceee6623b00 100644 --- a/arch/um/Kconfig.common +++ b/arch/um/Kconfig.common @@ -12,6 +12,7 @@ config UML select GENERIC_CPU_DEVICES select GENERIC_IO select GENERIC_CLOCKEVENTS + select TTY # Needed for line.c config MMU bool diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 5aab1acabf1c..ad64c73b8675 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -132,6 +132,7 @@ choice config XTENSA_PLATFORM_ISS bool "ISS" + depends on TTY select XTENSA_CALIBRATE_CCOUNT select SERIAL_CONSOLE select XTENSA_ISS_NETWORK -- cgit From 2326669ccbd901dffeefb66ed742c294b2e8041b Mon Sep 17 00:00:00 2001 From: Josh Cartwright Date: Mon, 21 Jan 2013 19:57:41 +0100 Subject: serial: xilinx_uartps: Get clock rate info from dts Add support for specifying clock information for the uart clk via the device tree. This eliminates the need to hardcode rates in the device tree. Signed-off-by: Josh Cartwright Signed-off-by: Wei Yongjun Acked-by: Michal Simek Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- arch/arm/boot/dts/zynq-7000.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 401c1262d4ed..5914b5654591 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -44,14 +44,14 @@ compatible = "xlnx,xuartps"; reg = <0xE0000000 0x1000>; interrupts = <0 27 4>; - clock = <50000000>; + clocks = <&uart_clk 0>; }; uart1: uart@e0001000 { compatible = "xlnx,xuartps"; reg = <0xE0001000 0x1000>; interrupts = <0 50 4>; - clock = <50000000>; + clocks = <&uart_clk 1>; }; slcr: slcr@f8000000 { -- cgit From 26f7936c332a3ddc7ce88d5eceffbac3062ab836 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Wed, 6 Feb 2013 18:26:51 +1100 Subject: sparc: explicitly include sched.h to get task_thread_info declaration This was caused by commit 16559ae48c76 ("kgdb: remove #include from kgdb.h") from the tty tree. Signed-off-by: Stephen Rothwell Cc: David S. Miller Signed-off-by: Greg Kroah-Hartman --- arch/sparc/kernel/kgdb_32.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch') diff --git a/arch/sparc/kernel/kgdb_32.c b/arch/sparc/kernel/kgdb_32.c index 2e424a576a36..dcf210811af4 100644 --- a/arch/sparc/kernel/kgdb_32.c +++ b/arch/sparc/kernel/kgdb_32.c @@ -5,6 +5,7 @@ #include #include +#include #include #include -- cgit From 7f206d499ab5ce4db766efd9a4335572d9082911 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 14 Feb 2013 23:26:50 +0100 Subject: ARM: sa1100/assabet: include platform_device.h directly Patch "16559ae kgdb: remove #include from kgdb.h caused assabet_defconfig to fail, since assabet.c did not itself include linux/platform_device.h, although it needs it: In file included from include/linux/mfd/ucb1x00.h:13:0, from arch/arm/mach-sa1100/assabet.c:19: include/linux/mfd/mcp.h:22:16: error: field 'attached_device' has incomplete type include/linux/mfd/mcp.h:48:23: error: field 'drv' has incomplete type In file included from arch/arm/mach-sa1100/assabet.c:19:0: include/linux/mfd/ucb1x00.h:137:16: error: field 'dev' has incomplete type arch/arm/mach-sa1100/assabet.c: In function 'assabet_init': arch/arm/mach-sa1100/assabet.c:343:3: error: implicit declaration of function 'platform_device_register_simple' [-Wimplicit-function-declaration] Signed-off-by: Arnd Bergmann Cc: Russell King Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-sa1100/assabet.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch') diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index 9a23739f7026..442497363db9 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include -- cgit From 56cc6cb707fedd897d391f6e50e3b56d62d6683f Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 14 Feb 2013 23:26:56 +0100 Subject: ARM defconfigs: add missing inclusions of linux/platform_device.h Patch 16559ae "kgdb: remove #include from kgdb.h" removed an implicit inclusion of linux/platform_device.h In a number of places. This adds back explicit inclusions in a few more places I found. Signed-off-by: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Florian Tobias Schandinat Signed-off-by: Greg Kroah-Hartman --- arch/arm/plat-samsung/include/plat/adc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'arch') diff --git a/arch/arm/plat-samsung/include/plat/adc.h b/arch/arm/plat-samsung/include/plat/adc.h index b258a08de591..2fc89315553f 100644 --- a/arch/arm/plat-samsung/include/plat/adc.h +++ b/arch/arm/plat-samsung/include/plat/adc.h @@ -15,6 +15,7 @@ #define __ASM_PLAT_ADC_H __FILE__ struct s3c_adc_client; +struct platform_device; extern int s3c_adc_start(struct s3c_adc_client *client, unsigned int channel, unsigned int nr_samples); -- cgit From cb8081cb6bfbdb867d17cafaaf3509ee31140f7f Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Thu, 14 Feb 2013 10:55:06 -0800 Subject: lguest: select CONFIG_TTY to build properly. Fix kconfig warning for LGUEST_GUEST config by selecting TTY: warning: (KVMTOOL_TEST_ENABLE && LGUEST_GUEST) selects VIRTIO_CONSOLE which has unmet direct dependencies (VIRTIO && TTY) Signed-off-by: Randy Dunlap Cc: Stephen Rothwell Cc: Joe Millenbach Signed-off-by: Greg Kroah-Hartman --- arch/x86/lguest/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'arch') diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig index 7872a3330fb5..29043d2048a0 100644 --- a/arch/x86/lguest/Kconfig +++ b/arch/x86/lguest/Kconfig @@ -2,6 +2,7 @@ config LGUEST_GUEST bool "Lguest guest support" select PARAVIRT depends on X86_32 + select TTY select VIRTUALIZATION select VIRTIO select VIRTIO_CONSOLE -- cgit