aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/i4l
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 16:41:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 16:41:04 -0500
commit21eaab6d19ed43e82ed39c8deb7f192134fb4a0e (patch)
treed995205afdcb7f47462bcd28067dc0c4ab0b7b02 /drivers/isdn/i4l
parent74e1a2a39355b2d3ae8c60c78d8add162c6d7183 (diff)
parent9e17df37d710f8998e9cb10a548304fe33d4a5c2 (diff)
Merge tag 'tty-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial patches from Greg Kroah-Hartman: "Here's the big tty/serial driver patches for 3.9-rc1. More tty port rework and fixes from Jiri here, as well as lots of individual serial driver updates and fixes. All of these have been in the linux-next tree for a while." * tag 'tty-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (140 commits) tty: mxser: improve error handling in mxser_probe() and mxser_module_init() serial: imx: fix uninitialized variable warning serial: tegra: assume CONFIG_OF TTY: do not update atime/mtime on read/write lguest: select CONFIG_TTY to build properly. ARM defconfigs: add missing inclusions of linux/platform_device.h fb/exynos: include platform_device.h ARM: sa1100/assabet: include platform_device.h directly serial: imx: Fix recursive locking bug pps: Fix build breakage from decoupling pps from tty tty: Remove ancient hardpps() pps: Additional cleanups in uart_handle_dcd_change pps: Move timestamp read into PPS code proper pps: Don't crash the machine when exiting will do pps: Fix a use-after free bug when unregistering a source. pps: Use pps_lookup_dev to reduce ldisc coupling pps: Add pps_lookup_dev() function tty: serial: uartlite: Support uartlite on big and little endian systems tty: serial: uartlite: Fix sparse and checkpatch warnings serial/arc-uart: Miscll DT related updates (Grant's review comments) ... Fix up trivial conflicts, mostly just due to the TTY config option clashing with the EXPERIMENTAL removal.
Diffstat (limited to 'drivers/isdn/i4l')
-rw-r--r--drivers/isdn/i4l/isdn_common.c14
-rw-r--r--drivers/isdn/i4l/isdn_common.h2
-rw-r--r--drivers/isdn/i4l/isdn_tty.c59
3 files changed, 35 insertions, 40 deletions
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index e2a945ee9f05..b87d9e577be2 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -876,7 +876,7 @@ isdn_readbchan(int di, int channel, u_char *buf, u_char *fp, int len, wait_queue
876 * of the mapping (di,ch)<->minor, happen during the sleep? --he 876 * of the mapping (di,ch)<->minor, happen during the sleep? --he
877 */ 877 */
878int 878int
879isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack) 879isdn_readbchan_tty(int di, int channel, struct tty_port *port, int cisco_hack)
880{ 880{
881 int count; 881 int count;
882 int count_pull; 882 int count_pull;
@@ -891,7 +891,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
891 if (skb_queue_empty(&dev->drv[di]->rpqueue[channel])) 891 if (skb_queue_empty(&dev->drv[di]->rpqueue[channel]))
892 return 0; 892 return 0;
893 893
894 len = tty_buffer_request_room(tty, dev->drv[di]->rcvcount[channel]); 894 len = tty_buffer_request_room(port, dev->drv[di]->rcvcount[channel]);
895 if (len == 0) 895 if (len == 0)
896 return len; 896 return len;
897 897
@@ -912,7 +912,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
912 while ((count_pull < skb->len) && (len > 0)) { 912 while ((count_pull < skb->len) && (len > 0)) {
913 /* push every character but the last to the tty buffer directly */ 913 /* push every character but the last to the tty buffer directly */
914 if (count_put) 914 if (count_put)
915 tty_insert_flip_char(tty, last, TTY_NORMAL); 915 tty_insert_flip_char(port, last, TTY_NORMAL);
916 len--; 916 len--;
917 if (dev->drv[di]->DLEflag & DLEmask) { 917 if (dev->drv[di]->DLEflag & DLEmask) {
918 last = DLE; 918 last = DLE;
@@ -940,7 +940,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
940 } 940 }
941 count_put = count_pull; 941 count_put = count_pull;
942 if (count_put > 1) 942 if (count_put > 1)
943 tty_insert_flip_string(tty, skb->data, count_put - 1); 943 tty_insert_flip_string(port, skb->data, count_put - 1);
944 last = skb->data[count_put - 1]; 944 last = skb->data[count_put - 1];
945 len -= count_put; 945 len -= count_put;
946#ifdef CONFIG_ISDN_AUDIO 946#ifdef CONFIG_ISDN_AUDIO
@@ -952,16 +952,16 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
952 * Now we can dequeue it. 952 * Now we can dequeue it.
953 */ 953 */
954 if (cisco_hack) 954 if (cisco_hack)
955 tty_insert_flip_char(tty, last, 0xFF); 955 tty_insert_flip_char(port, last, 0xFF);
956 else 956 else
957 tty_insert_flip_char(tty, last, TTY_NORMAL); 957 tty_insert_flip_char(port, last, TTY_NORMAL);
958#ifdef CONFIG_ISDN_AUDIO 958#ifdef CONFIG_ISDN_AUDIO
959 ISDN_AUDIO_SKB_LOCK(skb) = 0; 959 ISDN_AUDIO_SKB_LOCK(skb) = 0;
960#endif 960#endif
961 skb = skb_dequeue(&dev->drv[di]->rpqueue[channel]); 961 skb = skb_dequeue(&dev->drv[di]->rpqueue[channel]);
962 dev_kfree_skb(skb); 962 dev_kfree_skb(skb);
963 } else { 963 } else {
964 tty_insert_flip_char(tty, last, TTY_NORMAL); 964 tty_insert_flip_char(port, last, TTY_NORMAL);
965 /* Not yet emptied this buff, so it 965 /* Not yet emptied this buff, so it
966 * must stay in the queue, for further calls 966 * must stay in the queue, for further calls
967 * but we pull off the data we got until now. 967 * but we pull off the data we got until now.
diff --git a/drivers/isdn/i4l/isdn_common.h b/drivers/isdn/i4l/isdn_common.h
index 9a471f62e1d4..2260ef07ab9c 100644
--- a/drivers/isdn/i4l/isdn_common.h
+++ b/drivers/isdn/i4l/isdn_common.h
@@ -37,7 +37,7 @@ extern void isdn_timer_ctrl(int tf, int onoff);
37extern void isdn_unexclusive_channel(int di, int ch); 37extern void isdn_unexclusive_channel(int di, int ch);
38extern int isdn_getnum(char **); 38extern int isdn_getnum(char **);
39extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *); 39extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *);
40extern int isdn_readbchan_tty(int, int, struct tty_struct *, int); 40extern int isdn_readbchan_tty(int, int, struct tty_port *, int);
41extern int isdn_get_free_channel(int, int, int, int, int, char *); 41extern int isdn_get_free_channel(int, int, int, int, int, char *);
42extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *); 42extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *);
43extern int register_isdn(isdn_if *i); 43extern int register_isdn(isdn_if *i);
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index e09dc8a5e743..d8a7d8323414 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -60,18 +60,14 @@ static int si2bit[8] =
60static int 60static int
61isdn_tty_try_read(modem_info *info, struct sk_buff *skb) 61isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
62{ 62{
63 struct tty_port *port = &info->port;
63 int c; 64 int c;
64 int len; 65 int len;
65 struct tty_struct *tty;
66 char last; 66 char last;
67 67
68 if (!info->online) 68 if (!info->online)
69 return 0; 69 return 0;
70 70
71 tty = info->port.tty;
72 if (!tty)
73 return 0;
74
75 if (!(info->mcr & UART_MCR_RTS)) 71 if (!(info->mcr & UART_MCR_RTS))
76 return 0; 72 return 0;
77 73
@@ -81,7 +77,7 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
81#endif 77#endif
82 ; 78 ;
83 79
84 c = tty_buffer_request_room(tty, len); 80 c = tty_buffer_request_room(port, len);
85 if (c < len) 81 if (c < len)
86 return 0; 82 return 0;
87 83
@@ -91,25 +87,25 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
91 unsigned char *dp = skb->data; 87 unsigned char *dp = skb->data;
92 while (--l) { 88 while (--l) {
93 if (*dp == DLE) 89 if (*dp == DLE)
94 tty_insert_flip_char(tty, DLE, 0); 90 tty_insert_flip_char(port, DLE, 0);
95 tty_insert_flip_char(tty, *dp++, 0); 91 tty_insert_flip_char(port, *dp++, 0);
96 } 92 }
97 if (*dp == DLE) 93 if (*dp == DLE)
98 tty_insert_flip_char(tty, DLE, 0); 94 tty_insert_flip_char(port, DLE, 0);
99 last = *dp; 95 last = *dp;
100 } else { 96 } else {
101#endif 97#endif
102 if (len > 1) 98 if (len > 1)
103 tty_insert_flip_string(tty, skb->data, len - 1); 99 tty_insert_flip_string(port, skb->data, len - 1);
104 last = skb->data[len - 1]; 100 last = skb->data[len - 1];
105#ifdef CONFIG_ISDN_AUDIO 101#ifdef CONFIG_ISDN_AUDIO
106 } 102 }
107#endif 103#endif
108 if (info->emu.mdmreg[REG_CPPP] & BIT_CPPP) 104 if (info->emu.mdmreg[REG_CPPP] & BIT_CPPP)
109 tty_insert_flip_char(tty, last, 0xFF); 105 tty_insert_flip_char(port, last, 0xFF);
110 else 106 else
111 tty_insert_flip_char(tty, last, TTY_NORMAL); 107 tty_insert_flip_char(port, last, TTY_NORMAL);
112 tty_flip_buffer_push(tty); 108 tty_flip_buffer_push(port);
113 kfree_skb(skb); 109 kfree_skb(skb);
114 110
115 return 1; 111 return 1;
@@ -126,7 +122,6 @@ isdn_tty_readmodem(void)
126 int midx; 122 int midx;
127 int i; 123 int i;
128 int r; 124 int r;
129 struct tty_struct *tty;
130 modem_info *info; 125 modem_info *info;
131 126
132 for (i = 0; i < ISDN_MAX_CHANNELS; i++) { 127 for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
@@ -144,20 +139,21 @@ isdn_tty_readmodem(void)
144 if ((info->vonline & 1) && (info->emu.vpar[1])) 139 if ((info->vonline & 1) && (info->emu.vpar[1]))
145 isdn_audio_eval_silence(info); 140 isdn_audio_eval_silence(info);
146#endif 141#endif
147 tty = info->port.tty; 142 if (info->mcr & UART_MCR_RTS) {
148 if (tty) { 143 /* CISCO AsyncPPP Hack */
149 if (info->mcr & UART_MCR_RTS) { 144 if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP))
150 /* CISCO AsyncPPP Hack */ 145 r = isdn_readbchan_tty(info->isdn_driver,
151 if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP)) 146 info->isdn_channel,
152 r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, tty, 0); 147 &info->port, 0);
153 else 148 else
154 r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, tty, 1); 149 r = isdn_readbchan_tty(info->isdn_driver,
155 if (r) 150 info->isdn_channel,
156 tty_flip_buffer_push(tty); 151 &info->port, 1);
157 } else 152 if (r)
158 r = 1; 153 tty_flip_buffer_push(&info->port);
159 } else 154 } else
160 r = 1; 155 r = 1;
156
161 if (r) { 157 if (r) {
162 info->rcvsched = 0; 158 info->rcvsched = 0;
163 resched = 1; 159 resched = 1;
@@ -2229,7 +2225,7 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
2229void 2225void
2230isdn_tty_at_cout(char *msg, modem_info *info) 2226isdn_tty_at_cout(char *msg, modem_info *info)
2231{ 2227{
2232 struct tty_struct *tty; 2228 struct tty_port *port = &info->port;
2233 atemu *m = &info->emu; 2229 atemu *m = &info->emu;
2234 char *p; 2230 char *p;
2235 char c; 2231 char c;
@@ -2246,15 +2242,14 @@ isdn_tty_at_cout(char *msg, modem_info *info)
2246 l = strlen(msg); 2242 l = strlen(msg);
2247 2243
2248 spin_lock_irqsave(&info->readlock, flags); 2244 spin_lock_irqsave(&info->readlock, flags);
2249 tty = info->port.tty; 2245 if (port->flags & ASYNC_CLOSING) {
2250 if ((info->port.flags & ASYNC_CLOSING) || (!tty)) {
2251 spin_unlock_irqrestore(&info->readlock, flags); 2246 spin_unlock_irqrestore(&info->readlock, flags);
2252 return; 2247 return;
2253 } 2248 }
2254 2249
2255 /* use queue instead of direct, if online and */ 2250 /* use queue instead of direct, if online and */
2256 /* data is in queue or buffer is full */ 2251 /* data is in queue or buffer is full */
2257 if (info->online && ((tty_buffer_request_room(tty, l) < l) || 2252 if (info->online && ((tty_buffer_request_room(port, l) < l) ||
2258 !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) { 2253 !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) {
2259 skb = alloc_skb(l, GFP_ATOMIC); 2254 skb = alloc_skb(l, GFP_ATOMIC);
2260 if (!skb) { 2255 if (!skb) {
@@ -2285,7 +2280,7 @@ isdn_tty_at_cout(char *msg, modem_info *info)
2285 if (skb) { 2280 if (skb) {
2286 *sp++ = c; 2281 *sp++ = c;
2287 } else { 2282 } else {
2288 if (tty_insert_flip_char(tty, c, TTY_NORMAL) == 0) 2283 if (tty_insert_flip_char(port, c, TTY_NORMAL) == 0)
2289 break; 2284 break;
2290 } 2285 }
2291 } 2286 }
@@ -2299,7 +2294,7 @@ isdn_tty_at_cout(char *msg, modem_info *info)
2299 2294
2300 } else { 2295 } else {
2301 spin_unlock_irqrestore(&info->readlock, flags); 2296 spin_unlock_irqrestore(&info->readlock, flags);
2302 tty_flip_buffer_push(tty); 2297 tty_flip_buffer_push(port);
2303 } 2298 }
2304} 2299}
2305 2300