Commit dcfeda9d authored by Linus Torvalds's avatar Linus Torvalds

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

Pull tty/serial fixes from Greg KH:
 "Here are a few small tty/serial driver fixes for 4.4-rc2 that resolve
  some reported problems.

  All have been in linux-next, full details are in the shortlog below"

* tag 'tty-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  serial: export fsl8250_handle_irq
  serial: 8250_mid: Add missing dependency
  tty: audit: Fix audit source
  serial: etraxfs-uart: Fix crash
  serial: fsl_lpuart: Fix earlycon support
  bcm63xx_uart: Use the device name when registering an interrupt
  tty: Fix direct use of tty buffer work
  tty: Fix tty_send_xchar() lock order inversion
parents 7f217393 bd63acf9
...@@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty, ...@@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty,
{ {
struct n_tty_data *ldata = tty->disc_data; struct n_tty_data *ldata = tty->disc_data;
tty_audit_add_data(tty, to, n, ldata->icanon); tty_audit_add_data(tty, from, n, ldata->icanon);
return copy_to_user(to, from, n); return copy_to_user(to, from, n);
} }
......
...@@ -60,3 +60,4 @@ int fsl8250_handle_irq(struct uart_port *port) ...@@ -60,3 +60,4 @@ int fsl8250_handle_irq(struct uart_port *port)
spin_unlock_irqrestore(&up->port.lock, flags); spin_unlock_irqrestore(&up->port.lock, flags);
return 1; return 1;
} }
EXPORT_SYMBOL_GPL(fsl8250_handle_irq);
...@@ -373,6 +373,7 @@ config SERIAL_8250_MID ...@@ -373,6 +373,7 @@ config SERIAL_8250_MID
depends on SERIAL_8250 && PCI depends on SERIAL_8250 && PCI
select HSU_DMA if SERIAL_8250_DMA select HSU_DMA if SERIAL_8250_DMA
select HSU_DMA_PCI if X86_INTEL_MID select HSU_DMA_PCI if X86_INTEL_MID
select RATIONAL
help help
Selecting this option will enable handling of the extra features Selecting this option will enable handling of the extra features
present on the UART found on Intel Medfield SOC and various other present on the UART found on Intel Medfield SOC and various other
......
...@@ -1539,7 +1539,6 @@ config SERIAL_FSL_LPUART ...@@ -1539,7 +1539,6 @@ config SERIAL_FSL_LPUART
tristate "Freescale lpuart serial port support" tristate "Freescale lpuart serial port support"
depends on HAS_DMA depends on HAS_DMA
select SERIAL_CORE select SERIAL_CORE
select SERIAL_EARLYCON
help help
Support for the on-chip lpuart on some Freescale SOCs. Support for the on-chip lpuart on some Freescale SOCs.
...@@ -1547,6 +1546,7 @@ config SERIAL_FSL_LPUART_CONSOLE ...@@ -1547,6 +1546,7 @@ config SERIAL_FSL_LPUART_CONSOLE
bool "Console on Freescale lpuart serial port" bool "Console on Freescale lpuart serial port"
depends on SERIAL_FSL_LPUART=y depends on SERIAL_FSL_LPUART=y
select SERIAL_CORE_CONSOLE select SERIAL_CORE_CONSOLE
select SERIAL_EARLYCON
help help
If you have enabled the lpuart serial port on the Freescale SoCs, If you have enabled the lpuart serial port on the Freescale SoCs,
you can make it the console by answering Y to this option. you can make it the console by answering Y to this option.
......
...@@ -474,7 +474,7 @@ static int bcm_uart_startup(struct uart_port *port) ...@@ -474,7 +474,7 @@ static int bcm_uart_startup(struct uart_port *port)
/* register irq and enable rx interrupts */ /* register irq and enable rx interrupts */
ret = request_irq(port->irq, bcm_uart_interrupt, 0, ret = request_irq(port->irq, bcm_uart_interrupt, 0,
bcm_uart_type(port), port); dev_name(port->dev), port);
if (ret) if (ret)
return ret; return ret;
bcm_uart_writel(port, UART_RX_INT_MASK, UART_IR_REG); bcm_uart_writel(port, UART_RX_INT_MASK, UART_IR_REG);
......
...@@ -894,7 +894,7 @@ static int etraxfs_uart_probe(struct platform_device *pdev) ...@@ -894,7 +894,7 @@ static int etraxfs_uart_probe(struct platform_device *pdev)
up->regi_ser = of_iomap(np, 0); up->regi_ser = of_iomap(np, 0);
up->port.dev = &pdev->dev; up->port.dev = &pdev->dev;
up->gpios = mctrl_gpio_init(&pdev->dev, 0); up->gpios = mctrl_gpio_init_noauto(&pdev->dev, 0);
if (IS_ERR(up->gpios)) if (IS_ERR(up->gpios))
return PTR_ERR(up->gpios); return PTR_ERR(up->gpios);
......
...@@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty, ...@@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty,
* *
* Audit @data of @size from @tty, if necessary. * Audit @data of @size from @tty, if necessary.
*/ */
void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, void tty_audit_add_data(struct tty_struct *tty, const void *data,
size_t size, unsigned icanon) size_t size, unsigned icanon)
{ {
struct tty_audit_buf *buf; struct tty_audit_buf *buf;
......
...@@ -1282,18 +1282,22 @@ int tty_send_xchar(struct tty_struct *tty, char ch) ...@@ -1282,18 +1282,22 @@ int tty_send_xchar(struct tty_struct *tty, char ch)
int was_stopped = tty->stopped; int was_stopped = tty->stopped;
if (tty->ops->send_xchar) { if (tty->ops->send_xchar) {
down_read(&tty->termios_rwsem);
tty->ops->send_xchar(tty, ch); tty->ops->send_xchar(tty, ch);
up_read(&tty->termios_rwsem);
return 0; return 0;
} }
if (tty_write_lock(tty, 0) < 0) if (tty_write_lock(tty, 0) < 0)
return -ERESTARTSYS; return -ERESTARTSYS;
down_read(&tty->termios_rwsem);
if (was_stopped) if (was_stopped)
start_tty(tty); start_tty(tty);
tty->ops->write(tty, &ch, 1); tty->ops->write(tty, &ch, 1);
if (was_stopped) if (was_stopped)
stop_tty(tty); stop_tty(tty);
up_read(&tty->termios_rwsem);
tty_write_unlock(tty); tty_write_unlock(tty);
return 0; return 0;
} }
......
...@@ -1147,16 +1147,12 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, ...@@ -1147,16 +1147,12 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
spin_unlock_irq(&tty->flow_lock); spin_unlock_irq(&tty->flow_lock);
break; break;
case TCIOFF: case TCIOFF:
down_read(&tty->termios_rwsem);
if (STOP_CHAR(tty) != __DISABLED_CHAR) if (STOP_CHAR(tty) != __DISABLED_CHAR)
retval = tty_send_xchar(tty, STOP_CHAR(tty)); retval = tty_send_xchar(tty, STOP_CHAR(tty));
up_read(&tty->termios_rwsem);
break; break;
case TCION: case TCION:
down_read(&tty->termios_rwsem);
if (START_CHAR(tty) != __DISABLED_CHAR) if (START_CHAR(tty) != __DISABLED_CHAR)
retval = tty_send_xchar(tty, START_CHAR(tty)); retval = tty_send_xchar(tty, START_CHAR(tty));
up_read(&tty->termios_rwsem);
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -592,7 +592,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) ...@@ -592,7 +592,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
/* Restart the work queue in case no characters kick it off. Safe if /* Restart the work queue in case no characters kick it off. Safe if
already running */ already running */
schedule_work(&tty->port->buf.work); tty_buffer_restart_work(tty->port);
tty_unlock(tty); tty_unlock(tty);
return retval; return retval;
......
...@@ -607,7 +607,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops); ...@@ -607,7 +607,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
/* tty_audit.c */ /* tty_audit.c */
#ifdef CONFIG_AUDIT #ifdef CONFIG_AUDIT
extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, extern void tty_audit_add_data(struct tty_struct *tty, const void *data,
size_t size, unsigned icanon); size_t size, unsigned icanon);
extern void tty_audit_exit(void); extern void tty_audit_exit(void);
extern void tty_audit_fork(struct signal_struct *sig); extern void tty_audit_fork(struct signal_struct *sig);
...@@ -615,8 +615,8 @@ extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); ...@@ -615,8 +615,8 @@ extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
extern void tty_audit_push(struct tty_struct *tty); extern void tty_audit_push(struct tty_struct *tty);
extern int tty_audit_push_current(void); extern int tty_audit_push_current(void);
#else #else
static inline void tty_audit_add_data(struct tty_struct *tty, static inline void tty_audit_add_data(struct tty_struct *tty, const void *data,
unsigned char *data, size_t size, unsigned icanon) size_t size, unsigned icanon)
{ {
} }
static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch) static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
......
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