Merge tag 'tty-3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial fixes from Greg KH:
 "Here are some tty/serial driver fixes for reported issues in 3.13-rc2.

  The n_gsm "fix" was reverted as it was found to not be correct.
  Hopefully this will be resolved in a future pull request, but as
  there's really only one user of this line setting, it's not a big
  deal..."

* tag 'tty-3.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  Revert "n_gsm: race between ld close and gsmtty open"
  n_tty: Protect minimum_to_wake reset for concurrent readers
  tty: Reset hupped state on open
  TTY: amiserial, add missing platform check
  TTY: pmac_zilog, check existence of ports in pmz_console_init()
  n_gsm: race between ld close and gsmtty open
  tty/serial/8250: fix typo in help text
  n_tty: Fix 4096-byte canonical reads
  n_tty: Fix echo overrun tail computation
  n_tty: Ensure reader restarts worker for next reader
This commit is contained in:
Linus Torvalds
2013-11-27 21:06:01 -08:00
5 changed files with 18 additions and 7 deletions

View File

@@ -1855,6 +1855,9 @@ static struct console sercons = {
*/ */
static int __init amiserial_console_init(void) static int __init amiserial_console_init(void)
{ {
if (!MACH_IS_AMIGA)
return -ENODEV;
register_console(&sercons); register_console(&sercons);
return 0; return 0;
} }

View File

@@ -768,7 +768,7 @@ static size_t __process_echoes(struct tty_struct *tty)
* data at the tail to prevent a subsequent overrun */ * data at the tail to prevent a subsequent overrun */
while (ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) { while (ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) {
if (echo_buf(ldata, tail) == ECHO_OP_START) { if (echo_buf(ldata, tail) == ECHO_OP_START) {
if (echo_buf(ldata, tail) == ECHO_OP_ERASE_TAB) if (echo_buf(ldata, tail + 1) == ECHO_OP_ERASE_TAB)
tail += 3; tail += 3;
else else
tail += 2; tail += 2;
@@ -1998,7 +1998,10 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
found = 1; found = 1;
size = N_TTY_BUF_SIZE - tail; size = N_TTY_BUF_SIZE - tail;
n = (found + eol + size) & (N_TTY_BUF_SIZE - 1); n = eol - tail;
if (n > 4096)
n += 4096;
n += found;
c = n; c = n;
if (found && read_buf(ldata, eol) == __DISABLED_CHAR) { if (found && read_buf(ldata, eol) == __DISABLED_CHAR) {
@@ -2243,18 +2246,19 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
if (time) if (time)
timeout = time; timeout = time;
} }
mutex_unlock(&ldata->atomic_read_lock); n_tty_set_room(tty);
remove_wait_queue(&tty->read_wait, &wait); up_read(&tty->termios_rwsem);
remove_wait_queue(&tty->read_wait, &wait);
if (!waitqueue_active(&tty->read_wait)) if (!waitqueue_active(&tty->read_wait))
ldata->minimum_to_wake = minimum; ldata->minimum_to_wake = minimum;
mutex_unlock(&ldata->atomic_read_lock);
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
if (b - buf) if (b - buf)
retval = b - buf; retval = b - buf;
n_tty_set_room(tty);
up_read(&tty->termios_rwsem);
return retval; return retval;
} }

View File

@@ -41,7 +41,7 @@ config SERIAL_8250_DEPRECATED_OPTIONS
accept kernel parameters in both forms like 8250_core.nr_uarts=4 and accept kernel parameters in both forms like 8250_core.nr_uarts=4 and
8250.nr_uarts=4. We now renamed the module back to 8250, but if 8250.nr_uarts=4. We now renamed the module back to 8250, but if
anybody noticed in 3.7 and changed their userspace we still have to anybody noticed in 3.7 and changed their userspace we still have to
keep the 8350_core.* options around until they revert the changes keep the 8250_core.* options around until they revert the changes
they already did. they already did.
If 8250 is built as a module, this adds 8250_core alias instead. If 8250 is built as a module, this adds 8250_core alias instead.

View File

@@ -2052,6 +2052,9 @@ static int __init pmz_console_init(void)
/* Probe ports */ /* Probe ports */
pmz_probe(); pmz_probe();
if (pmz_ports_count == 0)
return -ENODEV;
/* TODO: Autoprobe console based on OF */ /* TODO: Autoprobe console based on OF */
/* pmz_console.index = i; */ /* pmz_console.index = i; */
register_console(&pmz_console); register_console(&pmz_console);

View File

@@ -2086,6 +2086,7 @@ retry_open:
filp->f_op = &tty_fops; filp->f_op = &tty_fops;
goto retry_open; goto retry_open;
} }
clear_bit(TTY_HUPPED, &tty->flags);
tty_unlock(tty); tty_unlock(tty);