diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index adb5d8a55a14..b875d394796f 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -845,6 +845,10 @@ int serial8250_register_8250_port(const struct uart_8250_port *up) uart->port.get_divisor = up->port.get_divisor; if (up->port.set_divisor) uart->port.set_divisor = up->port.set_divisor; + if (up->port.get_rxtrig) + uart->port.get_rxtrig = up->port.get_rxtrig; + if (up->port.set_rxtrig) + uart->port.set_rxtrig = up->port.set_rxtrig; if (up->port.startup) uart->port.startup = up->port.startup; if (up->port.shutdown) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 926d46821c70..38fa45e74a37 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3035,9 +3035,14 @@ static ssize_t rx_trig_bytes_show(struct device *dev, struct device_attribute *attr, char *buf) { struct tty_port *port = dev_get_drvdata(dev); + struct uart_state *state = container_of(port, struct uart_state, port); + struct uart_port *uport = state->uart_port; int rxtrig_bytes; - rxtrig_bytes = do_serial8250_get_rxtrig(port); + if (uport->get_rxtrig) + rxtrig_bytes = uport->get_rxtrig(uport); + else + rxtrig_bytes = do_serial8250_get_rxtrig(port); if (rxtrig_bytes < 0) return rxtrig_bytes; @@ -3080,6 +3085,8 @@ static ssize_t rx_trig_bytes_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct tty_port *port = dev_get_drvdata(dev); + struct uart_state *state = container_of(port, struct uart_state, port); + struct uart_port *uport = state->uart_port; unsigned char bytes; int ret; @@ -3090,7 +3097,10 @@ static ssize_t rx_trig_bytes_store(struct device *dev, if (ret < 0) return ret; - ret = do_serial8250_set_rxtrig(port, bytes); + if (uport->set_rxtrig) + ret = uport->set_rxtrig(uport, bytes); + else + ret = do_serial8250_set_rxtrig(port, bytes); if (ret < 0) return ret; diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index a7fd24f9e908..904760876ca8 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -460,6 +460,8 @@ struct uart_port { unsigned int baud, unsigned int quot, unsigned int quot_frac); + int (*get_rxtrig)(struct uart_port *port); + int (*set_rxtrig)(struct uart_port *port, unsigned char bytes); int (*startup)(struct uart_port *port); void (*shutdown)(struct uart_port *port); void (*throttle)(struct uart_port *port);