diff options
Diffstat (limited to 'drivers/char/vme_scc.c')
-rw-r--r-- | drivers/char/vme_scc.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index 1718b3c481db..0e8234bd0e19 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); | |||
69 | static void scc_enable_tx_interrupts(void * ptr); | 69 | static void scc_enable_tx_interrupts(void * ptr); |
70 | static void scc_disable_rx_interrupts(void * ptr); | 70 | static void scc_disable_rx_interrupts(void * ptr); |
71 | static void scc_enable_rx_interrupts(void * ptr); | 71 | static void scc_enable_rx_interrupts(void * ptr); |
72 | static int scc_get_CD(void * ptr); | 72 | static int scc_carrier_raised(struct tty_port *port); |
73 | static void scc_shutdown_port(void * ptr); | 73 | static void scc_shutdown_port(void * ptr); |
74 | static int scc_set_real_termios(void *ptr); | 74 | static int scc_set_real_termios(void *ptr); |
75 | static void scc_hungup(void *ptr); | 75 | static 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 | ||
131 | static 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,10 +629,10 @@ static void scc_enable_rx_interrupts(void *ptr) | |||
624 | } | 629 | } |
625 | 630 | ||
626 | 631 | ||
627 | static int scc_get_CD(void *ptr) | 632 | static int scc_carrier_raised(struct tty_port *port) |
628 | { | 633 | { |
629 | struct scc_port *port = ptr; | 634 | struct scc_port *sc = container_of(port, struct scc_port, gs.port); |
630 | unsigned channel = port->channel; | 635 | unsigned channel = sc->channel; |
631 | 636 | ||
632 | return !!(scc_last_status_reg[channel] & SR_DCD); | 637 | return !!(scc_last_status_reg[channel] & SR_DCD); |
633 | } | 638 | } |
@@ -638,7 +643,7 @@ static void scc_shutdown_port(void *ptr) | |||
638 | struct scc_port *port = ptr; | 643 | struct scc_port *port = ptr; |
639 | 644 | ||
640 | port->gs.port.flags &= ~ GS_ACTIVE; | 645 | port->gs.port.flags &= ~ GS_ACTIVE; |
641 | if (port->gs.port.tty && port->gs.port.tty->termios->c_cflag & HUPCL) { | 646 | if (port->gs.port.tty && (port->gs.port.tty->termios->c_cflag & HUPCL)) { |
642 | scc_setsignals (port, 0, 0); | 647 | scc_setsignals (port, 0, 0); |
643 | } | 648 | } |
644 | } | 649 | } |
@@ -779,7 +784,7 @@ static void scc_setsignals(struct scc_port *port, int dtr, int rts) | |||
779 | 784 | ||
780 | static void scc_send_xchar(struct tty_struct *tty, char ch) | 785 | static void scc_send_xchar(struct tty_struct *tty, char ch) |
781 | { | 786 | { |
782 | struct scc_port *port = (struct scc_port *)tty->driver_data; | 787 | struct scc_port *port = tty->driver_data; |
783 | 788 | ||
784 | port->x_char = ch; | 789 | port->x_char = ch; |
785 | if (ch) | 790 | if (ch) |
@@ -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 | ||
@@ -906,7 +911,7 @@ static int scc_open (struct tty_struct * tty, struct file * filp) | |||
906 | 911 | ||
907 | static void scc_throttle (struct tty_struct * tty) | 912 | static void scc_throttle (struct tty_struct * tty) |
908 | { | 913 | { |
909 | struct scc_port *port = (struct scc_port *)tty->driver_data; | 914 | struct scc_port *port = tty->driver_data; |
910 | unsigned long flags; | 915 | unsigned long flags; |
911 | SCC_ACCESS_INIT(port); | 916 | SCC_ACCESS_INIT(port); |
912 | 917 | ||
@@ -922,7 +927,7 @@ static void scc_throttle (struct tty_struct * tty) | |||
922 | 927 | ||
923 | static void scc_unthrottle (struct tty_struct * tty) | 928 | static void scc_unthrottle (struct tty_struct * tty) |
924 | { | 929 | { |
925 | struct scc_port *port = (struct scc_port *)tty->driver_data; | 930 | struct scc_port *port = tty->driver_data; |
926 | unsigned long flags; | 931 | unsigned long flags; |
927 | SCC_ACCESS_INIT(port); | 932 | SCC_ACCESS_INIT(port); |
928 | 933 | ||
@@ -945,7 +950,7 @@ static int scc_ioctl(struct tty_struct *tty, struct file *file, | |||
945 | 950 | ||
946 | static int scc_break_ctl(struct tty_struct *tty, int break_state) | 951 | static int scc_break_ctl(struct tty_struct *tty, int break_state) |
947 | { | 952 | { |
948 | struct scc_port *port = (struct scc_port *)tty->driver_data; | 953 | struct scc_port *port = tty->driver_data; |
949 | unsigned long flags; | 954 | unsigned long flags; |
950 | SCC_ACCESS_INIT(port); | 955 | SCC_ACCESS_INIT(port); |
951 | 956 | ||