Skip to content

Commit 5266e70

Browse files
committed
Merge tag 'tty-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial updates from Greg KH: "Here's the tty/serial patchset for 4.10-rc1. It's been a quiet kernel cycle for this subsystem, just a small number of changes. A few new serial drivers, and some cleanups to the old vgacon logic, and other minor serial driver changes as well. All of these have been in linux-next for a while with no reported issues" * tag 'tty-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (54 commits) serial: 8250_mid fix calltrace when hotplug 8250 serial controller console: Move userspace I/O out of console_lock to fix lockdep warning tty: nozomi: avoid sprintf buffer overflow serial: 8250_pci: Detach low-level driver during PCI error recovery serial: core: don't check port twice in a row mxs-auart: count FIFO overrun errors serial: 8250_dw: Add support for IrDA SIR mode serial: 8250: Expose set_ldisc function serial: 8250: Add IrDA to UART capabilities serial: 8250_dma: power off device after TX is done serial: 8250_port: export serial8250_rpm_{get|put}_tx() serial: sunsu: Free memory when probe fails serial: sunhv: Free memory when remove() is called vt: fix Scroll Lock LED trigger name tty: typo in comments in drivers/tty/vt/keyboard.c tty: amba-pl011: Add earlycon support for SBSA UART tty: nozomi: use permission-specific DEVICE_ATTR variants tty: serial: Make the STM32 serial port depend on it's arch serial: ifx6x60: Free memory when probe fails serial: ioc4_serial: Free memory when kzalloc fails during probe ...
2 parents 03f8d4c + a9b01b5 commit 5266e70

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+921
-429
lines changed

Documentation/admin-guide/vga-softcursor.rst

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ Software cursor for VGA
44
by Pavel Machek <pavel@atrey.karlin.mff.cuni.cz>
55
and Martin Mares <mj@atrey.karlin.mff.cuni.cz>
66

7-
Linux now has some ability to manipulate cursor appearance. Normally, you
8-
can set the size of hardware cursor (and also work around some ugly bugs in
9-
those miserable Trident cards [#f1]_. You can now play a few new tricks:
10-
you can make your cursor look
11-
12-
like a non-blinking red block, make it inverse background of the character it's
13-
over or to highlight that character and still choose whether the original
14-
hardware cursor should remain visible or not. There may be other things I have
15-
never thought of.
7+
Linux now has some ability to manipulate cursor appearance. Normally,
8+
you can set the size of hardware cursor. You can now play a few new
9+
tricks: you can make your cursor look like a non-blinking red block,
10+
make it inverse background of the character it's over or to highlight
11+
that character and still choose whether the original hardware cursor
12+
should remain visible or not. There may be other things I have never
13+
thought of.
1614

1715
The cursor appearance is controlled by a ``<ESC>[?1;2;3c`` escape sequence
1816
where 1, 2 and 3 are parameters described below. If you omit any of them,
@@ -48,8 +46,6 @@ third parameter
4846
Bit setting takes place before bit toggling, so you can simply clear a
4947
bit by including it in both the set mask and the toggle mask.
5048

51-
.. [#f1] see ``#define TRIDENT_GLITCH`` in ``drivers/video/vgacon.c``.
52-
5349
Examples
5450
--------
5551

arch/x86/platform/ce4100/ce4100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static void ce4100_mem_serial_out(struct uart_port *p, int offset, int value)
8989
}
9090

9191
static void ce4100_serial_fixup(int port, struct uart_port *up,
92-
unsigned short *capabilites)
92+
u32 *capabilites)
9393
{
9494
#ifdef CONFIG_EARLY_PRINTK
9595
/*

drivers/tty/amiserial.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,8 +1012,6 @@ static int get_serial_info(struct tty_struct *tty, struct serial_state *state,
10121012
{
10131013
struct serial_struct tmp;
10141014

1015-
if (!retinfo)
1016-
return -EFAULT;
10171015
memset(&tmp, 0, sizeof(tmp));
10181016
tty_lock(tty);
10191017
tmp.line = tty->index;

drivers/tty/nozomi.c

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -63,44 +63,23 @@
6363

6464
#define VERSION_STRING DRIVER_DESC " 2.1d"
6565

66-
/* Macros definitions */
67-
6866
/* Default debug printout level */
6967
#define NOZOMI_DEBUG_LEVEL 0x00
70-
71-
#define P_BUF_SIZE 128
72-
#define NFO(_err_flag_, args...) \
73-
do { \
74-
char tmp[P_BUF_SIZE]; \
75-
snprintf(tmp, sizeof(tmp), ##args); \
76-
printk(_err_flag_ "[%d] %s(): %s\n", __LINE__, \
77-
__func__, tmp); \
78-
} while (0)
79-
80-
#define DBG1(args...) D_(0x01, ##args)
81-
#define DBG2(args...) D_(0x02, ##args)
82-
#define DBG3(args...) D_(0x04, ##args)
83-
#define DBG4(args...) D_(0x08, ##args)
84-
#define DBG5(args...) D_(0x10, ##args)
85-
#define DBG6(args...) D_(0x20, ##args)
86-
#define DBG7(args...) D_(0x40, ##args)
87-
#define DBG8(args...) D_(0x80, ##args)
88-
89-
#ifdef DEBUG
90-
/* Do we need this settable at runtime? */
9168
static int debug = NOZOMI_DEBUG_LEVEL;
69+
module_param(debug, int, S_IRUGO | S_IWUSR);
9270

93-
#define D(lvl, args...) do \
94-
{if (lvl & debug) NFO(KERN_DEBUG, ##args); } \
95-
while (0)
96-
#define D_(lvl, args...) D(lvl, ##args)
97-
98-
/* These printouts are always printed */
71+
/* Macros definitions */
72+
#define DBG_(lvl, fmt, args...) \
73+
do { \
74+
if (lvl & debug) \
75+
pr_debug("[%d] %s(): " fmt "\n", \
76+
__LINE__, __func__, ##args); \
77+
} while (0)
9978

100-
#else
101-
static int debug;
102-
#define D_(lvl, args...)
103-
#endif
79+
#define DBG1(args...) DBG_(0x01, ##args)
80+
#define DBG2(args...) DBG_(0x02, ##args)
81+
#define DBG3(args...) DBG_(0x04, ##args)
82+
#define DBG4(args...) DBG_(0x08, ##args)
10483

10584
/* TODO: rewrite to optimize macros... */
10685

@@ -1320,7 +1299,7 @@ static ssize_t card_type_show(struct device *dev, struct device_attribute *attr,
13201299

13211300
return sprintf(buf, "%d\n", dc->card_type);
13221301
}
1323-
static DEVICE_ATTR(card_type, S_IRUGO, card_type_show, NULL);
1302+
static DEVICE_ATTR_RO(card_type);
13241303

13251304
static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr,
13261305
char *buf)
@@ -1329,7 +1308,7 @@ static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr,
13291308

13301309
return sprintf(buf, "%u\n", dc->open_ttys);
13311310
}
1332-
static DEVICE_ATTR(open_ttys, S_IRUGO, open_ttys_show, NULL);
1311+
static DEVICE_ATTR_RO(open_ttys);
13331312

13341313
static void make_sysfs_files(struct nozomi *dc)
13351314
{
@@ -1943,7 +1922,5 @@ static __exit void nozomi_exit(void)
19431922
module_init(nozomi_init);
19441923
module_exit(nozomi_exit);
19451924

1946-
module_param(debug, int, S_IRUGO | S_IWUSR);
1947-
19481925
MODULE_LICENSE("Dual BSD/GPL");
19491926
MODULE_DESCRIPTION(DRIVER_DESC);

drivers/tty/rocket.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,8 +1189,6 @@ static int get_config(struct r_port *info, struct rocket_config __user *retinfo)
11891189
{
11901190
struct rocket_config tmp;
11911191

1192-
if (!retinfo)
1193-
return -EFAULT;
11941192
memset(&tmp, 0, sizeof (tmp));
11951193
mutex_lock(&info->port.mutex);
11961194
tmp.line = info->line;
@@ -1255,8 +1253,6 @@ static int get_ports(struct r_port *info, struct rocket_ports __user *retports)
12551253
struct rocket_ports tmp;
12561254
int board;
12571255

1258-
if (!retports)
1259-
return -EFAULT;
12601256
memset(&tmp, 0, sizeof (tmp));
12611257
tmp.tty_major = rocket_driver->major;
12621258

drivers/tty/serial/8250/8250.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ struct serial8250_config {
8080
#define UART_CAP_RTOIE (1 << 13) /* UART needs IER bit 4 set (Xscale, Tegra) */
8181
#define UART_CAP_HFIFO (1 << 14) /* UART has a "hidden" FIFO */
8282
#define UART_CAP_RPM (1 << 15) /* Runtime PM is active while idle */
83+
#define UART_CAP_IRDA (1 << 16) /* UART supports IrDA line discipline */
8384

8485
#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
8586
#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
@@ -129,8 +130,13 @@ static inline void serial_dl_write(struct uart_8250_port *up, int value)
129130
}
130131

131132
struct uart_8250_port *serial8250_get_port(int line);
133+
132134
void serial8250_rpm_get(struct uart_8250_port *p);
133135
void serial8250_rpm_put(struct uart_8250_port *p);
136+
137+
void serial8250_rpm_get_tx(struct uart_8250_port *p);
138+
void serial8250_rpm_put_tx(struct uart_8250_port *p);
139+
134140
int serial8250_em485_init(struct uart_8250_port *p);
135141
void serial8250_em485_destroy(struct uart_8250_port *p);
136142

drivers/tty/serial/8250/8250_core.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,10 @@ struct uart_8250_port *serial8250_get_port(int line)
425425
EXPORT_SYMBOL_GPL(serial8250_get_port);
426426

427427
static void (*serial8250_isa_config)(int port, struct uart_port *up,
428-
unsigned short *capabilities);
428+
u32 *capabilities);
429429

430430
void serial8250_set_isa_configurator(
431-
void (*v)(int port, struct uart_port *up, unsigned short *capabilities))
431+
void (*v)(int port, struct uart_port *up, u32 *capabilities))
432432
{
433433
serial8250_isa_config = v;
434434
}
@@ -830,6 +830,7 @@ static int serial8250_probe(struct platform_device *dev)
830830
uart.port.handle_irq = p->handle_irq;
831831
uart.port.handle_break = p->handle_break;
832832
uart.port.set_termios = p->set_termios;
833+
uart.port.set_ldisc = p->set_ldisc;
833834
uart.port.get_mctrl = p->get_mctrl;
834835
uart.port.pm = p->pm;
835836
uart.port.dev = &dev->dev;
@@ -1023,6 +1024,8 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
10231024
/* Possibly override set_termios call */
10241025
if (up->port.set_termios)
10251026
uart->port.set_termios = up->port.set_termios;
1027+
if (up->port.set_ldisc)
1028+
uart->port.set_ldisc = up->port.set_ldisc;
10261029
if (up->port.get_mctrl)
10271030
uart->port.get_mctrl = up->port.get_mctrl;
10281031
if (up->port.set_mctrl)

drivers/tty/serial/8250/8250_dma.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,15 @@ int serial8250_tx_dma(struct uart_8250_port *p)
7272
struct dma_async_tx_descriptor *desc;
7373
int ret;
7474

75-
if (uart_tx_stopped(&p->port) || dma->tx_running ||
76-
uart_circ_empty(xmit))
75+
if (dma->tx_running)
7776
return 0;
7877

78+
if (uart_tx_stopped(&p->port) || uart_circ_empty(xmit)) {
79+
/* We have been called from __dma_tx_complete() */
80+
serial8250_rpm_put_tx(p);
81+
return 0;
82+
}
83+
7984
dma->tx_size = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
8085

8186
desc = dmaengine_prep_slave_single(dma->txchan,

drivers/tty/serial/8250/8250_dw.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
/* Helper for fifo size calculation */
5454
#define DW_UART_CPR_FIFO_SIZE(a) (((a >> 16) & 0xff) * 16)
5555

56+
/* DesignWare specific register fields */
57+
#define DW_UART_MCR_SIRE BIT(6)
5658

5759
struct dw8250_data {
5860
u8 usr_reg;
@@ -254,6 +256,22 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
254256
serial8250_do_set_termios(p, termios, old);
255257
}
256258

259+
static void dw8250_set_ldisc(struct uart_port *p, struct ktermios *termios)
260+
{
261+
struct uart_8250_port *up = up_to_u8250p(p);
262+
unsigned int mcr = p->serial_in(p, UART_MCR);
263+
264+
if (up->capabilities & UART_CAP_IRDA) {
265+
if (termios->c_line == N_IRDA)
266+
mcr |= DW_UART_MCR_SIRE;
267+
else
268+
mcr &= ~DW_UART_MCR_SIRE;
269+
270+
p->serial_out(p, UART_MCR, mcr);
271+
}
272+
serial8250_do_set_ldisc(p, termios);
273+
}
274+
257275
/*
258276
* dw8250_fallback_dma_filter will prevent the UART from getting just any free
259277
* channel on platforms that have DMA engines, but don't have any channels
@@ -357,6 +375,9 @@ static void dw8250_setup_port(struct uart_port *p)
357375

358376
if (reg & DW_UART_CPR_AFCE_MODE)
359377
up->capabilities |= UART_CAP_AFE;
378+
379+
if (reg & DW_UART_CPR_SIR_MODE)
380+
up->capabilities |= UART_CAP_IRDA;
360381
}
361382

362383
static int dw8250_probe(struct platform_device *pdev)
@@ -392,6 +413,7 @@ static int dw8250_probe(struct platform_device *pdev)
392413
p->iotype = UPIO_MEM;
393414
p->serial_in = dw8250_serial_in;
394415
p->serial_out = dw8250_serial_out;
416+
p->set_ldisc = dw8250_set_ldisc;
395417

396418
p->membase = devm_ioremap(dev, regs->start, resource_size(regs));
397419
if (!p->membase)

0 commit comments

Comments
 (0)