Skip to content

Commit dcfeda9

Browse files
committed
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
2 parents 7f21739 + bd63acf commit dcfeda9

File tree

11 files changed

+15
-13
lines changed

11 files changed

+15
-13
lines changed

drivers/tty/n_tty.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty,
169169
{
170170
struct n_tty_data *ldata = tty->disc_data;
171171

172-
tty_audit_add_data(tty, to, n, ldata->icanon);
172+
tty_audit_add_data(tty, from, n, ldata->icanon);
173173
return copy_to_user(to, from, n);
174174
}
175175

drivers/tty/serial/8250/8250_fsl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ int fsl8250_handle_irq(struct uart_port *port)
6060
spin_unlock_irqrestore(&up->port.lock, flags);
6161
return 1;
6262
}
63+
EXPORT_SYMBOL_GPL(fsl8250_handle_irq);

drivers/tty/serial/8250/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ config SERIAL_8250_MID
373373
depends on SERIAL_8250 && PCI
374374
select HSU_DMA if SERIAL_8250_DMA
375375
select HSU_DMA_PCI if X86_INTEL_MID
376+
select RATIONAL
376377
help
377378
Selecting this option will enable handling of the extra features
378379
present on the UART found on Intel Medfield SOC and various other

drivers/tty/serial/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,14 +1539,14 @@ config SERIAL_FSL_LPUART
15391539
tristate "Freescale lpuart serial port support"
15401540
depends on HAS_DMA
15411541
select SERIAL_CORE
1542-
select SERIAL_EARLYCON
15431542
help
15441543
Support for the on-chip lpuart on some Freescale SOCs.
15451544

15461545
config SERIAL_FSL_LPUART_CONSOLE
15471546
bool "Console on Freescale lpuart serial port"
15481547
depends on SERIAL_FSL_LPUART=y
15491548
select SERIAL_CORE_CONSOLE
1549+
select SERIAL_EARLYCON
15501550
help
15511551
If you have enabled the lpuart serial port on the Freescale SoCs,
15521552
you can make it the console by answering Y to this option.

drivers/tty/serial/bcm63xx_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ static int bcm_uart_startup(struct uart_port *port)
474474

475475
/* register irq and enable rx interrupts */
476476
ret = request_irq(port->irq, bcm_uart_interrupt, 0,
477-
bcm_uart_type(port), port);
477+
dev_name(port->dev), port);
478478
if (ret)
479479
return ret;
480480
bcm_uart_writel(port, UART_RX_INT_MASK, UART_IR_REG);

drivers/tty/serial/etraxfs-uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ static int etraxfs_uart_probe(struct platform_device *pdev)
894894
up->regi_ser = of_iomap(np, 0);
895895
up->port.dev = &pdev->dev;
896896

897-
up->gpios = mctrl_gpio_init(&pdev->dev, 0);
897+
up->gpios = mctrl_gpio_init_noauto(&pdev->dev, 0);
898898
if (IS_ERR(up->gpios))
899899
return PTR_ERR(up->gpios);
900900

drivers/tty/tty_audit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty,
265265
*
266266
* Audit @data of @size from @tty, if necessary.
267267
*/
268-
void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
268+
void tty_audit_add_data(struct tty_struct *tty, const void *data,
269269
size_t size, unsigned icanon)
270270
{
271271
struct tty_audit_buf *buf;

drivers/tty/tty_io.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,18 +1282,22 @@ int tty_send_xchar(struct tty_struct *tty, char ch)
12821282
int was_stopped = tty->stopped;
12831283

12841284
if (tty->ops->send_xchar) {
1285+
down_read(&tty->termios_rwsem);
12851286
tty->ops->send_xchar(tty, ch);
1287+
up_read(&tty->termios_rwsem);
12861288
return 0;
12871289
}
12881290

12891291
if (tty_write_lock(tty, 0) < 0)
12901292
return -ERESTARTSYS;
12911293

1294+
down_read(&tty->termios_rwsem);
12921295
if (was_stopped)
12931296
start_tty(tty);
12941297
tty->ops->write(tty, &ch, 1);
12951298
if (was_stopped)
12961299
stop_tty(tty);
1300+
up_read(&tty->termios_rwsem);
12971301
tty_write_unlock(tty);
12981302
return 0;
12991303
}

drivers/tty/tty_ioctl.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,16 +1147,12 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
11471147
spin_unlock_irq(&tty->flow_lock);
11481148
break;
11491149
case TCIOFF:
1150-
down_read(&tty->termios_rwsem);
11511150
if (STOP_CHAR(tty) != __DISABLED_CHAR)
11521151
retval = tty_send_xchar(tty, STOP_CHAR(tty));
1153-
up_read(&tty->termios_rwsem);
11541152
break;
11551153
case TCION:
1156-
down_read(&tty->termios_rwsem);
11571154
if (START_CHAR(tty) != __DISABLED_CHAR)
11581155
retval = tty_send_xchar(tty, START_CHAR(tty));
1159-
up_read(&tty->termios_rwsem);
11601156
break;
11611157
default:
11621158
return -EINVAL;

drivers/tty/tty_ldisc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
592592

593593
/* Restart the work queue in case no characters kick it off. Safe if
594594
already running */
595-
schedule_work(&tty->port->buf.work);
595+
tty_buffer_restart_work(tty->port);
596596

597597
tty_unlock(tty);
598598
return retval;

include/linux/tty.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,16 +607,16 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
607607

608608
/* tty_audit.c */
609609
#ifdef CONFIG_AUDIT
610-
extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
610+
extern void tty_audit_add_data(struct tty_struct *tty, const void *data,
611611
size_t size, unsigned icanon);
612612
extern void tty_audit_exit(void);
613613
extern void tty_audit_fork(struct signal_struct *sig);
614614
extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
615615
extern void tty_audit_push(struct tty_struct *tty);
616616
extern int tty_audit_push_current(void);
617617
#else
618-
static inline void tty_audit_add_data(struct tty_struct *tty,
619-
unsigned char *data, size_t size, unsigned icanon)
618+
static inline void tty_audit_add_data(struct tty_struct *tty, const void *data,
619+
size_t size, unsigned icanon)
620620
{
621621
}
622622
static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)

0 commit comments

Comments
 (0)