Skip to content

Commit 15225b9

Browse files
committed
Merge tag 'tty-6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull serial driver fixes from Greg KH: "Here are some small serial driver fixes for some reported issues. Included in here are: - serial sysfs fwnode fix that was much reported - sh-sci driver fix - serial device init bugfix - 8250 bugfix - xilinx_uartps bugfix All of these have passed 0-day testing and individual testing" * tag 'tty-6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: xilinx_uartps: fix rs485 delay_rts_after_send serial: sh-sci: Check that the DMA cookie is valid serial: core: Fix serial device initialization serial: 8250: longson: Fix NULL vs IS_ERR() bug in probe serial: core: Restore sysfs fwnode information
2 parents 1c55bc8 + 267ee93 commit 15225b9

4 files changed

Lines changed: 17 additions & 14 deletions

File tree

drivers/tty/serial/8250/8250_loongson.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ static int loongson_uart_probe(struct platform_device *pdev)
128128
port->private_data = priv;
129129

130130
port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &priv->res);
131-
if (!port->membase)
132-
return -ENOMEM;
131+
if (IS_ERR(port->membase))
132+
return PTR_ERR(port->membase);
133133

134134
port->mapbase = priv->res->start;
135135
port->mapsize = resource_size(priv->res);

drivers/tty/serial/serial_base_bus.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <linux/device.h>
1414
#include <linux/idr.h>
1515
#include <linux/module.h>
16-
#include <linux/of.h>
16+
#include <linux/property.h>
1717
#include <linux/serial_core.h>
1818
#include <linux/slab.h>
1919
#include <linux/spinlock.h>
@@ -60,6 +60,7 @@ void serial_base_driver_unregister(struct device_driver *driver)
6060
driver_unregister(driver);
6161
}
6262

63+
/* On failure the caller must put device @dev with put_device() */
6364
static int serial_base_device_init(struct uart_port *port,
6465
struct device *dev,
6566
struct device *parent_dev,
@@ -73,7 +74,9 @@ static int serial_base_device_init(struct uart_port *port,
7374
dev->parent = parent_dev;
7475
dev->bus = &serial_base_bus_type;
7576
dev->release = release;
76-
device_set_of_node_from_dev(dev, parent_dev);
77+
dev->of_node_reused = true;
78+
79+
device_set_node(dev, fwnode_handle_get(dev_fwnode(parent_dev)));
7780

7881
if (!serial_base_initialized) {
7982
dev_dbg(port->dev, "uart_add_one_port() called before arch_initcall()?\n");
@@ -94,7 +97,7 @@ static void serial_base_ctrl_release(struct device *dev)
9497
{
9598
struct serial_ctrl_device *ctrl_dev = to_serial_base_ctrl_device(dev);
9699

97-
of_node_put(dev->of_node);
100+
fwnode_handle_put(dev_fwnode(dev));
98101
kfree(ctrl_dev);
99102
}
100103

@@ -142,7 +145,7 @@ static void serial_base_port_release(struct device *dev)
142145
{
143146
struct serial_port_device *port_dev = to_serial_base_port_device(dev);
144147

145-
of_node_put(dev->of_node);
148+
fwnode_handle_put(dev_fwnode(dev));
146149
kfree(port_dev);
147150
}
148151

drivers/tty/serial/sh-sci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,7 @@ static void sci_dma_check_tx_occurred(struct sci_port *s)
19141914
struct dma_tx_state state;
19151915
enum dma_status status;
19161916

1917-
if (!s->chan_tx)
1917+
if (!s->chan_tx || s->cookie_tx <= 0)
19181918
return;
19191919

19201920
status = dmaengine_tx_status(s->chan_tx, s->cookie_tx, &state);

drivers/tty/serial/xilinx_uartps.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,17 @@ static void cdns_uart_handle_tx(void *dev_id)
428428
struct tty_port *tport = &port->state->port;
429429
unsigned int numbytes;
430430
unsigned char ch;
431+
ktime_t rts_delay;
431432

432433
if (kfifo_is_empty(&tport->xmit_fifo) || uart_tx_stopped(port)) {
433434
/* Disable the TX Empty interrupt */
434435
writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IDR);
436+
/* Set RTS line after delay */
437+
if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED) {
438+
cdns_uart->tx_timer.function = &cdns_rs485_rx_callback;
439+
rts_delay = ns_to_ktime(cdns_calc_after_tx_delay(cdns_uart));
440+
hrtimer_start(&cdns_uart->tx_timer, rts_delay, HRTIMER_MODE_REL);
441+
}
435442
return;
436443
}
437444

@@ -448,13 +455,6 @@ static void cdns_uart_handle_tx(void *dev_id)
448455

449456
/* Enable the TX Empty interrupt */
450457
writel(CDNS_UART_IXR_TXEMPTY, cdns_uart->port->membase + CDNS_UART_IER);
451-
452-
if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED &&
453-
(kfifo_is_empty(&tport->xmit_fifo) || uart_tx_stopped(port))) {
454-
hrtimer_update_function(&cdns_uart->tx_timer, cdns_rs485_rx_callback);
455-
hrtimer_start(&cdns_uart->tx_timer,
456-
ns_to_ktime(cdns_calc_after_tx_delay(cdns_uart)), HRTIMER_MODE_REL);
457-
}
458458
}
459459

460460
/**

0 commit comments

Comments
 (0)