linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/17] proc tty: add struct tty_operations::proc_fops
@ 2009-01-29 17:48 Alexey Dobriyan
  2009-01-29 17:49 ` [PATCH 02/17] proc tty: switch cyclades to ->proc_fops Alexey Dobriyan
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Alexey Dobriyan @ 2009-01-29 17:48 UTC (permalink / raw)
  To: akpm, alan; +Cc: linux-kernel

Used for gradual switch of TTY drivers from using ->read_proc
which helps with gradual switch from ->read_proc for the whole tree.

As side effect, fix possible race condition when ->data initialized after
PDE is hooked into proc tree.

->proc_fops takes precedence over ->read_proc.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 fs/proc/proc_tty.c         |   19 +++++++++++++------
 include/linux/tty_driver.h |    1 +
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c
index d153946..2b72dbf 100644
--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
@@ -144,16 +144,23 @@ void proc_tty_register_driver(struct tty_driver *driver)
 {
 	struct proc_dir_entry *ent;
 		
-	if (!driver->ops->read_proc || !driver->driver_name ||
-	    driver->proc_entry)
+	if (!driver->driver_name || driver->proc_entry)
 		return;
 
-	ent = create_proc_entry(driver->driver_name, 0, proc_tty_driver);
-	if (!ent)
+	if (driver->ops->proc_fops) {
+		ent = proc_create_data(driver->driver_name, 0, proc_tty_driver,
+				       driver->ops->proc_fops, driver);
+		if (!ent)
+			return;
+	} else if (driver->ops->read_proc) {
+		ent = create_proc_entry(driver->driver_name, 0, proc_tty_driver);
+		if (!ent)
+			return;
+		ent->read_proc = driver->ops->read_proc;
+		ent->data = driver;
+	} else
 		return;
-	ent->read_proc = driver->ops->read_proc;
 	ent->owner = driver->owner;
-	ent->data = driver;
 
 	driver->proc_entry = ent;
 }
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 08e0883..c9a6957 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -264,6 +264,7 @@ struct tty_operations {
 	int (*poll_get_char)(struct tty_driver *driver, int line);
 	void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
 #endif
+	const struct file_operations *proc_fops;
 };
 
 struct tty_driver {
-- 
1.5.6.5


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

end of thread, other threads:[~2009-01-29 17:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-29 17:48 [PATCH 01/17] proc tty: add struct tty_operations::proc_fops Alexey Dobriyan
2009-01-29 17:49 ` [PATCH 02/17] proc tty: switch cyclades to ->proc_fops Alexey Dobriyan
2009-01-29 17:49 ` [PATCH 03/17] proc tty: switch ip2 " Alexey Dobriyan
2009-01-29 17:49 ` [PATCH 04/17] proc tty: switch istallion " Alexey Dobriyan
2009-01-29 17:50 ` [PATCH 05/17] proc tty: switch synclink_cs " Alexey Dobriyan
2009-01-29 17:50 ` [PATCH 06/17] proc tty: switch stallion " Alexey Dobriyan
2009-01-29 17:50 ` [PATCH 07/17] proc tty: switch synclink " Alexey Dobriyan
2009-01-29 17:51 ` [PATCH 08/17] proc tty: switch synclink_gt " Alexey Dobriyan
2009-01-29 17:51 ` [PATCH 09/17] proc tty: switch synclinkmp " Alexey Dobriyan
2009-01-29 17:53 ` [PATCH 10/17] proc tty: switch sdio_uart " Alexey Dobriyan
2009-01-29 17:53 ` [PATCH 11/17] proc tty: switch serial_core " Alexey Dobriyan
2009-01-29 17:54 ` [PATCH 12/17] proc tty: switch usb-serial " Alexey Dobriyan
2009-01-29 17:54 ` [PATCH 13/17] proc tty: switch ircomm " Alexey Dobriyan
2009-01-29 17:54 ` [PATCH 14/17] proc tty: switch amiserial " Alexey Dobriyan
2009-01-29 17:55 ` [PATCH 15/17] proc tty: switch ia64 simserial " Alexey Dobriyan
2009-01-29 17:55 ` [PATCH 16/17] proc tty: switch xtensa iss console " Alexey Dobriyan
2009-01-29 17:55 ` [PATCH 17/17] proc tty: remove struct tty_operations::read_proc Alexey Dobriyan

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).