aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/proc_tty.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-03-31 18:19:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:08 -0400
commitae149b6bec64a09373ba20fce75f8aa6b14b78fd (patch)
tree5e2f1fdfc223b76ab798c87fd25bcff8d5f92eeb /fs/proc/proc_tty.c
parent15f7176eb1cccec0a332541285ee752b935c1c85 (diff)
proc tty: add struct tty_operations::proc_fops
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> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/proc_tty.c')
-rw-r--r--fs/proc/proc_tty.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c
index 4a9e0f65ae60..854827b1d463 100644
--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
@@ -144,16 +144,22 @@ void proc_tty_register_driver(struct tty_driver *driver)
144{ 144{
145 struct proc_dir_entry *ent; 145 struct proc_dir_entry *ent;
146 146
147 if (!driver->ops->read_proc || !driver->driver_name || 147 if (!driver->driver_name || driver->proc_entry)
148 driver->proc_entry)
149 return; 148 return;
150 149
151 ent = create_proc_entry(driver->driver_name, 0, proc_tty_driver); 150 if (driver->ops->proc_fops) {
152 if (!ent) 151 ent = proc_create_data(driver->driver_name, 0, proc_tty_driver,
152 driver->ops->proc_fops, driver);
153 if (!ent)
154 return;
155 } else if (driver->ops->read_proc) {
156 ent = create_proc_entry(driver->driver_name, 0, proc_tty_driver);
157 if (!ent)
158 return;
159 ent->read_proc = driver->ops->read_proc;
160 ent->data = driver;
161 } else
153 return; 162 return;
154 ent->read_proc = driver->ops->read_proc;
155 ent->data = driver;
156
157 driver->proc_entry = ent; 163 driver->proc_entry = ent;
158} 164}
159 165