5 #include <linux/types.h>
6 #include <linux/errno.h>
10 #include <linux/serial.h>
12 #include <linux/string.h>
13 #include <linux/slab.h>
14 #include <linux/sched.h>
16 #include <linux/wait.h>
17 #include <linux/bitops.h>
19 #include <linux/module.h>
23 memset(port, 0,
sizeof(*port));
32 kref_init(&port->
kref);
124 static void tty_port_destructor(
struct kref *
kref)
129 if (port->
ops->destruct)
130 port->
ops->destruct(port);
138 kref_put(&port->
kref, tty_port_destructor);
156 tty = tty_kref_get(port->
tty);
157 spin_unlock_irqrestore(&port->
lock, flags);
178 port->
tty = tty_kref_get(tty);
179 spin_unlock_irqrestore(&port->
lock, flags);
183 static void tty_port_shutdown(
struct tty_port *port)
188 port->
ops->shutdown(port);
212 spin_unlock_irqrestore(&port->
lock, flags);
215 tty_port_shutdown(port);
230 if (port->
ops->carrier_raised ==
NULL)
232 return port->
ops->carrier_raised(port);
247 if (port->
ops->dtr_rts)
248 port->
ops->dtr_rts(port, 1);
263 if (port->
ops->dtr_rts)
264 port->
ops->dtr_rts(port, 0);
291 int do_clocal = 0,
retval;
313 if (tty->termios.c_cflag &
CBAUD)
333 spin_unlock_irqrestore(&port->
lock, flags);
337 if (tty->termios.c_cflag &
CBAUD)
377 spin_unlock_irqrestore(&port->
lock, flags);
389 spin_unlock_irqrestore(&port->
lock, flags);
395 "tty_port_close_start: tty->count = 1 port count = %d.\n",
399 if (--port->
count < 0) {
406 spin_unlock_irqrestore(&port->
lock, flags);
408 port->
ops->drop(port);
413 spin_unlock_irqrestore(&port->
lock, flags);
419 tty_wait_until_sent_from_close(tty, port->
closing_wait);
425 timeout =
max_t(
long,
436 if (tty->termios.c_cflag &
HUPCL)
454 spin_unlock_irqrestore(&port->
lock, flags);
464 spin_unlock_irqrestore(&port->
lock, flags);
473 tty_port_shutdown(port);
501 spin_lock_irq(&port->
lock);
504 spin_unlock_irq(&port->
lock);
517 if (port->
ops->activate) {
518 int retval = port->
ops->activate(port, tty);