linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty: serdev: serdev-ttyport: add devt for ctrl->dev
@ 2023-03-15 10:54 Sherry Sun
  2023-03-15 11:10 ` Greg KH
  2023-03-20  5:55 ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Sherry Sun @ 2023-03-15 10:54 UTC (permalink / raw)
  To: gregkh, jirislaby, robh; +Cc: linux-serial, linux-kernel, linux-imx

For serdev framework, the serdev_controller device is the tty device,
which is also the child device of the uart_port device. If we don't set
devt property for ctrl->dev, device_find_child(uport->dev, ...) may
always return NULL in uart_suspend_port() function, which prevents us
from properly handling uart port suspend, so fix it here.

Fixes: bed35c6dfa6a ("serdev: add a tty port controller driver")
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
---
 drivers/tty/serdev/serdev-ttyport.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
index bba37ab90215..c58af8141380 100644
--- a/drivers/tty/serdev/serdev-ttyport.c
+++ b/drivers/tty/serdev/serdev-ttyport.c
@@ -268,6 +268,7 @@ struct device *serdev_tty_port_register(struct tty_port *port,
 {
 	struct serdev_controller *ctrl;
 	struct serport *serport;
+	dev_t devt = MKDEV(drv->major, drv->minor_start) + idx;
 	int ret;
 
 	if (!port || !drv || !parent)
@@ -282,6 +283,7 @@ struct device *serdev_tty_port_register(struct tty_port *port,
 	serport->tty_idx = idx;
 	serport->tty_drv = drv;
 
+	ctrl->dev.devt = devt;
 	ctrl->ops = &ctrl_ops;
 
 	port->client_ops = &client_ops;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-20  5:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-15 10:54 [PATCH] tty: serdev: serdev-ttyport: add devt for ctrl->dev Sherry Sun
2023-03-15 11:10 ` Greg KH
2023-03-15 13:37   ` Sherry Sun
2023-03-20  5:55 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).