Merge tag 'tty-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 29 Dec 2018 04:33:54 +0000 (20:33 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 29 Dec 2018 04:33:54 +0000 (20:33 -0800)
Pull tty/serial driver updates from Greg KH:
 "Here is the large TTY/Serial driver set of patches for 4.21-rc1.

  A number of small serial driver changes along with some good tty core
  fixes for long-reported issues with locking. There is also a new
  console font added to the tree, for high-res screens, so that should
  be helpful for many.

  The last patch in the series is a revert of an older one in the tree,
  it came late but it resolves a reported issue that linux-next was
  having for some people.

  Full details are in the shortlog, and all of these, with the exception
  of the revert, have been in linux-next for a while with no reported
  issues"

* tag 'tty-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (85 commits)
  Revert "serial: 8250: Default SERIAL_OF_PLATFORM to SERIAL_8250"
  serial: sccnxp: Allow to use non-standard baud rates
  serial: sccnxp: Adds a delay between sequential read/write cycles
  tty: serial: qcom_geni_serial: Fix UART hang
  tty: serial: qcom_geni_serial: Fix wrap around of TX buffer
  serial: max310x: Fix tx_empty() callback
  dt-bindings: serial: sh-sci: Document r8a774c0 bindings
  dt-bindings: serial: sh-sci: Document r8a774a1 bindings
  Fonts: New Terminus large console font
  dt-bindings: serial: lpuart: add imx8qxp compatible string
  serial: uartps: Fix interrupt mask issue to handle the RX interrupts properly
  serial: uartps: Fix error path when alloc failed
  serial: uartps: Check if the device is a console
  serial: uartps: Add the device_init_wakeup
  tty: serial: samsung: Increase maximum baudrate
  tty: serial: samsung: Properly set flags in autoCTS mode
  tty: Use of_node_name_{eq,prefix} for node name comparisons
  tty/serial: do not free trasnmit buffer page under port lock
  serial: 8250: Rate limit serial port rx interrupts during input overruns
  dt-bindings: serial: 8250: Add rate limit for serial port input overruns
  ...

1  2 
drivers/tty/serial/8250/8250_port.c
drivers/tty/serial/sunsu.c

@@@ -552,11 -552,30 +552,11 @@@ static unsigned int serial_icr_read(str
   */
  static void serial8250_clear_fifos(struct uart_8250_port *p)
  {
 -      unsigned char fcr;
 -      unsigned char clr_mask = UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT;
 -
        if (p->capabilities & UART_CAP_FIFO) {
 -              /*
 -               * Make sure to avoid changing FCR[7:3] and ENABLE_FIFO bits.
 -               * In case ENABLE_FIFO is not set, there is nothing to flush
 -               * so just return. Furthermore, on certain implementations of
 -               * the 8250 core, the FCR[7:3] bits may only be changed under
 -               * specific conditions and changing them if those conditions
 -               * are not met can have nasty side effects. One such core is
 -               * the 8250-omap present in TI AM335x.
 -               */
 -              fcr = serial_in(p, UART_FCR);
 -
 -              /* FIFO is not enabled, there's nothing to clear. */
 -              if (!(fcr & UART_FCR_ENABLE_FIFO))
 -                      return;
 -
 -              fcr |= clr_mask;
 -              serial_out(p, UART_FCR, fcr);
 -
 -              fcr &= ~clr_mask;
 -              serial_out(p, UART_FCR, fcr);
 +              serial_out(p, UART_FCR, UART_FCR_ENABLE_FIFO);
 +              serial_out(p, UART_FCR, UART_FCR_ENABLE_FIFO |
 +                             UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
 +              serial_out(p, UART_FCR, 0);
        }
  }
  
@@@ -1448,7 -1467,7 +1448,7 @@@ static void __do_stop_tx_rs485(struct u
         * Enable previously disabled RX interrupts.
         */
        if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) {
 -              serial8250_clear_fifos(p);
 +              serial8250_clear_and_reinit_fifos(p);
  
                p->ier |= UART_IER_RLSI | UART_IER_RDI;
                serial_port_out(&p->port, UART_IER, p->ier);
@@@ -1736,7 -1755,7 +1736,7 @@@ void serial8250_read_char(struct uart_8
                else if (lsr & UART_LSR_FE)
                        flag = TTY_FRAME;
        }
-       if (uart_handle_sysrq_char(port, ch))
+       if (uart_prepare_sysrq_char(port, ch))
                return;
  
        uart_insert_char(port, lsr, UART_LSR_OE, ch, flag);
@@@ -1878,7 -1897,7 +1878,7 @@@ int serial8250_handle_irq(struct uart_p
        if ((!up->dma || up->dma->tx_err) && (status & UART_LSR_THRE))
                serial8250_tx_chars(up);
  
-       spin_unlock_irqrestore(&port->lock, flags);
+       uart_unlock_and_check_sysrq(port, flags);
        return 1;
  }
  EXPORT_SYMBOL_GPL(serial8250_handle_irq);
@@@ -3239,9 -3258,7 +3239,7 @@@ void serial8250_console_write(struct ua
  
        serial8250_rpm_get(up);
  
-       if (port->sysrq)
-               locked = 0;
-       else if (oops_in_progress)
+       if (oops_in_progress)
                locked = spin_trylock_irqsave(&port->lock, flags);
        else
                spin_lock_irqsave(&port->lock, flags);
@@@ -1394,43 -1394,22 +1394,43 @@@ static inline struct console *SUNSU_CON
  static enum su_type su_get_type(struct device_node *dp)
  {
        struct device_node *ap = of_find_node_by_path("/aliases");
 +      enum su_type rc = SU_PORT_PORT;
  
        if (ap) {
                const char *keyb = of_get_property(ap, "keyboard", NULL);
                const char *ms = of_get_property(ap, "mouse", NULL);
 +              struct device_node *match;
  
                if (keyb) {
 -                      if (dp == of_find_node_by_path(keyb))
 -                              return SU_PORT_KBD;
 +                      match = of_find_node_by_path(keyb);
 +
 +                      /*
 +                       * The pointer is used as an identifier not
 +                       * as a pointer, we can drop the refcount on
 +                       * the of__node immediately after getting it.
 +                       */
 +                      of_node_put(match);
 +
 +                      if (dp == match) {
 +                              rc = SU_PORT_KBD;
 +                              goto out;
 +                      }
                }
                if (ms) {
 -                      if (dp == of_find_node_by_path(ms))
 -                              return SU_PORT_MS;
 +                      match = of_find_node_by_path(ms);
 +
 +                      of_node_put(match);
 +
 +                      if (dp == match) {
 +                              rc = SU_PORT_MS;
 +                              goto out;
 +                      }
                }
        }
  
 -      return SU_PORT_PORT;
 +out:
 +      of_node_put(ap);
 +      return rc;
  }
  
  static int su_probe(struct platform_device *op)
        up->port.ops = &sunsu_pops;
  
        ignore_line = false;
-       if (!strcmp(dp->name, "rsc-console") ||
-           !strcmp(dp->name, "lom-console"))
+       if (of_node_name_eq(dp, "rsc-console") ||
+           of_node_name_eq(dp, "lom-console"))
                ignore_line = true;
  
        sunserial_console_match(SUNSU_CONSOLE(), dp,