public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: serdev: serdev-ttyport: set correct tty->dev for serdev framework
@ 2023-03-15  7:21 Sherry Sun
  2023-03-15  7:39 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Sherry Sun @ 2023-03-15  7:21 UTC (permalink / raw)
  To: gregkh, jirislaby, robh; +Cc: linux-serial, linux-kernel, linux-imx

ttyport_open() calls tty_init_dev() to initialize a tty device, but
tty_get_device() cannot get the correct tty->dev for serdev tty in
alloc_tty_struct(), because serdev framework does not set tty_class, so
class_find_device_by_devt(tty_class, devt) may always return NULL.

For serdev framework, we need to assign the correct ctrl->dev to
tty->dev.

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

diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
index d367803e2044..bba37ab90215 100644
--- a/drivers/tty/serdev/serdev-ttyport.c
+++ b/drivers/tty/serdev/serdev-ttyport.c
@@ -112,6 +112,7 @@ static int ttyport_open(struct serdev_controller *ctrl)
 	tty = tty_init_dev(serport->tty_drv, serport->tty_idx);
 	if (IS_ERR(tty))
 		return PTR_ERR(tty);
+	tty->dev = &ctrl->dev;
 	serport->tty = tty;
 
 	if (!tty->ops->open || !tty->ops->close) {
-- 
2.17.1


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-15  7:21 [PATCH] tty: serdev: serdev-ttyport: set correct tty->dev for serdev framework Sherry Sun
2023-03-15  7:39 ` Greg KH
2023-03-15  9:49   ` Sherry Sun
2023-03-15 11:33     ` Greg KH
2023-03-16  5:05       ` Sherry Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox