aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/i4l/isdn_tty.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2013-01-03 09:53:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-16 01:30:15 -0500
commit2e124b4a390ca85325fae75764bef92f0547fa25 (patch)
tree5519fbcdbe954e79b271ea6d31ac5a4dc754c4f5 /drivers/isdn/i4l/isdn_tty.c
parentd6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896 (diff)
TTY: switch tty_flip_buffer_push
Now, we start converting tty buffer functions to actually use tty_port. This will allow us to get rid of the need of tty in many call sites. Only tty_port will needed and hence no more tty_port_tty_get in those paths. Now, the one where most of tty_port_tty_get gets removed: tty_flip_buffer_push. IOW we also closed all the races in drivers not using tty_port_tty_get at all yet. Also we move tty_flip_buffer_push declaration from include/linux/tty.h to include/linux/tty_flip.h to all others while we are changing it anyway. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/isdn/i4l/isdn_tty.c')
-rw-r--r--drivers/isdn/i4l/isdn_tty.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 9bb9986659e4..d8a7d8323414 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -63,16 +63,11 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
63 struct tty_port *port = &info->port; 63 struct tty_port *port = &info->port;
64 int c; 64 int c;
65 int len; 65 int len;
66 struct tty_struct *tty;
67 char last; 66 char last;
68 67
69 if (!info->online) 68 if (!info->online)
70 return 0; 69 return 0;
71 70
72 tty = port->tty;
73 if (!tty)
74 return 0;
75
76 if (!(info->mcr & UART_MCR_RTS)) 71 if (!(info->mcr & UART_MCR_RTS))
77 return 0; 72 return 0;
78 73
@@ -110,7 +105,7 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
110 tty_insert_flip_char(port, last, 0xFF); 105 tty_insert_flip_char(port, last, 0xFF);
111 else 106 else
112 tty_insert_flip_char(port, last, TTY_NORMAL); 107 tty_insert_flip_char(port, last, TTY_NORMAL);
113 tty_flip_buffer_push(tty); 108 tty_flip_buffer_push(port);
114 kfree_skb(skb); 109 kfree_skb(skb);
115 110
116 return 1; 111 return 1;
@@ -127,7 +122,6 @@ isdn_tty_readmodem(void)
127 int midx; 122 int midx;
128 int i; 123 int i;
129 int r; 124 int r;
130 struct tty_struct *tty;
131 modem_info *info; 125 modem_info *info;
132 126
133 for (i = 0; i < ISDN_MAX_CHANNELS; i++) { 127 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
@@ -145,20 +139,21 @@ isdn_tty_readmodem(void)
145 if ((info->vonline & 1) && (info->emu.vpar[1])) 139 if ((info->vonline & 1) && (info->emu.vpar[1]))
146 isdn_audio_eval_silence(info); 140 isdn_audio_eval_silence(info);
147#endif 141#endif
148 tty = info->port.tty; 142 if (info->mcr & UART_MCR_RTS) {
149 if (tty) { 143 /* CISCO AsyncPPP Hack */
150 if (info->mcr & UART_MCR_RTS) { 144 if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP))
151 /* CISCO AsyncPPP Hack */ 145 r = isdn_readbchan_tty(info->isdn_driver,
152 if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP)) 146 info->isdn_channel,
153 r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, &info->port, 0); 147 &info->port, 0);
154 else 148 else
155 r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, &info->port, 1); 149 r = isdn_readbchan_tty(info->isdn_driver,
156 if (r) 150 info->isdn_channel,
157 tty_flip_buffer_push(tty); 151 &info->port, 1);
158 } else 152 if (r)
159 r = 1; 153 tty_flip_buffer_push(&info->port);
160 } else 154 } else
161 r = 1; 155 r = 1;
156
162 if (r) { 157 if (r) {
163 info->rcvsched = 0; 158 info->rcvsched = 0;
164 resched = 1; 159 resched = 1;
@@ -2230,7 +2225,6 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
2230void 2225void
2231isdn_tty_at_cout(char *msg, modem_info *info) 2226isdn_tty_at_cout(char *msg, modem_info *info)
2232{ 2227{
2233 struct tty_struct *tty;
2234 struct tty_port *port = &info->port; 2228 struct tty_port *port = &info->port;
2235 atemu *m = &info->emu; 2229 atemu *m = &info->emu;
2236 char *p; 2230 char *p;
@@ -2248,8 +2242,7 @@ isdn_tty_at_cout(char *msg, modem_info *info)
2248 l = strlen(msg); 2242 l = strlen(msg);
2249 2243
2250 spin_lock_irqsave(&info->readlock, flags); 2244 spin_lock_irqsave(&info->readlock, flags);
2251 tty = port->tty; 2245 if (port->flags & ASYNC_CLOSING) {
2252 if ((port->flags & ASYNC_CLOSING) || (!tty)) {
2253 spin_unlock_irqrestore(&info->readlock, flags); 2246 spin_unlock_irqrestore(&info->readlock, flags);
2254 return; 2247 return;
2255 } 2248 }
@@ -2301,7 +2294,7 @@ isdn_tty_at_cout(char *msg, modem_info *info)
2301 2294
2302 } else { 2295 } else {
2303 spin_unlock_irqrestore(&info->readlock, flags); 2296 spin_unlock_irqrestore(&info->readlock, flags);
2304 tty_flip_buffer_push(tty); 2297 tty_flip_buffer_push(port);
2305 } 2298 }
2306} 2299}
2307 2300