All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 1/5]: Move tty lookup/reopen to caller
@ 2008-08-29  7:00 sukadev-r/Jw6+rmf7HQT0dZR+AlfA
       [not found] ` <20080829070001.GA21286-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: sukadev-r/Jw6+rmf7HQT0dZR+AlfA @ 2008-08-29  7:00 UTC (permalink / raw)
  To: hpa-YMNOUZJC4hwAvxtiuMwx3w, alan-qBU/x9rampVanCEyBjwyrvXRex20P6io
  Cc: kyle-hoO6YkzgTuCM0SS3m2neIg, ebiederm-aS9lmoZGLiVWk0Htik3J/w,
	bastian-yyjItF7Rl6lg9hUCZPvPmw, containers-qjLDD68F18O7TbgM5vRIOg,
	sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8,
	xemul-GEFAQzZX7r8dnm+yROfE0A

get_node() cleanup in devpts

This patchset adds inode/tty parameter to devpts interfaces and uses
this new parameter to remove the unnecessary get_node() calls in devpts
(as pointed out by Peter Anvin).

Alan, if these are getting in your way, I can hold off for now, but
just wanted some quick comments from you on patch 1 and from Peter
on get_node() cleanup.

----

From: Sukadev Bhattiprolu <sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Subject: [RFC][PATCH 1/5]: Move tty lookup/reopen to caller

Move tty_driver_lookup_tty() and tty_reopen() from tty_init_dev()
into tty_open() (one of the two callers of tty_init_dev()).  These
calls are not really required in ptmx_open(), the other caller,
since ptmx_open() would be setting up a new tty.

Changelog[v2]:
	- remove the lookup and reopen calls from ptmx_open
	- merge with recent changes to ttydev tree

---
 drivers/char/tty_io.c |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

Index: linux-2.6.27-rc3-tty/drivers/char/tty_io.c
===================================================================
--- linux-2.6.27-rc3-tty.orig/drivers/char/tty_io.c	2008-08-28 15:26:34.000000000 -0700
+++ linux-2.6.27-rc3-tty/drivers/char/tty_io.c	2008-08-28 16:16:29.000000000 -0700
@@ -1366,19 +1366,6 @@ struct tty_struct *tty_init_dev(struct t
 	struct tty_struct *tty;
 	int retval;
 
-	/* check whether we're reopening an existing tty */
-	tty = tty_driver_lookup_tty(driver, idx);
-
-	if (IS_ERR(tty))
-		return tty;
-
-	if (tty) {
-		retval = tty_reopen(tty);
-		if (retval)
-			return ERR_PTR(retval);
-		return tty;
-	}
-
 	/* Check if pty master is being opened multiple times */
 	if (driver->subtype == PTY_TYPE_MASTER &&
 		(driver->flags & TTY_DRIVER_DEVPTS_MEM) && !first_ok)
@@ -1780,7 +1767,7 @@ void tty_release_dev(struct file *filp)
 
 static int __tty_open(struct inode *inode, struct file *filp)
 {
-	struct tty_struct *tty;
+	struct tty_struct *tty = NULL;
 	int noctty, retval;
 	struct tty_driver *driver;
 	int index;
@@ -1837,7 +1824,21 @@ retry_open:
 		return -ENODEV;
 	}
 got_driver:
-	tty = tty_init_dev(driver, index, 0);
+	if (!tty) {
+		/* check whether we're reopening an existing tty */
+		tty = tty_driver_lookup_tty(driver, index);
+
+		if (IS_ERR(tty))
+			return PTR_ERR(tty);
+	}
+
+	if (tty) {
+		retval = tty_reopen(tty);
+		if (retval)
+			tty = ERR_PTR(retval);
+	} else
+		tty = tty_init_dev(driver, index, 0);
+
 	mutex_unlock(&tty_mutex);
 	tty_driver_kref_put(driver);
 	if (IS_ERR(tty))

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

end of thread, other threads:[~2008-08-29 10:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-29  7:00 [RFC][PATCH 1/5]: Move tty lookup/reopen to caller sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found] ` <20080829070001.GA21286-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-08-29  7:02   ` [RFC][PATCH 2/5]: Add an instance parameter devpts interfaces sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2008-08-29  7:02   ` [RFC][PATCH 3/5]: Simplify devpts_get_tty() sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2008-08-29  7:03   ` [RFC][PATCH 4/5]: Simplify devpts_pty_new() sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2008-08-29  7:04   ` [RFC][PATCH 5/5]: Simplify devpts_pty_kill sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2008-08-29 10:49   ` [RFC][PATCH 1/5]: Move tty lookup/reopen to caller Alan Cox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.