@@ -436,6 +436,9 @@ RTC
SERDEV
devm_serdev_device_open()
+SERIAL
+ devm_uart_add_one_port()
+
SLAVE DMA ENGINE
devm_acpi_dma_controller_register()
@@ -3217,6 +3217,42 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
}
EXPORT_SYMBOL(uart_remove_one_port);
+struct uart_port_devres {
+ struct uart_driver *drv;
+ struct uart_port *port;
+};
+
+static void devm_uart_remove_one_port(struct device *dev, void *data)
+{
+ struct uart_port_devres *res = data;
+
+ uart_remove_one_port(res->drv, res->port);
+}
+
+int devm_uart_add_one_port(struct device *dev,
+ struct uart_driver *drv, struct uart_port *port)
+{
+ struct uart_port_devres *res;
+ int ret;
+
+ res = devres_alloc(devm_uart_remove_one_port, sizeof(*res), GFP_KERNEL);
+ if (!res)
+ return -1;
+
+ ret = uart_add_one_port(drv, port);
+ if (ret) {
+ devres_free(res);
+ return -1;
+ }
+
+ res->drv = drv;
+ res->port = port;
+ devres_add(dev, res);
+
+ return 0;
+}
+EXPORT_SYMBOL(devm_uart_add_one_port);
+
/**
* uart_match_port - are the two ports equivalent?
* @port1: first port
@@ -771,6 +771,12 @@ int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
bool uart_match_port(const struct uart_port *port1,
const struct uart_port *port2);
+/*
+ * UART devres
+ */
+int devm_uart_add_one_port(struct device *dev,
+ struct uart_driver *drv, struct uart_port *port);
+
/*
* Power Management
*/