Skip to content

Commit 6efc63a

Browse files
committed
Merge tag 'tty-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial driver fixes from Greg KH: "Here are some small tty and serial driver fixes that resolve som reported problems. Included in here are: - n_tty lookahead buffer bugfix - WARN_ON() removal where it was not needed - 8250_dw driver bugfixes - 8250_pxa bugfix - sc16is7xx Kconfig fixes for reported build issues All of these have been in linux-next for over a week with no reported problems" * tag 'tty-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: drop debugging WARN_ON_ONCE() from uart_write() serial: sc16is7xx: re-add Kconfig SPI or I2C dependency serial: sc16is7xx: rename Kconfig CONFIG_SERIAL_SC16IS7XX_CORE serial: port: Don't block system suspend even if bytes are left to xmit serial: 8250_pxa: Configure tx_loadsz to match FIFO IRQ level serial: 8250_dw: Revert "Move definitions to the shared header" serial: 8250_dw: Don't use struct dw8250_data outside of 8250_dw tty: n_tty: Fix buffer offsets when lookahead is used
2 parents d3e6dc4 + ae01e52 commit 6efc63a

File tree

9 files changed

+64
-45
lines changed

9 files changed

+64
-45
lines changed

drivers/tty/n_tty.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,15 +1619,25 @@ static void __receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp,
16191619
else if (ldata->raw || (L_EXTPROC(tty) && !preops))
16201620
n_tty_receive_buf_raw(tty, cp, fp, count);
16211621
else if (tty->closing && !L_EXTPROC(tty)) {
1622-
if (la_count > 0)
1622+
if (la_count > 0) {
16231623
n_tty_receive_buf_closing(tty, cp, fp, la_count, true);
1624-
if (count > la_count)
1625-
n_tty_receive_buf_closing(tty, cp, fp, count - la_count, false);
1624+
cp += la_count;
1625+
if (fp)
1626+
fp += la_count;
1627+
count -= la_count;
1628+
}
1629+
if (count > 0)
1630+
n_tty_receive_buf_closing(tty, cp, fp, count, false);
16261631
} else {
1627-
if (la_count > 0)
1632+
if (la_count > 0) {
16281633
n_tty_receive_buf_standard(tty, cp, fp, la_count, true);
1629-
if (count > la_count)
1630-
n_tty_receive_buf_standard(tty, cp, fp, count - la_count, false);
1634+
cp += la_count;
1635+
if (fp)
1636+
fp += la_count;
1637+
count -= la_count;
1638+
}
1639+
if (count > 0)
1640+
n_tty_receive_buf_standard(tty, cp, fp, count, false);
16311641

16321642
flush_echoes(tty);
16331643
if (tty->ops->flush_chars)

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,34 @@
5555
#define DW_UART_QUIRK_SKIP_SET_RATE BIT(2)
5656
#define DW_UART_QUIRK_IS_DMA_FC BIT(3)
5757
#define DW_UART_QUIRK_APMC0D08 BIT(4)
58+
#define DW_UART_QUIRK_CPR_VALUE BIT(5)
59+
60+
struct dw8250_platform_data {
61+
u8 usr_reg;
62+
u32 cpr_value;
63+
unsigned int quirks;
64+
};
65+
66+
struct dw8250_data {
67+
struct dw8250_port_data data;
68+
const struct dw8250_platform_data *pdata;
69+
70+
int msr_mask_on;
71+
int msr_mask_off;
72+
struct clk *clk;
73+
struct clk *pclk;
74+
struct notifier_block clk_notifier;
75+
struct work_struct clk_work;
76+
struct reset_control *rst;
77+
78+
unsigned int skip_autocfg:1;
79+
unsigned int uart_16550_compatible:1;
80+
};
81+
82+
static inline struct dw8250_data *to_dw8250_data(struct dw8250_port_data *data)
83+
{
84+
return container_of(data, struct dw8250_data, data);
85+
}
5886

5987
static inline struct dw8250_data *clk_to_dw8250_data(struct notifier_block *nb)
6088
{
@@ -432,6 +460,10 @@ static void dw8250_prepare_rx_dma(struct uart_8250_port *p)
432460
static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
433461
{
434462
unsigned int quirks = data->pdata ? data->pdata->quirks : 0;
463+
u32 cpr_value = data->pdata ? data->pdata->cpr_value : 0;
464+
465+
if (quirks & DW_UART_QUIRK_CPR_VALUE)
466+
data->data.cpr_value = cpr_value;
435467

436468
#ifdef CONFIG_64BIT
437469
if (quirks & DW_UART_QUIRK_OCTEON) {
@@ -714,8 +746,8 @@ static const struct dw8250_platform_data dw8250_armada_38x_data = {
714746

715747
static const struct dw8250_platform_data dw8250_renesas_rzn1_data = {
716748
.usr_reg = DW_UART_USR,
717-
.cpr_val = 0x00012f32,
718-
.quirks = DW_UART_QUIRK_IS_DMA_FC,
749+
.cpr_value = 0x00012f32,
750+
.quirks = DW_UART_QUIRK_CPR_VALUE | DW_UART_QUIRK_IS_DMA_FC,
719751
};
720752

721753
static const struct dw8250_platform_data dw8250_starfive_jh7100_data = {

drivers/tty/serial/8250/8250_dwlib.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ static const struct serial_rs485 dw8250_rs485_supported = {
242242
void dw8250_setup_port(struct uart_port *p)
243243
{
244244
struct dw8250_port_data *pd = p->private_data;
245-
struct dw8250_data *data = to_dw8250_data(pd);
246245
struct uart_8250_port *up = up_to_u8250p(p);
247246
u32 reg, old_dlf;
248247

@@ -278,7 +277,7 @@ void dw8250_setup_port(struct uart_port *p)
278277

279278
reg = dw8250_readl_ext(p, DW_UART_CPR);
280279
if (!reg) {
281-
reg = data->pdata->cpr_val;
280+
reg = pd->cpr_value;
282281
dev_dbg(p->dev, "CPR is not available, using 0x%08x instead\n", reg);
283282
}
284283
if (!reg)

drivers/tty/serial/8250/8250_dwlib.h

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22
/* Synopsys DesignWare 8250 library header file. */
33

44
#include <linux/io.h>
5-
#include <linux/notifier.h>
65
#include <linux/types.h>
7-
#include <linux/workqueue.h>
86

97
#include "8250.h"
108

11-
struct clk;
12-
struct reset_control;
13-
149
struct dw8250_port_data {
1510
/* Port properties */
1611
int line;
@@ -19,42 +14,16 @@ struct dw8250_port_data {
1914
struct uart_8250_dma dma;
2015

2116
/* Hardware configuration */
17+
u32 cpr_value;
2218
u8 dlf_size;
2319

2420
/* RS485 variables */
2521
bool hw_rs485_support;
2622
};
2723

28-
struct dw8250_platform_data {
29-
u8 usr_reg;
30-
u32 cpr_val;
31-
unsigned int quirks;
32-
};
33-
34-
struct dw8250_data {
35-
struct dw8250_port_data data;
36-
const struct dw8250_platform_data *pdata;
37-
38-
int msr_mask_on;
39-
int msr_mask_off;
40-
struct clk *clk;
41-
struct clk *pclk;
42-
struct notifier_block clk_notifier;
43-
struct work_struct clk_work;
44-
struct reset_control *rst;
45-
46-
unsigned int skip_autocfg:1;
47-
unsigned int uart_16550_compatible:1;
48-
};
49-
5024
void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios, const struct ktermios *old);
5125
void dw8250_setup_port(struct uart_port *p);
5226

53-
static inline struct dw8250_data *to_dw8250_data(struct dw8250_port_data *data)
54-
{
55-
return container_of(data, struct dw8250_data, data);
56-
}
57-
5827
static inline u32 dw8250_readl_ext(struct uart_port *p, int offset)
5928
{
6029
if (p->iotype == UPIO_MEM32BE)

drivers/tty/serial/8250/8250_pxa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ static int serial_pxa_probe(struct platform_device *pdev)
125125
uart.port.iotype = UPIO_MEM32;
126126
uart.port.regshift = 2;
127127
uart.port.fifosize = 64;
128+
uart.tx_loadsz = 32;
128129
uart.dl_write = serial_pxa_dl_write;
129130

130131
ret = serial8250_register_8250_port(&uart);

drivers/tty/serial/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,9 @@ config SERIAL_SCCNXP_CONSOLE
10231023
help
10241024
Support for console on SCCNXP serial ports.
10251025

1026-
config SERIAL_SC16IS7XX_CORE
1026+
config SERIAL_SC16IS7XX
10271027
tristate "NXP SC16IS7xx UART support"
1028+
depends on SPI_MASTER || I2C
10281029
select SERIAL_CORE
10291030
select SERIAL_SC16IS7XX_SPI if SPI_MASTER
10301031
select SERIAL_SC16IS7XX_I2C if I2C

drivers/tty/serial/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ obj-$(CONFIG_SERIAL_SA1100) += sa1100.o
7575
obj-$(CONFIG_SERIAL_SAMSUNG) += samsung_tty.o
7676
obj-$(CONFIG_SERIAL_SB1250_DUART) += sb1250-duart.o
7777
obj-$(CONFIG_SERIAL_SCCNXP) += sccnxp.o
78-
obj-$(CONFIG_SERIAL_SC16IS7XX_CORE) += sc16is7xx.o
78+
obj-$(CONFIG_SERIAL_SC16IS7XX) += sc16is7xx.o
7979
obj-$(CONFIG_SERIAL_SC16IS7XX_SPI) += sc16is7xx_spi.o
8080
obj-$(CONFIG_SERIAL_SC16IS7XX_I2C) += sc16is7xx_i2c.o
8181
obj-$(CONFIG_SERIAL_SH_SCI) += sh-sci.o

drivers/tty/serial/serial_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ static ssize_t uart_write(struct tty_struct *tty, const u8 *buf, size_t count)
622622
return -EL3HLT;
623623

624624
port = uart_port_lock(state, flags);
625-
if (WARN_ON_ONCE(!state->port.xmit_buf)) {
625+
if (!state->port.xmit_buf) {
626626
uart_port_unlock(port, flags);
627627
return 0;
628628
}

drivers/tty/serial/serial_port.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ static int serial_port_runtime_suspend(struct device *dev)
6464
if (port->flags & UPF_DEAD)
6565
return 0;
6666

67+
/*
68+
* Nothing to do on pm_runtime_force_suspend(), see
69+
* DEFINE_RUNTIME_DEV_PM_OPS.
70+
*/
71+
if (!pm_runtime_enabled(dev))
72+
return 0;
73+
6774
uart_port_lock_irqsave(port, &flags);
6875
if (!port_dev->tx_enabled) {
6976
uart_port_unlock_irqrestore(port, flags);

0 commit comments

Comments
 (0)