Commit 1520f7e7 authored by Rob Herring's avatar Rob Herring Committed by Sasha Levin

tty_port: register tty ports with serdev bus

[ Upstream commit 8ee3fde0 ]

Register a serdev controller with the serdev bus when a tty_port is
registered. This creates the serdev controller and create's serdev
devices for any DT child nodes of the tty_port's parent (i.e. the UART
device).
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Reviewed-By: default avatarSebastian Reichel <sre@kernel.org>
Tested-By: default avatarSebastian Reichel <sre@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 00956254
......@@ -16,6 +16,7 @@
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/serdev.h>
void tty_port_init(struct tty_port *port)
{
......@@ -91,7 +92,15 @@ struct device *tty_port_register_device_attr(struct tty_port *port,
struct device *device, void *drvdata,
const struct attribute_group **attr_grp)
{
struct device *dev;
tty_port_link_device(port, driver, index);
dev = serdev_tty_port_register(port, device, driver, index);
if (PTR_ERR(dev) != -ENODEV)
/* Skip creating cdev if we registered a serdev device */
return dev;
return tty_register_device_attr(driver, index, device, drvdata,
attr_grp);
}
......@@ -143,6 +152,9 @@ static void tty_port_destructor(struct kref *kref)
/* check if last port ref was dropped before tty release */
if (WARN_ON(port->itty))
return;
serdev_tty_port_unregister(port);
if (port->xmit_buf)
free_page((unsigned long)port->xmit_buf);
tty_port_destroy(port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment