aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/vme_scc.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/vme_scc.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/vme_scc.c')
-rw-r--r--drivers/char/vme_scc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
index 1718b3c481db..d4e1534c0e03 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/char/vme_scc.c
@@ -69,7 +69,7 @@ static void scc_disable_tx_interrupts(void * ptr);
69static void scc_enable_tx_interrupts(void * ptr); 69static void scc_enable_tx_interrupts(void * ptr);
70static void scc_disable_rx_interrupts(void * ptr); 70static void scc_disable_rx_interrupts(void * ptr);
71static void scc_enable_rx_interrupts(void * ptr); 71static void scc_enable_rx_interrupts(void * ptr);
72static int scc_get_CD(void * ptr); 72static int scc_carrier_raised(struct tty_port *port);
73static void scc_shutdown_port(void * ptr); 73static void scc_shutdown_port(void * ptr);
74static int scc_set_real_termios(void *ptr); 74static int scc_set_real_termios(void *ptr);
75static void scc_hungup(void *ptr); 75static void scc_hungup(void *ptr);
@@ -100,7 +100,6 @@ static struct real_driver scc_real_driver = {
100 scc_enable_tx_interrupts, 100 scc_enable_tx_interrupts,
101 scc_disable_rx_interrupts, 101 scc_disable_rx_interrupts,
102 scc_enable_rx_interrupts, 102 scc_enable_rx_interrupts,
103 scc_get_CD,
104 scc_shutdown_port, 103 scc_shutdown_port,
105 scc_set_real_termios, 104 scc_set_real_termios,
106 scc_chars_in_buffer, 105 scc_chars_in_buffer,
@@ -129,6 +128,10 @@ static const struct tty_operations scc_ops = {
129 .break_ctl = scc_break_ctl, 128 .break_ctl = scc_break_ctl,
130}; 129};
131 130
131static const struct tty_port_operations scc_port_ops = {
132 .carrier_raised = scc_carrier_raised,
133};
134
132/*---------------------------------------------------------------------------- 135/*----------------------------------------------------------------------------
133 * vme_scc_init() and support functions 136 * vme_scc_init() and support functions
134 *---------------------------------------------------------------------------*/ 137 *---------------------------------------------------------------------------*/
@@ -176,6 +179,8 @@ static void scc_init_portstructs(void)
176 179
177 for (i = 0; i < 2; i++) { 180 for (i = 0; i < 2; i++) {
178 port = scc_ports + i; 181 port = scc_ports + i;
182 tty_port_init(&port->gs.port);
183 port->gs.port.ops = &scc_port_ops;
179 port->gs.magic = SCC_MAGIC; 184 port->gs.magic = SCC_MAGIC;
180 port->gs.close_delay = HZ/2; 185 port->gs.close_delay = HZ/2;
181 port->gs.closing_wait = 30 * HZ; 186 port->gs.closing_wait = 30 * HZ;
@@ -624,9 +629,9 @@ static void scc_enable_rx_interrupts(void *ptr)
624} 629}
625 630
626 631
627static int scc_get_CD(void *ptr) 632static int scc_carrier_raised(struct tty_port *port)
628{ 633{
629 struct scc_port *port = ptr; 634 struct scc_port *scc = container_of(port, struct scc_port, gs.port);
630 unsigned channel = port->channel; 635 unsigned channel = port->channel;
631 636
632 return !!(scc_last_status_reg[channel] & SR_DCD); 637 return !!(scc_last_status_reg[channel] & SR_DCD);
@@ -896,7 +901,7 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
896 return retval; 901 return retval;
897 } 902 }
898 903
899 port->c_dcd = scc_get_CD (port); 904 port->c_dcd = tty_port_carrier_raised(&port->gs.port);
900 905
901 scc_enable_rx_interrupts(port); 906 scc_enable_rx_interrupts(port);
902 907