TTY/Serial driver update for 6.1-rc1

Here is the big set of TTY and Serial driver updates for 6.1-rc1.
 
 Lots of cleanups in here, no real new functionality this time around,
 with the diffstat being that we removed more lines than we added!
 
 Included in here are:
 	- termios unification cleanups from Al Viro, it's nice to
 	  finally get this work done
 	- tty serial transmit cleanups in various drivers in preparation
 	  for more cleanup and unification in future releases (that work
 	  was not ready for this release.)
 	- n_gsm fixes and updates
 	- ktermios cleanups and code reductions
 	- dt bindings json conversions and updates for new devices
 	- some serial driver updates for new devices
 	- lots of other tiny cleanups and janitorial stuff.  Full
 	  details in the shortlog.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCY0BSdA8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ylucQCfaXIrYuh2AHcb6+G+Nqp1xD2BYaEAoIdLyOCA
 a2yziLrDF6us2oav6j4x
 =Wv+X
 -----END PGP SIGNATURE-----

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

Pull tty/serial driver updates from Greg KH:
 "Here is the big set of TTY and Serial driver updates for 6.1-rc1.

  Lots of cleanups in here, no real new functionality this time around,
  with the diffstat being that we removed more lines than we added!

  Included in here are:

   - termios unification cleanups from Al Viro, it's nice to finally get
     this work done

   - tty serial transmit cleanups in various drivers in preparation for
     more cleanup and unification in future releases (that work was not
     ready for this release)

   - n_gsm fixes and updates

   - ktermios cleanups and code reductions

   - dt bindings json conversions and updates for new devices

   - some serial driver updates for new devices

   - lots of other tiny cleanups and janitorial stuff. Full details in
     the shortlog.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'tty-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (102 commits)
  serial: cpm_uart: Don't request IRQ too early for console port
  tty: serial: do unlock on a common path in altera_jtaguart_console_putc()
  tty: serial: unify TX space reads under altera_jtaguart_tx_space()
  tty: serial: use FIELD_GET() in lqasc_tx_ready()
  tty: serial: extend lqasc_tx_ready() to lqasc_console_putchar()
  tty: serial: allow pxa.c to be COMPILE_TESTed
  serial: stm32: Fix unused-variable warning
  tty: serial: atmel: Add COMMON_CLK dependency to SERIAL_ATMEL
  serial: 8250: Fix restoring termios speed after suspend
  serial: Deassert Transmit Enable on probe in driver-specific way
  serial: 8250_dma: Convert to use uart_xmit_advance()
  serial: 8250_omap: Convert to use uart_xmit_advance()
  MAINTAINERS: Solve warning regarding inexistent atmel-usart binding
  serial: stm32: Deassert Transmit Enable on ->rs485_config()
  serial: ar933x: Deassert Transmit Enable on ->rs485_config()
  tty: serial: atmel: Use FIELD_PREP/FIELD_GET
  tty: serial: atmel: Make the driver aware of the existence of GCLK
  tty: serial: atmel: Only divide Clock Divisor if the IP is USART
  tty: serial: atmel: Separate mode clearing between UART and USART
  dt-bindings: serial: atmel,at91-usart: Add gclk as a possible USART clock
  ...
This commit is contained in:
Linus Torvalds 2022-10-07 16:36:24 -07:00
commit 6181073dd6
188 changed files with 1433 additions and 1765 deletions

View file

@ -87,12 +87,13 @@ obj-$(CONFIG_SPARC64_SMP) += hvtramp.o
obj-y += auxio_$(BITS).o
obj-$(CONFIG_SUN_PM) += apc.o pmc.o
obj-y += termios.o
obj-$(CONFIG_MODULES) += module.o
obj-$(CONFIG_MODULES) += sparc_ksyms.o
obj-$(CONFIG_SPARC_LED) += led.o
obj-$(CONFIG_KGDB) += kgdb_$(BITS).o
obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
@ -104,6 +105,7 @@ obj-$(CONFIG_SPARC64_PCI) += pci_psycho.o pci_sabre.o pci_schizo.o
obj-$(CONFIG_SPARC64_PCI) += pci_sun4v.o pci_sun4v_asm.o pci_fire.o
obj-$(CONFIG_SPARC64_PCI_MSI) += pci_msi.o
obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o
obj-$(CONFIG_US3_MC) += chmc.o

115
arch/sparc/kernel/termios.c Normal file
View file

@ -0,0 +1,115 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/termios_internal.h>
/*
* c_cc characters in the termio structure. Oh, how I love being
* backwardly compatible. Notice that character 4 and 5 are
* interpreted differently depending on whether ICANON is set in
* c_lflag. If it's set, they are used as _VEOF and _VEOL, otherwise
* as _VMIN and V_TIME. This is for compatibility with OSF/1 (which
* is compatible with sysV)...
*/
#define _VMIN 4
#define _VTIME 5
int kernel_termios_to_user_termio(struct termio __user *termio,
struct ktermios *termios)
{
struct termio v;
memset(&v, 0, sizeof(struct termio));
v.c_iflag = termios->c_iflag;
v.c_oflag = termios->c_oflag;
v.c_cflag = termios->c_cflag;
v.c_lflag = termios->c_lflag;
v.c_line = termios->c_line;
memcpy(v.c_cc, termios->c_cc, NCC);
if (!(v.c_lflag & ICANON)) {
v.c_cc[_VMIN] = termios->c_cc[VMIN];
v.c_cc[_VTIME] = termios->c_cc[VTIME];
}
return copy_to_user(termio, &v, sizeof(struct termio));
}
int user_termios_to_kernel_termios(struct ktermios *k,
struct termios2 __user *u)
{
int err;
err = get_user(k->c_iflag, &u->c_iflag);
err |= get_user(k->c_oflag, &u->c_oflag);
err |= get_user(k->c_cflag, &u->c_cflag);
err |= get_user(k->c_lflag, &u->c_lflag);
err |= get_user(k->c_line, &u->c_line);
err |= copy_from_user(k->c_cc, u->c_cc, NCCS);
if (k->c_lflag & ICANON) {
err |= get_user(k->c_cc[VEOF], &u->c_cc[VEOF]);
err |= get_user(k->c_cc[VEOL], &u->c_cc[VEOL]);
} else {
err |= get_user(k->c_cc[VMIN], &u->c_cc[_VMIN]);
err |= get_user(k->c_cc[VTIME], &u->c_cc[_VTIME]);
}
err |= get_user(k->c_ispeed, &u->c_ispeed);
err |= get_user(k->c_ospeed, &u->c_ospeed);
return err;
}
int kernel_termios_to_user_termios(struct termios2 __user *u,
struct ktermios *k)
{
int err;
err = put_user(k->c_iflag, &u->c_iflag);
err |= put_user(k->c_oflag, &u->c_oflag);
err |= put_user(k->c_cflag, &u->c_cflag);
err |= put_user(k->c_lflag, &u->c_lflag);
err |= put_user(k->c_line, &u->c_line);
err |= copy_to_user(u->c_cc, k->c_cc, NCCS);
if (!(k->c_lflag & ICANON)) {
err |= put_user(k->c_cc[VMIN], &u->c_cc[_VMIN]);
err |= put_user(k->c_cc[VTIME], &u->c_cc[_VTIME]);
} else {
err |= put_user(k->c_cc[VEOF], &u->c_cc[VEOF]);
err |= put_user(k->c_cc[VEOL], &u->c_cc[VEOL]);
}
err |= put_user(k->c_ispeed, &u->c_ispeed);
err |= put_user(k->c_ospeed, &u->c_ospeed);
return err;
}
int user_termios_to_kernel_termios_1(struct ktermios *k,
struct termios __user *u)
{
int err;
err = get_user(k->c_iflag, &u->c_iflag);
err |= get_user(k->c_oflag, &u->c_oflag);
err |= get_user(k->c_cflag, &u->c_cflag);
err |= get_user(k->c_lflag, &u->c_lflag);
err |= get_user(k->c_line, &u->c_line);
err |= copy_from_user(k->c_cc, u->c_cc, NCCS);
if (k->c_lflag & ICANON) {
err |= get_user(k->c_cc[VEOF], &u->c_cc[VEOF]);
err |= get_user(k->c_cc[VEOL], &u->c_cc[VEOL]);
} else {
err |= get_user(k->c_cc[VMIN], &u->c_cc[_VMIN]);
err |= get_user(k->c_cc[VTIME], &u->c_cc[_VTIME]);
}
return err;
}
int kernel_termios_to_user_termios_1(struct termios __user *u,
struct ktermios *k)
{
int err;
err = put_user(k->c_iflag, &u->c_iflag);
err |= put_user(k->c_oflag, &u->c_oflag);
err |= put_user(k->c_cflag, &u->c_cflag);
err |= put_user(k->c_lflag, &u->c_lflag);
err |= put_user(k->c_line, &u->c_line);
err |= copy_to_user(u->c_cc, k->c_cc, NCCS);
if (!(k->c_lflag & ICANON)) {
err |= put_user(k->c_cc[VMIN], &u->c_cc[_VMIN]);
err |= put_user(k->c_cc[VTIME], &u->c_cc[_VTIME]);
} else {
err |= put_user(k->c_cc[VEOF], &u->c_cc[VEOF]);
err |= put_user(k->c_cc[VEOL], &u->c_cc[VEOL]);
}
return err;
}