Commit edaa4d66 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6

* 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
  n_gsm: Fix length handling
  n_gsm: Copy n2 over when configuring via ioctl interface
  serial: bfin_5xx: grab port lock before making port termios changes
  serial: bfin_5xx: disable CON_PRINTBUFFER for consoles
  serial: bfin_5xx: remove redundant SSYNC to improve TX speed
  serial: bfin_5xx: always include DMA headers
  vcs: make proper usage of the poll flags
  amiserial: Remove unused variable icount
  8250: Fix tcsetattr to avoid ioctl(TIOCMIWAIT) hang
  tty_ldisc: Fix BUG() on hangup
  TTY: restore tty_ldisc_wait_idle
  SERIAL: blacklist si3052 chip
  drivers/serial/bfin_5xx.c: Fix line continuation defects
  tty: prevent DOS in the flush_to_ldisc
  8250: add support for Kouwell KW-L221N-2
  nozomi: Fix warning from the previous TIOCGCOUNT changes
  tty: fix warning in synclink driver
  tty: Fix formatting in tty.h
  tty: the development tree is now done in git
parents 891cbd30 40e3465d
...@@ -161,7 +161,7 @@ M: Greg Kroah-Hartman <gregkh@suse.de> ...@@ -161,7 +161,7 @@ M: Greg Kroah-Hartman <gregkh@suse.de>
L: linux-serial@vger.kernel.org L: linux-serial@vger.kernel.org
W: http://serial.sourceforge.net W: http://serial.sourceforge.net
S: Maintained S: Maintained
T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git
F: drivers/serial/8250* F: drivers/serial/8250*
F: include/linux/serial_8250.h F: include/linux/serial_8250.h
...@@ -5910,7 +5910,7 @@ S: Maintained ...@@ -5910,7 +5910,7 @@ S: Maintained
TTY LAYER TTY LAYER
M: Greg Kroah-Hartman <gregkh@suse.de> M: Greg Kroah-Hartman <gregkh@suse.de>
S: Maintained S: Maintained
T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git
F: drivers/char/tty_* F: drivers/char/tty_*
F: drivers/serial/serial_core.c F: drivers/serial/serial_core.c
F: include/linux/serial_core.h F: include/linux/serial_core.h
......
...@@ -1299,7 +1299,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, ...@@ -1299,7 +1299,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
{ {
struct async_struct * info = tty->driver_data; struct async_struct * info = tty->driver_data;
struct async_icount cprev, cnow; /* kernel counter temps */ struct async_icount cprev, cnow; /* kernel counter temps */
struct serial_icounter_struct icount;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
unsigned long flags; unsigned long flags;
......
...@@ -1828,7 +1828,6 @@ static int ntty_ioctl(struct tty_struct *tty, struct file *file, ...@@ -1828,7 +1828,6 @@ static int ntty_ioctl(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct port *port = tty->driver_data; struct port *port = tty->driver_data;
void __user *argp = (void __user *)arg;
int rval = -ENOIOCTLCMD; int rval = -ENOIOCTLCMD;
DBG1("******** IOCTL, cmd: %d", cmd); DBG1("******** IOCTL, cmd: %d", cmd);
......
...@@ -2796,6 +2796,7 @@ static const struct tty_operations mgslpc_ops = { ...@@ -2796,6 +2796,7 @@ static const struct tty_operations mgslpc_ops = {
.hangup = mgslpc_hangup, .hangup = mgslpc_hangup,
.tiocmget = tiocmget, .tiocmget = tiocmget,
.tiocmset = tiocmset, .tiocmset = tiocmset,
.get_icount = mgslpc_get_icount,
.proc_fops = &mgslpc_proc_fops, .proc_fops = &mgslpc_proc_fops,
}; };
......
...@@ -2343,8 +2343,11 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -2343,8 +2343,11 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
/* /*
* CTS flow control flag and modem status interrupts * CTS flow control flag and modem status interrupts
* Only disable MSI if no threads are waiting in
* serial_core::uart_wait_modem_status
*/ */
up->ier &= ~UART_IER_MSI; if (!waitqueue_active(&up->port.state->port.delta_msr_wait))
up->ier &= ~UART_IER_MSI;
if (!(up->bugs & UART_BUG_NOMSR) && if (!(up->bugs & UART_BUG_NOMSR) &&
UART_ENABLE_MS(&up->port, termios->c_cflag)) UART_ENABLE_MS(&up->port, termios->c_cflag))
up->ier |= UART_IER_MSI; up->ier |= UART_IER_MSI;
......
...@@ -2285,6 +2285,8 @@ static struct pciserial_board pci_boards[] __devinitdata = { ...@@ -2285,6 +2285,8 @@ static struct pciserial_board pci_boards[] __devinitdata = {
static const struct pci_device_id softmodem_blacklist[] = { static const struct pci_device_id softmodem_blacklist[] = {
{ PCI_VDEVICE(AL, 0x5457), }, /* ALi Corporation M5457 AC'97 Modem */ { PCI_VDEVICE(AL, 0x5457), }, /* ALi Corporation M5457 AC'97 Modem */
{ PCI_VDEVICE(MOTOROLA, 0x3052), }, /* Motorola Si3052-based modem */
{ PCI_DEVICE(0x1543, 0x3052), }, /* Si3052-based modem, default IDs */
}; };
/* /*
...@@ -2863,6 +2865,9 @@ static struct pci_device_id serial_pci_tbl[] = { ...@@ -2863,6 +2865,9 @@ static struct pci_device_id serial_pci_tbl[] = {
PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL, PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL,
0, 0, 0, 0,
pbn_b0_4_1152000 }, pbn_b0_4_1152000 },
{ PCI_VENDOR_ID_OXSEMI, 0x9505,
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
pbn_b0_bt_2_921600 },
/* /*
* The below card is a little controversial since it is the * The below card is a little controversial since it is the
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/tty_flip.h> #include <linux/tty_flip.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/dma-mapping.h>
#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \ #if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE) defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
...@@ -33,12 +34,10 @@ ...@@ -33,12 +34,10 @@
#include <asm/gpio.h> #include <asm/gpio.h>
#include <mach/bfin_serial_5xx.h> #include <mach/bfin_serial_5xx.h>
#ifdef CONFIG_SERIAL_BFIN_DMA #include <asm/dma.h>
#include <linux/dma-mapping.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#endif
#ifdef CONFIG_SERIAL_BFIN_MODULE #ifdef CONFIG_SERIAL_BFIN_MODULE
# undef CONFIG_EARLY_PRINTK # undef CONFIG_EARLY_PRINTK
...@@ -360,7 +359,6 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart) ...@@ -360,7 +359,6 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
UART_PUT_CHAR(uart, xmit->buf[xmit->tail]); UART_PUT_CHAR(uart, xmit->buf[xmit->tail]);
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
uart->port.icount.tx++; uart->port.icount.tx++;
SSYNC();
} }
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
...@@ -688,6 +686,13 @@ static int bfin_serial_startup(struct uart_port *port) ...@@ -688,6 +686,13 @@ static int bfin_serial_startup(struct uart_port *port)
# ifdef CONFIG_BF54x # ifdef CONFIG_BF54x
{ {
/*
* UART2 and UART3 on BF548 share interrupt PINs and DMA
* controllers with SPORT2 and SPORT3. UART rx and tx
* interrupts are generated in PIO mode only when configure
* their peripheral mapping registers properly, which means
* request corresponding DMA channels in PIO mode as well.
*/
unsigned uart_dma_ch_rx, uart_dma_ch_tx; unsigned uart_dma_ch_rx, uart_dma_ch_tx;
switch (uart->port.irq) { switch (uart->port.irq) {
...@@ -734,8 +739,7 @@ static int bfin_serial_startup(struct uart_port *port) ...@@ -734,8 +739,7 @@ static int bfin_serial_startup(struct uart_port *port)
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
IRQF_DISABLED, "BFIN_UART_CTS", uart)) { IRQF_DISABLED, "BFIN_UART_CTS", uart)) {
uart->cts_pin = -1; uart->cts_pin = -1;
pr_info("Unable to attach BlackFin UART CTS interrupt.\ pr_info("Unable to attach BlackFin UART CTS interrupt. So, disable it.\n");
So, disable it.\n");
} }
} }
if (uart->rts_pin >= 0) { if (uart->rts_pin >= 0) {
...@@ -747,8 +751,7 @@ static int bfin_serial_startup(struct uart_port *port) ...@@ -747,8 +751,7 @@ static int bfin_serial_startup(struct uart_port *port)
if (request_irq(uart->status_irq, if (request_irq(uart->status_irq,
bfin_serial_mctrl_cts_int, bfin_serial_mctrl_cts_int,
IRQF_DISABLED, "BFIN_UART_MODEM_STATUS", uart)) { IRQF_DISABLED, "BFIN_UART_MODEM_STATUS", uart)) {
pr_info("Unable to attach BlackFin UART Modem \ pr_info("Unable to attach BlackFin UART Modem Status interrupt.\n");
Status interrupt.\n");
} }
/* CTS RTS PINs are negative assertive. */ /* CTS RTS PINs are negative assertive. */
...@@ -846,6 +849,8 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -846,6 +849,8 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
if (termios->c_cflag & CMSPAR) if (termios->c_cflag & CMSPAR)
lcr |= STP; lcr |= STP;
spin_lock_irqsave(&uart->port.lock, flags);
port->read_status_mask = OE; port->read_status_mask = OE;
if (termios->c_iflag & INPCK) if (termios->c_iflag & INPCK)
port->read_status_mask |= (FE | PE); port->read_status_mask |= (FE | PE);
...@@ -875,8 +880,6 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -875,8 +880,6 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
if (termios->c_line != N_IRDA) if (termios->c_line != N_IRDA)
quot -= ANOMALY_05000230; quot -= ANOMALY_05000230;
spin_lock_irqsave(&uart->port.lock, flags);
UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15); UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15);
/* Disable UART */ /* Disable UART */
...@@ -1321,6 +1324,14 @@ struct console __init *bfin_earlyserial_init(unsigned int port, ...@@ -1321,6 +1324,14 @@ struct console __init *bfin_earlyserial_init(unsigned int port,
struct bfin_serial_port *uart; struct bfin_serial_port *uart;
struct ktermios t; struct ktermios t;
#ifdef CONFIG_SERIAL_BFIN_CONSOLE
/*
* If we are using early serial, don't let the normal console rewind
* log buffer, since that causes things to be printed multiple times
*/
bfin_serial_console.flags &= ~CON_PRINTBUFFER;
#endif
if (port == -1 || port >= nr_active_ports) if (port == -1 || port >= nr_active_ports)
port = 0; port = 0;
bfin_serial_init_ports(); bfin_serial_init_ports();
......
...@@ -716,8 +716,8 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) ...@@ -716,8 +716,8 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
if (msg->len < 128) if (msg->len < 128)
*--dp = (msg->len << 1) | EA; *--dp = (msg->len << 1) | EA;
else { else {
*--dp = (msg->len >> 6) | EA; *--dp = ((msg->len & 127) << 1) | EA;
*--dp = (msg->len & 127) << 1; *--dp = (msg->len >> 6) & 0xfe;
} }
} }
...@@ -2375,6 +2375,7 @@ static int gsmld_config(struct tty_struct *tty, struct gsm_mux *gsm, ...@@ -2375,6 +2375,7 @@ static int gsmld_config(struct tty_struct *tty, struct gsm_mux *gsm,
gsm->mru = c->mru; gsm->mru = c->mru;
gsm->encoding = c->encapsulation; gsm->encoding = c->encapsulation;
gsm->adaption = c->adaption; gsm->adaption = c->adaption;
gsm->n2 = c->n2;
if (c->i == 1) if (c->i == 1)
gsm->ftype = UIH; gsm->ftype = UIH;
......
...@@ -413,7 +413,8 @@ static void flush_to_ldisc(struct work_struct *work) ...@@ -413,7 +413,8 @@ static void flush_to_ldisc(struct work_struct *work)
spin_lock_irqsave(&tty->buf.lock, flags); spin_lock_irqsave(&tty->buf.lock, flags);
if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) {
struct tty_buffer *head; struct tty_buffer *head, *tail = tty->buf.tail;
int seen_tail = 0;
while ((head = tty->buf.head) != NULL) { while ((head = tty->buf.head) != NULL) {
int count; int count;
char *char_buf; char *char_buf;
...@@ -423,6 +424,15 @@ static void flush_to_ldisc(struct work_struct *work) ...@@ -423,6 +424,15 @@ static void flush_to_ldisc(struct work_struct *work)
if (!count) { if (!count) {
if (head->next == NULL) if (head->next == NULL)
break; break;
/*
There's a possibility tty might get new buffer
added during the unlock window below. We could
end up spinning in here forever hogging the CPU
completely. To avoid this let's have a rest each
time we processed the tail buffer.
*/
if (tail == head)
seen_tail = 1;
tty->buf.head = head->next; tty->buf.head = head->next;
tty_buffer_free(tty, head); tty_buffer_free(tty, head);
continue; continue;
...@@ -432,7 +442,7 @@ static void flush_to_ldisc(struct work_struct *work) ...@@ -432,7 +442,7 @@ static void flush_to_ldisc(struct work_struct *work)
line discipline as we want to empty the queue */ line discipline as we want to empty the queue */
if (test_bit(TTY_FLUSHPENDING, &tty->flags)) if (test_bit(TTY_FLUSHPENDING, &tty->flags))
break; break;
if (!tty->receive_room) { if (!tty->receive_room || seen_tail) {
schedule_delayed_work(&tty->buf.work, 1); schedule_delayed_work(&tty->buf.work, 1);
break; break;
} }
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
static DEFINE_SPINLOCK(tty_ldisc_lock); static DEFINE_SPINLOCK(tty_ldisc_lock);
static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait);
static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_idle);
/* Line disc dispatch table */ /* Line disc dispatch table */
static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS];
...@@ -83,6 +84,7 @@ static void put_ldisc(struct tty_ldisc *ld) ...@@ -83,6 +84,7 @@ static void put_ldisc(struct tty_ldisc *ld)
return; return;
} }
local_irq_restore(flags); local_irq_restore(flags);
wake_up(&tty_ldisc_idle);
} }
/** /**
...@@ -530,6 +532,23 @@ static int tty_ldisc_halt(struct tty_struct *tty) ...@@ -530,6 +532,23 @@ static int tty_ldisc_halt(struct tty_struct *tty)
return cancel_delayed_work_sync(&tty->buf.work); return cancel_delayed_work_sync(&tty->buf.work);
} }
/**
* tty_ldisc_wait_idle - wait for the ldisc to become idle
* @tty: tty to wait for
*
* Wait for the line discipline to become idle. The discipline must
* have been halted for this to guarantee it remains idle.
*/
static int tty_ldisc_wait_idle(struct tty_struct *tty)
{
int ret;
ret = wait_event_interruptible_timeout(tty_ldisc_idle,
atomic_read(&tty->ldisc->users) == 1, 5 * HZ);
if (ret < 0)
return ret;
return ret > 0 ? 0 : -EBUSY;
}
/** /**
* tty_set_ldisc - set line discipline * tty_set_ldisc - set line discipline
* @tty: the terminal to set * @tty: the terminal to set
...@@ -634,8 +653,17 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) ...@@ -634,8 +653,17 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
flush_scheduled_work(); flush_scheduled_work();
retval = tty_ldisc_wait_idle(tty);
tty_lock(); tty_lock();
mutex_lock(&tty->ldisc_mutex); mutex_lock(&tty->ldisc_mutex);
/* handle wait idle failure locked */
if (retval) {
tty_ldisc_put(new_ldisc);
goto enable;
}
if (test_bit(TTY_HUPPED, &tty->flags)) { if (test_bit(TTY_HUPPED, &tty->flags)) {
/* We were raced by the hangup method. It will have stomped /* We were raced by the hangup method. It will have stomped
the ldisc data and closed the ldisc down */ the ldisc data and closed the ldisc down */
...@@ -669,6 +697,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) ...@@ -669,6 +697,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
tty_ldisc_put(o_ldisc); tty_ldisc_put(o_ldisc);
enable:
/* /*
* Allow ldisc referencing to occur again * Allow ldisc referencing to occur again
*/ */
...@@ -714,9 +743,12 @@ static void tty_reset_termios(struct tty_struct *tty) ...@@ -714,9 +743,12 @@ static void tty_reset_termios(struct tty_struct *tty)
* state closed * state closed
*/ */
static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc) static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
{ {
struct tty_ldisc *ld; struct tty_ldisc *ld = tty_ldisc_get(ldisc);
if (IS_ERR(ld))
return -1;
tty_ldisc_close(tty, tty->ldisc); tty_ldisc_close(tty, tty->ldisc);
tty_ldisc_put(tty->ldisc); tty_ldisc_put(tty->ldisc);
...@@ -724,10 +756,10 @@ static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc) ...@@ -724,10 +756,10 @@ static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
/* /*
* Switch the line discipline back * Switch the line discipline back
*/ */
ld = tty_ldisc_get(ldisc);
BUG_ON(IS_ERR(ld));
tty_ldisc_assign(tty, ld); tty_ldisc_assign(tty, ld);
tty_set_termios_ldisc(tty, ldisc); tty_set_termios_ldisc(tty, ldisc);
return 0;
} }
/** /**
...@@ -802,13 +834,16 @@ void tty_ldisc_hangup(struct tty_struct *tty) ...@@ -802,13 +834,16 @@ void tty_ldisc_hangup(struct tty_struct *tty)
a FIXME */ a FIXME */
if (tty->ldisc) { /* Not yet closed */ if (tty->ldisc) { /* Not yet closed */
if (reset == 0) { if (reset == 0) {
tty_ldisc_reinit(tty, tty->termios->c_line);
err = tty_ldisc_open(tty, tty->ldisc); if (!tty_ldisc_reinit(tty, tty->termios->c_line))
err = tty_ldisc_open(tty, tty->ldisc);
else
err = 1;
} }
/* If the re-open fails or we reset then go to N_TTY. The /* If the re-open fails or we reset then go to N_TTY. The
N_TTY open cannot fail */ N_TTY open cannot fail */
if (reset || err) { if (reset || err) {
tty_ldisc_reinit(tty, N_TTY); BUG_ON(tty_ldisc_reinit(tty, N_TTY));
WARN_ON(tty_ldisc_open(tty, tty->ldisc)); WARN_ON(tty_ldisc_open(tty, tty->ldisc));
} }
tty_ldisc_enable(tty); tty_ldisc_enable(tty);
......
...@@ -553,12 +553,12 @@ static unsigned int ...@@ -553,12 +553,12 @@ static unsigned int
vcs_poll(struct file *file, poll_table *wait) vcs_poll(struct file *file, poll_table *wait)
{ {
struct vcs_poll_data *poll = vcs_poll_data_get(file); struct vcs_poll_data *poll = vcs_poll_data_get(file);
int ret = 0; int ret = DEFAULT_POLLMASK|POLLERR|POLLPRI;
if (poll) { if (poll) {
poll_wait(file, &poll->waitq, wait); poll_wait(file, &poll->waitq, wait);
if (!poll->seen_last_update) if (poll->seen_last_update)
ret = POLLIN | POLLRDNORM; ret = DEFAULT_POLLMASK;
} }
return ret; return ret;
} }
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#define N_V253 19 /* Codec control over voice modem */ #define N_V253 19 /* Codec control over voice modem */
#define N_CAIF 20 /* CAIF protocol for talking to modems */ #define N_CAIF 20 /* CAIF protocol for talking to modems */
#define N_GSM0710 21 /* GSM 0710 Mux */ #define N_GSM0710 21 /* GSM 0710 Mux */
#define N_TI_WL 22 /* for TI's WL BT, FM, GPS combo chips */ #define N_TI_WL 22 /* for TI's WL BT, FM, GPS combo chips */
/* /*
* This character is the same as _POSIX_VDISABLE: it cannot be used as * This character is the same as _POSIX_VDISABLE: it cannot be used as
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment