diff options
author | Alan Cox <alan@linux.intel.com> | 2009-10-06 11:06:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 18:18:04 -0500 |
commit | 64bc397914265a9ead8d73b63bb31ab3bdd25f67 (patch) | |
tree | dc96d1737d3d70bbdebaea7e0f0aedd1377e1000 /include/linux/tty.h | |
parent | 894cb91770f7794f1a17db4df2d83999b197da24 (diff) |
tty_port: add "tty_port_open" helper
For the moment this just moves the USB logic over and fixes the 'what if
we open and hangup at the same time' race noticed by Oliver Neukum.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r-- | include/linux/tty.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index f0f43d08d8b8..6352ac257fcb 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -190,9 +190,15 @@ struct tty_port_operations { | |||
190 | /* Control the DTR line */ | 190 | /* Control the DTR line */ |
191 | void (*dtr_rts)(struct tty_port *port, int raise); | 191 | void (*dtr_rts)(struct tty_port *port, int raise); |
192 | /* Called when the last close completes or a hangup finishes | 192 | /* Called when the last close completes or a hangup finishes |
193 | IFF the port was initialized. Do not use to free resources */ | 193 | IFF the port was initialized. Do not use to free resources. Called |
194 | under the port mutex to serialize against activate/shutdowns */ | ||
194 | void (*shutdown)(struct tty_port *port); | 195 | void (*shutdown)(struct tty_port *port); |
195 | void (*drop)(struct tty_port *port); | 196 | void (*drop)(struct tty_port *port); |
197 | /* Called under the port mutex from tty_port_open, serialized using | ||
198 | the port mutex */ | ||
199 | /* FIXME: long term getting the tty argument *out* of this would be | ||
200 | good for consoles */ | ||
201 | int (*activate)(struct tty_port *port, struct tty_struct *tty); | ||
196 | }; | 202 | }; |
197 | 203 | ||
198 | struct tty_port { | 204 | struct tty_port { |
@@ -467,6 +473,8 @@ extern int tty_port_close_start(struct tty_port *port, | |||
467 | extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); | 473 | extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); |
468 | extern void tty_port_close(struct tty_port *port, | 474 | extern void tty_port_close(struct tty_port *port, |
469 | struct tty_struct *tty, struct file *filp); | 475 | struct tty_struct *tty, struct file *filp); |
476 | extern int tty_port_open(struct tty_port *port, | ||
477 | struct tty_struct *tty, struct file *filp); | ||
470 | extern inline int tty_port_users(struct tty_port *port) | 478 | extern inline int tty_port_users(struct tty_port *port) |
471 | { | 479 | { |
472 | return port->count + port->blocked_open; | 480 | return port->count + port->blocked_open; |