public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: clarify that not all ttys have a class device
@ 2021-04-09  7:35 Johan Hovold
  0 siblings, 0 replies; only message in thread
From: Johan Hovold @ 2021-04-09  7:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Jiri Slaby, Tetsuo Handa, linux-kernel, Johan Hovold

Commit 30004ac9c090 ("tty: add tty_struct->dev pointer to corresponding
device instance") added a struct device pointer field to struct
tty_struct which was populated with the corresponding tty class device
during initialisation.

Unfortunately, not all ttys have a class device (e.g. pseudoterminals
and serdev) in which case the device pointer will be set to NULL,
something which have bit driver authors over the years.

In retrospect perhaps this field should never have been added, but let's
at least document the current behaviour.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 include/linux/tty.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/tty.h b/include/linux/tty.h
index 95fc2f100f12..178d8a3b18f2 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -284,7 +284,7 @@ struct tty_operations;
 struct tty_struct {
 	int	magic;
 	struct kref kref;
-	struct device *dev;
+	struct device *dev;	/* class device or NULL (e.g. ptys, serdev) */
 	struct tty_driver *driver;
 	const struct tty_operations *ops;
 	int index;
-- 
2.26.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-09  7:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-09  7:35 [PATCH] tty: clarify that not all ttys have a class device Johan Hovold

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