aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rio/rio_linux.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2009-01-02 08:45:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:19:38 -0500
commit31f35939d1d9bcfb3099b32c67b896d2792603f9 (patch)
tree39b6ceaf0e7477e0357ff8235814f579adad3f28 /drivers/char/rio/rio_linux.c
parentc9b3976e3fec266be25c5001a70aa0a890b6c476 (diff)
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>
Diffstat (limited to 'drivers/char/rio/rio_linux.c')
-rw-r--r--drivers/char/rio/rio_linux.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index a8f68a3f14dd..ec2afd139472 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -173,7 +173,7 @@ static void rio_disable_tx_interrupts(void *ptr);
173static void rio_enable_tx_interrupts(void *ptr); 173static void rio_enable_tx_interrupts(void *ptr);
174static void rio_disable_rx_interrupts(void *ptr); 174static void rio_disable_rx_interrupts(void *ptr);
175static void rio_enable_rx_interrupts(void *ptr); 175static void rio_enable_rx_interrupts(void *ptr);
176static int rio_get_CD(void *ptr); 176static int rio_carrier_raised(struct tty_port *port);
177static void rio_shutdown_port(void *ptr); 177static void rio_shutdown_port(void *ptr);
178static int rio_set_real_termios(void *ptr); 178static int rio_set_real_termios(void *ptr);
179static void rio_hungup(void *ptr); 179static void rio_hungup(void *ptr);
@@ -224,7 +224,6 @@ static struct real_driver rio_real_driver = {
224 rio_enable_tx_interrupts, 224 rio_enable_tx_interrupts,
225 rio_disable_rx_interrupts, 225 rio_disable_rx_interrupts,
226 rio_enable_rx_interrupts, 226 rio_enable_rx_interrupts,
227 rio_get_CD,
228 rio_shutdown_port, 227 rio_shutdown_port,
229 rio_set_real_termios, 228 rio_set_real_termios,
230 rio_chars_in_buffer, 229 rio_chars_in_buffer,
@@ -476,9 +475,9 @@ static void rio_enable_rx_interrupts(void *ptr)
476 475
477 476
478/* Jeez. Isn't this simple? */ 477/* Jeez. Isn't this simple? */
479static int rio_get_CD(void *ptr) 478static int rio_carrier_raised(struct tty_port *port)
480{ 479{
481 struct Port *PortP = ptr; 480 struct Port *PortP = container_of(port, struct Port, gs.port);
482 int rv; 481 int rv;
483 482
484 func_enter(); 483 func_enter();
@@ -806,7 +805,9 @@ static void *ckmalloc(int size)
806 return p; 805 return p;
807} 806}
808 807
809 808static const struct tty_port_operations rio_port_ops = {
809 .carrier_raised = rio_carrier_raised,
810};
810 811
811static int rio_init_datastructures(void) 812static int rio_init_datastructures(void)
812{ 813{
@@ -842,17 +843,14 @@ static int rio_init_datastructures(void)
842 goto free6; 843 goto free6;
843 } 844 }
844 rio_dprintk(RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped); 845 rio_dprintk(RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped);
846 tty_port_init(&port->gs.port);
847 port->gs.port.ops = &rio_port_ops;
845 port->PortNum = i; 848 port->PortNum = i;
846 port->gs.magic = RIO_MAGIC; 849 port->gs.magic = RIO_MAGIC;
847 port->gs.close_delay = HZ / 2; 850 port->gs.close_delay = HZ / 2;
848 port->gs.closing_wait = 30 * HZ; 851 port->gs.closing_wait = 30 * HZ;
849 port->gs.rd = &rio_real_driver; 852 port->gs.rd = &rio_real_driver;
850 spin_lock_init(&port->portSem); 853 spin_lock_init(&port->portSem);
851 /*
852 * Initializing wait queue
853 */
854 init_waitqueue_head(&port->gs.port.open_wait);
855 init_waitqueue_head(&port->gs.port.close_wait);
856 } 854 }
857#else 855#else
858 /* We could postpone initializing them to when they are configured. */ 856 /* We could postpone initializing them to when they are configured. */