Skip to content

Commit 41226a3

Browse files
committed
Merge tag 'tty-6.6-rc6' 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/serial driver fixes for 6.6-rc6 that resolve some reported issues. Included in here are: - serial core pm runtime fix for issue reported by many - 8250_omap driver fix - rs485 spinlock fix for reported problem - ams-delta bugfix for previous tty api changes in -rc1 that missed this driver that never seems to get built in any test systems All of these have been in linux-next for over a week with no reported problems" * tag 'tty-6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: ASoC: ti: ams-delta: Fix cx81801_receive() argument types serial: core: Fix checks for tx runtime PM state serial: 8250_omap: Fix errors with no_console_suspend serial: Reduce spinlocked portion of uart_rs485_config()
2 parents a477e3a + b3fa3cf commit 41226a3

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

drivers/tty/serial/8250/8250_omap.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ static int omap8250_suspend(struct device *dev)
16171617
{
16181618
struct omap8250_priv *priv = dev_get_drvdata(dev);
16191619
struct uart_8250_port *up = serial8250_get_port(priv->line);
1620-
int err;
1620+
int err = 0;
16211621

16221622
serial8250_suspend_port(priv->line);
16231623

@@ -1627,7 +1627,8 @@ static int omap8250_suspend(struct device *dev)
16271627
if (!device_may_wakeup(dev))
16281628
priv->wer = 0;
16291629
serial_out(up, UART_OMAP_WER, priv->wer);
1630-
err = pm_runtime_force_suspend(dev);
1630+
if (uart_console(&up->port) && console_suspend_enabled)
1631+
err = pm_runtime_force_suspend(dev);
16311632
flush_work(&priv->qos_work);
16321633

16331634
return err;
@@ -1636,11 +1637,15 @@ static int omap8250_suspend(struct device *dev)
16361637
static int omap8250_resume(struct device *dev)
16371638
{
16381639
struct omap8250_priv *priv = dev_get_drvdata(dev);
1640+
struct uart_8250_port *up = serial8250_get_port(priv->line);
16391641
int err;
16401642

1641-
err = pm_runtime_force_resume(dev);
1642-
if (err)
1643-
return err;
1643+
if (uart_console(&up->port) && console_suspend_enabled) {
1644+
err = pm_runtime_force_resume(dev);
1645+
if (err)
1646+
return err;
1647+
}
1648+
16441649
serial8250_resume_port(priv->line);
16451650
/* Paired with pm_runtime_resume_and_get() in omap8250_suspend() */
16461651
pm_runtime_mark_last_busy(dev);
@@ -1717,16 +1722,6 @@ static int omap8250_runtime_suspend(struct device *dev)
17171722

17181723
if (priv->line >= 0)
17191724
up = serial8250_get_port(priv->line);
1720-
/*
1721-
* When using 'no_console_suspend', the console UART must not be
1722-
* suspended. Since driver suspend is managed by runtime suspend,
1723-
* preventing runtime suspend (by returning error) will keep device
1724-
* active during suspend.
1725-
*/
1726-
if (priv->is_suspending && !console_suspend_enabled) {
1727-
if (up && uart_console(&up->port))
1728-
return -EBUSY;
1729-
}
17301725

17311726
if (priv->habit & UART_ERRATA_CLOCK_DISABLE) {
17321727
int ret;

drivers/tty/serial/serial_core.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static void __uart_start(struct uart_state *state)
156156
* enabled, serial_port_runtime_resume() calls start_tx() again
157157
* after enabling the device.
158158
*/
159-
if (pm_runtime_active(&port_dev->dev))
159+
if (!pm_runtime_enabled(port->dev) || pm_runtime_active(port->dev))
160160
port->ops->start_tx(port);
161161
pm_runtime_mark_last_busy(&port_dev->dev);
162162
pm_runtime_put_autosuspend(&port_dev->dev);
@@ -1404,12 +1404,18 @@ static void uart_set_rs485_termination(struct uart_port *port,
14041404
static int uart_rs485_config(struct uart_port *port)
14051405
{
14061406
struct serial_rs485 *rs485 = &port->rs485;
1407+
unsigned long flags;
14071408
int ret;
14081409

1410+
if (!(rs485->flags & SER_RS485_ENABLED))
1411+
return 0;
1412+
14091413
uart_sanitize_serial_rs485(port, rs485);
14101414
uart_set_rs485_termination(port, rs485);
14111415

1416+
spin_lock_irqsave(&port->lock, flags);
14121417
ret = port->rs485_config(port, NULL, rs485);
1418+
spin_unlock_irqrestore(&port->lock, flags);
14131419
if (ret)
14141420
memset(rs485, 0, sizeof(*rs485));
14151421

@@ -2474,11 +2480,10 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
24742480
if (ret == 0) {
24752481
if (tty)
24762482
uart_change_line_settings(tty, state, NULL);
2483+
uart_rs485_config(uport);
24772484
spin_lock_irq(&uport->lock);
24782485
if (!(uport->rs485.flags & SER_RS485_ENABLED))
24792486
ops->set_mctrl(uport, uport->mctrl);
2480-
else
2481-
uart_rs485_config(uport);
24822487
ops->start_tx(uport);
24832488
spin_unlock_irq(&uport->lock);
24842489
tty_port_set_initialized(port, true);
@@ -2587,10 +2592,10 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
25872592
port->mctrl &= TIOCM_DTR;
25882593
if (!(port->rs485.flags & SER_RS485_ENABLED))
25892594
port->ops->set_mctrl(port, port->mctrl);
2590-
else
2591-
uart_rs485_config(port);
25922595
spin_unlock_irqrestore(&port->lock, flags);
25932596

2597+
uart_rs485_config(port);
2598+
25942599
/*
25952600
* If this driver supports console, and it hasn't been
25962601
* successfully registered yet, try to re-register it.

sound/soc/ti/ams-delta.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ static void cx81801_hangup(struct tty_struct *tty)
336336
}
337337

338338
/* Line discipline .receive_buf() */
339-
static void cx81801_receive(struct tty_struct *tty, const u8 *cp,
340-
const char *fp, int count)
339+
static void cx81801_receive(struct tty_struct *tty, const u8 *cp, const u8 *fp,
340+
size_t count)
341341
{
342342
struct snd_soc_component *component = tty->disc_data;
343343
const unsigned char *c;

0 commit comments

Comments
 (0)