aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_gsm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/n_gsm.c')
-rw-r--r--drivers/tty/n_gsm.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index dcc0430a49c8..e0f80ce0cf8f 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1067,9 +1067,9 @@ static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
1067 if ((mlines & TIOCM_CD) == 0 && (dlci->modem_rx & TIOCM_CD)) 1067 if ((mlines & TIOCM_CD) == 0 && (dlci->modem_rx & TIOCM_CD))
1068 if (!(tty->termios.c_cflag & CLOCAL)) 1068 if (!(tty->termios.c_cflag & CLOCAL))
1069 tty_hangup(tty); 1069 tty_hangup(tty);
1070 if (brk & 0x01)
1071 tty_insert_flip_char(tty, 0, TTY_BREAK);
1072 } 1070 }
1071 if (brk & 0x01)
1072 tty_insert_flip_char(&dlci->port, 0, TTY_BREAK);
1073 dlci->modem_rx = mlines; 1073 dlci->modem_rx = mlines;
1074} 1074}
1075 1075
@@ -1137,7 +1137,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen)
1137 1137
1138static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen) 1138static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen)
1139{ 1139{
1140 struct tty_struct *tty; 1140 struct tty_port *port;
1141 unsigned int addr = 0 ; 1141 unsigned int addr = 0 ;
1142 u8 bits; 1142 u8 bits;
1143 int len = clen; 1143 int len = clen;
@@ -1160,19 +1160,18 @@ static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen)
1160 bits = *dp; 1160 bits = *dp;
1161 if ((bits & 1) == 0) 1161 if ((bits & 1) == 0)
1162 return; 1162 return;
1163 /* See if we have an uplink tty */
1164 tty = tty_port_tty_get(&gsm->dlci[addr]->port);
1165 1163
1166 if (tty) { 1164 port = &gsm->dlci[addr]->port;
1167 if (bits & 2) 1165
1168 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 1166 if (bits & 2)
1169 if (bits & 4) 1167 tty_insert_flip_char(port, 0, TTY_OVERRUN);
1170 tty_insert_flip_char(tty, 0, TTY_PARITY); 1168 if (bits & 4)
1171 if (bits & 8) 1169 tty_insert_flip_char(port, 0, TTY_PARITY);
1172 tty_insert_flip_char(tty, 0, TTY_FRAME); 1170 if (bits & 8)
1173 tty_flip_buffer_push(tty); 1171 tty_insert_flip_char(port, 0, TTY_FRAME);
1174 tty_kref_put(tty); 1172
1175 } 1173 tty_flip_buffer_push(port);
1174
1176 gsm_control_reply(gsm, CMD_RLS, data, clen); 1175 gsm_control_reply(gsm, CMD_RLS, data, clen);
1177} 1176}
1178 1177
@@ -1545,36 +1544,37 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int clen)
1545{ 1544{
1546 /* krefs .. */ 1545 /* krefs .. */
1547 struct tty_port *port = &dlci->port; 1546 struct tty_port *port = &dlci->port;
1548 struct tty_struct *tty = tty_port_tty_get(port); 1547 struct tty_struct *tty;
1549 unsigned int modem = 0; 1548 unsigned int modem = 0;
1550 int len = clen; 1549 int len = clen;
1551 1550
1552 if (debug & 16) 1551 if (debug & 16)
1553 pr_debug("%d bytes for tty %p\n", len, tty); 1552 pr_debug("%d bytes for tty\n", len);
1554 if (tty) { 1553 switch (dlci->adaption) {
1555 switch (dlci->adaption) { 1554 /* Unsupported types */
1556 /* Unsupported types */ 1555 /* Packetised interruptible data */
1557 /* Packetised interruptible data */ 1556 case 4:
1558 case 4: 1557 break;
1559 break; 1558 /* Packetised uininterruptible voice/data */
1560 /* Packetised uininterruptible voice/data */ 1559 case 3:
1561 case 3: 1560 break;
1562 break; 1561 /* Asynchronous serial with line state in each frame */
1563 /* Asynchronous serial with line state in each frame */ 1562 case 2:
1564 case 2: 1563 while (gsm_read_ea(&modem, *data++) == 0) {
1565 while (gsm_read_ea(&modem, *data++) == 0) { 1564 len--;
1566 len--; 1565 if (len == 0)
1567 if (len == 0) 1566 return;
1568 return; 1567 }
1569 } 1568 tty = tty_port_tty_get(port);
1569 if (tty) {
1570 gsm_process_modem(tty, dlci, modem, clen); 1570 gsm_process_modem(tty, dlci, modem, clen);
1571 /* Line state will go via DLCI 0 controls only */ 1571 tty_kref_put(tty);
1572 case 1:
1573 default:
1574 tty_insert_flip_string(tty, data, len);
1575 tty_flip_buffer_push(tty);
1576 } 1572 }
1577 tty_kref_put(tty); 1573 /* Line state will go via DLCI 0 controls only */
1574 case 1:
1575 default:
1576 tty_insert_flip_string(port, data, len);
1577 tty_flip_buffer_push(port);
1578 } 1578 }
1579} 1579}
1580 1580