tty_port: Add a port level carrier detect operation
This is the first step to generalising the various pieces of waiting logic duplicated in all sorts of serial drivers. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -180,8 +180,16 @@ struct signal_struct;
|
||||
* until a hangup so don't use the wrong path.
|
||||
*/
|
||||
|
||||
struct tty_port;
|
||||
|
||||
struct tty_port_operations {
|
||||
/* Return 1 if the carrier is raised */
|
||||
int (*carrier_raised)(struct tty_port *port);
|
||||
};
|
||||
|
||||
struct tty_port {
|
||||
struct tty_struct *tty; /* Back pointer */
|
||||
const struct tty_port_operations *ops; /* Port operations */
|
||||
spinlock_t lock; /* Lock protecting tty field */
|
||||
int blocked_open; /* Waiting to open */
|
||||
int count; /* Usage count */
|
||||
@@ -427,6 +435,7 @@ extern int tty_port_alloc_xmit_buf(struct tty_port *port);
|
||||
extern void tty_port_free_xmit_buf(struct tty_port *port);
|
||||
extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
|
||||
extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
|
||||
extern int tty_port_carrier_raised(struct tty_port *port);
|
||||
|
||||
extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
|
||||
extern int tty_unregister_ldisc(int disc);
|
||||
|
Reference in New Issue
Block a user