diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-21 05:02:45 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-21 05:02:45 -0400 |
commit | e27772b48df91a954a74b1411b57d83b945a58c7 (patch) | |
tree | ebd4a434d9e3cbd0844109e4469f91daac581b59 /drivers/char | |
parent | d092633bff3b19faffc480fe9810805e7792a029 (diff) | |
parent | 14b395e35d1afdd8019d11b92e28041fad591b71 (diff) |
Merge branch 'linus' into x86/urgent
Diffstat (limited to 'drivers/char')
58 files changed, 1840 insertions, 1970 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 6bff9d87dc57..e991dc85f2fb 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -762,7 +762,7 @@ static int cy_next_channel; /* next minor available */ | |||
762 | /* | 762 | /* |
763 | * This is used to look up the divisor speeds and the timeouts | 763 | * This is used to look up the divisor speeds and the timeouts |
764 | * We're normally limited to 15 distinct baud rates. The extra | 764 | * We're normally limited to 15 distinct baud rates. The extra |
765 | * are accessed via settings in info->flags. | 765 | * are accessed via settings in info->port.flags. |
766 | * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, | 766 | * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, |
767 | * 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | 767 | * 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
768 | * HI VHI | 768 | * HI VHI |
@@ -1003,7 +1003,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip, | |||
1003 | cy_writeb(base_addr + (CyCAR << index), save_xir); | 1003 | cy_writeb(base_addr + (CyCAR << index), save_xir); |
1004 | 1004 | ||
1005 | /* if there is nowhere to put the data, discard it */ | 1005 | /* if there is nowhere to put the data, discard it */ |
1006 | if (info->tty == NULL) { | 1006 | if (info->port.tty == NULL) { |
1007 | if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == | 1007 | if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == |
1008 | CyIVRRxEx) { /* exception */ | 1008 | CyIVRRxEx) { /* exception */ |
1009 | data = readb(base_addr + (CyRDSR << index)); | 1009 | data = readb(base_addr + (CyRDSR << index)); |
@@ -1015,7 +1015,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip, | |||
1015 | goto end; | 1015 | goto end; |
1016 | } | 1016 | } |
1017 | /* there is an open port for this data */ | 1017 | /* there is an open port for this data */ |
1018 | tty = info->tty; | 1018 | tty = info->port.tty; |
1019 | if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == | 1019 | if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == |
1020 | CyIVRRxEx) { /* exception */ | 1020 | CyIVRRxEx) { /* exception */ |
1021 | data = readb(base_addr + (CyRDSR << index)); | 1021 | data = readb(base_addr + (CyRDSR << index)); |
@@ -1041,7 +1041,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip, | |||
1041 | readb(base_addr + (CyRDSR << | 1041 | readb(base_addr + (CyRDSR << |
1042 | index)), TTY_BREAK); | 1042 | index)), TTY_BREAK); |
1043 | info->icount.rx++; | 1043 | info->icount.rx++; |
1044 | if (info->flags & ASYNC_SAK) | 1044 | if (info->port.flags & ASYNC_SAK) |
1045 | do_SAK(tty); | 1045 | do_SAK(tty); |
1046 | } else if (data & CyFRAME) { | 1046 | } else if (data & CyFRAME) { |
1047 | tty_insert_flip_char(tty, | 1047 | tty_insert_flip_char(tty, |
@@ -1145,7 +1145,7 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip, | |||
1145 | goto end; | 1145 | goto end; |
1146 | } | 1146 | } |
1147 | info = &cinfo->ports[channel + chip * 4]; | 1147 | info = &cinfo->ports[channel + chip * 4]; |
1148 | if (info->tty == NULL) { | 1148 | if (info->port.tty == NULL) { |
1149 | cy_writeb(base_addr + (CySRER << index), | 1149 | cy_writeb(base_addr + (CySRER << index), |
1150 | readb(base_addr + (CySRER << index)) & ~CyTxRdy); | 1150 | readb(base_addr + (CySRER << index)) & ~CyTxRdy); |
1151 | goto end; | 1151 | goto end; |
@@ -1190,13 +1190,13 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip, | |||
1190 | } | 1190 | } |
1191 | goto done; | 1191 | goto done; |
1192 | } | 1192 | } |
1193 | if (info->xmit_buf == NULL) { | 1193 | if (info->port.xmit_buf == NULL) { |
1194 | cy_writeb(base_addr + (CySRER << index), | 1194 | cy_writeb(base_addr + (CySRER << index), |
1195 | readb(base_addr + (CySRER << index)) & | 1195 | readb(base_addr + (CySRER << index)) & |
1196 | ~CyTxRdy); | 1196 | ~CyTxRdy); |
1197 | goto done; | 1197 | goto done; |
1198 | } | 1198 | } |
1199 | if (info->tty->stopped || info->tty->hw_stopped) { | 1199 | if (info->port.tty->stopped || info->port.tty->hw_stopped) { |
1200 | cy_writeb(base_addr + (CySRER << index), | 1200 | cy_writeb(base_addr + (CySRER << index), |
1201 | readb(base_addr + (CySRER << index)) & | 1201 | readb(base_addr + (CySRER << index)) & |
1202 | ~CyTxRdy); | 1202 | ~CyTxRdy); |
@@ -1211,7 +1211,7 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip, | |||
1211 | * character. This is necessary because there may not be room | 1211 | * character. This is necessary because there may not be room |
1212 | * for the two chars needed to send a NULL.) | 1212 | * for the two chars needed to send a NULL.) |
1213 | */ | 1213 | */ |
1214 | outch = info->xmit_buf[info->xmit_tail]; | 1214 | outch = info->port.xmit_buf[info->xmit_tail]; |
1215 | if (outch) { | 1215 | if (outch) { |
1216 | info->xmit_cnt--; | 1216 | info->xmit_cnt--; |
1217 | info->xmit_tail = (info->xmit_tail + 1) & | 1217 | info->xmit_tail = (info->xmit_tail + 1) & |
@@ -1232,7 +1232,7 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip, | |||
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | done: | 1234 | done: |
1235 | tty_wakeup(info->tty); | 1235 | tty_wakeup(info->port.tty); |
1236 | end: | 1236 | end: |
1237 | /* end of service */ | 1237 | /* end of service */ |
1238 | cy_writeb(base_addr + (CyTIR << index), save_xir & 0x3f); | 1238 | cy_writeb(base_addr + (CyTIR << index), save_xir & 0x3f); |
@@ -1256,7 +1256,7 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip, | |||
1256 | mdm_change = readb(base_addr + (CyMISR << index)); | 1256 | mdm_change = readb(base_addr + (CyMISR << index)); |
1257 | mdm_status = readb(base_addr + (CyMSVR1 << index)); | 1257 | mdm_status = readb(base_addr + (CyMSVR1 << index)); |
1258 | 1258 | ||
1259 | if (!info->tty) | 1259 | if (!info->port.tty) |
1260 | goto end; | 1260 | goto end; |
1261 | 1261 | ||
1262 | if (mdm_change & CyANY_DELTA) { | 1262 | if (mdm_change & CyANY_DELTA) { |
@@ -1273,29 +1273,29 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip, | |||
1273 | wake_up_interruptible(&info->delta_msr_wait); | 1273 | wake_up_interruptible(&info->delta_msr_wait); |
1274 | } | 1274 | } |
1275 | 1275 | ||
1276 | if ((mdm_change & CyDCD) && (info->flags & ASYNC_CHECK_CD)) { | 1276 | if ((mdm_change & CyDCD) && (info->port.flags & ASYNC_CHECK_CD)) { |
1277 | if (!(mdm_status & CyDCD)) { | 1277 | if (!(mdm_status & CyDCD)) { |
1278 | tty_hangup(info->tty); | 1278 | tty_hangup(info->port.tty); |
1279 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 1279 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
1280 | } | 1280 | } |
1281 | wake_up_interruptible(&info->open_wait); | 1281 | wake_up_interruptible(&info->port.open_wait); |
1282 | } | 1282 | } |
1283 | if ((mdm_change & CyCTS) && (info->flags & ASYNC_CTS_FLOW)) { | 1283 | if ((mdm_change & CyCTS) && (info->port.flags & ASYNC_CTS_FLOW)) { |
1284 | if (info->tty->hw_stopped) { | 1284 | if (info->port.tty->hw_stopped) { |
1285 | if (mdm_status & CyCTS) { | 1285 | if (mdm_status & CyCTS) { |
1286 | /* cy_start isn't used | 1286 | /* cy_start isn't used |
1287 | because... !!! */ | 1287 | because... !!! */ |
1288 | info->tty->hw_stopped = 0; | 1288 | info->port.tty->hw_stopped = 0; |
1289 | cy_writeb(base_addr + (CySRER << index), | 1289 | cy_writeb(base_addr + (CySRER << index), |
1290 | readb(base_addr + (CySRER << index)) | | 1290 | readb(base_addr + (CySRER << index)) | |
1291 | CyTxRdy); | 1291 | CyTxRdy); |
1292 | tty_wakeup(info->tty); | 1292 | tty_wakeup(info->port.tty); |
1293 | } | 1293 | } |
1294 | } else { | 1294 | } else { |
1295 | if (!(mdm_status & CyCTS)) { | 1295 | if (!(mdm_status & CyCTS)) { |
1296 | /* cy_stop isn't used | 1296 | /* cy_stop isn't used |
1297 | because ... !!! */ | 1297 | because ... !!! */ |
1298 | info->tty->hw_stopped = 1; | 1298 | info->port.tty->hw_stopped = 1; |
1299 | cy_writeb(base_addr + (CySRER << index), | 1299 | cy_writeb(base_addr + (CySRER << index), |
1300 | readb(base_addr + (CySRER << index)) & | 1300 | readb(base_addr + (CySRER << index)) & |
1301 | ~CyTxRdy); | 1301 | ~CyTxRdy); |
@@ -1449,7 +1449,7 @@ static void cyz_handle_rx(struct cyclades_port *info, | |||
1449 | struct BUF_CTRL __iomem *buf_ctrl) | 1449 | struct BUF_CTRL __iomem *buf_ctrl) |
1450 | { | 1450 | { |
1451 | struct cyclades_card *cinfo = info->card; | 1451 | struct cyclades_card *cinfo = info->card; |
1452 | struct tty_struct *tty = info->tty; | 1452 | struct tty_struct *tty = info->port.tty; |
1453 | unsigned int char_count; | 1453 | unsigned int char_count; |
1454 | int len; | 1454 | int len; |
1455 | #ifdef BLOCKMOVE | 1455 | #ifdef BLOCKMOVE |
@@ -1542,7 +1542,7 @@ static void cyz_handle_tx(struct cyclades_port *info, | |||
1542 | struct BUF_CTRL __iomem *buf_ctrl) | 1542 | struct BUF_CTRL __iomem *buf_ctrl) |
1543 | { | 1543 | { |
1544 | struct cyclades_card *cinfo = info->card; | 1544 | struct cyclades_card *cinfo = info->card; |
1545 | struct tty_struct *tty = info->tty; | 1545 | struct tty_struct *tty = info->port.tty; |
1546 | u8 data; | 1546 | u8 data; |
1547 | unsigned int char_count; | 1547 | unsigned int char_count; |
1548 | #ifdef BLOCKMOVE | 1548 | #ifdef BLOCKMOVE |
@@ -1585,7 +1585,7 @@ static void cyz_handle_tx(struct cyclades_port *info, | |||
1585 | 1585 | ||
1586 | memcpy_toio((char *)(cinfo->base_addr + tx_bufaddr + | 1586 | memcpy_toio((char *)(cinfo->base_addr + tx_bufaddr + |
1587 | tx_put), | 1587 | tx_put), |
1588 | &info->xmit_buf[info->xmit_tail], | 1588 | &info->port.xmit_buf[info->xmit_tail], |
1589 | small_count); | 1589 | small_count); |
1590 | 1590 | ||
1591 | tx_put = (tx_put + small_count) & (tx_bufsize - 1); | 1591 | tx_put = (tx_put + small_count) & (tx_bufsize - 1); |
@@ -1597,7 +1597,7 @@ static void cyz_handle_tx(struct cyclades_port *info, | |||
1597 | } | 1597 | } |
1598 | #else | 1598 | #else |
1599 | while (info->xmit_cnt && char_count) { | 1599 | while (info->xmit_cnt && char_count) { |
1600 | data = info->xmit_buf[info->xmit_tail]; | 1600 | data = info->port.xmit_buf[info->xmit_tail]; |
1601 | info->xmit_cnt--; | 1601 | info->xmit_cnt--; |
1602 | info->xmit_tail = (info->xmit_tail + 1) & | 1602 | info->xmit_tail = (info->xmit_tail + 1) & |
1603 | (SERIAL_XMIT_SIZE - 1); | 1603 | (SERIAL_XMIT_SIZE - 1); |
@@ -1642,7 +1642,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) | |||
1642 | special_count = 0; | 1642 | special_count = 0; |
1643 | delta_count = 0; | 1643 | delta_count = 0; |
1644 | info = &cinfo->ports[channel]; | 1644 | info = &cinfo->ports[channel]; |
1645 | tty = info->tty; | 1645 | tty = info->port.tty; |
1646 | if (tty == NULL) | 1646 | if (tty == NULL) |
1647 | continue; | 1647 | continue; |
1648 | 1648 | ||
@@ -1668,15 +1668,15 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) | |||
1668 | case C_CM_MDCD: | 1668 | case C_CM_MDCD: |
1669 | info->icount.dcd++; | 1669 | info->icount.dcd++; |
1670 | delta_count++; | 1670 | delta_count++; |
1671 | if (info->flags & ASYNC_CHECK_CD) { | 1671 | if (info->port.flags & ASYNC_CHECK_CD) { |
1672 | if ((fw_ver > 241 ? ((u_long) param) : | 1672 | if ((fw_ver > 241 ? ((u_long) param) : |
1673 | readl(&ch_ctrl->rs_status)) & | 1673 | readl(&ch_ctrl->rs_status)) & |
1674 | C_RS_DCD) { | 1674 | C_RS_DCD) { |
1675 | wake_up_interruptible(&info->open_wait); | 1675 | wake_up_interruptible(&info->port.open_wait); |
1676 | } else { | 1676 | } else { |
1677 | tty_hangup(info->tty); | 1677 | tty_hangup(info->port.tty); |
1678 | wake_up_interruptible(&info->open_wait); | 1678 | wake_up_interruptible(&info->port.open_wait); |
1679 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 1679 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
1680 | } | 1680 | } |
1681 | } | 1681 | } |
1682 | break; | 1682 | break; |
@@ -1814,7 +1814,7 @@ static void cyz_poll(unsigned long arg) | |||
1814 | 1814 | ||
1815 | for (port = 0; port < cinfo->nports; port++) { | 1815 | for (port = 0; port < cinfo->nports; port++) { |
1816 | info = &cinfo->ports[port]; | 1816 | info = &cinfo->ports[port]; |
1817 | tty = info->tty; | 1817 | tty = info->port.tty; |
1818 | buf_ctrl = &(zfw_ctrl->buf_ctrl[port]); | 1818 | buf_ctrl = &(zfw_ctrl->buf_ctrl[port]); |
1819 | 1819 | ||
1820 | if (!info->throttle) | 1820 | if (!info->throttle) |
@@ -1853,22 +1853,22 @@ static int startup(struct cyclades_port *info) | |||
1853 | 1853 | ||
1854 | spin_lock_irqsave(&card->card_lock, flags); | 1854 | spin_lock_irqsave(&card->card_lock, flags); |
1855 | 1855 | ||
1856 | if (info->flags & ASYNC_INITIALIZED) { | 1856 | if (info->port.flags & ASYNC_INITIALIZED) { |
1857 | free_page(page); | 1857 | free_page(page); |
1858 | goto errout; | 1858 | goto errout; |
1859 | } | 1859 | } |
1860 | 1860 | ||
1861 | if (!info->type) { | 1861 | if (!info->type) { |
1862 | if (info->tty) | 1862 | if (info->port.tty) |
1863 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 1863 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
1864 | free_page(page); | 1864 | free_page(page); |
1865 | goto errout; | 1865 | goto errout; |
1866 | } | 1866 | } |
1867 | 1867 | ||
1868 | if (info->xmit_buf) | 1868 | if (info->port.xmit_buf) |
1869 | free_page(page); | 1869 | free_page(page); |
1870 | else | 1870 | else |
1871 | info->xmit_buf = (unsigned char *)page; | 1871 | info->port.xmit_buf = (unsigned char *)page; |
1872 | 1872 | ||
1873 | spin_unlock_irqrestore(&card->card_lock, flags); | 1873 | spin_unlock_irqrestore(&card->card_lock, flags); |
1874 | 1874 | ||
@@ -1909,10 +1909,10 @@ static int startup(struct cyclades_port *info) | |||
1909 | 1909 | ||
1910 | cy_writeb(base_addr + (CySRER << index), | 1910 | cy_writeb(base_addr + (CySRER << index), |
1911 | readb(base_addr + (CySRER << index)) | CyRxData); | 1911 | readb(base_addr + (CySRER << index)) | CyRxData); |
1912 | info->flags |= ASYNC_INITIALIZED; | 1912 | info->port.flags |= ASYNC_INITIALIZED; |
1913 | 1913 | ||
1914 | if (info->tty) | 1914 | if (info->port.tty) |
1915 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 1915 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
1916 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 1916 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
1917 | info->breakon = info->breakoff = 0; | 1917 | info->breakon = info->breakoff = 0; |
1918 | memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); | 1918 | memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); |
@@ -1994,9 +1994,9 @@ static int startup(struct cyclades_port *info) | |||
1994 | 1994 | ||
1995 | /* enable send, recv, modem !!! */ | 1995 | /* enable send, recv, modem !!! */ |
1996 | 1996 | ||
1997 | info->flags |= ASYNC_INITIALIZED; | 1997 | info->port.flags |= ASYNC_INITIALIZED; |
1998 | if (info->tty) | 1998 | if (info->port.tty) |
1999 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 1999 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2000 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 2000 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
2001 | info->breakon = info->breakoff = 0; | 2001 | info->breakon = info->breakoff = 0; |
2002 | memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); | 2002 | memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); |
@@ -2065,7 +2065,7 @@ static void shutdown(struct cyclades_port *info) | |||
2065 | void __iomem *base_addr; | 2065 | void __iomem *base_addr; |
2066 | int chip, channel, index; | 2066 | int chip, channel, index; |
2067 | 2067 | ||
2068 | if (!(info->flags & ASYNC_INITIALIZED)) | 2068 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
2069 | return; | 2069 | return; |
2070 | 2070 | ||
2071 | card = info->card; | 2071 | card = info->card; |
@@ -2087,14 +2087,14 @@ static void shutdown(struct cyclades_port *info) | |||
2087 | /* Clear delta_msr_wait queue to avoid mem leaks. */ | 2087 | /* Clear delta_msr_wait queue to avoid mem leaks. */ |
2088 | wake_up_interruptible(&info->delta_msr_wait); | 2088 | wake_up_interruptible(&info->delta_msr_wait); |
2089 | 2089 | ||
2090 | if (info->xmit_buf) { | 2090 | if (info->port.xmit_buf) { |
2091 | unsigned char *temp; | 2091 | unsigned char *temp; |
2092 | temp = info->xmit_buf; | 2092 | temp = info->port.xmit_buf; |
2093 | info->xmit_buf = NULL; | 2093 | info->port.xmit_buf = NULL; |
2094 | free_page((unsigned long)temp); | 2094 | free_page((unsigned long)temp); |
2095 | } | 2095 | } |
2096 | cy_writeb(base_addr + (CyCAR << index), (u_char) channel); | 2096 | cy_writeb(base_addr + (CyCAR << index), (u_char) channel); |
2097 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) { | 2097 | if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) { |
2098 | cy_writeb(base_addr + (CyMSVR1 << index), ~CyRTS); | 2098 | cy_writeb(base_addr + (CyMSVR1 << index), ~CyRTS); |
2099 | cy_writeb(base_addr + (CyMSVR2 << index), ~CyDTR); | 2099 | cy_writeb(base_addr + (CyMSVR2 << index), ~CyDTR); |
2100 | #ifdef CY_DEBUG_DTR | 2100 | #ifdef CY_DEBUG_DTR |
@@ -2108,9 +2108,9 @@ static void shutdown(struct cyclades_port *info) | |||
2108 | /* it may be appropriate to clear _XMIT at | 2108 | /* it may be appropriate to clear _XMIT at |
2109 | some later date (after testing)!!! */ | 2109 | some later date (after testing)!!! */ |
2110 | 2110 | ||
2111 | if (info->tty) | 2111 | if (info->port.tty) |
2112 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2112 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2113 | info->flags &= ~ASYNC_INITIALIZED; | 2113 | info->port.flags &= ~ASYNC_INITIALIZED; |
2114 | spin_unlock_irqrestore(&card->card_lock, flags); | 2114 | spin_unlock_irqrestore(&card->card_lock, flags); |
2115 | } else { | 2115 | } else { |
2116 | struct FIRM_ID __iomem *firm_id; | 2116 | struct FIRM_ID __iomem *firm_id; |
@@ -2136,14 +2136,14 @@ static void shutdown(struct cyclades_port *info) | |||
2136 | 2136 | ||
2137 | spin_lock_irqsave(&card->card_lock, flags); | 2137 | spin_lock_irqsave(&card->card_lock, flags); |
2138 | 2138 | ||
2139 | if (info->xmit_buf) { | 2139 | if (info->port.xmit_buf) { |
2140 | unsigned char *temp; | 2140 | unsigned char *temp; |
2141 | temp = info->xmit_buf; | 2141 | temp = info->port.xmit_buf; |
2142 | info->xmit_buf = NULL; | 2142 | info->port.xmit_buf = NULL; |
2143 | free_page((unsigned long)temp); | 2143 | free_page((unsigned long)temp); |
2144 | } | 2144 | } |
2145 | 2145 | ||
2146 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) { | 2146 | if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) { |
2147 | cy_writel(&ch_ctrl[channel].rs_control, | 2147 | cy_writel(&ch_ctrl[channel].rs_control, |
2148 | (__u32)(readl(&ch_ctrl[channel].rs_control) & | 2148 | (__u32)(readl(&ch_ctrl[channel].rs_control) & |
2149 | ~(C_RS_RTS | C_RS_DTR))); | 2149 | ~(C_RS_RTS | C_RS_DTR))); |
@@ -2158,9 +2158,9 @@ static void shutdown(struct cyclades_port *info) | |||
2158 | #endif | 2158 | #endif |
2159 | } | 2159 | } |
2160 | 2160 | ||
2161 | if (info->tty) | 2161 | if (info->port.tty) |
2162 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2162 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2163 | info->flags &= ~ASYNC_INITIALIZED; | 2163 | info->port.flags &= ~ASYNC_INITIALIZED; |
2164 | 2164 | ||
2165 | spin_unlock_irqrestore(&card->card_lock, flags); | 2165 | spin_unlock_irqrestore(&card->card_lock, flags); |
2166 | } | 2166 | } |
@@ -2194,10 +2194,10 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2194 | * If the device is in the middle of being closed, then block | 2194 | * If the device is in the middle of being closed, then block |
2195 | * until it's done, and then try again. | 2195 | * until it's done, and then try again. |
2196 | */ | 2196 | */ |
2197 | if (tty_hung_up_p(filp) || (info->flags & ASYNC_CLOSING)) { | 2197 | if (tty_hung_up_p(filp) || (info->port.flags & ASYNC_CLOSING)) { |
2198 | wait_event_interruptible(info->close_wait, | 2198 | wait_event_interruptible(info->port.close_wait, |
2199 | !(info->flags & ASYNC_CLOSING)); | 2199 | !(info->port.flags & ASYNC_CLOSING)); |
2200 | return (info->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; | 2200 | return (info->port.flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; |
2201 | } | 2201 | } |
2202 | 2202 | ||
2203 | /* | 2203 | /* |
@@ -2206,32 +2206,32 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2206 | */ | 2206 | */ |
2207 | if ((filp->f_flags & O_NONBLOCK) || | 2207 | if ((filp->f_flags & O_NONBLOCK) || |
2208 | (tty->flags & (1 << TTY_IO_ERROR))) { | 2208 | (tty->flags & (1 << TTY_IO_ERROR))) { |
2209 | info->flags |= ASYNC_NORMAL_ACTIVE; | 2209 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
2210 | return 0; | 2210 | return 0; |
2211 | } | 2211 | } |
2212 | 2212 | ||
2213 | /* | 2213 | /* |
2214 | * Block waiting for the carrier detect and the line to become | 2214 | * Block waiting for the carrier detect and the line to become |
2215 | * free (i.e., not in use by the callout). While we are in | 2215 | * free (i.e., not in use by the callout). While we are in |
2216 | * this loop, info->count is dropped by one, so that | 2216 | * this loop, info->port.count is dropped by one, so that |
2217 | * cy_close() knows when to free things. We restore it upon | 2217 | * cy_close() knows when to free things. We restore it upon |
2218 | * exit, either normal or abnormal. | 2218 | * exit, either normal or abnormal. |
2219 | */ | 2219 | */ |
2220 | retval = 0; | 2220 | retval = 0; |
2221 | add_wait_queue(&info->open_wait, &wait); | 2221 | add_wait_queue(&info->port.open_wait, &wait); |
2222 | #ifdef CY_DEBUG_OPEN | 2222 | #ifdef CY_DEBUG_OPEN |
2223 | printk(KERN_DEBUG "cyc block_til_ready before block: ttyC%d, " | 2223 | printk(KERN_DEBUG "cyc block_til_ready before block: ttyC%d, " |
2224 | "count = %d\n", info->line, info->count); | 2224 | "count = %d\n", info->line, info->port.count); |
2225 | #endif | 2225 | #endif |
2226 | spin_lock_irqsave(&cinfo->card_lock, flags); | 2226 | spin_lock_irqsave(&cinfo->card_lock, flags); |
2227 | if (!tty_hung_up_p(filp)) | 2227 | if (!tty_hung_up_p(filp)) |
2228 | info->count--; | 2228 | info->port.count--; |
2229 | spin_unlock_irqrestore(&cinfo->card_lock, flags); | 2229 | spin_unlock_irqrestore(&cinfo->card_lock, flags); |
2230 | #ifdef CY_DEBUG_COUNT | 2230 | #ifdef CY_DEBUG_COUNT |
2231 | printk(KERN_DEBUG "cyc block_til_ready: (%d): decrementing count to " | 2231 | printk(KERN_DEBUG "cyc block_til_ready: (%d): decrementing count to " |
2232 | "%d\n", current->pid, info->count); | 2232 | "%d\n", current->pid, info->port.count); |
2233 | #endif | 2233 | #endif |
2234 | info->blocked_open++; | 2234 | info->port.blocked_open++; |
2235 | 2235 | ||
2236 | if (!IS_CYC_Z(*cinfo)) { | 2236 | if (!IS_CYC_Z(*cinfo)) { |
2237 | chip = channel >> 2; | 2237 | chip = channel >> 2; |
@@ -2260,8 +2260,8 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2260 | 2260 | ||
2261 | set_current_state(TASK_INTERRUPTIBLE); | 2261 | set_current_state(TASK_INTERRUPTIBLE); |
2262 | if (tty_hung_up_p(filp) || | 2262 | if (tty_hung_up_p(filp) || |
2263 | !(info->flags & ASYNC_INITIALIZED)) { | 2263 | !(info->port.flags & ASYNC_INITIALIZED)) { |
2264 | retval = ((info->flags & ASYNC_HUP_NOTIFY) ? | 2264 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
2265 | -EAGAIN : -ERESTARTSYS); | 2265 | -EAGAIN : -ERESTARTSYS); |
2266 | break; | 2266 | break; |
2267 | } | 2267 | } |
@@ -2269,7 +2269,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2269 | spin_lock_irqsave(&cinfo->card_lock, flags); | 2269 | spin_lock_irqsave(&cinfo->card_lock, flags); |
2270 | cy_writeb(base_addr + (CyCAR << index), | 2270 | cy_writeb(base_addr + (CyCAR << index), |
2271 | (u_char) channel); | 2271 | (u_char) channel); |
2272 | if (!(info->flags & ASYNC_CLOSING) && (C_CLOCAL(tty) || | 2272 | if (!(info->port.flags & ASYNC_CLOSING) && (C_CLOCAL(tty) || |
2273 | (readb(base_addr + | 2273 | (readb(base_addr + |
2274 | (CyMSVR1 << index)) & CyDCD))) { | 2274 | (CyMSVR1 << index)) & CyDCD))) { |
2275 | spin_unlock_irqrestore(&cinfo->card_lock, flags); | 2275 | spin_unlock_irqrestore(&cinfo->card_lock, flags); |
@@ -2284,7 +2284,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2284 | #ifdef CY_DEBUG_OPEN | 2284 | #ifdef CY_DEBUG_OPEN |
2285 | printk(KERN_DEBUG "cyc block_til_ready blocking: " | 2285 | printk(KERN_DEBUG "cyc block_til_ready blocking: " |
2286 | "ttyC%d, count = %d\n", | 2286 | "ttyC%d, count = %d\n", |
2287 | info->line, info->count); | 2287 | info->line, info->port.count); |
2288 | #endif | 2288 | #endif |
2289 | schedule(); | 2289 | schedule(); |
2290 | } | 2290 | } |
@@ -2298,7 +2298,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2298 | firm_id = base_addr + ID_ADDRESS; | 2298 | firm_id = base_addr + ID_ADDRESS; |
2299 | if (!ISZLOADED(*cinfo)) { | 2299 | if (!ISZLOADED(*cinfo)) { |
2300 | __set_current_state(TASK_RUNNING); | 2300 | __set_current_state(TASK_RUNNING); |
2301 | remove_wait_queue(&info->open_wait, &wait); | 2301 | remove_wait_queue(&info->port.open_wait, &wait); |
2302 | return -EINVAL; | 2302 | return -EINVAL; |
2303 | } | 2303 | } |
2304 | 2304 | ||
@@ -2327,12 +2327,12 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2327 | 2327 | ||
2328 | set_current_state(TASK_INTERRUPTIBLE); | 2328 | set_current_state(TASK_INTERRUPTIBLE); |
2329 | if (tty_hung_up_p(filp) || | 2329 | if (tty_hung_up_p(filp) || |
2330 | !(info->flags & ASYNC_INITIALIZED)) { | 2330 | !(info->port.flags & ASYNC_INITIALIZED)) { |
2331 | retval = ((info->flags & ASYNC_HUP_NOTIFY) ? | 2331 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
2332 | -EAGAIN : -ERESTARTSYS); | 2332 | -EAGAIN : -ERESTARTSYS); |
2333 | break; | 2333 | break; |
2334 | } | 2334 | } |
2335 | if (!(info->flags & ASYNC_CLOSING) && (C_CLOCAL(tty) || | 2335 | if (!(info->port.flags & ASYNC_CLOSING) && (C_CLOCAL(tty) || |
2336 | (readl(&ch_ctrl[channel].rs_status) & | 2336 | (readl(&ch_ctrl[channel].rs_status) & |
2337 | C_RS_DCD))) { | 2337 | C_RS_DCD))) { |
2338 | break; | 2338 | break; |
@@ -2344,28 +2344,28 @@ block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2344 | #ifdef CY_DEBUG_OPEN | 2344 | #ifdef CY_DEBUG_OPEN |
2345 | printk(KERN_DEBUG "cyc block_til_ready blocking: " | 2345 | printk(KERN_DEBUG "cyc block_til_ready blocking: " |
2346 | "ttyC%d, count = %d\n", | 2346 | "ttyC%d, count = %d\n", |
2347 | info->line, info->count); | 2347 | info->line, info->port.count); |
2348 | #endif | 2348 | #endif |
2349 | schedule(); | 2349 | schedule(); |
2350 | } | 2350 | } |
2351 | } | 2351 | } |
2352 | __set_current_state(TASK_RUNNING); | 2352 | __set_current_state(TASK_RUNNING); |
2353 | remove_wait_queue(&info->open_wait, &wait); | 2353 | remove_wait_queue(&info->port.open_wait, &wait); |
2354 | if (!tty_hung_up_p(filp)) { | 2354 | if (!tty_hung_up_p(filp)) { |
2355 | info->count++; | 2355 | info->port.count++; |
2356 | #ifdef CY_DEBUG_COUNT | 2356 | #ifdef CY_DEBUG_COUNT |
2357 | printk(KERN_DEBUG "cyc:block_til_ready (%d): incrementing " | 2357 | printk(KERN_DEBUG "cyc:block_til_ready (%d): incrementing " |
2358 | "count to %d\n", current->pid, info->count); | 2358 | "count to %d\n", current->pid, info->port.count); |
2359 | #endif | 2359 | #endif |
2360 | } | 2360 | } |
2361 | info->blocked_open--; | 2361 | info->port.blocked_open--; |
2362 | #ifdef CY_DEBUG_OPEN | 2362 | #ifdef CY_DEBUG_OPEN |
2363 | printk(KERN_DEBUG "cyc:block_til_ready after blocking: ttyC%d, " | 2363 | printk(KERN_DEBUG "cyc:block_til_ready after blocking: ttyC%d, " |
2364 | "count = %d\n", info->line, info->count); | 2364 | "count = %d\n", info->line, info->port.count); |
2365 | #endif | 2365 | #endif |
2366 | if (retval) | 2366 | if (retval) |
2367 | return retval; | 2367 | return retval; |
2368 | info->flags |= ASYNC_NORMAL_ACTIVE; | 2368 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
2369 | return 0; | 2369 | return 0; |
2370 | } /* block_til_ready */ | 2370 | } /* block_til_ready */ |
2371 | 2371 | ||
@@ -2456,27 +2456,27 @@ static int cy_open(struct tty_struct *tty, struct file *filp) | |||
2456 | printk(KERN_DEBUG "cyc:cy_open ttyC%d\n", info->line); | 2456 | printk(KERN_DEBUG "cyc:cy_open ttyC%d\n", info->line); |
2457 | #endif | 2457 | #endif |
2458 | tty->driver_data = info; | 2458 | tty->driver_data = info; |
2459 | info->tty = tty; | 2459 | info->port.tty = tty; |
2460 | if (serial_paranoia_check(info, tty->name, "cy_open")) | 2460 | if (serial_paranoia_check(info, tty->name, "cy_open")) |
2461 | return -ENODEV; | 2461 | return -ENODEV; |
2462 | 2462 | ||
2463 | #ifdef CY_DEBUG_OPEN | 2463 | #ifdef CY_DEBUG_OPEN |
2464 | printk(KERN_DEBUG "cyc:cy_open ttyC%d, count = %d\n", info->line, | 2464 | printk(KERN_DEBUG "cyc:cy_open ttyC%d, count = %d\n", info->line, |
2465 | info->count); | 2465 | info->port.count); |
2466 | #endif | 2466 | #endif |
2467 | info->count++; | 2467 | info->port.count++; |
2468 | #ifdef CY_DEBUG_COUNT | 2468 | #ifdef CY_DEBUG_COUNT |
2469 | printk(KERN_DEBUG "cyc:cy_open (%d): incrementing count to %d\n", | 2469 | printk(KERN_DEBUG "cyc:cy_open (%d): incrementing count to %d\n", |
2470 | current->pid, info->count); | 2470 | current->pid, info->port.count); |
2471 | #endif | 2471 | #endif |
2472 | 2472 | ||
2473 | /* | 2473 | /* |
2474 | * If the port is the middle of closing, bail out now | 2474 | * If the port is the middle of closing, bail out now |
2475 | */ | 2475 | */ |
2476 | if (tty_hung_up_p(filp) || (info->flags & ASYNC_CLOSING)) { | 2476 | if (tty_hung_up_p(filp) || (info->port.flags & ASYNC_CLOSING)) { |
2477 | wait_event_interruptible(info->close_wait, | 2477 | wait_event_interruptible(info->port.close_wait, |
2478 | !(info->flags & ASYNC_CLOSING)); | 2478 | !(info->port.flags & ASYNC_CLOSING)); |
2479 | return (info->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; | 2479 | return (info->port.flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; |
2480 | } | 2480 | } |
2481 | 2481 | ||
2482 | /* | 2482 | /* |
@@ -2641,9 +2641,9 @@ static void cy_close(struct tty_struct *tty, struct file *filp) | |||
2641 | } | 2641 | } |
2642 | #ifdef CY_DEBUG_OPEN | 2642 | #ifdef CY_DEBUG_OPEN |
2643 | printk(KERN_DEBUG "cyc:cy_close ttyC%d, count = %d\n", info->line, | 2643 | printk(KERN_DEBUG "cyc:cy_close ttyC%d, count = %d\n", info->line, |
2644 | info->count); | 2644 | info->port.count); |
2645 | #endif | 2645 | #endif |
2646 | if ((tty->count == 1) && (info->count != 1)) { | 2646 | if ((tty->count == 1) && (info->port.count != 1)) { |
2647 | /* | 2647 | /* |
2648 | * Uh, oh. tty->count is 1, which means that the tty | 2648 | * Uh, oh. tty->count is 1, which means that the tty |
2649 | * structure will be freed. Info->count should always | 2649 | * structure will be freed. Info->count should always |
@@ -2652,24 +2652,24 @@ static void cy_close(struct tty_struct *tty, struct file *filp) | |||
2652 | * serial port won't be shutdown. | 2652 | * serial port won't be shutdown. |
2653 | */ | 2653 | */ |
2654 | printk(KERN_ERR "cyc:cy_close: bad serial port count; " | 2654 | printk(KERN_ERR "cyc:cy_close: bad serial port count; " |
2655 | "tty->count is 1, info->count is %d\n", info->count); | 2655 | "tty->count is 1, info->port.count is %d\n", info->port.count); |
2656 | info->count = 1; | 2656 | info->port.count = 1; |
2657 | } | 2657 | } |
2658 | #ifdef CY_DEBUG_COUNT | 2658 | #ifdef CY_DEBUG_COUNT |
2659 | printk(KERN_DEBUG "cyc:cy_close at (%d): decrementing count to %d\n", | 2659 | printk(KERN_DEBUG "cyc:cy_close at (%d): decrementing count to %d\n", |
2660 | current->pid, info->count - 1); | 2660 | current->pid, info->port.count - 1); |
2661 | #endif | 2661 | #endif |
2662 | if (--info->count < 0) { | 2662 | if (--info->port.count < 0) { |
2663 | #ifdef CY_DEBUG_COUNT | 2663 | #ifdef CY_DEBUG_COUNT |
2664 | printk(KERN_DEBUG "cyc:cyc_close setting count to 0\n"); | 2664 | printk(KERN_DEBUG "cyc:cyc_close setting count to 0\n"); |
2665 | #endif | 2665 | #endif |
2666 | info->count = 0; | 2666 | info->port.count = 0; |
2667 | } | 2667 | } |
2668 | if (info->count) { | 2668 | if (info->port.count) { |
2669 | spin_unlock_irqrestore(&card->card_lock, flags); | 2669 | spin_unlock_irqrestore(&card->card_lock, flags); |
2670 | return; | 2670 | return; |
2671 | } | 2671 | } |
2672 | info->flags |= ASYNC_CLOSING; | 2672 | info->port.flags |= ASYNC_CLOSING; |
2673 | 2673 | ||
2674 | /* | 2674 | /* |
2675 | * Now we wait for the transmit buffer to clear; and we notify | 2675 | * Now we wait for the transmit buffer to clear; and we notify |
@@ -2677,8 +2677,8 @@ static void cy_close(struct tty_struct *tty, struct file *filp) | |||
2677 | */ | 2677 | */ |
2678 | tty->closing = 1; | 2678 | tty->closing = 1; |
2679 | spin_unlock_irqrestore(&card->card_lock, flags); | 2679 | spin_unlock_irqrestore(&card->card_lock, flags); |
2680 | if (info->closing_wait != CY_CLOSING_WAIT_NONE) | 2680 | if (info->port.closing_wait != CY_CLOSING_WAIT_NONE) |
2681 | tty_wait_until_sent(tty, info->closing_wait); | 2681 | tty_wait_until_sent(tty, info->port.closing_wait); |
2682 | 2682 | ||
2683 | spin_lock_irqsave(&card->card_lock, flags); | 2683 | spin_lock_irqsave(&card->card_lock, flags); |
2684 | 2684 | ||
@@ -2692,7 +2692,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp) | |||
2692 | cy_writeb(base_addr + (CyCAR << index), (u_char) channel); | 2692 | cy_writeb(base_addr + (CyCAR << index), (u_char) channel); |
2693 | cy_writeb(base_addr + (CySRER << index), | 2693 | cy_writeb(base_addr + (CySRER << index), |
2694 | readb(base_addr + (CySRER << index)) & ~CyRxData); | 2694 | readb(base_addr + (CySRER << index)) & ~CyRxData); |
2695 | if (info->flags & ASYNC_INITIALIZED) { | 2695 | if (info->port.flags & ASYNC_INITIALIZED) { |
2696 | /* Waiting for on-board buffers to be empty before | 2696 | /* Waiting for on-board buffers to be empty before |
2697 | closing the port */ | 2697 | closing the port */ |
2698 | spin_unlock_irqrestore(&card->card_lock, flags); | 2698 | spin_unlock_irqrestore(&card->card_lock, flags); |
@@ -2731,18 +2731,18 @@ static void cy_close(struct tty_struct *tty, struct file *filp) | |||
2731 | spin_lock_irqsave(&card->card_lock, flags); | 2731 | spin_lock_irqsave(&card->card_lock, flags); |
2732 | 2732 | ||
2733 | tty->closing = 0; | 2733 | tty->closing = 0; |
2734 | info->tty = NULL; | 2734 | info->port.tty = NULL; |
2735 | if (info->blocked_open) { | 2735 | if (info->port.blocked_open) { |
2736 | spin_unlock_irqrestore(&card->card_lock, flags); | 2736 | spin_unlock_irqrestore(&card->card_lock, flags); |
2737 | if (info->close_delay) { | 2737 | if (info->port.close_delay) { |
2738 | msleep_interruptible(jiffies_to_msecs | 2738 | msleep_interruptible(jiffies_to_msecs |
2739 | (info->close_delay)); | 2739 | (info->port.close_delay)); |
2740 | } | 2740 | } |
2741 | wake_up_interruptible(&info->open_wait); | 2741 | wake_up_interruptible(&info->port.open_wait); |
2742 | spin_lock_irqsave(&card->card_lock, flags); | 2742 | spin_lock_irqsave(&card->card_lock, flags); |
2743 | } | 2743 | } |
2744 | info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); | 2744 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); |
2745 | wake_up_interruptible(&info->close_wait); | 2745 | wake_up_interruptible(&info->port.close_wait); |
2746 | 2746 | ||
2747 | #ifdef CY_DEBUG_OTHER | 2747 | #ifdef CY_DEBUG_OTHER |
2748 | printk(KERN_DEBUG "cyc:cy_close done\n"); | 2748 | printk(KERN_DEBUG "cyc:cy_close done\n"); |
@@ -2777,7 +2777,7 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count) | |||
2777 | if (serial_paranoia_check(info, tty->name, "cy_write")) | 2777 | if (serial_paranoia_check(info, tty->name, "cy_write")) |
2778 | return 0; | 2778 | return 0; |
2779 | 2779 | ||
2780 | if (!info->xmit_buf) | 2780 | if (!info->port.xmit_buf) |
2781 | return 0; | 2781 | return 0; |
2782 | 2782 | ||
2783 | spin_lock_irqsave(&info->card->card_lock, flags); | 2783 | spin_lock_irqsave(&info->card->card_lock, flags); |
@@ -2788,7 +2788,7 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count) | |||
2788 | if (c <= 0) | 2788 | if (c <= 0) |
2789 | break; | 2789 | break; |
2790 | 2790 | ||
2791 | memcpy(info->xmit_buf + info->xmit_head, buf, c); | 2791 | memcpy(info->port.xmit_buf + info->xmit_head, buf, c); |
2792 | info->xmit_head = (info->xmit_head + c) & | 2792 | info->xmit_head = (info->xmit_head + c) & |
2793 | (SERIAL_XMIT_SIZE - 1); | 2793 | (SERIAL_XMIT_SIZE - 1); |
2794 | info->xmit_cnt += c; | 2794 | info->xmit_cnt += c; |
@@ -2826,7 +2826,7 @@ static int cy_put_char(struct tty_struct *tty, unsigned char ch) | |||
2826 | if (serial_paranoia_check(info, tty->name, "cy_put_char")) | 2826 | if (serial_paranoia_check(info, tty->name, "cy_put_char")) |
2827 | return 0; | 2827 | return 0; |
2828 | 2828 | ||
2829 | if (!info->xmit_buf) | 2829 | if (!info->port.xmit_buf) |
2830 | return 0; | 2830 | return 0; |
2831 | 2831 | ||
2832 | spin_lock_irqsave(&info->card->card_lock, flags); | 2832 | spin_lock_irqsave(&info->card->card_lock, flags); |
@@ -2835,7 +2835,7 @@ static int cy_put_char(struct tty_struct *tty, unsigned char ch) | |||
2835 | return 0; | 2835 | return 0; |
2836 | } | 2836 | } |
2837 | 2837 | ||
2838 | info->xmit_buf[info->xmit_head++] = ch; | 2838 | info->port.xmit_buf[info->xmit_head++] = ch; |
2839 | info->xmit_head &= SERIAL_XMIT_SIZE - 1; | 2839 | info->xmit_head &= SERIAL_XMIT_SIZE - 1; |
2840 | info->xmit_cnt++; | 2840 | info->xmit_cnt++; |
2841 | info->idle_stats.xmit_bytes++; | 2841 | info->idle_stats.xmit_bytes++; |
@@ -2860,7 +2860,7 @@ static void cy_flush_chars(struct tty_struct *tty) | |||
2860 | return; | 2860 | return; |
2861 | 2861 | ||
2862 | if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || | 2862 | if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || |
2863 | !info->xmit_buf) | 2863 | !info->port.xmit_buf) |
2864 | return; | 2864 | return; |
2865 | 2865 | ||
2866 | start_xmit(info); | 2866 | start_xmit(info); |
@@ -2988,27 +2988,27 @@ static void set_line_char(struct cyclades_port *info) | |||
2988 | int baud, baud_rate = 0; | 2988 | int baud, baud_rate = 0; |
2989 | int i; | 2989 | int i; |
2990 | 2990 | ||
2991 | if (!info->tty || !info->tty->termios) | 2991 | if (!info->port.tty || !info->port.tty->termios) |
2992 | return; | 2992 | return; |
2993 | 2993 | ||
2994 | if (info->line == -1) | 2994 | if (info->line == -1) |
2995 | return; | 2995 | return; |
2996 | 2996 | ||
2997 | cflag = info->tty->termios->c_cflag; | 2997 | cflag = info->port.tty->termios->c_cflag; |
2998 | iflag = info->tty->termios->c_iflag; | 2998 | iflag = info->port.tty->termios->c_iflag; |
2999 | 2999 | ||
3000 | /* | 3000 | /* |
3001 | * Set up the tty->alt_speed kludge | 3001 | * Set up the tty->alt_speed kludge |
3002 | */ | 3002 | */ |
3003 | if (info->tty) { | 3003 | if (info->port.tty) { |
3004 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 3004 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
3005 | info->tty->alt_speed = 57600; | 3005 | info->port.tty->alt_speed = 57600; |
3006 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 3006 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
3007 | info->tty->alt_speed = 115200; | 3007 | info->port.tty->alt_speed = 115200; |
3008 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) | 3008 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) |
3009 | info->tty->alt_speed = 230400; | 3009 | info->port.tty->alt_speed = 230400; |
3010 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) | 3010 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) |
3011 | info->tty->alt_speed = 460800; | 3011 | info->port.tty->alt_speed = 460800; |
3012 | } | 3012 | } |
3013 | 3013 | ||
3014 | card = info->card; | 3014 | card = info->card; |
@@ -3020,8 +3020,8 @@ static void set_line_char(struct cyclades_port *info) | |||
3020 | index = card->bus_index; | 3020 | index = card->bus_index; |
3021 | 3021 | ||
3022 | /* baud rate */ | 3022 | /* baud rate */ |
3023 | baud = tty_get_baud_rate(info->tty); | 3023 | baud = tty_get_baud_rate(info->port.tty); |
3024 | if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == | 3024 | if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == |
3025 | ASYNC_SPD_CUST) { | 3025 | ASYNC_SPD_CUST) { |
3026 | if (info->custom_divisor) | 3026 | if (info->custom_divisor) |
3027 | baud_rate = info->baud / info->custom_divisor; | 3027 | baud_rate = info->baud / info->custom_divisor; |
@@ -3038,7 +3038,7 @@ static void set_line_char(struct cyclades_port *info) | |||
3038 | if (i == 20) | 3038 | if (i == 20) |
3039 | i = 19; /* CD1400_MAX_SPEED */ | 3039 | i = 19; /* CD1400_MAX_SPEED */ |
3040 | 3040 | ||
3041 | if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == | 3041 | if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == |
3042 | ASYNC_SPD_CUST) { | 3042 | ASYNC_SPD_CUST) { |
3043 | cyy_baud_calc(info, baud_rate); | 3043 | cyy_baud_calc(info, baud_rate); |
3044 | } else { | 3044 | } else { |
@@ -3059,7 +3059,7 @@ static void set_line_char(struct cyclades_port *info) | |||
3059 | /* get it right for 134.5 baud */ | 3059 | /* get it right for 134.5 baud */ |
3060 | info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) + | 3060 | info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) + |
3061 | 2; | 3061 | 2; |
3062 | } else if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == | 3062 | } else if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == |
3063 | ASYNC_SPD_CUST) { | 3063 | ASYNC_SPD_CUST) { |
3064 | info->timeout = (info->xmit_fifo_size * HZ * 15 / | 3064 | info->timeout = (info->xmit_fifo_size * HZ * 15 / |
3065 | baud_rate) + 2; | 3065 | baud_rate) + 2; |
@@ -3108,16 +3108,16 @@ static void set_line_char(struct cyclades_port *info) | |||
3108 | 3108 | ||
3109 | /* CTS flow control flag */ | 3109 | /* CTS flow control flag */ |
3110 | if (cflag & CRTSCTS) { | 3110 | if (cflag & CRTSCTS) { |
3111 | info->flags |= ASYNC_CTS_FLOW; | 3111 | info->port.flags |= ASYNC_CTS_FLOW; |
3112 | info->cor2 |= CyCtsAE; | 3112 | info->cor2 |= CyCtsAE; |
3113 | } else { | 3113 | } else { |
3114 | info->flags &= ~ASYNC_CTS_FLOW; | 3114 | info->port.flags &= ~ASYNC_CTS_FLOW; |
3115 | info->cor2 &= ~CyCtsAE; | 3115 | info->cor2 &= ~CyCtsAE; |
3116 | } | 3116 | } |
3117 | if (cflag & CLOCAL) | 3117 | if (cflag & CLOCAL) |
3118 | info->flags &= ~ASYNC_CHECK_CD; | 3118 | info->port.flags &= ~ASYNC_CHECK_CD; |
3119 | else | 3119 | else |
3120 | info->flags |= ASYNC_CHECK_CD; | 3120 | info->port.flags |= ASYNC_CHECK_CD; |
3121 | 3121 | ||
3122 | /*********************************************** | 3122 | /*********************************************** |
3123 | The hardware option, CyRtsAO, presents RTS when | 3123 | The hardware option, CyRtsAO, presents RTS when |
@@ -3146,8 +3146,8 @@ static void set_line_char(struct cyclades_port *info) | |||
3146 | /* set line characteristics according configuration */ | 3146 | /* set line characteristics according configuration */ |
3147 | 3147 | ||
3148 | cy_writeb(base_addr + (CySCHR1 << index), | 3148 | cy_writeb(base_addr + (CySCHR1 << index), |
3149 | START_CHAR(info->tty)); | 3149 | START_CHAR(info->port.tty)); |
3150 | cy_writeb(base_addr + (CySCHR2 << index), STOP_CHAR(info->tty)); | 3150 | cy_writeb(base_addr + (CySCHR2 << index), STOP_CHAR(info->port.tty)); |
3151 | cy_writeb(base_addr + (CyCOR1 << index), info->cor1); | 3151 | cy_writeb(base_addr + (CyCOR1 << index), info->cor1); |
3152 | cy_writeb(base_addr + (CyCOR2 << index), info->cor2); | 3152 | cy_writeb(base_addr + (CyCOR2 << index), info->cor2); |
3153 | cy_writeb(base_addr + (CyCOR3 << index), info->cor3); | 3153 | cy_writeb(base_addr + (CyCOR3 << index), info->cor3); |
@@ -3163,7 +3163,7 @@ static void set_line_char(struct cyclades_port *info) | |||
3163 | (info->default_timeout ? info->default_timeout : 0x02)); | 3163 | (info->default_timeout ? info->default_timeout : 0x02)); |
3164 | /* 10ms rx timeout */ | 3164 | /* 10ms rx timeout */ |
3165 | 3165 | ||
3166 | if (C_CLOCAL(info->tty)) { | 3166 | if (C_CLOCAL(info->port.tty)) { |
3167 | /* without modem intr */ | 3167 | /* without modem intr */ |
3168 | cy_writeb(base_addr + (CySRER << index), | 3168 | cy_writeb(base_addr + (CySRER << index), |
3169 | readb(base_addr + (CySRER << index)) | CyMdmCh); | 3169 | readb(base_addr + (CySRER << index)) | CyMdmCh); |
@@ -3226,8 +3226,8 @@ static void set_line_char(struct cyclades_port *info) | |||
3226 | #endif | 3226 | #endif |
3227 | } | 3227 | } |
3228 | 3228 | ||
3229 | if (info->tty) | 3229 | if (info->port.tty) |
3230 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 3230 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
3231 | spin_unlock_irqrestore(&card->card_lock, flags); | 3231 | spin_unlock_irqrestore(&card->card_lock, flags); |
3232 | 3232 | ||
3233 | } else { | 3233 | } else { |
@@ -3250,8 +3250,8 @@ static void set_line_char(struct cyclades_port *info) | |||
3250 | buf_ctrl = &zfw_ctrl->buf_ctrl[channel]; | 3250 | buf_ctrl = &zfw_ctrl->buf_ctrl[channel]; |
3251 | 3251 | ||
3252 | /* baud rate */ | 3252 | /* baud rate */ |
3253 | baud = tty_get_baud_rate(info->tty); | 3253 | baud = tty_get_baud_rate(info->port.tty); |
3254 | if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == | 3254 | if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == |
3255 | ASYNC_SPD_CUST) { | 3255 | ASYNC_SPD_CUST) { |
3256 | if (info->custom_divisor) | 3256 | if (info->custom_divisor) |
3257 | baud_rate = info->baud / info->custom_divisor; | 3257 | baud_rate = info->baud / info->custom_divisor; |
@@ -3266,7 +3266,7 @@ static void set_line_char(struct cyclades_port *info) | |||
3266 | /* get it right for 134.5 baud */ | 3266 | /* get it right for 134.5 baud */ |
3267 | info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) + | 3267 | info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) + |
3268 | 2; | 3268 | 2; |
3269 | } else if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == | 3269 | } else if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == |
3270 | ASYNC_SPD_CUST) { | 3270 | ASYNC_SPD_CUST) { |
3271 | info->timeout = (info->xmit_fifo_size * HZ * 15 / | 3271 | info->timeout = (info->xmit_fifo_size * HZ * 15 / |
3272 | baud_rate) + 2; | 3272 | baud_rate) + 2; |
@@ -3318,7 +3318,7 @@ static void set_line_char(struct cyclades_port *info) | |||
3318 | } | 3318 | } |
3319 | /* As the HW flow control is done in firmware, the driver | 3319 | /* As the HW flow control is done in firmware, the driver |
3320 | doesn't need to care about it */ | 3320 | doesn't need to care about it */ |
3321 | info->flags &= ~ASYNC_CTS_FLOW; | 3321 | info->port.flags &= ~ASYNC_CTS_FLOW; |
3322 | 3322 | ||
3323 | /* XON/XOFF/XANY flow control flags */ | 3323 | /* XON/XOFF/XANY flow control flags */ |
3324 | sw_flow = 0; | 3324 | sw_flow = 0; |
@@ -3337,9 +3337,9 @@ static void set_line_char(struct cyclades_port *info) | |||
3337 | 3337 | ||
3338 | /* CD sensitivity */ | 3338 | /* CD sensitivity */ |
3339 | if (cflag & CLOCAL) | 3339 | if (cflag & CLOCAL) |
3340 | info->flags &= ~ASYNC_CHECK_CD; | 3340 | info->port.flags &= ~ASYNC_CHECK_CD; |
3341 | else | 3341 | else |
3342 | info->flags |= ASYNC_CHECK_CD; | 3342 | info->port.flags |= ASYNC_CHECK_CD; |
3343 | 3343 | ||
3344 | if (baud == 0) { /* baud rate is zero, turn off line */ | 3344 | if (baud == 0) { /* baud rate is zero, turn off line */ |
3345 | cy_writel(&ch_ctrl->rs_control, | 3345 | cy_writel(&ch_ctrl->rs_control, |
@@ -3361,8 +3361,8 @@ static void set_line_char(struct cyclades_port *info) | |||
3361 | "was %x\n", info->line, retval); | 3361 | "was %x\n", info->line, retval); |
3362 | } | 3362 | } |
3363 | 3363 | ||
3364 | if (info->tty) | 3364 | if (info->port.tty) |
3365 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 3365 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
3366 | } | 3366 | } |
3367 | } /* set_line_char */ | 3367 | } /* set_line_char */ |
3368 | 3368 | ||
@@ -3381,9 +3381,9 @@ get_serial_info(struct cyclades_port *info, | |||
3381 | tmp.port = (info->card - cy_card) * 0x100 + info->line - | 3381 | tmp.port = (info->card - cy_card) * 0x100 + info->line - |
3382 | cinfo->first_line; | 3382 | cinfo->first_line; |
3383 | tmp.irq = cinfo->irq; | 3383 | tmp.irq = cinfo->irq; |
3384 | tmp.flags = info->flags; | 3384 | tmp.flags = info->port.flags; |
3385 | tmp.close_delay = info->close_delay; | 3385 | tmp.close_delay = info->port.close_delay; |
3386 | tmp.closing_wait = info->closing_wait; | 3386 | tmp.closing_wait = info->port.closing_wait; |
3387 | tmp.baud_base = info->baud; | 3387 | tmp.baud_base = info->baud; |
3388 | tmp.custom_divisor = info->custom_divisor; | 3388 | tmp.custom_divisor = info->custom_divisor; |
3389 | tmp.hub6 = 0; /*!!! */ | 3389 | tmp.hub6 = 0; /*!!! */ |
@@ -3402,13 +3402,13 @@ set_serial_info(struct cyclades_port *info, | |||
3402 | old_info = *info; | 3402 | old_info = *info; |
3403 | 3403 | ||
3404 | if (!capable(CAP_SYS_ADMIN)) { | 3404 | if (!capable(CAP_SYS_ADMIN)) { |
3405 | if (new_serial.close_delay != info->close_delay || | 3405 | if (new_serial.close_delay != info->port.close_delay || |
3406 | new_serial.baud_base != info->baud || | 3406 | new_serial.baud_base != info->baud || |
3407 | (new_serial.flags & ASYNC_FLAGS & | 3407 | (new_serial.flags & ASYNC_FLAGS & |
3408 | ~ASYNC_USR_MASK) != | 3408 | ~ASYNC_USR_MASK) != |
3409 | (info->flags & ASYNC_FLAGS & ~ASYNC_USR_MASK)) | 3409 | (info->port.flags & ASYNC_FLAGS & ~ASYNC_USR_MASK)) |
3410 | return -EPERM; | 3410 | return -EPERM; |
3411 | info->flags = (info->flags & ~ASYNC_USR_MASK) | | 3411 | info->port.flags = (info->port.flags & ~ASYNC_USR_MASK) | |
3412 | (new_serial.flags & ASYNC_USR_MASK); | 3412 | (new_serial.flags & ASYNC_USR_MASK); |
3413 | info->baud = new_serial.baud_base; | 3413 | info->baud = new_serial.baud_base; |
3414 | info->custom_divisor = new_serial.custom_divisor; | 3414 | info->custom_divisor = new_serial.custom_divisor; |
@@ -3422,13 +3422,13 @@ set_serial_info(struct cyclades_port *info, | |||
3422 | 3422 | ||
3423 | info->baud = new_serial.baud_base; | 3423 | info->baud = new_serial.baud_base; |
3424 | info->custom_divisor = new_serial.custom_divisor; | 3424 | info->custom_divisor = new_serial.custom_divisor; |
3425 | info->flags = (info->flags & ~ASYNC_FLAGS) | | 3425 | info->port.flags = (info->port.flags & ~ASYNC_FLAGS) | |
3426 | (new_serial.flags & ASYNC_FLAGS); | 3426 | (new_serial.flags & ASYNC_FLAGS); |
3427 | info->close_delay = new_serial.close_delay * HZ / 100; | 3427 | info->port.close_delay = new_serial.close_delay * HZ / 100; |
3428 | info->closing_wait = new_serial.closing_wait * HZ / 100; | 3428 | info->port.closing_wait = new_serial.closing_wait * HZ / 100; |
3429 | 3429 | ||
3430 | check_and_exit: | 3430 | check_and_exit: |
3431 | if (info->flags & ASYNC_INITIALIZED) { | 3431 | if (info->port.flags & ASYNC_INITIALIZED) { |
3432 | set_line_char(info); | 3432 | set_line_char(info); |
3433 | return 0; | 3433 | return 0; |
3434 | } else { | 3434 | } else { |
@@ -3971,11 +3971,11 @@ cy_ioctl(struct tty_struct *tty, struct file *file, | |||
3971 | break; | 3971 | break; |
3972 | #endif /* CONFIG_CYZ_INTR */ | 3972 | #endif /* CONFIG_CYZ_INTR */ |
3973 | case CYSETWAIT: | 3973 | case CYSETWAIT: |
3974 | info->closing_wait = (unsigned short)arg * HZ / 100; | 3974 | info->port.closing_wait = (unsigned short)arg * HZ / 100; |
3975 | ret_val = 0; | 3975 | ret_val = 0; |
3976 | break; | 3976 | break; |
3977 | case CYGETWAIT: | 3977 | case CYGETWAIT: |
3978 | ret_val = info->closing_wait / (HZ / 100); | 3978 | ret_val = info->port.closing_wait / (HZ / 100); |
3979 | break; | 3979 | break; |
3980 | case TIOCGSERIAL: | 3980 | case TIOCGSERIAL: |
3981 | ret_val = get_serial_info(info, argp); | 3981 | ret_val = get_serial_info(info, argp); |
@@ -4097,7 +4097,7 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
4097 | */ | 4097 | */ |
4098 | if (!(old_termios->c_cflag & CLOCAL) && | 4098 | if (!(old_termios->c_cflag & CLOCAL) && |
4099 | (tty->termios->c_cflag & CLOCAL)) | 4099 | (tty->termios->c_cflag & CLOCAL)) |
4100 | wake_up_interruptible(&info->open_wait); | 4100 | wake_up_interruptible(&info->port.open_wait); |
4101 | #endif | 4101 | #endif |
4102 | } /* cy_set_termios */ | 4102 | } /* cy_set_termios */ |
4103 | 4103 | ||
@@ -4326,14 +4326,14 @@ static void cy_hangup(struct tty_struct *tty) | |||
4326 | 4326 | ||
4327 | cy_flush_buffer(tty); | 4327 | cy_flush_buffer(tty); |
4328 | shutdown(info); | 4328 | shutdown(info); |
4329 | info->count = 0; | 4329 | info->port.count = 0; |
4330 | #ifdef CY_DEBUG_COUNT | 4330 | #ifdef CY_DEBUG_COUNT |
4331 | printk(KERN_DEBUG "cyc:cy_hangup (%d): setting count to 0\n", | 4331 | printk(KERN_DEBUG "cyc:cy_hangup (%d): setting count to 0\n", |
4332 | current->pid); | 4332 | current->pid); |
4333 | #endif | 4333 | #endif |
4334 | info->tty = NULL; | 4334 | info->port.tty = NULL; |
4335 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 4335 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
4336 | wake_up_interruptible(&info->open_wait); | 4336 | wake_up_interruptible(&info->port.open_wait); |
4337 | } /* cy_hangup */ | 4337 | } /* cy_hangup */ |
4338 | 4338 | ||
4339 | /* | 4339 | /* |
@@ -4376,15 +4376,14 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo) | |||
4376 | for (port = cinfo->first_line; port < cinfo->first_line + nports; | 4376 | for (port = cinfo->first_line; port < cinfo->first_line + nports; |
4377 | port++) { | 4377 | port++) { |
4378 | info = &cinfo->ports[port - cinfo->first_line]; | 4378 | info = &cinfo->ports[port - cinfo->first_line]; |
4379 | tty_port_init(&info->port); | ||
4379 | info->magic = CYCLADES_MAGIC; | 4380 | info->magic = CYCLADES_MAGIC; |
4380 | info->card = cinfo; | 4381 | info->card = cinfo; |
4381 | info->line = port; | 4382 | info->line = port; |
4382 | info->flags = STD_COM_FLAGS; | ||
4383 | info->closing_wait = CLOSING_WAIT_DELAY; | ||
4384 | info->close_delay = 5 * HZ / 10; | ||
4385 | 4383 | ||
4386 | init_waitqueue_head(&info->open_wait); | 4384 | info->port.closing_wait = CLOSING_WAIT_DELAY; |
4387 | init_waitqueue_head(&info->close_wait); | 4385 | info->port.close_delay = 5 * HZ / 10; |
4386 | info->port.flags = STD_COM_FLAGS; | ||
4388 | init_completion(&info->shutdown_wait); | 4387 | init_completion(&info->shutdown_wait); |
4389 | init_waitqueue_head(&info->delta_msr_wait); | 4388 | init_waitqueue_head(&info->delta_msr_wait); |
4390 | 4389 | ||
@@ -5237,7 +5236,7 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length, | |||
5237 | for (j = 0; j < cy_card[i].nports; j++) { | 5236 | for (j = 0; j < cy_card[i].nports; j++) { |
5238 | info = &cy_card[i].ports[j]; | 5237 | info = &cy_card[i].ports[j]; |
5239 | 5238 | ||
5240 | if (info->count) | 5239 | if (info->port.count) |
5241 | size = sprintf(buf + len, "%3d %8lu %10lu %8lu " | 5240 | size = sprintf(buf + len, "%3d %8lu %10lu %8lu " |
5242 | "%10lu %8lu %9lu %6ld\n", info->line, | 5241 | "%10lu %8lu %9lu %6ld\n", info->line, |
5243 | (cur_jifs - info->idle_stats.in_use) / | 5242 | (cur_jifs - info->idle_stats.in_use) / |
@@ -5246,7 +5245,8 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length, | |||
5246 | HZ, info->idle_stats.recv_bytes, | 5245 | HZ, info->idle_stats.recv_bytes, |
5247 | (cur_jifs - info->idle_stats.recv_idle)/ | 5246 | (cur_jifs - info->idle_stats.recv_idle)/ |
5248 | HZ, info->idle_stats.overruns, | 5247 | HZ, info->idle_stats.overruns, |
5249 | (long)info->tty->ldisc.num); | 5248 | /* FIXME: double check locking */ |
5249 | (long)info->port.tty->ldisc.ops->num); | ||
5250 | else | 5250 | else |
5251 | size = sprintf(buf + len, "%3d %8lu %10lu %8lu " | 5251 | size = sprintf(buf + len, "%3d %8lu %10lu %8lu " |
5252 | "%10lu %8lu %9lu %6ld\n", | 5252 | "%10lu %8lu %9lu %6ld\n", |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 60a4df7dac12..ac9995f6578b 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -432,7 +432,7 @@ static void pc_close(struct tty_struct *tty, struct file *filp) | |||
432 | spin_unlock_irqrestore(&epca_lock, flags); | 432 | spin_unlock_irqrestore(&epca_lock, flags); |
433 | return; | 433 | return; |
434 | } | 434 | } |
435 | if (ch->count-- > 1) { | 435 | if (ch->port.count-- > 1) { |
436 | /* Begin channel is open more than once */ | 436 | /* Begin channel is open more than once */ |
437 | /* | 437 | /* |
438 | * Return without doing anything. Someone might still | 438 | * Return without doing anything. Someone might still |
@@ -442,19 +442,19 @@ static void pc_close(struct tty_struct *tty, struct file *filp) | |||
442 | return; | 442 | return; |
443 | } | 443 | } |
444 | /* Port open only once go ahead with shutdown & reset */ | 444 | /* Port open only once go ahead with shutdown & reset */ |
445 | BUG_ON(ch->count < 0); | 445 | BUG_ON(ch->port.count < 0); |
446 | 446 | ||
447 | /* | 447 | /* |
448 | * Let the rest of the driver know the channel is being closed. | 448 | * Let the rest of the driver know the channel is being closed. |
449 | * This becomes important if an open is attempted before close | 449 | * This becomes important if an open is attempted before close |
450 | * is finished. | 450 | * is finished. |
451 | */ | 451 | */ |
452 | ch->asyncflags |= ASYNC_CLOSING; | 452 | ch->port.flags |= ASYNC_CLOSING; |
453 | tty->closing = 1; | 453 | tty->closing = 1; |
454 | 454 | ||
455 | spin_unlock_irqrestore(&epca_lock, flags); | 455 | spin_unlock_irqrestore(&epca_lock, flags); |
456 | 456 | ||
457 | if (ch->asyncflags & ASYNC_INITIALIZED) { | 457 | if (ch->port.flags & ASYNC_INITIALIZED) { |
458 | /* Setup an event to indicate when the | 458 | /* Setup an event to indicate when the |
459 | transmit buffer empties */ | 459 | transmit buffer empties */ |
460 | setup_empty_event(tty, ch); | 460 | setup_empty_event(tty, ch); |
@@ -469,17 +469,17 @@ static void pc_close(struct tty_struct *tty, struct file *filp) | |||
469 | spin_lock_irqsave(&epca_lock, flags); | 469 | spin_lock_irqsave(&epca_lock, flags); |
470 | tty->closing = 0; | 470 | tty->closing = 0; |
471 | ch->event = 0; | 471 | ch->event = 0; |
472 | ch->tty = NULL; | 472 | ch->port.tty = NULL; |
473 | spin_unlock_irqrestore(&epca_lock, flags); | 473 | spin_unlock_irqrestore(&epca_lock, flags); |
474 | 474 | ||
475 | if (ch->blocked_open) { | 475 | if (ch->port.blocked_open) { |
476 | if (ch->close_delay) | 476 | if (ch->close_delay) |
477 | msleep_interruptible(jiffies_to_msecs(ch->close_delay)); | 477 | msleep_interruptible(jiffies_to_msecs(ch->close_delay)); |
478 | wake_up_interruptible(&ch->open_wait); | 478 | wake_up_interruptible(&ch->port.open_wait); |
479 | } | 479 | } |
480 | ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED | | 480 | ch->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED | |
481 | ASYNC_CLOSING); | 481 | ASYNC_CLOSING); |
482 | wake_up_interruptible(&ch->close_wait); | 482 | wake_up_interruptible(&ch->port.close_wait); |
483 | } | 483 | } |
484 | } | 484 | } |
485 | 485 | ||
@@ -489,7 +489,7 @@ static void shutdown(struct channel *ch) | |||
489 | struct tty_struct *tty; | 489 | struct tty_struct *tty; |
490 | struct board_chan __iomem *bc; | 490 | struct board_chan __iomem *bc; |
491 | 491 | ||
492 | if (!(ch->asyncflags & ASYNC_INITIALIZED)) | 492 | if (!(ch->port.flags & ASYNC_INITIALIZED)) |
493 | return; | 493 | return; |
494 | 494 | ||
495 | spin_lock_irqsave(&epca_lock, flags); | 495 | spin_lock_irqsave(&epca_lock, flags); |
@@ -504,7 +504,7 @@ static void shutdown(struct channel *ch) | |||
504 | */ | 504 | */ |
505 | if (bc) | 505 | if (bc) |
506 | writeb(0, &bc->idata); | 506 | writeb(0, &bc->idata); |
507 | tty = ch->tty; | 507 | tty = ch->port.tty; |
508 | 508 | ||
509 | /* If we're a modem control device and HUPCL is on, drop RTS & DTR. */ | 509 | /* If we're a modem control device and HUPCL is on, drop RTS & DTR. */ |
510 | if (tty->termios->c_cflag & HUPCL) { | 510 | if (tty->termios->c_cflag & HUPCL) { |
@@ -518,7 +518,7 @@ static void shutdown(struct channel *ch) | |||
518 | * will have to reinitialized. Set a flag to indicate this. | 518 | * will have to reinitialized. Set a flag to indicate this. |
519 | */ | 519 | */ |
520 | /* Prevent future Digi programmed interrupts from coming active */ | 520 | /* Prevent future Digi programmed interrupts from coming active */ |
521 | ch->asyncflags &= ~ASYNC_INITIALIZED; | 521 | ch->port.flags &= ~ASYNC_INITIALIZED; |
522 | spin_unlock_irqrestore(&epca_lock, flags); | 522 | spin_unlock_irqrestore(&epca_lock, flags); |
523 | } | 523 | } |
524 | 524 | ||
@@ -538,12 +538,12 @@ static void pc_hangup(struct tty_struct *tty) | |||
538 | shutdown(ch); | 538 | shutdown(ch); |
539 | 539 | ||
540 | spin_lock_irqsave(&epca_lock, flags); | 540 | spin_lock_irqsave(&epca_lock, flags); |
541 | ch->tty = NULL; | 541 | ch->port.tty = NULL; |
542 | ch->event = 0; | 542 | ch->event = 0; |
543 | ch->count = 0; | 543 | ch->port.count = 0; |
544 | ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED); | 544 | ch->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED); |
545 | spin_unlock_irqrestore(&epca_lock, flags); | 545 | spin_unlock_irqrestore(&epca_lock, flags); |
546 | wake_up_interruptible(&ch->open_wait); | 546 | wake_up_interruptible(&ch->port.open_wait); |
547 | } | 547 | } |
548 | } | 548 | } |
549 | 549 | ||
@@ -795,7 +795,7 @@ static int block_til_ready(struct tty_struct *tty, | |||
795 | unsigned long flags; | 795 | unsigned long flags; |
796 | 796 | ||
797 | if (tty_hung_up_p(filp)) { | 797 | if (tty_hung_up_p(filp)) { |
798 | if (ch->asyncflags & ASYNC_HUP_NOTIFY) | 798 | if (ch->port.flags & ASYNC_HUP_NOTIFY) |
799 | retval = -EAGAIN; | 799 | retval = -EAGAIN; |
800 | else | 800 | else |
801 | retval = -ERESTARTSYS; | 801 | retval = -ERESTARTSYS; |
@@ -806,10 +806,10 @@ static int block_til_ready(struct tty_struct *tty, | |||
806 | * If the device is in the middle of being closed, then block until | 806 | * If the device is in the middle of being closed, then block until |
807 | * it's done, and then try again. | 807 | * it's done, and then try again. |
808 | */ | 808 | */ |
809 | if (ch->asyncflags & ASYNC_CLOSING) { | 809 | if (ch->port.flags & ASYNC_CLOSING) { |
810 | interruptible_sleep_on(&ch->close_wait); | 810 | interruptible_sleep_on(&ch->port.close_wait); |
811 | 811 | ||
812 | if (ch->asyncflags & ASYNC_HUP_NOTIFY) | 812 | if (ch->port.flags & ASYNC_HUP_NOTIFY) |
813 | return -EAGAIN; | 813 | return -EAGAIN; |
814 | else | 814 | else |
815 | return -ERESTARTSYS; | 815 | return -ERESTARTSYS; |
@@ -820,7 +820,7 @@ static int block_til_ready(struct tty_struct *tty, | |||
820 | * If non-blocking mode is set, then make the check up front | 820 | * If non-blocking mode is set, then make the check up front |
821 | * and then exit. | 821 | * and then exit. |
822 | */ | 822 | */ |
823 | ch->asyncflags |= ASYNC_NORMAL_ACTIVE; | 823 | ch->port.flags |= ASYNC_NORMAL_ACTIVE; |
824 | return 0; | 824 | return 0; |
825 | } | 825 | } |
826 | if (tty->termios->c_cflag & CLOCAL) | 826 | if (tty->termios->c_cflag & CLOCAL) |
@@ -828,24 +828,24 @@ static int block_til_ready(struct tty_struct *tty, | |||
828 | /* Block waiting for the carrier detect and the line to become free */ | 828 | /* Block waiting for the carrier detect and the line to become free */ |
829 | 829 | ||
830 | retval = 0; | 830 | retval = 0; |
831 | add_wait_queue(&ch->open_wait, &wait); | 831 | add_wait_queue(&ch->port.open_wait, &wait); |
832 | 832 | ||
833 | spin_lock_irqsave(&epca_lock, flags); | 833 | spin_lock_irqsave(&epca_lock, flags); |
834 | /* We dec count so that pc_close will know when to free things */ | 834 | /* We dec count so that pc_close will know when to free things */ |
835 | if (!tty_hung_up_p(filp)) | 835 | if (!tty_hung_up_p(filp)) |
836 | ch->count--; | 836 | ch->port.count--; |
837 | ch->blocked_open++; | 837 | ch->port.blocked_open++; |
838 | while (1) { | 838 | while (1) { |
839 | set_current_state(TASK_INTERRUPTIBLE); | 839 | set_current_state(TASK_INTERRUPTIBLE); |
840 | if (tty_hung_up_p(filp) || | 840 | if (tty_hung_up_p(filp) || |
841 | !(ch->asyncflags & ASYNC_INITIALIZED)) { | 841 | !(ch->port.flags & ASYNC_INITIALIZED)) { |
842 | if (ch->asyncflags & ASYNC_HUP_NOTIFY) | 842 | if (ch->port.flags & ASYNC_HUP_NOTIFY) |
843 | retval = -EAGAIN; | 843 | retval = -EAGAIN; |
844 | else | 844 | else |
845 | retval = -ERESTARTSYS; | 845 | retval = -ERESTARTSYS; |
846 | break; | 846 | break; |
847 | } | 847 | } |
848 | if (!(ch->asyncflags & ASYNC_CLOSING) && | 848 | if (!(ch->port.flags & ASYNC_CLOSING) && |
849 | (do_clocal || (ch->imodem & ch->dcd))) | 849 | (do_clocal || (ch->imodem & ch->dcd))) |
850 | break; | 850 | break; |
851 | if (signal_pending(current)) { | 851 | if (signal_pending(current)) { |
@@ -864,17 +864,17 @@ static int block_til_ready(struct tty_struct *tty, | |||
864 | } | 864 | } |
865 | 865 | ||
866 | __set_current_state(TASK_RUNNING); | 866 | __set_current_state(TASK_RUNNING); |
867 | remove_wait_queue(&ch->open_wait, &wait); | 867 | remove_wait_queue(&ch->port.open_wait, &wait); |
868 | if (!tty_hung_up_p(filp)) | 868 | if (!tty_hung_up_p(filp)) |
869 | ch->count++; | 869 | ch->port.count++; |
870 | ch->blocked_open--; | 870 | ch->port.blocked_open--; |
871 | 871 | ||
872 | spin_unlock_irqrestore(&epca_lock, flags); | 872 | spin_unlock_irqrestore(&epca_lock, flags); |
873 | 873 | ||
874 | if (retval) | 874 | if (retval) |
875 | return retval; | 875 | return retval; |
876 | 876 | ||
877 | ch->asyncflags |= ASYNC_NORMAL_ACTIVE; | 877 | ch->port.flags |= ASYNC_NORMAL_ACTIVE; |
878 | return 0; | 878 | return 0; |
879 | } | 879 | } |
880 | 880 | ||
@@ -933,7 +933,7 @@ static int pc_open(struct tty_struct *tty, struct file *filp) | |||
933 | * necessary because we do not wish to flush and shutdown the channel | 933 | * necessary because we do not wish to flush and shutdown the channel |
934 | * until the last app holding the channel open, closes it. | 934 | * until the last app holding the channel open, closes it. |
935 | */ | 935 | */ |
936 | ch->count++; | 936 | ch->port.count++; |
937 | /* | 937 | /* |
938 | * Set a kernel structures pointer to our local channel structure. This | 938 | * Set a kernel structures pointer to our local channel structure. This |
939 | * way we can get to it when passed only a tty struct. | 939 | * way we can get to it when passed only a tty struct. |
@@ -957,14 +957,14 @@ static int pc_open(struct tty_struct *tty, struct file *filp) | |||
957 | writew(head, &bc->rout); | 957 | writew(head, &bc->rout); |
958 | 958 | ||
959 | /* Set the channels associated tty structure */ | 959 | /* Set the channels associated tty structure */ |
960 | ch->tty = tty; | 960 | ch->port.tty = tty; |
961 | 961 | ||
962 | /* | 962 | /* |
963 | * The below routine generally sets up parity, baud, flow control | 963 | * The below routine generally sets up parity, baud, flow control |
964 | * issues, etc.... It effect both control flags and input flags. | 964 | * issues, etc.... It effect both control flags and input flags. |
965 | */ | 965 | */ |
966 | epcaparam(tty, ch); | 966 | epcaparam(tty, ch); |
967 | ch->asyncflags |= ASYNC_INITIALIZED; | 967 | ch->port.flags |= ASYNC_INITIALIZED; |
968 | memoff(ch); | 968 | memoff(ch); |
969 | spin_unlock_irqrestore(&epca_lock, flags); | 969 | spin_unlock_irqrestore(&epca_lock, flags); |
970 | 970 | ||
@@ -976,7 +976,7 @@ static int pc_open(struct tty_struct *tty, struct file *filp) | |||
976 | * waiting for the line... | 976 | * waiting for the line... |
977 | */ | 977 | */ |
978 | spin_lock_irqsave(&epca_lock, flags); | 978 | spin_lock_irqsave(&epca_lock, flags); |
979 | ch->tty = tty; | 979 | ch->port.tty = tty; |
980 | globalwinon(ch); | 980 | globalwinon(ch); |
981 | /* Enable Digi Data events */ | 981 | /* Enable Digi Data events */ |
982 | writeb(1, &bc->idata); | 982 | writeb(1, &bc->idata); |
@@ -1017,8 +1017,8 @@ static void __exit epca_module_exit(void) | |||
1017 | } | 1017 | } |
1018 | ch = card_ptr[crd]; | 1018 | ch = card_ptr[crd]; |
1019 | for (count = 0; count < bd->numports; count++, ch++) { | 1019 | for (count = 0; count < bd->numports; count++, ch++) { |
1020 | if (ch && ch->tty) | 1020 | if (ch && ch->port.tty) |
1021 | tty_hangup(ch->tty); | 1021 | tty_hangup(ch->port.tty); |
1022 | } | 1022 | } |
1023 | } | 1023 | } |
1024 | pci_unregister_driver(&epca_driver); | 1024 | pci_unregister_driver(&epca_driver); |
@@ -1427,7 +1427,7 @@ static void post_fep_init(unsigned int crd) | |||
1427 | ch->boardnum = crd; | 1427 | ch->boardnum = crd; |
1428 | ch->channelnum = i; | 1428 | ch->channelnum = i; |
1429 | ch->magic = EPCA_MAGIC; | 1429 | ch->magic = EPCA_MAGIC; |
1430 | ch->tty = NULL; | 1430 | ch->port.tty = NULL; |
1431 | 1431 | ||
1432 | if (shrinkmem) { | 1432 | if (shrinkmem) { |
1433 | fepcmd(ch, SETBUFFER, 32, 0, 0, 0); | 1433 | fepcmd(ch, SETBUFFER, 32, 0, 0, 0); |
@@ -1510,10 +1510,10 @@ static void post_fep_init(unsigned int crd) | |||
1510 | ch->fepstopca = 0; | 1510 | ch->fepstopca = 0; |
1511 | 1511 | ||
1512 | ch->close_delay = 50; | 1512 | ch->close_delay = 50; |
1513 | ch->count = 0; | 1513 | ch->port.count = 0; |
1514 | ch->blocked_open = 0; | 1514 | ch->port.blocked_open = 0; |
1515 | init_waitqueue_head(&ch->open_wait); | 1515 | init_waitqueue_head(&ch->port.open_wait); |
1516 | init_waitqueue_head(&ch->close_wait); | 1516 | init_waitqueue_head(&ch->port.close_wait); |
1517 | 1517 | ||
1518 | spin_unlock_irqrestore(&epca_lock, flags); | 1518 | spin_unlock_irqrestore(&epca_lock, flags); |
1519 | } | 1519 | } |
@@ -1633,15 +1633,15 @@ static void doevent(int crd) | |||
1633 | if (event & MODEMCHG_IND) { | 1633 | if (event & MODEMCHG_IND) { |
1634 | /* A modem signal change has been indicated */ | 1634 | /* A modem signal change has been indicated */ |
1635 | ch->imodem = mstat; | 1635 | ch->imodem = mstat; |
1636 | if (ch->asyncflags & ASYNC_CHECK_CD) { | 1636 | if (ch->port.flags & ASYNC_CHECK_CD) { |
1637 | /* We are now receiving dcd */ | 1637 | /* We are now receiving dcd */ |
1638 | if (mstat & ch->dcd) | 1638 | if (mstat & ch->dcd) |
1639 | wake_up_interruptible(&ch->open_wait); | 1639 | wake_up_interruptible(&ch->port.open_wait); |
1640 | else /* No dcd; hangup */ | 1640 | else /* No dcd; hangup */ |
1641 | pc_sched_event(ch, EPCA_EVENT_HANGUP); | 1641 | pc_sched_event(ch, EPCA_EVENT_HANGUP); |
1642 | } | 1642 | } |
1643 | } | 1643 | } |
1644 | tty = ch->tty; | 1644 | tty = ch->port.tty; |
1645 | if (tty) { | 1645 | if (tty) { |
1646 | if (event & BREAK_IND) { | 1646 | if (event & BREAK_IND) { |
1647 | /* A break has been indicated */ | 1647 | /* A break has been indicated */ |
@@ -1880,9 +1880,9 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch) | |||
1880 | * that the driver will wait on carrier detect. | 1880 | * that the driver will wait on carrier detect. |
1881 | */ | 1881 | */ |
1882 | if (ts->c_cflag & CLOCAL) | 1882 | if (ts->c_cflag & CLOCAL) |
1883 | ch->asyncflags &= ~ASYNC_CHECK_CD; | 1883 | ch->port.flags &= ~ASYNC_CHECK_CD; |
1884 | else | 1884 | else |
1885 | ch->asyncflags |= ASYNC_CHECK_CD; | 1885 | ch->port.flags |= ASYNC_CHECK_CD; |
1886 | mval = ch->m_dtr | ch->m_rts; | 1886 | mval = ch->m_dtr | ch->m_rts; |
1887 | } /* End CBAUD not detected */ | 1887 | } /* End CBAUD not detected */ |
1888 | iflag = termios2digi_i(ch, ts->c_iflag); | 1888 | iflag = termios2digi_i(ch, ts->c_iflag); |
@@ -1972,7 +1972,7 @@ static void receive_data(struct channel *ch) | |||
1972 | globalwinon(ch); | 1972 | globalwinon(ch); |
1973 | if (ch->statusflags & RXSTOPPED) | 1973 | if (ch->statusflags & RXSTOPPED) |
1974 | return; | 1974 | return; |
1975 | tty = ch->tty; | 1975 | tty = ch->port.tty; |
1976 | if (tty) | 1976 | if (tty) |
1977 | ts = tty->termios; | 1977 | ts = tty->termios; |
1978 | bc = ch->brdchan; | 1978 | bc = ch->brdchan; |
@@ -2032,7 +2032,7 @@ static void receive_data(struct channel *ch) | |||
2032 | globalwinon(ch); | 2032 | globalwinon(ch); |
2033 | writew(tail, &bc->rout); | 2033 | writew(tail, &bc->rout); |
2034 | /* Must be called with global data */ | 2034 | /* Must be called with global data */ |
2035 | tty_schedule_flip(ch->tty); | 2035 | tty_schedule_flip(ch->port.tty); |
2036 | } | 2036 | } |
2037 | 2037 | ||
2038 | static int info_ioctl(struct tty_struct *tty, struct file *file, | 2038 | static int info_ioctl(struct tty_struct *tty, struct file *file, |
@@ -2262,8 +2262,8 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file, | |||
2262 | tty_wait_until_sent(tty, 0); | 2262 | tty_wait_until_sent(tty, 0); |
2263 | } else { | 2263 | } else { |
2264 | /* ldisc lock already held in ioctl */ | 2264 | /* ldisc lock already held in ioctl */ |
2265 | if (tty->ldisc.flush_buffer) | 2265 | if (tty->ldisc.ops->flush_buffer) |
2266 | tty->ldisc.flush_buffer(tty); | 2266 | tty->ldisc.ops->flush_buffer(tty); |
2267 | } | 2267 | } |
2268 | unlock_kernel(); | 2268 | unlock_kernel(); |
2269 | /* Fall Thru */ | 2269 | /* Fall Thru */ |
@@ -2376,7 +2376,7 @@ static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
2376 | 2376 | ||
2377 | if (!(old_termios->c_cflag & CLOCAL) && | 2377 | if (!(old_termios->c_cflag & CLOCAL) && |
2378 | (tty->termios->c_cflag & CLOCAL)) | 2378 | (tty->termios->c_cflag & CLOCAL)) |
2379 | wake_up_interruptible(&ch->open_wait); | 2379 | wake_up_interruptible(&ch->port.open_wait); |
2380 | 2380 | ||
2381 | } /* End if channel valid */ | 2381 | } /* End if channel valid */ |
2382 | } | 2382 | } |
@@ -2386,13 +2386,13 @@ static void do_softint(struct work_struct *work) | |||
2386 | struct channel *ch = container_of(work, struct channel, tqueue); | 2386 | struct channel *ch = container_of(work, struct channel, tqueue); |
2387 | /* Called in response to a modem change event */ | 2387 | /* Called in response to a modem change event */ |
2388 | if (ch && ch->magic == EPCA_MAGIC) { | 2388 | if (ch && ch->magic == EPCA_MAGIC) { |
2389 | struct tty_struct *tty = ch->tty; | 2389 | struct tty_struct *tty = ch->port.tty; |
2390 | 2390 | ||
2391 | if (tty && tty->driver_data) { | 2391 | if (tty && tty->driver_data) { |
2392 | if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) { | 2392 | if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) { |
2393 | tty_hangup(tty); | 2393 | tty_hangup(tty); |
2394 | wake_up_interruptible(&ch->open_wait); | 2394 | wake_up_interruptible(&ch->port.open_wait); |
2395 | ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; | 2395 | ch->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
2396 | } | 2396 | } |
2397 | } | 2397 | } |
2398 | } | 2398 | } |
diff --git a/drivers/char/epca.h b/drivers/char/epca.h index 3c77c02b5d65..d414bf2dbf7c 100644 --- a/drivers/char/epca.h +++ b/drivers/char/epca.h | |||
@@ -84,6 +84,7 @@ static char *board_desc[] = | |||
84 | struct channel | 84 | struct channel |
85 | { | 85 | { |
86 | long magic; | 86 | long magic; |
87 | struct tty_port port; | ||
87 | unsigned char boardnum; | 88 | unsigned char boardnum; |
88 | unsigned char channelnum; | 89 | unsigned char channelnum; |
89 | unsigned char omodem; /* FEP output modem status */ | 90 | unsigned char omodem; /* FEP output modem status */ |
@@ -117,10 +118,7 @@ struct channel | |||
117 | unsigned short rxbufhead; | 118 | unsigned short rxbufhead; |
118 | unsigned short rxbufsize; | 119 | unsigned short rxbufsize; |
119 | int close_delay; | 120 | int close_delay; |
120 | int count; | ||
121 | int blocked_open; | ||
122 | unsigned long event; | 121 | unsigned long event; |
123 | int asyncflags; | ||
124 | uint dev; | 122 | uint dev; |
125 | unsigned long statusflags; | 123 | unsigned long statusflags; |
126 | unsigned long c_iflag; | 124 | unsigned long c_iflag; |
@@ -132,9 +130,6 @@ struct channel | |||
132 | struct board_info *board; | 130 | struct board_info *board; |
133 | struct board_chan __iomem *brdchan; | 131 | struct board_chan __iomem *brdchan; |
134 | struct digi_struct digiext; | 132 | struct digi_struct digiext; |
135 | struct tty_struct *tty; | ||
136 | wait_queue_head_t open_wait; | ||
137 | wait_queue_head_t close_wait; | ||
138 | struct work_struct tqueue; | 133 | struct work_struct tqueue; |
139 | struct global_data __iomem *mailbox; | 134 | struct global_data __iomem *mailbox; |
140 | }; | 135 | }; |
diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 84840ba13ff0..2eaf09f93e3d 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c | |||
@@ -128,9 +128,9 @@ static struct tty_driver *esp_driver; | |||
128 | 128 | ||
129 | #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) | 129 | #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) |
130 | #define DBG_CNT(s) printk(KERN_DEBUG "(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ | 130 | #define DBG_CNT(s) printk(KERN_DEBUG "(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ |
131 | tty->name, info->flags, \ | 131 | tty->name, info->port.flags, \ |
132 | serial_driver.refcount, \ | 132 | serial_driver.refcount, \ |
133 | info->count, tty->count, s) | 133 | info->port.count, tty->count, s) |
134 | #else | 134 | #else |
135 | #define DBG_CNT(s) | 135 | #define DBG_CNT(s) |
136 | #endif | 136 | #endif |
@@ -172,13 +172,13 @@ static inline int serial_paranoia_check(struct esp_struct *info, | |||
172 | 172 | ||
173 | static inline unsigned int serial_in(struct esp_struct *info, int offset) | 173 | static inline unsigned int serial_in(struct esp_struct *info, int offset) |
174 | { | 174 | { |
175 | return inb(info->port + offset); | 175 | return inb(info->io_port + offset); |
176 | } | 176 | } |
177 | 177 | ||
178 | static inline void serial_out(struct esp_struct *info, int offset, | 178 | static inline void serial_out(struct esp_struct *info, int offset, |
179 | unsigned char value) | 179 | unsigned char value) |
180 | { | 180 | { |
181 | outb(value, info->port+offset); | 181 | outb(value, info->io_port+offset); |
182 | } | 182 | } |
183 | 183 | ||
184 | /* | 184 | /* |
@@ -273,7 +273,7 @@ static inline void release_pio_buffer(struct esp_pio_buffer *buf) | |||
273 | 273 | ||
274 | static inline void receive_chars_pio(struct esp_struct *info, int num_bytes) | 274 | static inline void receive_chars_pio(struct esp_struct *info, int num_bytes) |
275 | { | 275 | { |
276 | struct tty_struct *tty = info->tty; | 276 | struct tty_struct *tty = info->port.tty; |
277 | int i; | 277 | int i; |
278 | struct esp_pio_buffer *pio_buf; | 278 | struct esp_pio_buffer *pio_buf; |
279 | struct esp_pio_buffer *err_buf; | 279 | struct esp_pio_buffer *err_buf; |
@@ -295,7 +295,7 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes) | |||
295 | 295 | ||
296 | for (i = 0; i < num_bytes - 1; i += 2) { | 296 | for (i = 0; i < num_bytes - 1; i += 2) { |
297 | *((unsigned short *)(pio_buf->data + i)) = | 297 | *((unsigned short *)(pio_buf->data + i)) = |
298 | inw(info->port + UART_ESI_RX); | 298 | inw(info->io_port + UART_ESI_RX); |
299 | err_buf->data[i] = serial_in(info, UART_ESI_RWS); | 299 | err_buf->data[i] = serial_in(info, UART_ESI_RWS); |
300 | err_buf->data[i + 1] = (err_buf->data[i] >> 3) & status_mask; | 300 | err_buf->data[i + 1] = (err_buf->data[i] >> 3) & status_mask; |
301 | err_buf->data[i] &= status_mask; | 301 | err_buf->data[i] &= status_mask; |
@@ -308,7 +308,7 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes) | |||
308 | } | 308 | } |
309 | 309 | ||
310 | /* make sure everything is still ok since interrupts were enabled */ | 310 | /* make sure everything is still ok since interrupts were enabled */ |
311 | tty = info->tty; | 311 | tty = info->port.tty; |
312 | 312 | ||
313 | if (!tty) { | 313 | if (!tty) { |
314 | release_pio_buffer(pio_buf); | 314 | release_pio_buffer(pio_buf); |
@@ -325,7 +325,7 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes) | |||
325 | 325 | ||
326 | if (err_buf->data[i] & 0x04) { | 326 | if (err_buf->data[i] & 0x04) { |
327 | flag = TTY_BREAK; | 327 | flag = TTY_BREAK; |
328 | if (info->flags & ASYNC_SAK) | 328 | if (info->port.flags & ASYNC_SAK) |
329 | do_SAK(tty); | 329 | do_SAK(tty); |
330 | } else if (err_buf->data[i] & 0x02) | 330 | } else if (err_buf->data[i] & 0x02) |
331 | flag = TTY_FRAME; | 331 | flag = TTY_FRAME; |
@@ -370,7 +370,7 @@ static void receive_chars_dma(struct esp_struct *info, int num_bytes) | |||
370 | static inline void receive_chars_dma_done(struct esp_struct *info, | 370 | static inline void receive_chars_dma_done(struct esp_struct *info, |
371 | int status) | 371 | int status) |
372 | { | 372 | { |
373 | struct tty_struct *tty = info->tty; | 373 | struct tty_struct *tty = info->port.tty; |
374 | int num_bytes; | 374 | int num_bytes; |
375 | unsigned long flags; | 375 | unsigned long flags; |
376 | 376 | ||
@@ -396,7 +396,7 @@ static inline void receive_chars_dma_done(struct esp_struct *info, | |||
396 | if (status & 0x10) { | 396 | if (status & 0x10) { |
397 | statflag = TTY_BREAK; | 397 | statflag = TTY_BREAK; |
398 | (info->icount.brk)++; | 398 | (info->icount.brk)++; |
399 | if (info->flags & ASYNC_SAK) | 399 | if (info->port.flags & ASYNC_SAK) |
400 | do_SAK(tty); | 400 | do_SAK(tty); |
401 | } else if (status & 0x08) { | 401 | } else if (status & 0x08) { |
402 | statflag = TTY_FRAME; | 402 | statflag = TTY_FRAME; |
@@ -451,7 +451,7 @@ static inline void transmit_chars_pio(struct esp_struct *info, | |||
451 | 451 | ||
452 | for (i = 0; i < space_avail - 1; i += 2) { | 452 | for (i = 0; i < space_avail - 1; i += 2) { |
453 | outw(*((unsigned short *)(pio_buf->data + i)), | 453 | outw(*((unsigned short *)(pio_buf->data + i)), |
454 | info->port + UART_ESI_TX); | 454 | info->io_port + UART_ESI_TX); |
455 | } | 455 | } |
456 | 456 | ||
457 | if (space_avail & 0x0001) | 457 | if (space_avail & 0x0001) |
@@ -470,8 +470,8 @@ static inline void transmit_chars_pio(struct esp_struct *info, | |||
470 | } | 470 | } |
471 | 471 | ||
472 | if (info->xmit_cnt < WAKEUP_CHARS) { | 472 | if (info->xmit_cnt < WAKEUP_CHARS) { |
473 | if (info->tty) | 473 | if (info->port.tty) |
474 | tty_wakeup(info->tty); | 474 | tty_wakeup(info->port.tty); |
475 | 475 | ||
476 | #ifdef SERIAL_DEBUG_INTR | 476 | #ifdef SERIAL_DEBUG_INTR |
477 | printk("THRE..."); | 477 | printk("THRE..."); |
@@ -507,8 +507,8 @@ static inline void transmit_chars_dma(struct esp_struct *info, int num_bytes) | |||
507 | info->xmit_tail = (info->xmit_tail + dma_bytes) & (ESP_XMIT_SIZE - 1); | 507 | info->xmit_tail = (info->xmit_tail + dma_bytes) & (ESP_XMIT_SIZE - 1); |
508 | 508 | ||
509 | if (info->xmit_cnt < WAKEUP_CHARS) { | 509 | if (info->xmit_cnt < WAKEUP_CHARS) { |
510 | if (info->tty) | 510 | if (info->port.tty) |
511 | tty_wakeup(info->tty); | 511 | tty_wakeup(info->port.tty); |
512 | 512 | ||
513 | #ifdef SERIAL_DEBUG_INTR | 513 | #ifdef SERIAL_DEBUG_INTR |
514 | printk("THRE..."); | 514 | printk("THRE..."); |
@@ -575,18 +575,18 @@ static void check_modem_status(struct esp_struct *info) | |||
575 | wake_up_interruptible(&info->delta_msr_wait); | 575 | wake_up_interruptible(&info->delta_msr_wait); |
576 | } | 576 | } |
577 | 577 | ||
578 | if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { | 578 | if ((info->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { |
579 | #if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR)) | 579 | #if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR)) |
580 | printk("ttys%d CD now %s...", info->line, | 580 | printk("ttys%d CD now %s...", info->line, |
581 | (status & UART_MSR_DCD) ? "on" : "off"); | 581 | (status & UART_MSR_DCD) ? "on" : "off"); |
582 | #endif | 582 | #endif |
583 | if (status & UART_MSR_DCD) | 583 | if (status & UART_MSR_DCD) |
584 | wake_up_interruptible(&info->open_wait); | 584 | wake_up_interruptible(&info->port.open_wait); |
585 | else { | 585 | else { |
586 | #ifdef SERIAL_DEBUG_OPEN | 586 | #ifdef SERIAL_DEBUG_OPEN |
587 | printk("scheduling hangup..."); | 587 | printk("scheduling hangup..."); |
588 | #endif | 588 | #endif |
589 | tty_hangup(info->tty); | 589 | tty_hangup(info->port.tty); |
590 | } | 590 | } |
591 | } | 591 | } |
592 | } | 592 | } |
@@ -609,7 +609,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id) | |||
609 | 609 | ||
610 | spin_lock(&info->lock); | 610 | spin_lock(&info->lock); |
611 | 611 | ||
612 | if (!info->tty) { | 612 | if (!info->port.tty) { |
613 | spin_unlock(&info->lock); | 613 | spin_unlock(&info->lock); |
614 | return IRQ_NONE; | 614 | return IRQ_NONE; |
615 | } | 615 | } |
@@ -647,7 +647,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id) | |||
647 | num_bytes = serial_in(info, UART_ESI_STAT1) << 8; | 647 | num_bytes = serial_in(info, UART_ESI_STAT1) << 8; |
648 | num_bytes |= serial_in(info, UART_ESI_STAT2); | 648 | num_bytes |= serial_in(info, UART_ESI_STAT2); |
649 | 649 | ||
650 | num_bytes = tty_buffer_request_room(info->tty, num_bytes); | 650 | num_bytes = tty_buffer_request_room(info->port.tty, num_bytes); |
651 | 651 | ||
652 | if (num_bytes) { | 652 | if (num_bytes) { |
653 | if (dma_bytes || | 653 | if (dma_bytes || |
@@ -661,7 +661,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id) | |||
661 | 661 | ||
662 | if (!(info->stat_flags & (ESP_STAT_DMA_RX | ESP_STAT_DMA_TX)) && | 662 | if (!(info->stat_flags & (ESP_STAT_DMA_RX | ESP_STAT_DMA_TX)) && |
663 | (scratch & 0x02) && (info->IER & UART_IER_THRI)) { | 663 | (scratch & 0x02) && (info->IER & UART_IER_THRI)) { |
664 | if ((info->xmit_cnt <= 0) || info->tty->stopped) { | 664 | if ((info->xmit_cnt <= 0) || info->port.tty->stopped) { |
665 | info->IER &= ~UART_IER_THRI; | 665 | info->IER &= ~UART_IER_THRI; |
666 | serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); | 666 | serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); |
667 | serial_out(info, UART_ESI_CMD2, info->IER); | 667 | serial_out(info, UART_ESI_CMD2, info->IER); |
@@ -782,7 +782,7 @@ static int startup(struct esp_struct *info) | |||
782 | 782 | ||
783 | spin_lock_irqsave(&info->lock, flags); | 783 | spin_lock_irqsave(&info->lock, flags); |
784 | 784 | ||
785 | if (info->flags & ASYNC_INITIALIZED) | 785 | if (info->port.flags & ASYNC_INITIALIZED) |
786 | goto out; | 786 | goto out; |
787 | 787 | ||
788 | if (!info->xmit_buf) { | 788 | if (!info->xmit_buf) { |
@@ -806,7 +806,7 @@ static int startup(struct esp_struct *info) | |||
806 | num_chars |= serial_in(info, UART_ESI_STAT2); | 806 | num_chars |= serial_in(info, UART_ESI_STAT2); |
807 | 807 | ||
808 | while (num_chars > 1) { | 808 | while (num_chars > 1) { |
809 | inw(info->port + UART_ESI_RX); | 809 | inw(info->io_port + UART_ESI_RX); |
810 | num_chars -= 2; | 810 | num_chars -= 2; |
811 | } | 811 | } |
812 | 812 | ||
@@ -834,9 +834,9 @@ static int startup(struct esp_struct *info) | |||
834 | 834 | ||
835 | if (retval) { | 835 | if (retval) { |
836 | if (capable(CAP_SYS_ADMIN)) { | 836 | if (capable(CAP_SYS_ADMIN)) { |
837 | if (info->tty) | 837 | if (info->port.tty) |
838 | set_bit(TTY_IO_ERROR, | 838 | set_bit(TTY_IO_ERROR, |
839 | &info->tty->flags); | 839 | &info->port.tty->flags); |
840 | retval = 0; | 840 | retval = 0; |
841 | } | 841 | } |
842 | goto out_unlocked; | 842 | goto out_unlocked; |
@@ -874,30 +874,30 @@ static int startup(struct esp_struct *info) | |||
874 | serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); | 874 | serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); |
875 | serial_out(info, UART_ESI_CMD2, info->IER); | 875 | serial_out(info, UART_ESI_CMD2, info->IER); |
876 | 876 | ||
877 | if (info->tty) | 877 | if (info->port.tty) |
878 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 878 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
879 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 879 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
880 | spin_unlock_irqrestore(&info->lock, flags); | 880 | spin_unlock_irqrestore(&info->lock, flags); |
881 | 881 | ||
882 | /* | 882 | /* |
883 | * Set up the tty->alt_speed kludge | 883 | * Set up the tty->alt_speed kludge |
884 | */ | 884 | */ |
885 | if (info->tty) { | 885 | if (info->port.tty) { |
886 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 886 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
887 | info->tty->alt_speed = 57600; | 887 | info->port.tty->alt_speed = 57600; |
888 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 888 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
889 | info->tty->alt_speed = 115200; | 889 | info->port.tty->alt_speed = 115200; |
890 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) | 890 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) |
891 | info->tty->alt_speed = 230400; | 891 | info->port.tty->alt_speed = 230400; |
892 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) | 892 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) |
893 | info->tty->alt_speed = 460800; | 893 | info->port.tty->alt_speed = 460800; |
894 | } | 894 | } |
895 | 895 | ||
896 | /* | 896 | /* |
897 | * set the speed of the serial port | 897 | * set the speed of the serial port |
898 | */ | 898 | */ |
899 | change_speed(info); | 899 | change_speed(info); |
900 | info->flags |= ASYNC_INITIALIZED; | 900 | info->port.flags |= ASYNC_INITIALIZED; |
901 | return 0; | 901 | return 0; |
902 | 902 | ||
903 | out: | 903 | out: |
@@ -914,7 +914,7 @@ static void shutdown(struct esp_struct *info) | |||
914 | { | 914 | { |
915 | unsigned long flags, f; | 915 | unsigned long flags, f; |
916 | 916 | ||
917 | if (!(info->flags & ASYNC_INITIALIZED)) | 917 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
918 | return; | 918 | return; |
919 | 919 | ||
920 | #ifdef SERIAL_DEBUG_OPEN | 920 | #ifdef SERIAL_DEBUG_OPEN |
@@ -951,7 +951,7 @@ static void shutdown(struct esp_struct *info) | |||
951 | 951 | ||
952 | while (current_port) { | 952 | while (current_port) { |
953 | if ((current_port != info) && | 953 | if ((current_port != info) && |
954 | (current_port->flags & ASYNC_INITIALIZED)) | 954 | (current_port->port.flags & ASYNC_INITIALIZED)) |
955 | break; | 955 | break; |
956 | 956 | ||
957 | current_port = current_port->next_port; | 957 | current_port = current_port->next_port; |
@@ -974,7 +974,7 @@ static void shutdown(struct esp_struct *info) | |||
974 | serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); | 974 | serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); |
975 | serial_out(info, UART_ESI_CMD2, 0x00); | 975 | serial_out(info, UART_ESI_CMD2, 0x00); |
976 | 976 | ||
977 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) | 977 | if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) |
978 | info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); | 978 | info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); |
979 | 979 | ||
980 | info->MCR &= ~UART_MCR_OUT2; | 980 | info->MCR &= ~UART_MCR_OUT2; |
@@ -982,10 +982,10 @@ static void shutdown(struct esp_struct *info) | |||
982 | serial_out(info, UART_ESI_CMD2, UART_MCR); | 982 | serial_out(info, UART_ESI_CMD2, UART_MCR); |
983 | serial_out(info, UART_ESI_CMD2, info->MCR); | 983 | serial_out(info, UART_ESI_CMD2, info->MCR); |
984 | 984 | ||
985 | if (info->tty) | 985 | if (info->port.tty) |
986 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 986 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
987 | 987 | ||
988 | info->flags &= ~ASYNC_INITIALIZED; | 988 | info->port.flags &= ~ASYNC_INITIALIZED; |
989 | spin_unlock_irqrestore(&info->lock, flags); | 989 | spin_unlock_irqrestore(&info->lock, flags); |
990 | } | 990 | } |
991 | 991 | ||
@@ -1002,10 +1002,10 @@ static void change_speed(struct esp_struct *info) | |||
1002 | unsigned char flow1 = 0, flow2 = 0; | 1002 | unsigned char flow1 = 0, flow2 = 0; |
1003 | unsigned long flags; | 1003 | unsigned long flags; |
1004 | 1004 | ||
1005 | if (!info->tty || !info->tty->termios) | 1005 | if (!info->port.tty || !info->port.tty->termios) |
1006 | return; | 1006 | return; |
1007 | cflag = info->tty->termios->c_cflag; | 1007 | cflag = info->port.tty->termios->c_cflag; |
1008 | port = info->port; | 1008 | port = info->io_port; |
1009 | 1009 | ||
1010 | /* byte size and parity */ | 1010 | /* byte size and parity */ |
1011 | switch (cflag & CSIZE) { | 1011 | switch (cflag & CSIZE) { |
@@ -1029,9 +1029,9 @@ static void change_speed(struct esp_struct *info) | |||
1029 | if (cflag & CMSPAR) | 1029 | if (cflag & CMSPAR) |
1030 | cval |= UART_LCR_SPAR; | 1030 | cval |= UART_LCR_SPAR; |
1031 | #endif | 1031 | #endif |
1032 | baud = tty_get_baud_rate(info->tty); | 1032 | baud = tty_get_baud_rate(info->port.tty); |
1033 | if (baud == 38400 && | 1033 | if (baud == 38400 && |
1034 | ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) | 1034 | ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) |
1035 | quot = info->custom_divisor; | 1035 | quot = info->custom_divisor; |
1036 | else { | 1036 | else { |
1037 | if (baud == 134) /* Special case since 134 is really 134.5 */ | 1037 | if (baud == 134) /* Special case since 134 is really 134.5 */ |
@@ -1046,49 +1046,49 @@ static void change_speed(struct esp_struct *info) | |||
1046 | if (baud) { | 1046 | if (baud) { |
1047 | /* Actual rate */ | 1047 | /* Actual rate */ |
1048 | baud = BASE_BAUD/quot; | 1048 | baud = BASE_BAUD/quot; |
1049 | tty_encode_baud_rate(info->tty, baud, baud); | 1049 | tty_encode_baud_rate(info->port.tty, baud, baud); |
1050 | } | 1050 | } |
1051 | info->timeout = ((1024 * HZ * bits * quot) / BASE_BAUD) + (HZ / 50); | 1051 | info->timeout = ((1024 * HZ * bits * quot) / BASE_BAUD) + (HZ / 50); |
1052 | 1052 | ||
1053 | /* CTS flow control flag and modem status interrupts */ | 1053 | /* CTS flow control flag and modem status interrupts */ |
1054 | /* info->IER &= ~UART_IER_MSI; */ | 1054 | /* info->IER &= ~UART_IER_MSI; */ |
1055 | if (cflag & CRTSCTS) { | 1055 | if (cflag & CRTSCTS) { |
1056 | info->flags |= ASYNC_CTS_FLOW; | 1056 | info->port.flags |= ASYNC_CTS_FLOW; |
1057 | /* info->IER |= UART_IER_MSI; */ | 1057 | /* info->IER |= UART_IER_MSI; */ |
1058 | flow1 = 0x04; | 1058 | flow1 = 0x04; |
1059 | flow2 = 0x10; | 1059 | flow2 = 0x10; |
1060 | } else | 1060 | } else |
1061 | info->flags &= ~ASYNC_CTS_FLOW; | 1061 | info->port.flags &= ~ASYNC_CTS_FLOW; |
1062 | if (cflag & CLOCAL) | 1062 | if (cflag & CLOCAL) |
1063 | info->flags &= ~ASYNC_CHECK_CD; | 1063 | info->port.flags &= ~ASYNC_CHECK_CD; |
1064 | else | 1064 | else |
1065 | info->flags |= ASYNC_CHECK_CD; | 1065 | info->port.flags |= ASYNC_CHECK_CD; |
1066 | 1066 | ||
1067 | /* | 1067 | /* |
1068 | * Set up parity check flag | 1068 | * Set up parity check flag |
1069 | */ | 1069 | */ |
1070 | info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 1070 | info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
1071 | if (I_INPCK(info->tty)) | 1071 | if (I_INPCK(info->port.tty)) |
1072 | info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 1072 | info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
1073 | if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) | 1073 | if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) |
1074 | info->read_status_mask |= UART_LSR_BI; | 1074 | info->read_status_mask |= UART_LSR_BI; |
1075 | 1075 | ||
1076 | info->ignore_status_mask = 0; | 1076 | info->ignore_status_mask = 0; |
1077 | #if 0 | 1077 | #if 0 |
1078 | /* This should be safe, but for some broken bits of hardware... */ | 1078 | /* This should be safe, but for some broken bits of hardware... */ |
1079 | if (I_IGNPAR(info->tty)) { | 1079 | if (I_IGNPAR(info->port.tty)) { |
1080 | info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; | 1080 | info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; |
1081 | info->read_status_mask |= UART_LSR_PE | UART_LSR_FE; | 1081 | info->read_status_mask |= UART_LSR_PE | UART_LSR_FE; |
1082 | } | 1082 | } |
1083 | #endif | 1083 | #endif |
1084 | if (I_IGNBRK(info->tty)) { | 1084 | if (I_IGNBRK(info->port.tty)) { |
1085 | info->ignore_status_mask |= UART_LSR_BI; | 1085 | info->ignore_status_mask |= UART_LSR_BI; |
1086 | info->read_status_mask |= UART_LSR_BI; | 1086 | info->read_status_mask |= UART_LSR_BI; |
1087 | /* | 1087 | /* |
1088 | * If we're ignore parity and break indicators, ignore | 1088 | * If we're ignore parity and break indicators, ignore |
1089 | * overruns too. (For real raw support). | 1089 | * overruns too. (For real raw support). |
1090 | */ | 1090 | */ |
1091 | if (I_IGNPAR(info->tty)) { | 1091 | if (I_IGNPAR(info->port.tty)) { |
1092 | info->ignore_status_mask |= UART_LSR_OE | \ | 1092 | info->ignore_status_mask |= UART_LSR_OE | \ |
1093 | UART_LSR_PE | UART_LSR_FE; | 1093 | UART_LSR_PE | UART_LSR_FE; |
1094 | info->read_status_mask |= UART_LSR_OE | \ | 1094 | info->read_status_mask |= UART_LSR_OE | \ |
@@ -1096,7 +1096,7 @@ static void change_speed(struct esp_struct *info) | |||
1096 | } | 1096 | } |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | if (I_IXOFF(info->tty)) | 1099 | if (I_IXOFF(info->port.tty)) |
1100 | flow1 |= 0x81; | 1100 | flow1 |= 0x81; |
1101 | 1101 | ||
1102 | spin_lock_irqsave(&info->lock, flags); | 1102 | spin_lock_irqsave(&info->lock, flags); |
@@ -1116,10 +1116,10 @@ static void change_speed(struct esp_struct *info) | |||
1116 | serial_out(info, UART_ESI_CMD2, flow2); | 1116 | serial_out(info, UART_ESI_CMD2, flow2); |
1117 | 1117 | ||
1118 | /* set flow control characters (XON/XOFF only) */ | 1118 | /* set flow control characters (XON/XOFF only) */ |
1119 | if (I_IXOFF(info->tty)) { | 1119 | if (I_IXOFF(info->port.tty)) { |
1120 | serial_out(info, UART_ESI_CMD1, ESI_SET_FLOW_CHARS); | 1120 | serial_out(info, UART_ESI_CMD1, ESI_SET_FLOW_CHARS); |
1121 | serial_out(info, UART_ESI_CMD2, START_CHAR(info->tty)); | 1121 | serial_out(info, UART_ESI_CMD2, START_CHAR(info->port.tty)); |
1122 | serial_out(info, UART_ESI_CMD2, STOP_CHAR(info->tty)); | 1122 | serial_out(info, UART_ESI_CMD2, STOP_CHAR(info->port.tty)); |
1123 | serial_out(info, UART_ESI_CMD2, 0x10); | 1123 | serial_out(info, UART_ESI_CMD2, 0x10); |
1124 | serial_out(info, UART_ESI_CMD2, 0x21); | 1124 | serial_out(info, UART_ESI_CMD2, 0x21); |
1125 | switch (cflag & CSIZE) { | 1125 | switch (cflag & CSIZE) { |
@@ -1355,9 +1355,9 @@ static int get_serial_info(struct esp_struct *info, | |||
1355 | memset(&tmp, 0, sizeof(tmp)); | 1355 | memset(&tmp, 0, sizeof(tmp)); |
1356 | tmp.type = PORT_16550A; | 1356 | tmp.type = PORT_16550A; |
1357 | tmp.line = info->line; | 1357 | tmp.line = info->line; |
1358 | tmp.port = info->port; | 1358 | tmp.port = info->io_port; |
1359 | tmp.irq = info->irq; | 1359 | tmp.irq = info->irq; |
1360 | tmp.flags = info->flags; | 1360 | tmp.flags = info->port.flags; |
1361 | tmp.xmit_fifo_size = 1024; | 1361 | tmp.xmit_fifo_size = 1024; |
1362 | tmp.baud_base = BASE_BAUD; | 1362 | tmp.baud_base = BASE_BAUD; |
1363 | tmp.close_delay = info->close_delay; | 1363 | tmp.close_delay = info->close_delay; |
@@ -1407,7 +1407,7 @@ static int set_serial_info(struct esp_struct *info, | |||
1407 | 1407 | ||
1408 | if ((new_serial.type != PORT_16550A) || | 1408 | if ((new_serial.type != PORT_16550A) || |
1409 | (new_serial.hub6) || | 1409 | (new_serial.hub6) || |
1410 | (info->port != new_serial.port) || | 1410 | (info->io_port != new_serial.port) || |
1411 | (new_serial.baud_base != BASE_BAUD) || | 1411 | (new_serial.baud_base != BASE_BAUD) || |
1412 | (new_serial.irq > 15) || | 1412 | (new_serial.irq > 15) || |
1413 | (new_serial.irq < 2) || | 1413 | (new_serial.irq < 2) || |
@@ -1425,9 +1425,9 @@ static int set_serial_info(struct esp_struct *info, | |||
1425 | if (change_irq || | 1425 | if (change_irq || |
1426 | (new_serial.close_delay != info->close_delay) || | 1426 | (new_serial.close_delay != info->close_delay) || |
1427 | ((new_serial.flags & ~ASYNC_USR_MASK) != | 1427 | ((new_serial.flags & ~ASYNC_USR_MASK) != |
1428 | (info->flags & ~ASYNC_USR_MASK))) | 1428 | (info->port.flags & ~ASYNC_USR_MASK))) |
1429 | return -EPERM; | 1429 | return -EPERM; |
1430 | info->flags = ((info->flags & ~ASYNC_USR_MASK) | | 1430 | info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) | |
1431 | (new_serial.flags & ASYNC_USR_MASK)); | 1431 | (new_serial.flags & ASYNC_USR_MASK)); |
1432 | info->custom_divisor = new_serial.custom_divisor; | 1432 | info->custom_divisor = new_serial.custom_divisor; |
1433 | } else { | 1433 | } else { |
@@ -1441,9 +1441,9 @@ static int set_serial_info(struct esp_struct *info, | |||
1441 | if ((current_async->line >= info->line) && | 1441 | if ((current_async->line >= info->line) && |
1442 | (current_async->line < (info->line + 8))) { | 1442 | (current_async->line < (info->line + 8))) { |
1443 | if (current_async == info) { | 1443 | if (current_async == info) { |
1444 | if (current_async->count > 1) | 1444 | if (current_async->port.count > 1) |
1445 | return -EBUSY; | 1445 | return -EBUSY; |
1446 | } else if (current_async->count) | 1446 | } else if (current_async->port.count) |
1447 | return -EBUSY; | 1447 | return -EBUSY; |
1448 | } | 1448 | } |
1449 | 1449 | ||
@@ -1456,7 +1456,7 @@ static int set_serial_info(struct esp_struct *info, | |||
1456 | * At this point, we start making changes..... | 1456 | * At this point, we start making changes..... |
1457 | */ | 1457 | */ |
1458 | 1458 | ||
1459 | info->flags = ((info->flags & ~ASYNC_FLAGS) | | 1459 | info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) | |
1460 | (new_serial.flags & ASYNC_FLAGS)); | 1460 | (new_serial.flags & ASYNC_FLAGS)); |
1461 | info->custom_divisor = new_serial.custom_divisor; | 1461 | info->custom_divisor = new_serial.custom_divisor; |
1462 | info->close_delay = new_serial.close_delay * HZ/100; | 1462 | info->close_delay = new_serial.close_delay * HZ/100; |
@@ -1487,18 +1487,18 @@ static int set_serial_info(struct esp_struct *info, | |||
1487 | } | 1487 | } |
1488 | } | 1488 | } |
1489 | 1489 | ||
1490 | if (info->flags & ASYNC_INITIALIZED) { | 1490 | if (info->port.flags & ASYNC_INITIALIZED) { |
1491 | if (((old_info.flags & ASYNC_SPD_MASK) != | 1491 | if (((old_info.port.flags & ASYNC_SPD_MASK) != |
1492 | (info->flags & ASYNC_SPD_MASK)) || | 1492 | (info->port.flags & ASYNC_SPD_MASK)) || |
1493 | (old_info.custom_divisor != info->custom_divisor)) { | 1493 | (old_info.custom_divisor != info->custom_divisor)) { |
1494 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 1494 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
1495 | info->tty->alt_speed = 57600; | 1495 | info->port.tty->alt_speed = 57600; |
1496 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 1496 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
1497 | info->tty->alt_speed = 115200; | 1497 | info->port.tty->alt_speed = 115200; |
1498 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) | 1498 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) |
1499 | info->tty->alt_speed = 230400; | 1499 | info->port.tty->alt_speed = 230400; |
1500 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) | 1500 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) |
1501 | info->tty->alt_speed = 460800; | 1501 | info->port.tty->alt_speed = 460800; |
1502 | change_speed(info); | 1502 | change_speed(info); |
1503 | } | 1503 | } |
1504 | } else | 1504 | } else |
@@ -1554,9 +1554,9 @@ static int set_esp_config(struct esp_struct *info, | |||
1554 | 1554 | ||
1555 | while (current_async) { | 1555 | while (current_async) { |
1556 | if (current_async == info) { | 1556 | if (current_async == info) { |
1557 | if (current_async->count > 1) | 1557 | if (current_async->port.count > 1) |
1558 | return -EBUSY; | 1558 | return -EBUSY; |
1559 | } else if (current_async->count) | 1559 | } else if (current_async->port.count) |
1560 | return -EBUSY; | 1560 | return -EBUSY; |
1561 | 1561 | ||
1562 | current_async = current_async->next_port; | 1562 | current_async = current_async->next_port; |
@@ -1578,7 +1578,7 @@ static int set_esp_config(struct esp_struct *info, | |||
1578 | spin_unlock_irqrestore(&info->lock, flags); | 1578 | spin_unlock_irqrestore(&info->lock, flags); |
1579 | } else { | 1579 | } else { |
1580 | /* DMA mode to PIO mode only */ | 1580 | /* DMA mode to PIO mode only */ |
1581 | if (info->count > 1) | 1581 | if (info->port.count > 1) |
1582 | return -EBUSY; | 1582 | return -EBUSY; |
1583 | 1583 | ||
1584 | shutdown(info); | 1584 | shutdown(info); |
@@ -1634,7 +1634,7 @@ static int set_esp_config(struct esp_struct *info, | |||
1634 | spin_unlock_irqrestore(&info->lock, flags); | 1634 | spin_unlock_irqrestore(&info->lock, flags); |
1635 | } | 1635 | } |
1636 | 1636 | ||
1637 | if (!(info->flags & ASYNC_INITIALIZED)) | 1637 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
1638 | retval = startup(info); | 1638 | retval = startup(info); |
1639 | 1639 | ||
1640 | return retval; | 1640 | return retval; |
@@ -1917,9 +1917,9 @@ static void rs_close(struct tty_struct *tty, struct file *filp) | |||
1917 | 1917 | ||
1918 | #ifdef SERIAL_DEBUG_OPEN | 1918 | #ifdef SERIAL_DEBUG_OPEN |
1919 | printk(KERN_DEBUG "rs_close ttys%d, count = %d\n", | 1919 | printk(KERN_DEBUG "rs_close ttys%d, count = %d\n", |
1920 | info->line, info->count); | 1920 | info->line, info->port.count); |
1921 | #endif | 1921 | #endif |
1922 | if (tty->count == 1 && info->count != 1) { | 1922 | if (tty->count == 1 && info->port.count != 1) { |
1923 | /* | 1923 | /* |
1924 | * Uh, oh. tty->count is 1, which means that the tty | 1924 | * Uh, oh. tty->count is 1, which means that the tty |
1925 | * structure will be freed. Info->count should always | 1925 | * structure will be freed. Info->count should always |
@@ -1927,19 +1927,19 @@ static void rs_close(struct tty_struct *tty, struct file *filp) | |||
1927 | * one, we've got real problems, since it means the | 1927 | * one, we've got real problems, since it means the |
1928 | * serial port won't be shutdown. | 1928 | * serial port won't be shutdown. |
1929 | */ | 1929 | */ |
1930 | printk(KERN_DEBUG "rs_close: bad serial port count; tty->count is 1, info->count is %d\n", info->count); | 1930 | printk(KERN_DEBUG "rs_close: bad serial port count; tty->count is 1, info->port.count is %d\n", info->port.count); |
1931 | info->count = 1; | 1931 | info->port.count = 1; |
1932 | } | 1932 | } |
1933 | if (--info->count < 0) { | 1933 | if (--info->port.count < 0) { |
1934 | printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n", | 1934 | printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n", |
1935 | info->line, info->count); | 1935 | info->line, info->port.count); |
1936 | info->count = 0; | 1936 | info->port.count = 0; |
1937 | } | 1937 | } |
1938 | if (info->count) { | 1938 | if (info->port.count) { |
1939 | DBG_CNT("before DEC-2"); | 1939 | DBG_CNT("before DEC-2"); |
1940 | goto out; | 1940 | goto out; |
1941 | } | 1941 | } |
1942 | info->flags |= ASYNC_CLOSING; | 1942 | info->port.flags |= ASYNC_CLOSING; |
1943 | 1943 | ||
1944 | spin_unlock_irqrestore(&info->lock, flags); | 1944 | spin_unlock_irqrestore(&info->lock, flags); |
1945 | /* | 1945 | /* |
@@ -1958,7 +1958,7 @@ static void rs_close(struct tty_struct *tty, struct file *filp) | |||
1958 | /* info->IER &= ~UART_IER_RLSI; */ | 1958 | /* info->IER &= ~UART_IER_RLSI; */ |
1959 | info->IER &= ~UART_IER_RDI; | 1959 | info->IER &= ~UART_IER_RDI; |
1960 | info->read_status_mask &= ~UART_LSR_DR; | 1960 | info->read_status_mask &= ~UART_LSR_DR; |
1961 | if (info->flags & ASYNC_INITIALIZED) { | 1961 | if (info->port.flags & ASYNC_INITIALIZED) { |
1962 | 1962 | ||
1963 | spin_lock_irqsave(&info->lock, flags); | 1963 | spin_lock_irqsave(&info->lock, flags); |
1964 | serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); | 1964 | serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); |
@@ -1981,15 +1981,15 @@ static void rs_close(struct tty_struct *tty, struct file *filp) | |||
1981 | rs_flush_buffer(tty); | 1981 | rs_flush_buffer(tty); |
1982 | tty_ldisc_flush(tty); | 1982 | tty_ldisc_flush(tty); |
1983 | tty->closing = 0; | 1983 | tty->closing = 0; |
1984 | info->tty = NULL; | 1984 | info->port.tty = NULL; |
1985 | 1985 | ||
1986 | if (info->blocked_open) { | 1986 | if (info->port.blocked_open) { |
1987 | if (info->close_delay) | 1987 | if (info->close_delay) |
1988 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | 1988 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); |
1989 | wake_up_interruptible(&info->open_wait); | 1989 | wake_up_interruptible(&info->port.open_wait); |
1990 | } | 1990 | } |
1991 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 1991 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
1992 | wake_up_interruptible(&info->close_wait); | 1992 | wake_up_interruptible(&info->port.close_wait); |
1993 | return; | 1993 | return; |
1994 | 1994 | ||
1995 | out: | 1995 | out: |
@@ -2047,10 +2047,10 @@ static void esp_hangup(struct tty_struct *tty) | |||
2047 | 2047 | ||
2048 | rs_flush_buffer(tty); | 2048 | rs_flush_buffer(tty); |
2049 | shutdown(info); | 2049 | shutdown(info); |
2050 | info->count = 0; | 2050 | info->port.count = 0; |
2051 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 2051 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
2052 | info->tty = NULL; | 2052 | info->port.tty = NULL; |
2053 | wake_up_interruptible(&info->open_wait); | 2053 | wake_up_interruptible(&info->port.open_wait); |
2054 | } | 2054 | } |
2055 | 2055 | ||
2056 | /* | 2056 | /* |
@@ -2071,11 +2071,11 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2071 | * until it's done, and then try again. | 2071 | * until it's done, and then try again. |
2072 | */ | 2072 | */ |
2073 | if (tty_hung_up_p(filp) || | 2073 | if (tty_hung_up_p(filp) || |
2074 | (info->flags & ASYNC_CLOSING)) { | 2074 | (info->port.flags & ASYNC_CLOSING)) { |
2075 | if (info->flags & ASYNC_CLOSING) | 2075 | if (info->port.flags & ASYNC_CLOSING) |
2076 | interruptible_sleep_on(&info->close_wait); | 2076 | interruptible_sleep_on(&info->port.close_wait); |
2077 | #ifdef SERIAL_DO_RESTART | 2077 | #ifdef SERIAL_DO_RESTART |
2078 | if (info->flags & ASYNC_HUP_NOTIFY) | 2078 | if (info->port.flags & ASYNC_HUP_NOTIFY) |
2079 | return -EAGAIN; | 2079 | return -EAGAIN; |
2080 | else | 2080 | else |
2081 | return -ERESTARTSYS; | 2081 | return -ERESTARTSYS; |
@@ -2090,7 +2090,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2090 | */ | 2090 | */ |
2091 | if ((filp->f_flags & O_NONBLOCK) || | 2091 | if ((filp->f_flags & O_NONBLOCK) || |
2092 | (tty->flags & (1 << TTY_IO_ERROR))) { | 2092 | (tty->flags & (1 << TTY_IO_ERROR))) { |
2093 | info->flags |= ASYNC_NORMAL_ACTIVE; | 2093 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
2094 | return 0; | 2094 | return 0; |
2095 | } | 2095 | } |
2096 | 2096 | ||
@@ -2100,20 +2100,20 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2100 | /* | 2100 | /* |
2101 | * Block waiting for the carrier detect and the line to become | 2101 | * Block waiting for the carrier detect and the line to become |
2102 | * free (i.e., not in use by the callout). While we are in | 2102 | * free (i.e., not in use by the callout). While we are in |
2103 | * this loop, info->count is dropped by one, so that | 2103 | * this loop, info->port.count is dropped by one, so that |
2104 | * rs_close() knows when to free things. We restore it upon | 2104 | * rs_close() knows when to free things. We restore it upon |
2105 | * exit, either normal or abnormal. | 2105 | * exit, either normal or abnormal. |
2106 | */ | 2106 | */ |
2107 | retval = 0; | 2107 | retval = 0; |
2108 | add_wait_queue(&info->open_wait, &wait); | 2108 | add_wait_queue(&info->port.open_wait, &wait); |
2109 | #ifdef SERIAL_DEBUG_OPEN | 2109 | #ifdef SERIAL_DEBUG_OPEN |
2110 | printk(KERN_DEBUG "block_til_ready before block: ttys%d, count = %d\n", | 2110 | printk(KERN_DEBUG "block_til_ready before block: ttys%d, count = %d\n", |
2111 | info->line, info->count); | 2111 | info->line, info->port.count); |
2112 | #endif | 2112 | #endif |
2113 | spin_lock_irqsave(&info->lock, flags); | 2113 | spin_lock_irqsave(&info->lock, flags); |
2114 | if (!tty_hung_up_p(filp)) | 2114 | if (!tty_hung_up_p(filp)) |
2115 | info->count--; | 2115 | info->port.count--; |
2116 | info->blocked_open++; | 2116 | info->port.blocked_open++; |
2117 | while (1) { | 2117 | while (1) { |
2118 | if ((tty->termios->c_cflag & CBAUD)) { | 2118 | if ((tty->termios->c_cflag & CBAUD)) { |
2119 | unsigned int scratch; | 2119 | unsigned int scratch; |
@@ -2128,9 +2128,9 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2128 | } | 2128 | } |
2129 | set_current_state(TASK_INTERRUPTIBLE); | 2129 | set_current_state(TASK_INTERRUPTIBLE); |
2130 | if (tty_hung_up_p(filp) || | 2130 | if (tty_hung_up_p(filp) || |
2131 | !(info->flags & ASYNC_INITIALIZED)) { | 2131 | !(info->port.flags & ASYNC_INITIALIZED)) { |
2132 | #ifdef SERIAL_DO_RESTART | 2132 | #ifdef SERIAL_DO_RESTART |
2133 | if (info->flags & ASYNC_HUP_NOTIFY) | 2133 | if (info->port.flags & ASYNC_HUP_NOTIFY) |
2134 | retval = -EAGAIN; | 2134 | retval = -EAGAIN; |
2135 | else | 2135 | else |
2136 | retval = -ERESTARTSYS; | 2136 | retval = -ERESTARTSYS; |
@@ -2144,7 +2144,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2144 | if (serial_in(info, UART_ESI_STAT2) & UART_MSR_DCD) | 2144 | if (serial_in(info, UART_ESI_STAT2) & UART_MSR_DCD) |
2145 | do_clocal = 1; | 2145 | do_clocal = 1; |
2146 | 2146 | ||
2147 | if (!(info->flags & ASYNC_CLOSING) && | 2147 | if (!(info->port.flags & ASYNC_CLOSING) && |
2148 | (do_clocal)) | 2148 | (do_clocal)) |
2149 | break; | 2149 | break; |
2150 | if (signal_pending(current)) { | 2150 | if (signal_pending(current)) { |
@@ -2153,25 +2153,25 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
2153 | } | 2153 | } |
2154 | #ifdef SERIAL_DEBUG_OPEN | 2154 | #ifdef SERIAL_DEBUG_OPEN |
2155 | printk(KERN_DEBUG "block_til_ready blocking: ttys%d, count = %d\n", | 2155 | printk(KERN_DEBUG "block_til_ready blocking: ttys%d, count = %d\n", |
2156 | info->line, info->count); | 2156 | info->line, info->port.count); |
2157 | #endif | 2157 | #endif |
2158 | spin_unlock_irqrestore(&info->lock, flags); | 2158 | spin_unlock_irqrestore(&info->lock, flags); |
2159 | schedule(); | 2159 | schedule(); |
2160 | spin_lock_irqsave(&info->lock, flags); | 2160 | spin_lock_irqsave(&info->lock, flags); |
2161 | } | 2161 | } |
2162 | set_current_state(TASK_RUNNING); | 2162 | set_current_state(TASK_RUNNING); |
2163 | remove_wait_queue(&info->open_wait, &wait); | 2163 | remove_wait_queue(&info->port.open_wait, &wait); |
2164 | if (!tty_hung_up_p(filp)) | 2164 | if (!tty_hung_up_p(filp)) |
2165 | info->count++; | 2165 | info->port.count++; |
2166 | info->blocked_open--; | 2166 | info->port.blocked_open--; |
2167 | spin_unlock_irqrestore(&info->lock, flags); | 2167 | spin_unlock_irqrestore(&info->lock, flags); |
2168 | #ifdef SERIAL_DEBUG_OPEN | 2168 | #ifdef SERIAL_DEBUG_OPEN |
2169 | printk(KERN_DEBUG "block_til_ready after blocking: ttys%d, count = %d\n", | 2169 | printk(KERN_DEBUG "block_til_ready after blocking: ttys%d, count = %d\n", |
2170 | info->line, info->count); | 2170 | info->line, info->port.count); |
2171 | #endif | 2171 | #endif |
2172 | if (retval) | 2172 | if (retval) |
2173 | return retval; | 2173 | return retval; |
2174 | info->flags |= ASYNC_NORMAL_ACTIVE; | 2174 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
2175 | return 0; | 2175 | return 0; |
2176 | } | 2176 | } |
2177 | 2177 | ||
@@ -2204,12 +2204,12 @@ static int esp_open(struct tty_struct *tty, struct file *filp) | |||
2204 | } | 2204 | } |
2205 | 2205 | ||
2206 | #ifdef SERIAL_DEBUG_OPEN | 2206 | #ifdef SERIAL_DEBUG_OPEN |
2207 | printk(KERN_DEBUG "esp_open %s, count = %d\n", tty->name, info->count); | 2207 | printk(KERN_DEBUG "esp_open %s, count = %d\n", tty->name, info->port.count); |
2208 | #endif | 2208 | #endif |
2209 | spin_lock_irqsave(&info->lock, flags); | 2209 | spin_lock_irqsave(&info->lock, flags); |
2210 | info->count++; | 2210 | info->port.count++; |
2211 | tty->driver_data = info; | 2211 | tty->driver_data = info; |
2212 | info->tty = tty; | 2212 | info->port.tty = tty; |
2213 | 2213 | ||
2214 | spin_unlock_irqrestore(&info->lock, flags); | 2214 | spin_unlock_irqrestore(&info->lock, flags); |
2215 | 2215 | ||
@@ -2263,7 +2263,7 @@ static int autoconfig(struct esp_struct *info) | |||
2263 | int port_detected = 0; | 2263 | int port_detected = 0; |
2264 | unsigned long flags; | 2264 | unsigned long flags; |
2265 | 2265 | ||
2266 | if (!request_region(info->port, REGION_SIZE, "esp serial")) | 2266 | if (!request_region(info->io_port, REGION_SIZE, "esp serial")) |
2267 | return -EIO; | 2267 | return -EIO; |
2268 | 2268 | ||
2269 | spin_lock_irqsave(&info->lock, flags); | 2269 | spin_lock_irqsave(&info->lock, flags); |
@@ -2300,7 +2300,7 @@ static int autoconfig(struct esp_struct *info) | |||
2300 | } | 2300 | } |
2301 | } | 2301 | } |
2302 | if (!port_detected) | 2302 | if (!port_detected) |
2303 | release_region(info->port, REGION_SIZE); | 2303 | release_region(info->io_port, REGION_SIZE); |
2304 | 2304 | ||
2305 | spin_unlock_irqrestore(&info->lock, flags); | 2305 | spin_unlock_irqrestore(&info->lock, flags); |
2306 | return (port_detected); | 2306 | return (port_detected); |
@@ -2414,7 +2414,7 @@ static int __init espserial_init(void) | |||
2414 | offset = 0; | 2414 | offset = 0; |
2415 | 2415 | ||
2416 | do { | 2416 | do { |
2417 | info->port = esp[i] + offset; | 2417 | info->io_port = esp[i] + offset; |
2418 | info->irq = irq[i]; | 2418 | info->irq = irq[i]; |
2419 | info->line = (i * 8) + (offset / 8); | 2419 | info->line = (i * 8) + (offset / 8); |
2420 | 2420 | ||
@@ -2425,9 +2425,9 @@ static int __init espserial_init(void) | |||
2425 | } | 2425 | } |
2426 | 2426 | ||
2427 | info->custom_divisor = (divisor[i] >> (offset / 2)) & 0xf; | 2427 | info->custom_divisor = (divisor[i] >> (offset / 2)) & 0xf; |
2428 | info->flags = STD_COM_FLAGS; | 2428 | info->port.flags = STD_COM_FLAGS; |
2429 | if (info->custom_divisor) | 2429 | if (info->custom_divisor) |
2430 | info->flags |= ASYNC_SPD_CUST; | 2430 | info->port.flags |= ASYNC_SPD_CUST; |
2431 | info->magic = ESP_MAGIC; | 2431 | info->magic = ESP_MAGIC; |
2432 | info->close_delay = 5*HZ/10; | 2432 | info->close_delay = 5*HZ/10; |
2433 | info->closing_wait = 30*HZ; | 2433 | info->closing_wait = 30*HZ; |
@@ -2436,13 +2436,13 @@ static int __init espserial_init(void) | |||
2436 | info->config.flow_off = flow_off; | 2436 | info->config.flow_off = flow_off; |
2437 | info->config.pio_threshold = pio_threshold; | 2437 | info->config.pio_threshold = pio_threshold; |
2438 | info->next_port = ports; | 2438 | info->next_port = ports; |
2439 | init_waitqueue_head(&info->open_wait); | 2439 | init_waitqueue_head(&info->port.open_wait); |
2440 | init_waitqueue_head(&info->close_wait); | 2440 | init_waitqueue_head(&info->port.close_wait); |
2441 | init_waitqueue_head(&info->delta_msr_wait); | 2441 | init_waitqueue_head(&info->delta_msr_wait); |
2442 | init_waitqueue_head(&info->break_wait); | 2442 | init_waitqueue_head(&info->break_wait); |
2443 | ports = info; | 2443 | ports = info; |
2444 | printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ", | 2444 | printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ", |
2445 | info->line, info->port, info->irq); | 2445 | info->line, info->io_port, info->irq); |
2446 | 2446 | ||
2447 | if (info->line % 8) { | 2447 | if (info->line % 8) { |
2448 | printk("secondary port\n"); | 2448 | printk("secondary port\n"); |
@@ -2498,8 +2498,8 @@ static void __exit espserial_exit(void) | |||
2498 | put_tty_driver(esp_driver); | 2498 | put_tty_driver(esp_driver); |
2499 | 2499 | ||
2500 | while (ports) { | 2500 | while (ports) { |
2501 | if (ports->port) | 2501 | if (ports->io_port) |
2502 | release_region(ports->port, REGION_SIZE); | 2502 | release_region(ports->io_port, REGION_SIZE); |
2503 | temp_async = ports->next_port; | 2503 | temp_async = ports->next_port; |
2504 | kfree(ports); | 2504 | kfree(ports); |
2505 | ports = temp_async; | 2505 | ports = temp_async; |
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c index 252f73e48596..19d3afb0e50c 100644 --- a/drivers/char/generic_serial.c +++ b/drivers/char/generic_serial.c | |||
@@ -60,7 +60,7 @@ int gs_put_char(struct tty_struct * tty, unsigned char ch) | |||
60 | 60 | ||
61 | if (!port) return 0; | 61 | if (!port) return 0; |
62 | 62 | ||
63 | if (! (port->flags & ASYNC_INITIALIZED)) return 0; | 63 | if (! (port->port.flags & ASYNC_INITIALIZED)) return 0; |
64 | 64 | ||
65 | /* Take a lock on the serial tranmit buffer! */ | 65 | /* Take a lock on the serial tranmit buffer! */ |
66 | mutex_lock(& port->port_write_mutex); | 66 | mutex_lock(& port->port_write_mutex); |
@@ -103,7 +103,7 @@ int gs_write(struct tty_struct * tty, | |||
103 | 103 | ||
104 | if (!port) return 0; | 104 | if (!port) return 0; |
105 | 105 | ||
106 | if (! (port->flags & ASYNC_INITIALIZED)) | 106 | if (! (port->port.flags & ASYNC_INITIALIZED)) |
107 | return 0; | 107 | return 0; |
108 | 108 | ||
109 | /* get exclusive "write" access to this port (problem 3) */ | 109 | /* get exclusive "write" access to this port (problem 3) */ |
@@ -141,13 +141,13 @@ int gs_write(struct tty_struct * tty, | |||
141 | mutex_unlock(& port->port_write_mutex); | 141 | mutex_unlock(& port->port_write_mutex); |
142 | 142 | ||
143 | gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n", | 143 | gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n", |
144 | (port->flags & GS_TX_INTEN)?"enabled": "disabled"); | 144 | (port->port.flags & GS_TX_INTEN)?"enabled": "disabled"); |
145 | 145 | ||
146 | if (port->xmit_cnt && | 146 | if (port->xmit_cnt && |
147 | !tty->stopped && | 147 | !tty->stopped && |
148 | !tty->hw_stopped && | 148 | !tty->hw_stopped && |
149 | !(port->flags & GS_TX_INTEN)) { | 149 | !(port->port.flags & GS_TX_INTEN)) { |
150 | port->flags |= GS_TX_INTEN; | 150 | port->port.flags |= GS_TX_INTEN; |
151 | port->rd->enable_tx_interrupts (port); | 151 | port->rd->enable_tx_interrupts (port); |
152 | } | 152 | } |
153 | func_exit (); | 153 | func_exit (); |
@@ -208,7 +208,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout) | |||
208 | gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port); | 208 | gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port); |
209 | if (port) { | 209 | if (port) { |
210 | gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n", | 210 | gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n", |
211 | port->xmit_cnt, port->xmit_buf, port->tty); | 211 | port->xmit_cnt, port->xmit_buf, port->port.tty); |
212 | } | 212 | } |
213 | 213 | ||
214 | if (!port || port->xmit_cnt < 0 || !port->xmit_buf) { | 214 | if (!port || port->xmit_cnt < 0 || !port->xmit_buf) { |
@@ -217,7 +217,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout) | |||
217 | return -EINVAL; /* This is an error which we don't know how to handle. */ | 217 | return -EINVAL; /* This is an error which we don't know how to handle. */ |
218 | } | 218 | } |
219 | 219 | ||
220 | rcib = gs_real_chars_in_buffer(port->tty); | 220 | rcib = gs_real_chars_in_buffer(port->port.tty); |
221 | 221 | ||
222 | if(rcib <= 0) { | 222 | if(rcib <= 0) { |
223 | gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n"); | 223 | gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n"); |
@@ -236,7 +236,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout) | |||
236 | 236 | ||
237 | /* the expression is actually jiffies < end_jiffies, but that won't | 237 | /* the expression is actually jiffies < end_jiffies, but that won't |
238 | work around the wraparound. Tricky eh? */ | 238 | work around the wraparound. Tricky eh? */ |
239 | while ((charsleft = gs_real_chars_in_buffer (port->tty)) && | 239 | while ((charsleft = gs_real_chars_in_buffer (port->port.tty)) && |
240 | time_after (end_jiffies, jiffies)) { | 240 | time_after (end_jiffies, jiffies)) { |
241 | /* Units check: | 241 | /* Units check: |
242 | chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies! | 242 | chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies! |
@@ -309,7 +309,7 @@ void gs_flush_chars(struct tty_struct * tty) | |||
309 | } | 309 | } |
310 | 310 | ||
311 | /* Beats me -- REW */ | 311 | /* Beats me -- REW */ |
312 | port->flags |= GS_TX_INTEN; | 312 | port->port.flags |= GS_TX_INTEN; |
313 | port->rd->enable_tx_interrupts (port); | 313 | port->rd->enable_tx_interrupts (port); |
314 | func_exit (); | 314 | func_exit (); |
315 | } | 315 | } |
@@ -329,8 +329,8 @@ void gs_stop(struct tty_struct * tty) | |||
329 | 329 | ||
330 | if (port->xmit_cnt && | 330 | if (port->xmit_cnt && |
331 | port->xmit_buf && | 331 | port->xmit_buf && |
332 | (port->flags & GS_TX_INTEN) ) { | 332 | (port->port.flags & GS_TX_INTEN) ) { |
333 | port->flags &= ~GS_TX_INTEN; | 333 | port->port.flags &= ~GS_TX_INTEN; |
334 | port->rd->disable_tx_interrupts (port); | 334 | port->rd->disable_tx_interrupts (port); |
335 | } | 335 | } |
336 | func_exit (); | 336 | func_exit (); |
@@ -349,8 +349,8 @@ void gs_start(struct tty_struct * tty) | |||
349 | 349 | ||
350 | if (port->xmit_cnt && | 350 | if (port->xmit_cnt && |
351 | port->xmit_buf && | 351 | port->xmit_buf && |
352 | !(port->flags & GS_TX_INTEN) ) { | 352 | !(port->port.flags & GS_TX_INTEN) ) { |
353 | port->flags |= GS_TX_INTEN; | 353 | port->port.flags |= GS_TX_INTEN; |
354 | port->rd->enable_tx_interrupts (port); | 354 | port->rd->enable_tx_interrupts (port); |
355 | } | 355 | } |
356 | func_exit (); | 356 | func_exit (); |
@@ -365,7 +365,7 @@ static void gs_shutdown_port (struct gs_port *port) | |||
365 | 365 | ||
366 | if (!port) return; | 366 | if (!port) return; |
367 | 367 | ||
368 | if (!(port->flags & ASYNC_INITIALIZED)) | 368 | if (!(port->port.flags & ASYNC_INITIALIZED)) |
369 | return; | 369 | return; |
370 | 370 | ||
371 | spin_lock_irqsave(&port->driver_lock, flags); | 371 | spin_lock_irqsave(&port->driver_lock, flags); |
@@ -375,12 +375,12 @@ static void gs_shutdown_port (struct gs_port *port) | |||
375 | port->xmit_buf = NULL; | 375 | port->xmit_buf = NULL; |
376 | } | 376 | } |
377 | 377 | ||
378 | if (port->tty) | 378 | if (port->port.tty) |
379 | set_bit(TTY_IO_ERROR, &port->tty->flags); | 379 | set_bit(TTY_IO_ERROR, &port->port.tty->flags); |
380 | 380 | ||
381 | port->rd->shutdown_port (port); | 381 | port->rd->shutdown_port (port); |
382 | 382 | ||
383 | port->flags &= ~ASYNC_INITIALIZED; | 383 | port->port.flags &= ~ASYNC_INITIALIZED; |
384 | spin_unlock_irqrestore(&port->driver_lock, flags); | 384 | spin_unlock_irqrestore(&port->driver_lock, flags); |
385 | 385 | ||
386 | func_exit(); | 386 | func_exit(); |
@@ -396,16 +396,16 @@ void gs_hangup(struct tty_struct *tty) | |||
396 | if (!tty) return; | 396 | if (!tty) return; |
397 | 397 | ||
398 | port = tty->driver_data; | 398 | port = tty->driver_data; |
399 | tty = port->tty; | 399 | tty = port->port.tty; |
400 | if (!tty) | 400 | if (!tty) |
401 | return; | 401 | return; |
402 | 402 | ||
403 | gs_shutdown_port (port); | 403 | gs_shutdown_port (port); |
404 | port->flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE); | 404 | port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE); |
405 | port->tty = NULL; | 405 | port->port.tty = NULL; |
406 | port->count = 0; | 406 | port->port.count = 0; |
407 | 407 | ||
408 | wake_up_interruptible(&port->open_wait); | 408 | wake_up_interruptible(&port->port.open_wait); |
409 | func_exit (); | 409 | func_exit (); |
410 | } | 410 | } |
411 | 411 | ||
@@ -424,7 +424,7 @@ int gs_block_til_ready(void *port_, struct file * filp) | |||
424 | 424 | ||
425 | if (!port) return 0; | 425 | if (!port) return 0; |
426 | 426 | ||
427 | tty = port->tty; | 427 | tty = port->port.tty; |
428 | 428 | ||
429 | if (!tty) return 0; | 429 | if (!tty) return 0; |
430 | 430 | ||
@@ -433,9 +433,9 @@ int gs_block_til_ready(void *port_, struct file * filp) | |||
433 | * If the device is in the middle of being closed, then block | 433 | * If the device is in the middle of being closed, then block |
434 | * until it's done, and then try again. | 434 | * until it's done, and then try again. |
435 | */ | 435 | */ |
436 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { | 436 | if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) { |
437 | interruptible_sleep_on(&port->close_wait); | 437 | interruptible_sleep_on(&port->port.close_wait); |
438 | if (port->flags & ASYNC_HUP_NOTIFY) | 438 | if (port->port.flags & ASYNC_HUP_NOTIFY) |
439 | return -EAGAIN; | 439 | return -EAGAIN; |
440 | else | 440 | else |
441 | return -ERESTARTSYS; | 441 | return -ERESTARTSYS; |
@@ -449,7 +449,7 @@ int gs_block_til_ready(void *port_, struct file * filp) | |||
449 | */ | 449 | */ |
450 | if ((filp->f_flags & O_NONBLOCK) || | 450 | if ((filp->f_flags & O_NONBLOCK) || |
451 | (tty->flags & (1 << TTY_IO_ERROR))) { | 451 | (tty->flags & (1 << TTY_IO_ERROR))) { |
452 | port->flags |= ASYNC_NORMAL_ACTIVE; | 452 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
453 | return 0; | 453 | return 0; |
454 | } | 454 | } |
455 | 455 | ||
@@ -461,34 +461,34 @@ int gs_block_til_ready(void *port_, struct file * filp) | |||
461 | /* | 461 | /* |
462 | * Block waiting for the carrier detect and the line to become | 462 | * Block waiting for the carrier detect and the line to become |
463 | * free (i.e., not in use by the callout). While we are in | 463 | * free (i.e., not in use by the callout). While we are in |
464 | * this loop, port->count is dropped by one, so that | 464 | * this loop, port->port.count is dropped by one, so that |
465 | * rs_close() knows when to free things. We restore it upon | 465 | * rs_close() knows when to free things. We restore it upon |
466 | * exit, either normal or abnormal. | 466 | * exit, either normal or abnormal. |
467 | */ | 467 | */ |
468 | retval = 0; | 468 | retval = 0; |
469 | 469 | ||
470 | add_wait_queue(&port->open_wait, &wait); | 470 | add_wait_queue(&port->port.open_wait, &wait); |
471 | 471 | ||
472 | gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n"); | 472 | gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n"); |
473 | spin_lock_irqsave(&port->driver_lock, flags); | 473 | spin_lock_irqsave(&port->driver_lock, flags); |
474 | if (!tty_hung_up_p(filp)) { | 474 | if (!tty_hung_up_p(filp)) { |
475 | port->count--; | 475 | port->port.count--; |
476 | } | 476 | } |
477 | spin_unlock_irqrestore(&port->driver_lock, flags); | 477 | spin_unlock_irqrestore(&port->driver_lock, flags); |
478 | port->blocked_open++; | 478 | port->port.blocked_open++; |
479 | while (1) { | 479 | while (1) { |
480 | CD = port->rd->get_CD (port); | 480 | CD = port->rd->get_CD (port); |
481 | gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD); | 481 | gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD); |
482 | set_current_state (TASK_INTERRUPTIBLE); | 482 | set_current_state (TASK_INTERRUPTIBLE); |
483 | if (tty_hung_up_p(filp) || | 483 | if (tty_hung_up_p(filp) || |
484 | !(port->flags & ASYNC_INITIALIZED)) { | 484 | !(port->port.flags & ASYNC_INITIALIZED)) { |
485 | if (port->flags & ASYNC_HUP_NOTIFY) | 485 | if (port->port.flags & ASYNC_HUP_NOTIFY) |
486 | retval = -EAGAIN; | 486 | retval = -EAGAIN; |
487 | else | 487 | else |
488 | retval = -ERESTARTSYS; | 488 | retval = -ERESTARTSYS; |
489 | break; | 489 | break; |
490 | } | 490 | } |
491 | if (!(port->flags & ASYNC_CLOSING) && | 491 | if (!(port->port.flags & ASYNC_CLOSING) && |
492 | (do_clocal || CD)) | 492 | (do_clocal || CD)) |
493 | break; | 493 | break; |
494 | gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n", | 494 | gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n", |
@@ -500,17 +500,17 @@ int gs_block_til_ready(void *port_, struct file * filp) | |||
500 | schedule(); | 500 | schedule(); |
501 | } | 501 | } |
502 | gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n", | 502 | gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n", |
503 | port->blocked_open); | 503 | port->port.blocked_open); |
504 | set_current_state (TASK_RUNNING); | 504 | set_current_state (TASK_RUNNING); |
505 | remove_wait_queue(&port->open_wait, &wait); | 505 | remove_wait_queue(&port->port.open_wait, &wait); |
506 | if (!tty_hung_up_p(filp)) { | 506 | if (!tty_hung_up_p(filp)) { |
507 | port->count++; | 507 | port->port.count++; |
508 | } | 508 | } |
509 | port->blocked_open--; | 509 | port->port.blocked_open--; |
510 | if (retval) | 510 | if (retval) |
511 | return retval; | 511 | return retval; |
512 | 512 | ||
513 | port->flags |= ASYNC_NORMAL_ACTIVE; | 513 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
514 | func_exit (); | 514 | func_exit (); |
515 | return 0; | 515 | return 0; |
516 | } | 516 | } |
@@ -529,10 +529,10 @@ void gs_close(struct tty_struct * tty, struct file * filp) | |||
529 | 529 | ||
530 | if (!port) return; | 530 | if (!port) return; |
531 | 531 | ||
532 | if (!port->tty) { | 532 | if (!port->port.tty) { |
533 | /* This seems to happen when this is called from vhangup. */ | 533 | /* This seems to happen when this is called from vhangup. */ |
534 | gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->tty is NULL\n"); | 534 | gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->port.tty is NULL\n"); |
535 | port->tty = tty; | 535 | port->port.tty = tty; |
536 | } | 536 | } |
537 | 537 | ||
538 | spin_lock_irqsave(&port->driver_lock, flags); | 538 | spin_lock_irqsave(&port->driver_lock, flags); |
@@ -545,23 +545,23 @@ void gs_close(struct tty_struct * tty, struct file * filp) | |||
545 | return; | 545 | return; |
546 | } | 546 | } |
547 | 547 | ||
548 | if ((tty->count == 1) && (port->count != 1)) { | 548 | if ((tty->count == 1) && (port->port.count != 1)) { |
549 | printk(KERN_ERR "gs: gs_close port %p: bad port count;" | 549 | printk(KERN_ERR "gs: gs_close port %p: bad port count;" |
550 | " tty->count is 1, port count is %d\n", port, port->count); | 550 | " tty->count is 1, port count is %d\n", port, port->port.count); |
551 | port->count = 1; | 551 | port->port.count = 1; |
552 | } | 552 | } |
553 | if (--port->count < 0) { | 553 | if (--port->port.count < 0) { |
554 | printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->count); | 554 | printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->port.count); |
555 | port->count = 0; | 555 | port->port.count = 0; |
556 | } | 556 | } |
557 | 557 | ||
558 | if (port->count) { | 558 | if (port->port.count) { |
559 | gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->count); | 559 | gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->port.count); |
560 | spin_unlock_irqrestore(&port->driver_lock, flags); | 560 | spin_unlock_irqrestore(&port->driver_lock, flags); |
561 | func_exit (); | 561 | func_exit (); |
562 | return; | 562 | return; |
563 | } | 563 | } |
564 | port->flags |= ASYNC_CLOSING; | 564 | port->port.flags |= ASYNC_CLOSING; |
565 | 565 | ||
566 | /* | 566 | /* |
567 | * Now we wait for the transmit buffer to clear; and we notify | 567 | * Now we wait for the transmit buffer to clear; and we notify |
@@ -585,7 +585,7 @@ void gs_close(struct tty_struct * tty, struct file * filp) | |||
585 | if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 585 | if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
586 | gs_wait_tx_flushed (port, port->closing_wait); | 586 | gs_wait_tx_flushed (port, port->closing_wait); |
587 | 587 | ||
588 | port->flags &= ~GS_ACTIVE; | 588 | port->port.flags &= ~GS_ACTIVE; |
589 | 589 | ||
590 | gs_flush_buffer(tty); | 590 | gs_flush_buffer(tty); |
591 | 591 | ||
@@ -595,18 +595,18 @@ void gs_close(struct tty_struct * tty, struct file * filp) | |||
595 | port->event = 0; | 595 | port->event = 0; |
596 | port->rd->close (port); | 596 | port->rd->close (port); |
597 | port->rd->shutdown_port (port); | 597 | port->rd->shutdown_port (port); |
598 | port->tty = NULL; | 598 | port->port.tty = NULL; |
599 | 599 | ||
600 | if (port->blocked_open) { | 600 | if (port->port.blocked_open) { |
601 | if (port->close_delay) { | 601 | if (port->close_delay) { |
602 | spin_unlock_irqrestore(&port->driver_lock, flags); | 602 | spin_unlock_irqrestore(&port->driver_lock, flags); |
603 | msleep_interruptible(jiffies_to_msecs(port->close_delay)); | 603 | msleep_interruptible(jiffies_to_msecs(port->close_delay)); |
604 | spin_lock_irqsave(&port->driver_lock, flags); | 604 | spin_lock_irqsave(&port->driver_lock, flags); |
605 | } | 605 | } |
606 | wake_up_interruptible(&port->open_wait); | 606 | wake_up_interruptible(&port->port.open_wait); |
607 | } | 607 | } |
608 | port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED); | 608 | port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED); |
609 | wake_up_interruptible(&port->close_wait); | 609 | wake_up_interruptible(&port->port.close_wait); |
610 | 610 | ||
611 | func_exit (); | 611 | func_exit (); |
612 | } | 612 | } |
@@ -626,10 +626,10 @@ void gs_set_termios (struct tty_struct * tty, | |||
626 | port = tty->driver_data; | 626 | port = tty->driver_data; |
627 | 627 | ||
628 | if (!port) return; | 628 | if (!port) return; |
629 | if (!port->tty) { | 629 | if (!port->port.tty) { |
630 | /* This seems to happen when this is called after gs_close. */ | 630 | /* This seems to happen when this is called after gs_close. */ |
631 | gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->tty is NULL\n"); | 631 | gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->port.tty is NULL\n"); |
632 | port->tty = tty; | 632 | port->port.tty = tty; |
633 | } | 633 | } |
634 | 634 | ||
635 | 635 | ||
@@ -651,15 +651,15 @@ void gs_set_termios (struct tty_struct * tty, | |||
651 | baudrate = tty_get_baud_rate(tty); | 651 | baudrate = tty_get_baud_rate(tty); |
652 | 652 | ||
653 | if ((tiosp->c_cflag & CBAUD) == B38400) { | 653 | if ((tiosp->c_cflag & CBAUD) == B38400) { |
654 | if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 654 | if ( (port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
655 | baudrate = 57600; | 655 | baudrate = 57600; |
656 | else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 656 | else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
657 | baudrate = 115200; | 657 | baudrate = 115200; |
658 | else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) | 658 | else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) |
659 | baudrate = 230400; | 659 | baudrate = 230400; |
660 | else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) | 660 | else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) |
661 | baudrate = 460800; | 661 | baudrate = 460800; |
662 | else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) | 662 | else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) |
663 | baudrate = (port->baud_base / port->custom_divisor); | 663 | baudrate = (port->baud_base / port->custom_divisor); |
664 | } | 664 | } |
665 | 665 | ||
@@ -715,7 +715,7 @@ int gs_init_port(struct gs_port *port) | |||
715 | 715 | ||
716 | func_enter (); | 716 | func_enter (); |
717 | 717 | ||
718 | if (port->flags & ASYNC_INITIALIZED) { | 718 | if (port->port.flags & ASYNC_INITIALIZED) { |
719 | func_exit (); | 719 | func_exit (); |
720 | return 0; | 720 | return 0; |
721 | } | 721 | } |
@@ -737,15 +737,15 @@ int gs_init_port(struct gs_port *port) | |||
737 | } | 737 | } |
738 | 738 | ||
739 | spin_lock_irqsave (&port->driver_lock, flags); | 739 | spin_lock_irqsave (&port->driver_lock, flags); |
740 | if (port->tty) | 740 | if (port->port.tty) |
741 | clear_bit(TTY_IO_ERROR, &port->tty->flags); | 741 | clear_bit(TTY_IO_ERROR, &port->port.tty->flags); |
742 | mutex_init(&port->port_write_mutex); | 742 | mutex_init(&port->port_write_mutex); |
743 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; | 743 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; |
744 | spin_unlock_irqrestore(&port->driver_lock, flags); | 744 | spin_unlock_irqrestore(&port->driver_lock, flags); |
745 | gs_set_termios(port->tty, NULL); | 745 | gs_set_termios(port->port.tty, NULL); |
746 | spin_lock_irqsave (&port->driver_lock, flags); | 746 | spin_lock_irqsave (&port->driver_lock, flags); |
747 | port->flags |= ASYNC_INITIALIZED; | 747 | port->port.flags |= ASYNC_INITIALIZED; |
748 | port->flags &= ~GS_TX_INTEN; | 748 | port->port.flags &= ~GS_TX_INTEN; |
749 | 749 | ||
750 | spin_unlock_irqrestore(&port->driver_lock, flags); | 750 | spin_unlock_irqrestore(&port->driver_lock, flags); |
751 | func_exit (); | 751 | func_exit (); |
@@ -764,11 +764,11 @@ int gs_setserial(struct gs_port *port, struct serial_struct __user *sp) | |||
764 | if ((sio.baud_base != port->baud_base) || | 764 | if ((sio.baud_base != port->baud_base) || |
765 | (sio.close_delay != port->close_delay) || | 765 | (sio.close_delay != port->close_delay) || |
766 | ((sio.flags & ~ASYNC_USR_MASK) != | 766 | ((sio.flags & ~ASYNC_USR_MASK) != |
767 | (port->flags & ~ASYNC_USR_MASK))) | 767 | (port->port.flags & ~ASYNC_USR_MASK))) |
768 | return(-EPERM); | 768 | return(-EPERM); |
769 | } | 769 | } |
770 | 770 | ||
771 | port->flags = (port->flags & ~ASYNC_USR_MASK) | | 771 | port->port.flags = (port->port.flags & ~ASYNC_USR_MASK) | |
772 | (sio.flags & ASYNC_USR_MASK); | 772 | (sio.flags & ASYNC_USR_MASK); |
773 | 773 | ||
774 | port->baud_base = sio.baud_base; | 774 | port->baud_base = sio.baud_base; |
@@ -776,7 +776,7 @@ int gs_setserial(struct gs_port *port, struct serial_struct __user *sp) | |||
776 | port->closing_wait = sio.closing_wait; | 776 | port->closing_wait = sio.closing_wait; |
777 | port->custom_divisor = sio.custom_divisor; | 777 | port->custom_divisor = sio.custom_divisor; |
778 | 778 | ||
779 | gs_set_termios (port->tty, NULL); | 779 | gs_set_termios (port->port.tty, NULL); |
780 | 780 | ||
781 | return 0; | 781 | return 0; |
782 | } | 782 | } |
@@ -793,7 +793,7 @@ int gs_getserial(struct gs_port *port, struct serial_struct __user *sp) | |||
793 | struct serial_struct sio; | 793 | struct serial_struct sio; |
794 | 794 | ||
795 | memset(&sio, 0, sizeof(struct serial_struct)); | 795 | memset(&sio, 0, sizeof(struct serial_struct)); |
796 | sio.flags = port->flags; | 796 | sio.flags = port->port.flags; |
797 | sio.baud_base = port->baud_base; | 797 | sio.baud_base = port->baud_base; |
798 | sio.close_delay = port->close_delay; | 798 | sio.close_delay = port->close_delay; |
799 | sio.closing_wait = port->closing_wait; | 799 | sio.closing_wait = port->closing_wait; |
@@ -821,10 +821,10 @@ void gs_got_break(struct gs_port *port) | |||
821 | { | 821 | { |
822 | func_enter (); | 822 | func_enter (); |
823 | 823 | ||
824 | tty_insert_flip_char(port->tty, 0, TTY_BREAK); | 824 | tty_insert_flip_char(port->port.tty, 0, TTY_BREAK); |
825 | tty_schedule_flip(port->tty); | 825 | tty_schedule_flip(port->port.tty); |
826 | if (port->flags & ASYNC_SAK) { | 826 | if (port->port.flags & ASYNC_SAK) { |
827 | do_SAK (port->tty); | 827 | do_SAK (port->port.tty); |
828 | } | 828 | } |
829 | 829 | ||
830 | func_exit (); | 830 | func_exit (); |
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c index 938879cc7bcc..0061e18aff60 100644 --- a/drivers/char/ip2/i2lib.c +++ b/drivers/char/ip2/i2lib.c | |||
@@ -868,11 +868,11 @@ i2Input(i2ChanStrPtr pCh) | |||
868 | amountToMove = count; | 868 | amountToMove = count; |
869 | } | 869 | } |
870 | // Move the first block | 870 | // Move the first block |
871 | pCh->pTTY->ldisc.receive_buf( pCh->pTTY, | 871 | pCh->pTTY->ldisc.ops->receive_buf( pCh->pTTY, |
872 | &(pCh->Ibuf[stripIndex]), NULL, amountToMove ); | 872 | &(pCh->Ibuf[stripIndex]), NULL, amountToMove ); |
873 | // If we needed to wrap, do the second data move | 873 | // If we needed to wrap, do the second data move |
874 | if (count > amountToMove) { | 874 | if (count > amountToMove) { |
875 | pCh->pTTY->ldisc.receive_buf( pCh->pTTY, | 875 | pCh->pTTY->ldisc.ops->receive_buf( pCh->pTTY, |
876 | pCh->Ibuf, NULL, count - amountToMove ); | 876 | pCh->Ibuf, NULL, count - amountToMove ); |
877 | } | 877 | } |
878 | // Bump and wrap the stripIndex all at once by the amount of data read. This | 878 | // Bump and wrap the stripIndex all at once by the amount of data read. This |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 9a2394cda943..5dc74404058f 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -1289,11 +1289,12 @@ static void do_input(struct work_struct *work) | |||
1289 | // code duplicated from n_tty (ldisc) | 1289 | // code duplicated from n_tty (ldisc) |
1290 | static inline void isig(int sig, struct tty_struct *tty, int flush) | 1290 | static inline void isig(int sig, struct tty_struct *tty, int flush) |
1291 | { | 1291 | { |
1292 | /* FIXME: This is completely bogus */ | ||
1292 | if (tty->pgrp) | 1293 | if (tty->pgrp) |
1293 | kill_pgrp(tty->pgrp, sig, 1); | 1294 | kill_pgrp(tty->pgrp, sig, 1); |
1294 | if (flush || !L_NOFLSH(tty)) { | 1295 | if (flush || !L_NOFLSH(tty)) { |
1295 | if ( tty->ldisc.flush_buffer ) | 1296 | if ( tty->ldisc.ops->flush_buffer ) |
1296 | tty->ldisc.flush_buffer(tty); | 1297 | tty->ldisc.ops->flush_buffer(tty); |
1297 | i2InputFlush( tty->driver_data ); | 1298 | i2InputFlush( tty->driver_data ); |
1298 | } | 1299 | } |
1299 | } | 1300 | } |
@@ -1342,7 +1343,7 @@ static void do_status(struct work_struct *work) | |||
1342 | } | 1343 | } |
1343 | tmp = pCh->pTTY->real_raw; | 1344 | tmp = pCh->pTTY->real_raw; |
1344 | pCh->pTTY->real_raw = 0; | 1345 | pCh->pTTY->real_raw = 0; |
1345 | pCh->pTTY->ldisc.receive_buf( pCh->pTTY, &brkc, &brkf, 1 ); | 1346 | pCh->pTTY->ldisc->ops.receive_buf( pCh->pTTY, &brkc, &brkf, 1 ); |
1346 | pCh->pTTY->real_raw = tmp; | 1347 | pCh->pTTY->real_raw = tmp; |
1347 | } | 1348 | } |
1348 | #endif /* NEVER_HAPPENS_AS_SETUP_XXX */ | 1349 | #endif /* NEVER_HAPPENS_AS_SETUP_XXX */ |
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 4f3cefa8eb0e..d4281df10c22 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -198,17 +198,10 @@ struct isi_board { | |||
198 | 198 | ||
199 | struct isi_port { | 199 | struct isi_port { |
200 | unsigned short magic; | 200 | unsigned short magic; |
201 | unsigned int flags; | 201 | struct tty_port port; |
202 | int count; | ||
203 | int blocked_open; | ||
204 | int close_delay; | ||
205 | u16 channel; | 202 | u16 channel; |
206 | u16 status; | 203 | u16 status; |
207 | u16 closing_wait; | ||
208 | struct isi_board *card; | 204 | struct isi_board *card; |
209 | struct tty_struct *tty; | ||
210 | wait_queue_head_t close_wait; | ||
211 | wait_queue_head_t open_wait; | ||
212 | unsigned char *xmit_buf; | 205 | unsigned char *xmit_buf; |
213 | int xmit_head; | 206 | int xmit_head; |
214 | int xmit_tail; | 207 | int xmit_tail; |
@@ -430,11 +423,11 @@ static void isicom_tx(unsigned long _data) | |||
430 | 423 | ||
431 | for (; count > 0; count--, port++) { | 424 | for (; count > 0; count--, port++) { |
432 | /* port not active or tx disabled to force flow control */ | 425 | /* port not active or tx disabled to force flow control */ |
433 | if (!(port->flags & ASYNC_INITIALIZED) || | 426 | if (!(port->port.flags & ASYNC_INITIALIZED) || |
434 | !(port->status & ISI_TXOK)) | 427 | !(port->status & ISI_TXOK)) |
435 | continue; | 428 | continue; |
436 | 429 | ||
437 | tty = port->tty; | 430 | tty = port->port.tty; |
438 | 431 | ||
439 | if (tty == NULL) | 432 | if (tty == NULL) |
440 | continue; | 433 | continue; |
@@ -458,7 +451,7 @@ static void isicom_tx(unsigned long _data) | |||
458 | if (residue == YES) { | 451 | if (residue == YES) { |
459 | residue = NO; | 452 | residue = NO; |
460 | if (cnt > 0) { | 453 | if (cnt > 0) { |
461 | wrd |= (port->xmit_buf[port->xmit_tail] | 454 | wrd |= (port->port.xmit_buf[port->xmit_tail] |
462 | << 8); | 455 | << 8); |
463 | port->xmit_tail = (port->xmit_tail + 1) | 456 | port->xmit_tail = (port->xmit_tail + 1) |
464 | & (SERIAL_XMIT_SIZE - 1); | 457 | & (SERIAL_XMIT_SIZE - 1); |
@@ -474,14 +467,14 @@ static void isicom_tx(unsigned long _data) | |||
474 | if (cnt <= 0) | 467 | if (cnt <= 0) |
475 | break; | 468 | break; |
476 | word_count = cnt >> 1; | 469 | word_count = cnt >> 1; |
477 | outsw(base, port->xmit_buf+port->xmit_tail, word_count); | 470 | outsw(base, port->port.xmit_buf+port->xmit_tail, word_count); |
478 | port->xmit_tail = (port->xmit_tail | 471 | port->xmit_tail = (port->xmit_tail |
479 | + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1); | 472 | + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1); |
480 | txcount -= (word_count << 1); | 473 | txcount -= (word_count << 1); |
481 | port->xmit_cnt -= (word_count << 1); | 474 | port->xmit_cnt -= (word_count << 1); |
482 | if (cnt & 0x0001) { | 475 | if (cnt & 0x0001) { |
483 | residue = YES; | 476 | residue = YES; |
484 | wrd = port->xmit_buf[port->xmit_tail]; | 477 | wrd = port->port.xmit_buf[port->xmit_tail]; |
485 | port->xmit_tail = (port->xmit_tail + 1) | 478 | port->xmit_tail = (port->xmit_tail + 1) |
486 | & (SERIAL_XMIT_SIZE - 1); | 479 | & (SERIAL_XMIT_SIZE - 1); |
487 | port->xmit_cnt--; | 480 | port->xmit_cnt--; |
@@ -548,13 +541,13 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
548 | return IRQ_HANDLED; | 541 | return IRQ_HANDLED; |
549 | } | 542 | } |
550 | port = card->ports + channel; | 543 | port = card->ports + channel; |
551 | if (!(port->flags & ASYNC_INITIALIZED)) { | 544 | if (!(port->port.flags & ASYNC_INITIALIZED)) { |
552 | outw(0x0000, base+0x04); /* enable interrupts */ | 545 | outw(0x0000, base+0x04); /* enable interrupts */ |
553 | spin_unlock(&card->card_lock); | 546 | spin_unlock(&card->card_lock); |
554 | return IRQ_HANDLED; | 547 | return IRQ_HANDLED; |
555 | } | 548 | } |
556 | 549 | ||
557 | tty = port->tty; | 550 | tty = port->port.tty; |
558 | if (tty == NULL) { | 551 | if (tty == NULL) { |
559 | word_count = byte_count >> 1; | 552 | word_count = byte_count >> 1; |
560 | while (byte_count > 1) { | 553 | while (byte_count > 1) { |
@@ -572,7 +565,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
572 | header = inw(base); | 565 | header = inw(base); |
573 | switch (header & 0xff) { | 566 | switch (header & 0xff) { |
574 | case 0: /* Change in EIA signals */ | 567 | case 0: /* Change in EIA signals */ |
575 | if (port->flags & ASYNC_CHECK_CD) { | 568 | if (port->port.flags & ASYNC_CHECK_CD) { |
576 | if (port->status & ISI_DCD) { | 569 | if (port->status & ISI_DCD) { |
577 | if (!(header & ISI_DCD)) { | 570 | if (!(header & ISI_DCD)) { |
578 | /* Carrier has been lost */ | 571 | /* Carrier has been lost */ |
@@ -585,7 +578,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
585 | /* Carrier has been detected */ | 578 | /* Carrier has been detected */ |
586 | pr_dbg("interrupt: DCD->high.\n"); | 579 | pr_dbg("interrupt: DCD->high.\n"); |
587 | port->status |= ISI_DCD; | 580 | port->status |= ISI_DCD; |
588 | wake_up_interruptible(&port->open_wait); | 581 | wake_up_interruptible(&port->port.open_wait); |
589 | } | 582 | } |
590 | } else { | 583 | } else { |
591 | if (header & ISI_DCD) | 584 | if (header & ISI_DCD) |
@@ -594,17 +587,17 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
594 | port->status &= ~ISI_DCD; | 587 | port->status &= ~ISI_DCD; |
595 | } | 588 | } |
596 | 589 | ||
597 | if (port->flags & ASYNC_CTS_FLOW) { | 590 | if (port->port.flags & ASYNC_CTS_FLOW) { |
598 | if (port->tty->hw_stopped) { | 591 | if (port->port.tty->hw_stopped) { |
599 | if (header & ISI_CTS) { | 592 | if (header & ISI_CTS) { |
600 | port->tty->hw_stopped = 0; | 593 | port->port.tty->hw_stopped = 0; |
601 | /* start tx ing */ | 594 | /* start tx ing */ |
602 | port->status |= (ISI_TXOK | 595 | port->status |= (ISI_TXOK |
603 | | ISI_CTS); | 596 | | ISI_CTS); |
604 | tty_wakeup(tty); | 597 | tty_wakeup(tty); |
605 | } | 598 | } |
606 | } else if (!(header & ISI_CTS)) { | 599 | } else if (!(header & ISI_CTS)) { |
607 | port->tty->hw_stopped = 1; | 600 | port->port.tty->hw_stopped = 1; |
608 | /* stop tx ing */ | 601 | /* stop tx ing */ |
609 | port->status &= ~(ISI_TXOK | ISI_CTS); | 602 | port->status &= ~(ISI_TXOK | ISI_CTS); |
610 | } | 603 | } |
@@ -629,7 +622,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
629 | 622 | ||
630 | case 1: /* Received Break !!! */ | 623 | case 1: /* Received Break !!! */ |
631 | tty_insert_flip_char(tty, 0, TTY_BREAK); | 624 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
632 | if (port->flags & ASYNC_SAK) | 625 | if (port->port.flags & ASYNC_SAK) |
633 | do_SAK(tty); | 626 | do_SAK(tty); |
634 | tty_flip_buffer_push(tty); | 627 | tty_flip_buffer_push(tty); |
635 | break; | 628 | break; |
@@ -681,7 +674,7 @@ static void isicom_config_port(struct isi_port *port) | |||
681 | shift_count = card->shift_count; | 674 | shift_count = card->shift_count; |
682 | unsigned char flow_ctrl; | 675 | unsigned char flow_ctrl; |
683 | 676 | ||
684 | tty = port->tty; | 677 | tty = port->port.tty; |
685 | 678 | ||
686 | if (tty == NULL) | 679 | if (tty == NULL) |
687 | return; | 680 | return; |
@@ -697,7 +690,7 @@ static void isicom_config_port(struct isi_port *port) | |||
697 | 690 | ||
698 | /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */ | 691 | /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */ |
699 | if (baud < 1 || baud > 4) | 692 | if (baud < 1 || baud > 4) |
700 | port->tty->termios->c_cflag &= ~CBAUDEX; | 693 | port->port.tty->termios->c_cflag &= ~CBAUDEX; |
701 | else | 694 | else |
702 | baud += 15; | 695 | baud += 15; |
703 | } | 696 | } |
@@ -708,13 +701,13 @@ static void isicom_config_port(struct isi_port *port) | |||
708 | * the 'setserial' utility. | 701 | * the 'setserial' utility. |
709 | */ | 702 | */ |
710 | 703 | ||
711 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 704 | if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
712 | baud++; /* 57.6 Kbps */ | 705 | baud++; /* 57.6 Kbps */ |
713 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 706 | if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
714 | baud += 2; /* 115 Kbps */ | 707 | baud += 2; /* 115 Kbps */ |
715 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) | 708 | if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) |
716 | baud += 3; /* 230 kbps*/ | 709 | baud += 3; /* 230 kbps*/ |
717 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) | 710 | if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) |
718 | baud += 4; /* 460 kbps*/ | 711 | baud += 4; /* 460 kbps*/ |
719 | } | 712 | } |
720 | if (linuxb_to_isib[baud] == -1) { | 713 | if (linuxb_to_isib[baud] == -1) { |
@@ -754,15 +747,15 @@ static void isicom_config_port(struct isi_port *port) | |||
754 | InterruptTheCard(base); | 747 | InterruptTheCard(base); |
755 | } | 748 | } |
756 | if (C_CLOCAL(tty)) | 749 | if (C_CLOCAL(tty)) |
757 | port->flags &= ~ASYNC_CHECK_CD; | 750 | port->port.flags &= ~ASYNC_CHECK_CD; |
758 | else | 751 | else |
759 | port->flags |= ASYNC_CHECK_CD; | 752 | port->port.flags |= ASYNC_CHECK_CD; |
760 | 753 | ||
761 | /* flow control settings ...*/ | 754 | /* flow control settings ...*/ |
762 | flow_ctrl = 0; | 755 | flow_ctrl = 0; |
763 | port->flags &= ~ASYNC_CTS_FLOW; | 756 | port->port.flags &= ~ASYNC_CTS_FLOW; |
764 | if (C_CRTSCTS(tty)) { | 757 | if (C_CRTSCTS(tty)) { |
765 | port->flags |= ASYNC_CTS_FLOW; | 758 | port->port.flags |= ASYNC_CTS_FLOW; |
766 | flow_ctrl |= ISICOM_CTSRTS; | 759 | flow_ctrl |= ISICOM_CTSRTS; |
767 | } | 760 | } |
768 | if (I_IXON(tty)) | 761 | if (I_IXON(tty)) |
@@ -809,23 +802,15 @@ static int isicom_setup_port(struct isi_port *port) | |||
809 | struct isi_board *card = port->card; | 802 | struct isi_board *card = port->card; |
810 | unsigned long flags; | 803 | unsigned long flags; |
811 | 804 | ||
812 | if (port->flags & ASYNC_INITIALIZED) | 805 | if (port->port.flags & ASYNC_INITIALIZED) |
813 | return 0; | 806 | return 0; |
814 | if (!port->xmit_buf) { | 807 | if (tty_port_alloc_xmit_buf(&port->port) < 0) |
815 | /* Relies on BKL */ | 808 | return -ENOMEM; |
816 | unsigned long page = get_zeroed_page(GFP_KERNEL); | ||
817 | if (page == 0) | ||
818 | return -ENOMEM; | ||
819 | if (port->xmit_buf) | ||
820 | free_page(page); | ||
821 | else | ||
822 | port->xmit_buf = (unsigned char *) page; | ||
823 | } | ||
824 | 809 | ||
825 | spin_lock_irqsave(&card->card_lock, flags); | 810 | spin_lock_irqsave(&card->card_lock, flags); |
826 | if (port->tty) | 811 | if (port->port.tty) |
827 | clear_bit(TTY_IO_ERROR, &port->tty->flags); | 812 | clear_bit(TTY_IO_ERROR, &port->port.tty->flags); |
828 | if (port->count == 1) | 813 | if (port->port.count == 1) |
829 | card->count++; | 814 | card->count++; |
830 | 815 | ||
831 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; | 816 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; |
@@ -839,7 +824,7 @@ static int isicom_setup_port(struct isi_port *port) | |||
839 | } | 824 | } |
840 | 825 | ||
841 | isicom_config_port(port); | 826 | isicom_config_port(port); |
842 | port->flags |= ASYNC_INITIALIZED; | 827 | port->port.flags |= ASYNC_INITIALIZED; |
843 | spin_unlock_irqrestore(&card->card_lock, flags); | 828 | spin_unlock_irqrestore(&card->card_lock, flags); |
844 | 829 | ||
845 | return 0; | 830 | return 0; |
@@ -855,10 +840,10 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
855 | 840 | ||
856 | /* block if port is in the process of being closed */ | 841 | /* block if port is in the process of being closed */ |
857 | 842 | ||
858 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { | 843 | if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) { |
859 | pr_dbg("block_til_ready: close in progress.\n"); | 844 | pr_dbg("block_til_ready: close in progress.\n"); |
860 | interruptible_sleep_on(&port->close_wait); | 845 | interruptible_sleep_on(&port->port.close_wait); |
861 | if (port->flags & ASYNC_HUP_NOTIFY) | 846 | if (port->port.flags & ASYNC_HUP_NOTIFY) |
862 | return -EAGAIN; | 847 | return -EAGAIN; |
863 | else | 848 | else |
864 | return -ERESTARTSYS; | 849 | return -ERESTARTSYS; |
@@ -869,7 +854,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
869 | if ((filp->f_flags & O_NONBLOCK) || | 854 | if ((filp->f_flags & O_NONBLOCK) || |
870 | (tty->flags & (1 << TTY_IO_ERROR))) { | 855 | (tty->flags & (1 << TTY_IO_ERROR))) { |
871 | pr_dbg("block_til_ready: non-block mode.\n"); | 856 | pr_dbg("block_til_ready: non-block mode.\n"); |
872 | port->flags |= ASYNC_NORMAL_ACTIVE; | 857 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
873 | return 0; | 858 | return 0; |
874 | } | 859 | } |
875 | 860 | ||
@@ -879,26 +864,26 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
879 | /* block waiting for DCD to be asserted, and while | 864 | /* block waiting for DCD to be asserted, and while |
880 | callout dev is busy */ | 865 | callout dev is busy */ |
881 | retval = 0; | 866 | retval = 0; |
882 | add_wait_queue(&port->open_wait, &wait); | 867 | add_wait_queue(&port->port.open_wait, &wait); |
883 | 868 | ||
884 | spin_lock_irqsave(&card->card_lock, flags); | 869 | spin_lock_irqsave(&card->card_lock, flags); |
885 | if (!tty_hung_up_p(filp)) | 870 | if (!tty_hung_up_p(filp)) |
886 | port->count--; | 871 | port->port.count--; |
887 | port->blocked_open++; | 872 | port->port.blocked_open++; |
888 | spin_unlock_irqrestore(&card->card_lock, flags); | 873 | spin_unlock_irqrestore(&card->card_lock, flags); |
889 | 874 | ||
890 | while (1) { | 875 | while (1) { |
891 | raise_dtr_rts(port); | 876 | raise_dtr_rts(port); |
892 | 877 | ||
893 | set_current_state(TASK_INTERRUPTIBLE); | 878 | set_current_state(TASK_INTERRUPTIBLE); |
894 | if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { | 879 | if (tty_hung_up_p(filp) || !(port->port.flags & ASYNC_INITIALIZED)) { |
895 | if (port->flags & ASYNC_HUP_NOTIFY) | 880 | if (port->port.flags & ASYNC_HUP_NOTIFY) |
896 | retval = -EAGAIN; | 881 | retval = -EAGAIN; |
897 | else | 882 | else |
898 | retval = -ERESTARTSYS; | 883 | retval = -ERESTARTSYS; |
899 | break; | 884 | break; |
900 | } | 885 | } |
901 | if (!(port->flags & ASYNC_CLOSING) && | 886 | if (!(port->port.flags & ASYNC_CLOSING) && |
902 | (do_clocal || (port->status & ISI_DCD))) { | 887 | (do_clocal || (port->status & ISI_DCD))) { |
903 | break; | 888 | break; |
904 | } | 889 | } |
@@ -909,15 +894,15 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
909 | schedule(); | 894 | schedule(); |
910 | } | 895 | } |
911 | set_current_state(TASK_RUNNING); | 896 | set_current_state(TASK_RUNNING); |
912 | remove_wait_queue(&port->open_wait, &wait); | 897 | remove_wait_queue(&port->port.open_wait, &wait); |
913 | spin_lock_irqsave(&card->card_lock, flags); | 898 | spin_lock_irqsave(&card->card_lock, flags); |
914 | if (!tty_hung_up_p(filp)) | 899 | if (!tty_hung_up_p(filp)) |
915 | port->count++; | 900 | port->port.count++; |
916 | port->blocked_open--; | 901 | port->port.blocked_open--; |
917 | spin_unlock_irqrestore(&card->card_lock, flags); | 902 | spin_unlock_irqrestore(&card->card_lock, flags); |
918 | if (retval) | 903 | if (retval) |
919 | return retval; | 904 | return retval; |
920 | port->flags |= ASYNC_NORMAL_ACTIVE; | 905 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
921 | return 0; | 906 | return 0; |
922 | } | 907 | } |
923 | 908 | ||
@@ -947,9 +932,9 @@ static int isicom_open(struct tty_struct *tty, struct file *filp) | |||
947 | 932 | ||
948 | isicom_setup_board(card); | 933 | isicom_setup_board(card); |
949 | 934 | ||
950 | port->count++; | 935 | port->port.count++; |
951 | tty->driver_data = port; | 936 | tty->driver_data = port; |
952 | port->tty = tty; | 937 | port->port.tty = tty; |
953 | error = isicom_setup_port(port); | 938 | error = isicom_setup_port(port); |
954 | if (error == 0) | 939 | if (error == 0) |
955 | error = block_til_ready(tty, filp, port); | 940 | error = block_til_ready(tty, filp, port); |
@@ -970,18 +955,15 @@ static void isicom_shutdown_port(struct isi_port *port) | |||
970 | struct isi_board *card = port->card; | 955 | struct isi_board *card = port->card; |
971 | struct tty_struct *tty; | 956 | struct tty_struct *tty; |
972 | 957 | ||
973 | tty = port->tty; | 958 | tty = port->port.tty; |
974 | 959 | ||
975 | if (!(port->flags & ASYNC_INITIALIZED)) | 960 | if (!(port->port.flags & ASYNC_INITIALIZED)) |
976 | return; | 961 | return; |
977 | 962 | ||
978 | if (port->xmit_buf) { | 963 | tty_port_free_xmit_buf(&port->port); |
979 | free_page((unsigned long) port->xmit_buf); | 964 | port->port.flags &= ~ASYNC_INITIALIZED; |
980 | port->xmit_buf = NULL; | ||
981 | } | ||
982 | port->flags &= ~ASYNC_INITIALIZED; | ||
983 | /* 3rd October 2000 : Vinayak P Risbud */ | 965 | /* 3rd October 2000 : Vinayak P Risbud */ |
984 | port->tty = NULL; | 966 | port->port.tty = NULL; |
985 | 967 | ||
986 | /*Fix done by Anil .S on 30-04-2001 | 968 | /*Fix done by Anil .S on 30-04-2001 |
987 | remote login through isi port has dtr toggle problem | 969 | remote login through isi port has dtr toggle problem |
@@ -1046,33 +1028,33 @@ static void isicom_close(struct tty_struct *tty, struct file *filp) | |||
1046 | return; | 1028 | return; |
1047 | } | 1029 | } |
1048 | 1030 | ||
1049 | if (tty->count == 1 && port->count != 1) { | 1031 | if (tty->count == 1 && port->port.count != 1) { |
1050 | printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " | 1032 | printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " |
1051 | "count tty->count = 1 port count = %d.\n", | 1033 | "count tty->count = 1 port count = %d.\n", |
1052 | card->base, port->count); | 1034 | card->base, port->port.count); |
1053 | port->count = 1; | 1035 | port->port.count = 1; |
1054 | } | 1036 | } |
1055 | if (--port->count < 0) { | 1037 | if (--port->port.count < 0) { |
1056 | printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " | 1038 | printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " |
1057 | "count for channel%d = %d", card->base, port->channel, | 1039 | "count for channel%d = %d", card->base, port->channel, |
1058 | port->count); | 1040 | port->port.count); |
1059 | port->count = 0; | 1041 | port->port.count = 0; |
1060 | } | 1042 | } |
1061 | 1043 | ||
1062 | if (port->count) { | 1044 | if (port->port.count) { |
1063 | spin_unlock_irqrestore(&card->card_lock, flags); | 1045 | spin_unlock_irqrestore(&card->card_lock, flags); |
1064 | return; | 1046 | return; |
1065 | } | 1047 | } |
1066 | port->flags |= ASYNC_CLOSING; | 1048 | port->port.flags |= ASYNC_CLOSING; |
1067 | tty->closing = 1; | 1049 | tty->closing = 1; |
1068 | spin_unlock_irqrestore(&card->card_lock, flags); | 1050 | spin_unlock_irqrestore(&card->card_lock, flags); |
1069 | 1051 | ||
1070 | if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 1052 | if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) |
1071 | tty_wait_until_sent(tty, port->closing_wait); | 1053 | tty_wait_until_sent(tty, port->port.closing_wait); |
1072 | /* indicate to the card that no more data can be received | 1054 | /* indicate to the card that no more data can be received |
1073 | on this port */ | 1055 | on this port */ |
1074 | spin_lock_irqsave(&card->card_lock, flags); | 1056 | spin_lock_irqsave(&card->card_lock, flags); |
1075 | if (port->flags & ASYNC_INITIALIZED) { | 1057 | if (port->port.flags & ASYNC_INITIALIZED) { |
1076 | card->port_status &= ~(1 << port->channel); | 1058 | card->port_status &= ~(1 << port->channel); |
1077 | outw(card->port_status, card->base + 0x02); | 1059 | outw(card->port_status, card->base + 0x02); |
1078 | } | 1060 | } |
@@ -1085,18 +1067,18 @@ static void isicom_close(struct tty_struct *tty, struct file *filp) | |||
1085 | spin_lock_irqsave(&card->card_lock, flags); | 1067 | spin_lock_irqsave(&card->card_lock, flags); |
1086 | tty->closing = 0; | 1068 | tty->closing = 0; |
1087 | 1069 | ||
1088 | if (port->blocked_open) { | 1070 | if (port->port.blocked_open) { |
1089 | spin_unlock_irqrestore(&card->card_lock, flags); | 1071 | spin_unlock_irqrestore(&card->card_lock, flags); |
1090 | if (port->close_delay) { | 1072 | if (port->port.close_delay) { |
1091 | pr_dbg("scheduling until time out.\n"); | 1073 | pr_dbg("scheduling until time out.\n"); |
1092 | msleep_interruptible( | 1074 | msleep_interruptible( |
1093 | jiffies_to_msecs(port->close_delay)); | 1075 | jiffies_to_msecs(port->port.close_delay)); |
1094 | } | 1076 | } |
1095 | spin_lock_irqsave(&card->card_lock, flags); | 1077 | spin_lock_irqsave(&card->card_lock, flags); |
1096 | wake_up_interruptible(&port->open_wait); | 1078 | wake_up_interruptible(&port->port.open_wait); |
1097 | } | 1079 | } |
1098 | port->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); | 1080 | port->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); |
1099 | wake_up_interruptible(&port->close_wait); | 1081 | wake_up_interruptible(&port->port.close_wait); |
1100 | spin_unlock_irqrestore(&card->card_lock, flags); | 1082 | spin_unlock_irqrestore(&card->card_lock, flags); |
1101 | } | 1083 | } |
1102 | 1084 | ||
@@ -1112,9 +1094,6 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf, | |||
1112 | if (isicom_paranoia_check(port, tty->name, "isicom_write")) | 1094 | if (isicom_paranoia_check(port, tty->name, "isicom_write")) |
1113 | return 0; | 1095 | return 0; |
1114 | 1096 | ||
1115 | if (!port->xmit_buf) | ||
1116 | return 0; | ||
1117 | |||
1118 | spin_lock_irqsave(&card->card_lock, flags); | 1097 | spin_lock_irqsave(&card->card_lock, flags); |
1119 | 1098 | ||
1120 | while (1) { | 1099 | while (1) { |
@@ -1123,7 +1102,7 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf, | |||
1123 | if (cnt <= 0) | 1102 | if (cnt <= 0) |
1124 | break; | 1103 | break; |
1125 | 1104 | ||
1126 | memcpy(port->xmit_buf + port->xmit_head, buf, cnt); | 1105 | memcpy(port->port.xmit_buf + port->xmit_head, buf, cnt); |
1127 | port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE | 1106 | port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE |
1128 | - 1); | 1107 | - 1); |
1129 | port->xmit_cnt += cnt; | 1108 | port->xmit_cnt += cnt; |
@@ -1147,16 +1126,13 @@ static int isicom_put_char(struct tty_struct *tty, unsigned char ch) | |||
1147 | if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) | 1126 | if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) |
1148 | return 0; | 1127 | return 0; |
1149 | 1128 | ||
1150 | if (!port->xmit_buf) | ||
1151 | return 0; | ||
1152 | |||
1153 | spin_lock_irqsave(&card->card_lock, flags); | 1129 | spin_lock_irqsave(&card->card_lock, flags); |
1154 | if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) { | 1130 | if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) { |
1155 | spin_unlock_irqrestore(&card->card_lock, flags); | 1131 | spin_unlock_irqrestore(&card->card_lock, flags); |
1156 | return 0; | 1132 | return 0; |
1157 | } | 1133 | } |
1158 | 1134 | ||
1159 | port->xmit_buf[port->xmit_head++] = ch; | 1135 | port->port.xmit_buf[port->xmit_head++] = ch; |
1160 | port->xmit_head &= (SERIAL_XMIT_SIZE - 1); | 1136 | port->xmit_head &= (SERIAL_XMIT_SIZE - 1); |
1161 | port->xmit_cnt++; | 1137 | port->xmit_cnt++; |
1162 | spin_unlock_irqrestore(&card->card_lock, flags); | 1138 | spin_unlock_irqrestore(&card->card_lock, flags); |
@@ -1172,7 +1148,7 @@ static void isicom_flush_chars(struct tty_struct *tty) | |||
1172 | return; | 1148 | return; |
1173 | 1149 | ||
1174 | if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || | 1150 | if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || |
1175 | !port->xmit_buf) | 1151 | !port->port.xmit_buf) |
1176 | return; | 1152 | return; |
1177 | 1153 | ||
1178 | /* this tells the transmitter to consider this port for | 1154 | /* this tells the transmitter to consider this port for |
@@ -1274,23 +1250,23 @@ static int isicom_set_serial_info(struct isi_port *port, | |||
1274 | 1250 | ||
1275 | lock_kernel(); | 1251 | lock_kernel(); |
1276 | 1252 | ||
1277 | reconfig_port = ((port->flags & ASYNC_SPD_MASK) != | 1253 | reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) != |
1278 | (newinfo.flags & ASYNC_SPD_MASK)); | 1254 | (newinfo.flags & ASYNC_SPD_MASK)); |
1279 | 1255 | ||
1280 | if (!capable(CAP_SYS_ADMIN)) { | 1256 | if (!capable(CAP_SYS_ADMIN)) { |
1281 | if ((newinfo.close_delay != port->close_delay) || | 1257 | if ((newinfo.close_delay != port->port.close_delay) || |
1282 | (newinfo.closing_wait != port->closing_wait) || | 1258 | (newinfo.closing_wait != port->port.closing_wait) || |
1283 | ((newinfo.flags & ~ASYNC_USR_MASK) != | 1259 | ((newinfo.flags & ~ASYNC_USR_MASK) != |
1284 | (port->flags & ~ASYNC_USR_MASK))) { | 1260 | (port->port.flags & ~ASYNC_USR_MASK))) { |
1285 | unlock_kernel(); | 1261 | unlock_kernel(); |
1286 | return -EPERM; | 1262 | return -EPERM; |
1287 | } | 1263 | } |
1288 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | | 1264 | port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) | |
1289 | (newinfo.flags & ASYNC_USR_MASK)); | 1265 | (newinfo.flags & ASYNC_USR_MASK)); |
1290 | } else { | 1266 | } else { |
1291 | port->close_delay = newinfo.close_delay; | 1267 | port->port.close_delay = newinfo.close_delay; |
1292 | port->closing_wait = newinfo.closing_wait; | 1268 | port->port.closing_wait = newinfo.closing_wait; |
1293 | port->flags = ((port->flags & ~ASYNC_FLAGS) | | 1269 | port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) | |
1294 | (newinfo.flags & ASYNC_FLAGS)); | 1270 | (newinfo.flags & ASYNC_FLAGS)); |
1295 | } | 1271 | } |
1296 | if (reconfig_port) { | 1272 | if (reconfig_port) { |
@@ -1314,10 +1290,10 @@ static int isicom_get_serial_info(struct isi_port *port, | |||
1314 | out_info.line = port - isi_ports; | 1290 | out_info.line = port - isi_ports; |
1315 | out_info.port = port->card->base; | 1291 | out_info.port = port->card->base; |
1316 | out_info.irq = port->card->irq; | 1292 | out_info.irq = port->card->irq; |
1317 | out_info.flags = port->flags; | 1293 | out_info.flags = port->port.flags; |
1318 | /* out_info.baud_base = ? */ | 1294 | /* out_info.baud_base = ? */ |
1319 | out_info.close_delay = port->close_delay; | 1295 | out_info.close_delay = port->port.close_delay; |
1320 | out_info.closing_wait = port->closing_wait; | 1296 | out_info.closing_wait = port->port.closing_wait; |
1321 | unlock_kernel(); | 1297 | unlock_kernel(); |
1322 | if (copy_to_user(info, &out_info, sizeof(out_info))) | 1298 | if (copy_to_user(info, &out_info, sizeof(out_info))) |
1323 | return -EFAULT; | 1299 | return -EFAULT; |
@@ -1454,10 +1430,10 @@ static void isicom_hangup(struct tty_struct *tty) | |||
1454 | isicom_shutdown_port(port); | 1430 | isicom_shutdown_port(port); |
1455 | spin_unlock_irqrestore(&port->card->card_lock, flags); | 1431 | spin_unlock_irqrestore(&port->card->card_lock, flags); |
1456 | 1432 | ||
1457 | port->count = 0; | 1433 | port->port.count = 0; |
1458 | port->flags &= ~ASYNC_NORMAL_ACTIVE; | 1434 | port->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
1459 | port->tty = NULL; | 1435 | port->port.tty = NULL; |
1460 | wake_up_interruptible(&port->open_wait); | 1436 | wake_up_interruptible(&port->port.open_wait); |
1461 | } | 1437 | } |
1462 | 1438 | ||
1463 | 1439 | ||
@@ -1736,6 +1712,12 @@ static int __devinit isicom_probe(struct pci_dev *pdev, | |||
1736 | if (card_count >= BOARD_COUNT) | 1712 | if (card_count >= BOARD_COUNT) |
1737 | goto err; | 1713 | goto err; |
1738 | 1714 | ||
1715 | retval = pci_enable_device(pdev); | ||
1716 | if (retval) { | ||
1717 | dev_err(&pdev->dev, "failed to enable\n"); | ||
1718 | goto err; | ||
1719 | } | ||
1720 | |||
1739 | dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device); | 1721 | dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device); |
1740 | 1722 | ||
1741 | /* allot the first empty slot in the array */ | 1723 | /* allot the first empty slot in the array */ |
@@ -1790,6 +1772,7 @@ errunrr: | |||
1790 | errdec: | 1772 | errdec: |
1791 | board->base = 0; | 1773 | board->base = 0; |
1792 | card_count--; | 1774 | card_count--; |
1775 | pci_disable_device(pdev); | ||
1793 | err: | 1776 | err: |
1794 | return retval; | 1777 | return retval; |
1795 | } | 1778 | } |
@@ -1806,6 +1789,7 @@ static void __devexit isicom_remove(struct pci_dev *pdev) | |||
1806 | pci_release_region(pdev, 3); | 1789 | pci_release_region(pdev, 3); |
1807 | board->base = 0; | 1790 | board->base = 0; |
1808 | card_count--; | 1791 | card_count--; |
1792 | pci_disable_device(pdev); | ||
1809 | } | 1793 | } |
1810 | 1794 | ||
1811 | static int __init isicom_init(void) | 1795 | static int __init isicom_init(void) |
@@ -1818,14 +1802,13 @@ static int __init isicom_init(void) | |||
1818 | isi_card[idx].ports = port; | 1802 | isi_card[idx].ports = port; |
1819 | spin_lock_init(&isi_card[idx].card_lock); | 1803 | spin_lock_init(&isi_card[idx].card_lock); |
1820 | for (channel = 0; channel < 16; channel++, port++) { | 1804 | for (channel = 0; channel < 16; channel++, port++) { |
1805 | tty_port_init(&port->port); | ||
1821 | port->magic = ISICOM_MAGIC; | 1806 | port->magic = ISICOM_MAGIC; |
1822 | port->card = &isi_card[idx]; | 1807 | port->card = &isi_card[idx]; |
1823 | port->channel = channel; | 1808 | port->channel = channel; |
1824 | port->close_delay = 50 * HZ/100; | 1809 | port->port.close_delay = 50 * HZ/100; |
1825 | port->closing_wait = 3000 * HZ/100; | 1810 | port->port.closing_wait = 3000 * HZ/100; |
1826 | port->status = 0; | 1811 | port->status = 0; |
1827 | init_waitqueue_head(&port->open_wait); | ||
1828 | init_waitqueue_head(&port->close_wait); | ||
1829 | /* . . . */ | 1812 | /* . . . */ |
1830 | } | 1813 | } |
1831 | isi_card[idx].base = 0; | 1814 | isi_card[idx].base = 0; |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 7c8b62f162bf..6ef1c565705c 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -735,8 +735,8 @@ static void stli_cleanup_ports(struct stlibrd *brdp) | |||
735 | for (j = 0; j < STL_MAXPORTS; j++) { | 735 | for (j = 0; j < STL_MAXPORTS; j++) { |
736 | portp = brdp->ports[j]; | 736 | portp = brdp->ports[j]; |
737 | if (portp != NULL) { | 737 | if (portp != NULL) { |
738 | if (portp->tty != NULL) | 738 | if (portp->port.tty != NULL) |
739 | tty_hangup(portp->tty); | 739 | tty_hangup(portp->port.tty); |
740 | kfree(portp); | 740 | kfree(portp); |
741 | } | 741 | } |
742 | } | 742 | } |
@@ -811,9 +811,9 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
811 | * The sleep here does not need interrupt protection since the wakeup | 811 | * The sleep here does not need interrupt protection since the wakeup |
812 | * for it is done with the same context. | 812 | * for it is done with the same context. |
813 | */ | 813 | */ |
814 | if (portp->flags & ASYNC_CLOSING) { | 814 | if (portp->port.flags & ASYNC_CLOSING) { |
815 | interruptible_sleep_on(&portp->close_wait); | 815 | interruptible_sleep_on(&portp->port.close_wait); |
816 | if (portp->flags & ASYNC_HUP_NOTIFY) | 816 | if (portp->port.flags & ASYNC_HUP_NOTIFY) |
817 | return -EAGAIN; | 817 | return -EAGAIN; |
818 | return -ERESTARTSYS; | 818 | return -ERESTARTSYS; |
819 | } | 819 | } |
@@ -824,7 +824,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
824 | * requires several commands to the board we will need to wait for any | 824 | * requires several commands to the board we will need to wait for any |
825 | * other open that is already initializing the port. | 825 | * other open that is already initializing the port. |
826 | */ | 826 | */ |
827 | portp->tty = tty; | 827 | portp->port.tty = tty; |
828 | tty->driver_data = portp; | 828 | tty->driver_data = portp; |
829 | portp->refcount++; | 829 | portp->refcount++; |
830 | 830 | ||
@@ -833,10 +833,10 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
833 | if (signal_pending(current)) | 833 | if (signal_pending(current)) |
834 | return -ERESTARTSYS; | 834 | return -ERESTARTSYS; |
835 | 835 | ||
836 | if ((portp->flags & ASYNC_INITIALIZED) == 0) { | 836 | if ((portp->port.flags & ASYNC_INITIALIZED) == 0) { |
837 | set_bit(ST_INITIALIZING, &portp->state); | 837 | set_bit(ST_INITIALIZING, &portp->state); |
838 | if ((rc = stli_initopen(brdp, portp)) >= 0) { | 838 | if ((rc = stli_initopen(brdp, portp)) >= 0) { |
839 | portp->flags |= ASYNC_INITIALIZED; | 839 | portp->port.flags |= ASYNC_INITIALIZED; |
840 | clear_bit(TTY_IO_ERROR, &tty->flags); | 840 | clear_bit(TTY_IO_ERROR, &tty->flags); |
841 | } | 841 | } |
842 | clear_bit(ST_INITIALIZING, &portp->state); | 842 | clear_bit(ST_INITIALIZING, &portp->state); |
@@ -851,9 +851,9 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
851 | * The sleep here does not need interrupt protection since the wakeup | 851 | * The sleep here does not need interrupt protection since the wakeup |
852 | * for it is done with the same context. | 852 | * for it is done with the same context. |
853 | */ | 853 | */ |
854 | if (portp->flags & ASYNC_CLOSING) { | 854 | if (portp->port.flags & ASYNC_CLOSING) { |
855 | interruptible_sleep_on(&portp->close_wait); | 855 | interruptible_sleep_on(&portp->port.close_wait); |
856 | if (portp->flags & ASYNC_HUP_NOTIFY) | 856 | if (portp->port.flags & ASYNC_HUP_NOTIFY) |
857 | return -EAGAIN; | 857 | return -EAGAIN; |
858 | return -ERESTARTSYS; | 858 | return -ERESTARTSYS; |
859 | } | 859 | } |
@@ -867,7 +867,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
867 | if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) | 867 | if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) |
868 | return rc; | 868 | return rc; |
869 | } | 869 | } |
870 | portp->flags |= ASYNC_NORMAL_ACTIVE; | 870 | portp->port.flags |= ASYNC_NORMAL_ACTIVE; |
871 | return 0; | 871 | return 0; |
872 | } | 872 | } |
873 | 873 | ||
@@ -895,7 +895,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
895 | return; | 895 | return; |
896 | } | 896 | } |
897 | 897 | ||
898 | portp->flags |= ASYNC_CLOSING; | 898 | portp->port.flags |= ASYNC_CLOSING; |
899 | 899 | ||
900 | /* | 900 | /* |
901 | * May want to wait for data to drain before closing. The BUSY flag | 901 | * May want to wait for data to drain before closing. The BUSY flag |
@@ -911,7 +911,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
911 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 911 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
912 | tty_wait_until_sent(tty, portp->closing_wait); | 912 | tty_wait_until_sent(tty, portp->closing_wait); |
913 | 913 | ||
914 | portp->flags &= ~ASYNC_INITIALIZED; | 914 | portp->port.flags &= ~ASYNC_INITIALIZED; |
915 | brdp = stli_brds[portp->brdnr]; | 915 | brdp = stli_brds[portp->brdnr]; |
916 | stli_rawclose(brdp, portp, 0, 0); | 916 | stli_rawclose(brdp, portp, 0, 0); |
917 | if (tty->termios->c_cflag & HUPCL) { | 917 | if (tty->termios->c_cflag & HUPCL) { |
@@ -931,16 +931,16 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
931 | stli_flushbuffer(tty); | 931 | stli_flushbuffer(tty); |
932 | 932 | ||
933 | tty->closing = 0; | 933 | tty->closing = 0; |
934 | portp->tty = NULL; | 934 | portp->port.tty = NULL; |
935 | 935 | ||
936 | if (portp->openwaitcnt) { | 936 | if (portp->openwaitcnt) { |
937 | if (portp->close_delay) | 937 | if (portp->close_delay) |
938 | msleep_interruptible(jiffies_to_msecs(portp->close_delay)); | 938 | msleep_interruptible(jiffies_to_msecs(portp->close_delay)); |
939 | wake_up_interruptible(&portp->open_wait); | 939 | wake_up_interruptible(&portp->port.open_wait); |
940 | } | 940 | } |
941 | 941 | ||
942 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 942 | portp->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
943 | wake_up_interruptible(&portp->close_wait); | 943 | wake_up_interruptible(&portp->port.close_wait); |
944 | } | 944 | } |
945 | 945 | ||
946 | /*****************************************************************************/ | 946 | /*****************************************************************************/ |
@@ -970,7 +970,7 @@ static int stli_initopen(struct stlibrd *brdp, struct stliport *portp) | |||
970 | sizeof(asynotify_t), 0)) < 0) | 970 | sizeof(asynotify_t), 0)) < 0) |
971 | return rc; | 971 | return rc; |
972 | 972 | ||
973 | tty = portp->tty; | 973 | tty = portp->port.tty; |
974 | if (tty == NULL) | 974 | if (tty == NULL) |
975 | return -ENODEV; | 975 | return -ENODEV; |
976 | stli_mkasyport(portp, &aport, tty->termios); | 976 | stli_mkasyport(portp, &aport, tty->termios); |
@@ -1169,7 +1169,7 @@ static int stli_setport(struct stliport *portp) | |||
1169 | 1169 | ||
1170 | if (portp == NULL) | 1170 | if (portp == NULL) |
1171 | return -ENODEV; | 1171 | return -ENODEV; |
1172 | if (portp->tty == NULL) | 1172 | if (portp->port.tty == NULL) |
1173 | return -ENODEV; | 1173 | return -ENODEV; |
1174 | if (portp->brdnr >= stli_nrbrds) | 1174 | if (portp->brdnr >= stli_nrbrds) |
1175 | return -ENODEV; | 1175 | return -ENODEV; |
@@ -1177,7 +1177,7 @@ static int stli_setport(struct stliport *portp) | |||
1177 | if (brdp == NULL) | 1177 | if (brdp == NULL) |
1178 | return -ENODEV; | 1178 | return -ENODEV; |
1179 | 1179 | ||
1180 | stli_mkasyport(portp, &aport, portp->tty->termios); | 1180 | stli_mkasyport(portp, &aport, portp->port.tty->termios); |
1181 | return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); | 1181 | return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); |
1182 | } | 1182 | } |
1183 | 1183 | ||
@@ -1196,7 +1196,7 @@ static int stli_waitcarrier(struct stlibrd *brdp, struct stliport *portp, struct | |||
1196 | rc = 0; | 1196 | rc = 0; |
1197 | doclocal = 0; | 1197 | doclocal = 0; |
1198 | 1198 | ||
1199 | if (portp->tty->termios->c_cflag & CLOCAL) | 1199 | if (portp->port.tty->termios->c_cflag & CLOCAL) |
1200 | doclocal++; | 1200 | doclocal++; |
1201 | 1201 | ||
1202 | spin_lock_irqsave(&stli_lock, flags); | 1202 | spin_lock_irqsave(&stli_lock, flags); |
@@ -1211,14 +1211,14 @@ static int stli_waitcarrier(struct stlibrd *brdp, struct stliport *portp, struct | |||
1211 | &portp->asig, sizeof(asysigs_t), 0)) < 0) | 1211 | &portp->asig, sizeof(asysigs_t), 0)) < 0) |
1212 | break; | 1212 | break; |
1213 | if (tty_hung_up_p(filp) || | 1213 | if (tty_hung_up_p(filp) || |
1214 | ((portp->flags & ASYNC_INITIALIZED) == 0)) { | 1214 | ((portp->port.flags & ASYNC_INITIALIZED) == 0)) { |
1215 | if (portp->flags & ASYNC_HUP_NOTIFY) | 1215 | if (portp->port.flags & ASYNC_HUP_NOTIFY) |
1216 | rc = -EBUSY; | 1216 | rc = -EBUSY; |
1217 | else | 1217 | else |
1218 | rc = -ERESTARTSYS; | 1218 | rc = -ERESTARTSYS; |
1219 | break; | 1219 | break; |
1220 | } | 1220 | } |
1221 | if (((portp->flags & ASYNC_CLOSING) == 0) && | 1221 | if (((portp->port.flags & ASYNC_CLOSING) == 0) && |
1222 | (doclocal || (portp->sigs & TIOCM_CD))) { | 1222 | (doclocal || (portp->sigs & TIOCM_CD))) { |
1223 | break; | 1223 | break; |
1224 | } | 1224 | } |
@@ -1226,7 +1226,7 @@ static int stli_waitcarrier(struct stlibrd *brdp, struct stliport *portp, struct | |||
1226 | rc = -ERESTARTSYS; | 1226 | rc = -ERESTARTSYS; |
1227 | break; | 1227 | break; |
1228 | } | 1228 | } |
1229 | interruptible_sleep_on(&portp->open_wait); | 1229 | interruptible_sleep_on(&portp->port.open_wait); |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | spin_lock_irqsave(&stli_lock, flags); | 1232 | spin_lock_irqsave(&stli_lock, flags); |
@@ -1548,7 +1548,7 @@ static int stli_getserial(struct stliport *portp, struct serial_struct __user *s | |||
1548 | sio.type = PORT_UNKNOWN; | 1548 | sio.type = PORT_UNKNOWN; |
1549 | sio.line = portp->portnr; | 1549 | sio.line = portp->portnr; |
1550 | sio.irq = 0; | 1550 | sio.irq = 0; |
1551 | sio.flags = portp->flags; | 1551 | sio.flags = portp->port.flags; |
1552 | sio.baud_base = portp->baud_base; | 1552 | sio.baud_base = portp->baud_base; |
1553 | sio.close_delay = portp->close_delay; | 1553 | sio.close_delay = portp->close_delay; |
1554 | sio.closing_wait = portp->closing_wait; | 1554 | sio.closing_wait = portp->closing_wait; |
@@ -1583,11 +1583,11 @@ static int stli_setserial(struct stliport *portp, struct serial_struct __user *s | |||
1583 | if ((sio.baud_base != portp->baud_base) || | 1583 | if ((sio.baud_base != portp->baud_base) || |
1584 | (sio.close_delay != portp->close_delay) || | 1584 | (sio.close_delay != portp->close_delay) || |
1585 | ((sio.flags & ~ASYNC_USR_MASK) != | 1585 | ((sio.flags & ~ASYNC_USR_MASK) != |
1586 | (portp->flags & ~ASYNC_USR_MASK))) | 1586 | (portp->port.flags & ~ASYNC_USR_MASK))) |
1587 | return -EPERM; | 1587 | return -EPERM; |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | portp->flags = (portp->flags & ~ASYNC_USR_MASK) | | 1590 | portp->port.flags = (portp->port.flags & ~ASYNC_USR_MASK) | |
1591 | (sio.flags & ASYNC_USR_MASK); | 1591 | (sio.flags & ASYNC_USR_MASK); |
1592 | portp->baud_base = sio.baud_base; | 1592 | portp->baud_base = sio.baud_base; |
1593 | portp->close_delay = sio.close_delay; | 1593 | portp->close_delay = sio.close_delay; |
@@ -1751,7 +1751,7 @@ static void stli_settermios(struct tty_struct *tty, struct ktermios *old) | |||
1751 | if ((old->c_cflag & CRTSCTS) && ((tiosp->c_cflag & CRTSCTS) == 0)) | 1751 | if ((old->c_cflag & CRTSCTS) && ((tiosp->c_cflag & CRTSCTS) == 0)) |
1752 | tty->hw_stopped = 0; | 1752 | tty->hw_stopped = 0; |
1753 | if (((old->c_cflag & CLOCAL) == 0) && (tiosp->c_cflag & CLOCAL)) | 1753 | if (((old->c_cflag & CLOCAL) == 0) && (tiosp->c_cflag & CLOCAL)) |
1754 | wake_up_interruptible(&portp->open_wait); | 1754 | wake_up_interruptible(&portp->port.open_wait); |
1755 | } | 1755 | } |
1756 | 1756 | ||
1757 | /*****************************************************************************/ | 1757 | /*****************************************************************************/ |
@@ -1834,7 +1834,7 @@ static void stli_hangup(struct tty_struct *tty) | |||
1834 | if (brdp == NULL) | 1834 | if (brdp == NULL) |
1835 | return; | 1835 | return; |
1836 | 1836 | ||
1837 | portp->flags &= ~ASYNC_INITIALIZED; | 1837 | portp->port.flags &= ~ASYNC_INITIALIZED; |
1838 | 1838 | ||
1839 | if (!test_bit(ST_CLOSING, &portp->state)) | 1839 | if (!test_bit(ST_CLOSING, &portp->state)) |
1840 | stli_rawclose(brdp, portp, 0, 0); | 1840 | stli_rawclose(brdp, portp, 0, 0); |
@@ -1855,12 +1855,12 @@ static void stli_hangup(struct tty_struct *tty) | |||
1855 | clear_bit(ST_TXBUSY, &portp->state); | 1855 | clear_bit(ST_TXBUSY, &portp->state); |
1856 | clear_bit(ST_RXSTOP, &portp->state); | 1856 | clear_bit(ST_RXSTOP, &portp->state); |
1857 | set_bit(TTY_IO_ERROR, &tty->flags); | 1857 | set_bit(TTY_IO_ERROR, &tty->flags); |
1858 | portp->tty = NULL; | 1858 | portp->port.tty = NULL; |
1859 | portp->flags &= ~ASYNC_NORMAL_ACTIVE; | 1859 | portp->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
1860 | portp->refcount = 0; | 1860 | portp->refcount = 0; |
1861 | spin_unlock_irqrestore(&stli_lock, flags); | 1861 | spin_unlock_irqrestore(&stli_lock, flags); |
1862 | 1862 | ||
1863 | wake_up_interruptible(&portp->open_wait); | 1863 | wake_up_interruptible(&portp->port.open_wait); |
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | /*****************************************************************************/ | 1866 | /*****************************************************************************/ |
@@ -2188,7 +2188,7 @@ static void stli_read(struct stlibrd *brdp, struct stliport *portp) | |||
2188 | 2188 | ||
2189 | if (test_bit(ST_RXSTOP, &portp->state)) | 2189 | if (test_bit(ST_RXSTOP, &portp->state)) |
2190 | return; | 2190 | return; |
2191 | tty = portp->tty; | 2191 | tty = portp->port.tty; |
2192 | if (tty == NULL) | 2192 | if (tty == NULL) |
2193 | return; | 2193 | return; |
2194 | 2194 | ||
@@ -2362,7 +2362,7 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp) | |||
2362 | if (ap->notify) { | 2362 | if (ap->notify) { |
2363 | nt = ap->changed; | 2363 | nt = ap->changed; |
2364 | ap->notify = 0; | 2364 | ap->notify = 0; |
2365 | tty = portp->tty; | 2365 | tty = portp->port.tty; |
2366 | 2366 | ||
2367 | if (nt.signal & SG_DCD) { | 2367 | if (nt.signal & SG_DCD) { |
2368 | oldsigs = portp->sigs; | 2368 | oldsigs = portp->sigs; |
@@ -2370,10 +2370,10 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp) | |||
2370 | clear_bit(ST_GETSIGS, &portp->state); | 2370 | clear_bit(ST_GETSIGS, &portp->state); |
2371 | if ((portp->sigs & TIOCM_CD) && | 2371 | if ((portp->sigs & TIOCM_CD) && |
2372 | ((oldsigs & TIOCM_CD) == 0)) | 2372 | ((oldsigs & TIOCM_CD) == 0)) |
2373 | wake_up_interruptible(&portp->open_wait); | 2373 | wake_up_interruptible(&portp->port.open_wait); |
2374 | if ((oldsigs & TIOCM_CD) && | 2374 | if ((oldsigs & TIOCM_CD) && |
2375 | ((portp->sigs & TIOCM_CD) == 0)) { | 2375 | ((portp->sigs & TIOCM_CD) == 0)) { |
2376 | if (portp->flags & ASYNC_CHECK_CD) { | 2376 | if (portp->port.flags & ASYNC_CHECK_CD) { |
2377 | if (tty) | 2377 | if (tty) |
2378 | tty_hangup(tty); | 2378 | tty_hangup(tty); |
2379 | } | 2379 | } |
@@ -2392,7 +2392,7 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp) | |||
2392 | if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { | 2392 | if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { |
2393 | if (tty != NULL) { | 2393 | if (tty != NULL) { |
2394 | tty_insert_flip_char(tty, 0, TTY_BREAK); | 2394 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
2395 | if (portp->flags & ASYNC_SAK) { | 2395 | if (portp->port.flags & ASYNC_SAK) { |
2396 | do_SAK(tty); | 2396 | do_SAK(tty); |
2397 | EBRDENABLE(brdp); | 2397 | EBRDENABLE(brdp); |
2398 | } | 2398 | } |
@@ -2542,17 +2542,17 @@ static void stli_mkasyport(struct stliport *portp, asyport_t *pp, struct ktermio | |||
2542 | /* | 2542 | /* |
2543 | * Start of by setting the baud, char size, parity and stop bit info. | 2543 | * Start of by setting the baud, char size, parity and stop bit info. |
2544 | */ | 2544 | */ |
2545 | pp->baudout = tty_get_baud_rate(portp->tty); | 2545 | pp->baudout = tty_get_baud_rate(portp->port.tty); |
2546 | if ((tiosp->c_cflag & CBAUD) == B38400) { | 2546 | if ((tiosp->c_cflag & CBAUD) == B38400) { |
2547 | if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 2547 | if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
2548 | pp->baudout = 57600; | 2548 | pp->baudout = 57600; |
2549 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 2549 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
2550 | pp->baudout = 115200; | 2550 | pp->baudout = 115200; |
2551 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) | 2551 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) |
2552 | pp->baudout = 230400; | 2552 | pp->baudout = 230400; |
2553 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) | 2553 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) |
2554 | pp->baudout = 460800; | 2554 | pp->baudout = 460800; |
2555 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) | 2555 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) |
2556 | pp->baudout = (portp->baud_base / portp->custom_divisor); | 2556 | pp->baudout = (portp->baud_base / portp->custom_divisor); |
2557 | } | 2557 | } |
2558 | if (pp->baudout > STL_MAXBAUD) | 2558 | if (pp->baudout > STL_MAXBAUD) |
@@ -2625,9 +2625,9 @@ static void stli_mkasyport(struct stliport *portp, asyport_t *pp, struct ktermio | |||
2625 | * Set up clocal processing as required. | 2625 | * Set up clocal processing as required. |
2626 | */ | 2626 | */ |
2627 | if (tiosp->c_cflag & CLOCAL) | 2627 | if (tiosp->c_cflag & CLOCAL) |
2628 | portp->flags &= ~ASYNC_CHECK_CD; | 2628 | portp->port.flags &= ~ASYNC_CHECK_CD; |
2629 | else | 2629 | else |
2630 | portp->flags |= ASYNC_CHECK_CD; | 2630 | portp->port.flags |= ASYNC_CHECK_CD; |
2631 | 2631 | ||
2632 | /* | 2632 | /* |
2633 | * Transfer any persistent flags into the asyport structure. | 2633 | * Transfer any persistent flags into the asyport structure. |
@@ -2703,8 +2703,8 @@ static int stli_initports(struct stlibrd *brdp) | |||
2703 | portp->baud_base = STL_BAUDBASE; | 2703 | portp->baud_base = STL_BAUDBASE; |
2704 | portp->close_delay = STL_CLOSEDELAY; | 2704 | portp->close_delay = STL_CLOSEDELAY; |
2705 | portp->closing_wait = 30 * HZ; | 2705 | portp->closing_wait = 30 * HZ; |
2706 | init_waitqueue_head(&portp->open_wait); | 2706 | init_waitqueue_head(&portp->port.open_wait); |
2707 | init_waitqueue_head(&portp->close_wait); | 2707 | init_waitqueue_head(&portp->port.close_wait); |
2708 | init_waitqueue_head(&portp->raw_wait); | 2708 | init_waitqueue_head(&portp->raw_wait); |
2709 | panelport++; | 2709 | panelport++; |
2710 | if (panelport >= brdp->panels[panelnr]) { | 2710 | if (panelport >= brdp->panels[panelnr]) { |
@@ -4246,18 +4246,18 @@ static int stli_portcmdstats(struct stliport *portp) | |||
4246 | stli_comstats.panel = portp->panelnr; | 4246 | stli_comstats.panel = portp->panelnr; |
4247 | stli_comstats.port = portp->portnr; | 4247 | stli_comstats.port = portp->portnr; |
4248 | stli_comstats.state = portp->state; | 4248 | stli_comstats.state = portp->state; |
4249 | stli_comstats.flags = portp->flags; | 4249 | stli_comstats.flags = portp->port.flag; |
4250 | 4250 | ||
4251 | spin_lock_irqsave(&brd_lock, flags); | 4251 | spin_lock_irqsave(&brd_lock, flags); |
4252 | if (portp->tty != NULL) { | 4252 | if (portp->port.tty != NULL) { |
4253 | if (portp->tty->driver_data == portp) { | 4253 | if (portp->port.tty->driver_data == portp) { |
4254 | stli_comstats.ttystate = portp->tty->flags; | 4254 | stli_comstats.ttystate = portp->port.tty->flags; |
4255 | stli_comstats.rxbuffered = -1; | 4255 | stli_comstats.rxbuffered = -1; |
4256 | if (portp->tty->termios != NULL) { | 4256 | if (portp->port.tty->termios != NULL) { |
4257 | stli_comstats.cflags = portp->tty->termios->c_cflag; | 4257 | stli_comstats.cflags = portp->port.tty->termios->c_cflag; |
4258 | stli_comstats.iflags = portp->tty->termios->c_iflag; | 4258 | stli_comstats.iflags = portp->port.tty->termios->c_iflag; |
4259 | stli_comstats.oflags = portp->tty->termios->c_oflag; | 4259 | stli_comstats.oflags = portp->port.tty->termios->c_oflag; |
4260 | stli_comstats.lflags = portp->tty->termios->c_lflag; | 4260 | stli_comstats.lflags = portp->port.tty->termios->c_lflag; |
4261 | } | 4261 | } |
4262 | } | 4262 | } |
4263 | } | 4263 | } |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index e21346da3101..2bba250ffc8e 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -130,17 +130,13 @@ struct moxaq_str { | |||
130 | }; | 130 | }; |
131 | 131 | ||
132 | struct moxa_port { | 132 | struct moxa_port { |
133 | struct tty_port port; | ||
133 | struct moxa_board_conf *board; | 134 | struct moxa_board_conf *board; |
134 | struct tty_struct *tty; | ||
135 | void __iomem *tableAddr; | 135 | void __iomem *tableAddr; |
136 | 136 | ||
137 | int type; | 137 | int type; |
138 | int close_delay; | ||
139 | unsigned int count; | ||
140 | int asyncflags; | ||
141 | int cflag; | 138 | int cflag; |
142 | unsigned long statusflags; | 139 | unsigned long statusflags; |
143 | wait_queue_head_t open_wait; | ||
144 | 140 | ||
145 | u8 DCDState; | 141 | u8 DCDState; |
146 | u8 lineCtrl; | 142 | u8 lineCtrl; |
@@ -348,10 +344,10 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file, | |||
348 | if (status & 4) | 344 | if (status & 4) |
349 | tmp.dcd = 1; | 345 | tmp.dcd = 1; |
350 | 346 | ||
351 | if (!p->tty || !p->tty->termios) | 347 | if (!p->port.tty || !p->port.tty->termios) |
352 | tmp.cflag = p->cflag; | 348 | tmp.cflag = p->cflag; |
353 | else | 349 | else |
354 | tmp.cflag = p->tty->termios->c_cflag; | 350 | tmp.cflag = p->port.tty->termios->c_cflag; |
355 | copy: | 351 | copy: |
356 | if (copy_to_user(argm, &tmp, sizeof(tmp))) { | 352 | if (copy_to_user(argm, &tmp, sizeof(tmp))) { |
357 | mutex_unlock(&moxa_openlock); | 353 | mutex_unlock(&moxa_openlock); |
@@ -825,10 +821,9 @@ static int moxa_init_board(struct moxa_board_conf *brd, struct device *dev) | |||
825 | } | 821 | } |
826 | 822 | ||
827 | for (i = 0, p = brd->ports; i < MAX_PORTS_PER_BOARD; i++, p++) { | 823 | for (i = 0, p = brd->ports; i < MAX_PORTS_PER_BOARD; i++, p++) { |
824 | tty_port_init(&p->port); | ||
828 | p->type = PORT_16550A; | 825 | p->type = PORT_16550A; |
829 | p->close_delay = 5 * HZ / 10; | ||
830 | p->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL; | 826 | p->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL; |
831 | init_waitqueue_head(&p->open_wait); | ||
832 | } | 827 | } |
833 | 828 | ||
834 | switch (brd->boardType) { | 829 | switch (brd->boardType) { |
@@ -884,12 +879,12 @@ static void moxa_board_deinit(struct moxa_board_conf *brd) | |||
884 | 879 | ||
885 | /* pci hot-un-plug support */ | 880 | /* pci hot-un-plug support */ |
886 | for (a = 0; a < brd->numPorts; a++) | 881 | for (a = 0; a < brd->numPorts; a++) |
887 | if (brd->ports[a].asyncflags & ASYNC_INITIALIZED) | 882 | if (brd->ports[a].port.flags & ASYNC_INITIALIZED) |
888 | tty_hangup(brd->ports[a].tty); | 883 | tty_hangup(brd->ports[a].port.tty); |
889 | while (1) { | 884 | while (1) { |
890 | opened = 0; | 885 | opened = 0; |
891 | for (a = 0; a < brd->numPorts; a++) | 886 | for (a = 0; a < brd->numPorts; a++) |
892 | if (brd->ports[a].asyncflags & ASYNC_INITIALIZED) | 887 | if (brd->ports[a].port.flags & ASYNC_INITIALIZED) |
893 | opened++; | 888 | opened++; |
894 | mutex_unlock(&moxa_openlock); | 889 | mutex_unlock(&moxa_openlock); |
895 | if (!opened) | 890 | if (!opened) |
@@ -1104,9 +1099,9 @@ static void moxa_close_port(struct moxa_port *ch) | |||
1104 | { | 1099 | { |
1105 | moxa_shut_down(ch); | 1100 | moxa_shut_down(ch); |
1106 | MoxaPortFlushData(ch, 2); | 1101 | MoxaPortFlushData(ch, 2); |
1107 | ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; | 1102 | ch->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
1108 | ch->tty->driver_data = NULL; | 1103 | ch->port.tty->driver_data = NULL; |
1109 | ch->tty = NULL; | 1104 | ch->port.tty = NULL; |
1110 | } | 1105 | } |
1111 | 1106 | ||
1112 | static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp, | 1107 | static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp, |
@@ -1117,7 +1112,7 @@ static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp, | |||
1117 | u8 dcd; | 1112 | u8 dcd; |
1118 | 1113 | ||
1119 | while (1) { | 1114 | while (1) { |
1120 | prepare_to_wait(&ch->open_wait, &wait, TASK_INTERRUPTIBLE); | 1115 | prepare_to_wait(&ch->port.open_wait, &wait, TASK_INTERRUPTIBLE); |
1121 | if (tty_hung_up_p(filp)) { | 1116 | if (tty_hung_up_p(filp)) { |
1122 | #ifdef SERIAL_DO_RESTART | 1117 | #ifdef SERIAL_DO_RESTART |
1123 | retval = -ERESTARTSYS; | 1118 | retval = -ERESTARTSYS; |
@@ -1138,7 +1133,7 @@ static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp, | |||
1138 | } | 1133 | } |
1139 | schedule(); | 1134 | schedule(); |
1140 | } | 1135 | } |
1141 | finish_wait(&ch->open_wait, &wait); | 1136 | finish_wait(&ch->port.open_wait, &wait); |
1142 | 1137 | ||
1143 | return retval; | 1138 | return retval; |
1144 | } | 1139 | } |
@@ -1163,16 +1158,16 @@ static int moxa_open(struct tty_struct *tty, struct file *filp) | |||
1163 | } | 1158 | } |
1164 | 1159 | ||
1165 | ch = &brd->ports[port % MAX_PORTS_PER_BOARD]; | 1160 | ch = &brd->ports[port % MAX_PORTS_PER_BOARD]; |
1166 | ch->count++; | 1161 | ch->port.count++; |
1167 | tty->driver_data = ch; | 1162 | tty->driver_data = ch; |
1168 | ch->tty = tty; | 1163 | ch->port.tty = tty; |
1169 | if (!(ch->asyncflags & ASYNC_INITIALIZED)) { | 1164 | if (!(ch->port.flags & ASYNC_INITIALIZED)) { |
1170 | ch->statusflags = 0; | 1165 | ch->statusflags = 0; |
1171 | moxa_set_tty_param(tty, tty->termios); | 1166 | moxa_set_tty_param(tty, tty->termios); |
1172 | MoxaPortLineCtrl(ch, 1, 1); | 1167 | MoxaPortLineCtrl(ch, 1, 1); |
1173 | MoxaPortEnable(ch); | 1168 | MoxaPortEnable(ch); |
1174 | MoxaSetFifo(ch, ch->type == PORT_16550A); | 1169 | MoxaSetFifo(ch, ch->type == PORT_16550A); |
1175 | ch->asyncflags |= ASYNC_INITIALIZED; | 1170 | ch->port.flags |= ASYNC_INITIALIZED; |
1176 | } | 1171 | } |
1177 | mutex_unlock(&moxa_openlock); | 1172 | mutex_unlock(&moxa_openlock); |
1178 | 1173 | ||
@@ -1181,11 +1176,11 @@ static int moxa_open(struct tty_struct *tty, struct file *filp) | |||
1181 | retval = moxa_block_till_ready(tty, filp, ch); | 1176 | retval = moxa_block_till_ready(tty, filp, ch); |
1182 | mutex_lock(&moxa_openlock); | 1177 | mutex_lock(&moxa_openlock); |
1183 | if (retval) { | 1178 | if (retval) { |
1184 | if (ch->count) /* 0 means already hung up... */ | 1179 | if (ch->port.count) /* 0 means already hung up... */ |
1185 | if (--ch->count == 0) | 1180 | if (--ch->port.count == 0) |
1186 | moxa_close_port(ch); | 1181 | moxa_close_port(ch); |
1187 | } else | 1182 | } else |
1188 | ch->asyncflags |= ASYNC_NORMAL_ACTIVE; | 1183 | ch->port.flags |= ASYNC_NORMAL_ACTIVE; |
1189 | mutex_unlock(&moxa_openlock); | 1184 | mutex_unlock(&moxa_openlock); |
1190 | 1185 | ||
1191 | return retval; | 1186 | return retval; |
@@ -1204,21 +1199,21 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) | |||
1204 | ch = tty->driver_data; | 1199 | ch = tty->driver_data; |
1205 | if (ch == NULL) | 1200 | if (ch == NULL) |
1206 | goto unlock; | 1201 | goto unlock; |
1207 | if (tty->count == 1 && ch->count != 1) { | 1202 | if (tty->count == 1 && ch->port.count != 1) { |
1208 | printk(KERN_WARNING "moxa_close: bad serial port count; " | 1203 | printk(KERN_WARNING "moxa_close: bad serial port count; " |
1209 | "tty->count is 1, ch->count is %d\n", ch->count); | 1204 | "tty->count is 1, ch->port.count is %d\n", ch->port.count); |
1210 | ch->count = 1; | 1205 | ch->port.count = 1; |
1211 | } | 1206 | } |
1212 | if (--ch->count < 0) { | 1207 | if (--ch->port.count < 0) { |
1213 | printk(KERN_WARNING "moxa_close: bad serial port count, " | 1208 | printk(KERN_WARNING "moxa_close: bad serial port count, " |
1214 | "device=%s\n", tty->name); | 1209 | "device=%s\n", tty->name); |
1215 | ch->count = 0; | 1210 | ch->port.count = 0; |
1216 | } | 1211 | } |
1217 | if (ch->count) | 1212 | if (ch->port.count) |
1218 | goto unlock; | 1213 | goto unlock; |
1219 | 1214 | ||
1220 | ch->cflag = tty->termios->c_cflag; | 1215 | ch->cflag = tty->termios->c_cflag; |
1221 | if (ch->asyncflags & ASYNC_INITIALIZED) { | 1216 | if (ch->port.flags & ASYNC_INITIALIZED) { |
1222 | moxa_setup_empty_event(tty); | 1217 | moxa_setup_empty_event(tty); |
1223 | tty_wait_until_sent(tty, 30 * HZ); /* 30 seconds timeout */ | 1218 | tty_wait_until_sent(tty, 30 * HZ); /* 30 seconds timeout */ |
1224 | } | 1219 | } |
@@ -1374,7 +1369,7 @@ static void moxa_set_termios(struct tty_struct *tty, | |||
1374 | return; | 1369 | return; |
1375 | moxa_set_tty_param(tty, old_termios); | 1370 | moxa_set_tty_param(tty, old_termios); |
1376 | if (!(old_termios->c_cflag & CLOCAL) && C_CLOCAL(tty)) | 1371 | if (!(old_termios->c_cflag & CLOCAL) && C_CLOCAL(tty)) |
1377 | wake_up_interruptible(&ch->open_wait); | 1372 | wake_up_interruptible(&ch->port.open_wait); |
1378 | } | 1373 | } |
1379 | 1374 | ||
1380 | static void moxa_stop(struct tty_struct *tty) | 1375 | static void moxa_stop(struct tty_struct *tty) |
@@ -1412,20 +1407,20 @@ static void moxa_hangup(struct tty_struct *tty) | |||
1412 | mutex_unlock(&moxa_openlock); | 1407 | mutex_unlock(&moxa_openlock); |
1413 | return; | 1408 | return; |
1414 | } | 1409 | } |
1415 | ch->count = 0; | 1410 | ch->port.count = 0; |
1416 | moxa_close_port(ch); | 1411 | moxa_close_port(ch); |
1417 | mutex_unlock(&moxa_openlock); | 1412 | mutex_unlock(&moxa_openlock); |
1418 | 1413 | ||
1419 | wake_up_interruptible(&ch->open_wait); | 1414 | wake_up_interruptible(&ch->port.open_wait); |
1420 | } | 1415 | } |
1421 | 1416 | ||
1422 | static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd) | 1417 | static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd) |
1423 | { | 1418 | { |
1424 | dcd = !!dcd; | 1419 | dcd = !!dcd; |
1425 | 1420 | ||
1426 | if (dcd != p->DCDState && p->tty && C_CLOCAL(p->tty)) { | 1421 | if (dcd != p->DCDState && p->port.tty && C_CLOCAL(p->port.tty)) { |
1427 | if (!dcd) | 1422 | if (!dcd) |
1428 | tty_hangup(p->tty); | 1423 | tty_hangup(p->port.tty); |
1429 | } | 1424 | } |
1430 | p->DCDState = dcd; | 1425 | p->DCDState = dcd; |
1431 | } | 1426 | } |
@@ -1433,9 +1428,9 @@ static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd) | |||
1433 | static int moxa_poll_port(struct moxa_port *p, unsigned int handle, | 1428 | static int moxa_poll_port(struct moxa_port *p, unsigned int handle, |
1434 | u16 __iomem *ip) | 1429 | u16 __iomem *ip) |
1435 | { | 1430 | { |
1436 | struct tty_struct *tty = p->tty; | 1431 | struct tty_struct *tty = p->port.tty; |
1437 | void __iomem *ofsAddr; | 1432 | void __iomem *ofsAddr; |
1438 | unsigned int inited = p->asyncflags & ASYNC_INITIALIZED; | 1433 | unsigned int inited = p->port.flags & ASYNC_INITIALIZED; |
1439 | u16 intr; | 1434 | u16 intr; |
1440 | 1435 | ||
1441 | if (tty) { | 1436 | if (tty) { |
@@ -1566,9 +1561,9 @@ static void moxa_setup_empty_event(struct tty_struct *tty) | |||
1566 | 1561 | ||
1567 | static void moxa_shut_down(struct moxa_port *ch) | 1562 | static void moxa_shut_down(struct moxa_port *ch) |
1568 | { | 1563 | { |
1569 | struct tty_struct *tp = ch->tty; | 1564 | struct tty_struct *tp = ch->port.tty; |
1570 | 1565 | ||
1571 | if (!(ch->asyncflags & ASYNC_INITIALIZED)) | 1566 | if (!(ch->port.flags & ASYNC_INITIALIZED)) |
1572 | return; | 1567 | return; |
1573 | 1568 | ||
1574 | MoxaPortDisable(ch); | 1569 | MoxaPortDisable(ch); |
@@ -1580,7 +1575,7 @@ static void moxa_shut_down(struct moxa_port *ch) | |||
1580 | MoxaPortLineCtrl(ch, 0, 0); | 1575 | MoxaPortLineCtrl(ch, 0, 0); |
1581 | 1576 | ||
1582 | spin_lock_bh(&moxa_lock); | 1577 | spin_lock_bh(&moxa_lock); |
1583 | ch->asyncflags &= ~ASYNC_INITIALIZED; | 1578 | ch->port.flags &= ~ASYNC_INITIALIZED; |
1584 | spin_unlock_bh(&moxa_lock); | 1579 | spin_unlock_bh(&moxa_lock); |
1585 | } | 1580 | } |
1586 | 1581 | ||
@@ -1975,7 +1970,7 @@ static int MoxaPortWriteData(struct moxa_port *port, | |||
1975 | c = (head > tail) ? (head - tail - 1) : (head - tail + tx_mask); | 1970 | c = (head > tail) ? (head - tail - 1) : (head - tail + tx_mask); |
1976 | if (c > len) | 1971 | if (c > len) |
1977 | c = len; | 1972 | c = len; |
1978 | moxaLog.txcnt[port->tty->index] += c; | 1973 | moxaLog.txcnt[port->port.tty->index] += c; |
1979 | total = c; | 1974 | total = c; |
1980 | if (spage == epage) { | 1975 | if (spage == epage) { |
1981 | bufhead = readw(ofsAddr + Ofs_txb); | 1976 | bufhead = readw(ofsAddr + Ofs_txb); |
@@ -2017,7 +2012,7 @@ static int MoxaPortWriteData(struct moxa_port *port, | |||
2017 | 2012 | ||
2018 | static int MoxaPortReadData(struct moxa_port *port) | 2013 | static int MoxaPortReadData(struct moxa_port *port) |
2019 | { | 2014 | { |
2020 | struct tty_struct *tty = port->tty; | 2015 | struct tty_struct *tty = port->port.tty; |
2021 | unsigned char *dst; | 2016 | unsigned char *dst; |
2022 | void __iomem *baseAddr, *ofsAddr, *ofs; | 2017 | void __iomem *baseAddr, *ofsAddr, *ofs; |
2023 | unsigned int count, len, total; | 2018 | unsigned int count, len, total; |
@@ -2124,10 +2119,10 @@ static int moxa_get_serial_info(struct moxa_port *info, | |||
2124 | { | 2119 | { |
2125 | struct serial_struct tmp = { | 2120 | struct serial_struct tmp = { |
2126 | .type = info->type, | 2121 | .type = info->type, |
2127 | .line = info->tty->index, | 2122 | .line = info->port.tty->index, |
2128 | .flags = info->asyncflags, | 2123 | .flags = info->port.flags, |
2129 | .baud_base = 921600, | 2124 | .baud_base = 921600, |
2130 | .close_delay = info->close_delay | 2125 | .close_delay = info->port.close_delay |
2131 | }; | 2126 | }; |
2132 | return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0; | 2127 | return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0; |
2133 | } | 2128 | } |
@@ -2148,13 +2143,13 @@ static int moxa_set_serial_info(struct moxa_port *info, | |||
2148 | 2143 | ||
2149 | if (!capable(CAP_SYS_ADMIN)) { | 2144 | if (!capable(CAP_SYS_ADMIN)) { |
2150 | if (((new_serial.flags & ~ASYNC_USR_MASK) != | 2145 | if (((new_serial.flags & ~ASYNC_USR_MASK) != |
2151 | (info->asyncflags & ~ASYNC_USR_MASK))) | 2146 | (info->port.flags & ~ASYNC_USR_MASK))) |
2152 | return -EPERM; | 2147 | return -EPERM; |
2153 | } else | 2148 | } else |
2154 | info->close_delay = new_serial.close_delay * HZ / 100; | 2149 | info->port.close_delay = new_serial.close_delay * HZ / 100; |
2155 | 2150 | ||
2156 | new_serial.flags = (new_serial.flags & ~ASYNC_FLAGS); | 2151 | new_serial.flags = (new_serial.flags & ~ASYNC_FLAGS); |
2157 | new_serial.flags |= (info->asyncflags & ASYNC_FLAGS); | 2152 | new_serial.flags |= (info->port.flags & ASYNC_FLAGS); |
2158 | 2153 | ||
2159 | MoxaSetFifo(info, new_serial.type == PORT_16550A); | 2154 | MoxaSetFifo(info, new_serial.type == PORT_16550A); |
2160 | 2155 | ||
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 4b81a85c5b53..6307e301bd26 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -222,8 +222,8 @@ struct mxser_mon_ext { | |||
222 | struct mxser_board; | 222 | struct mxser_board; |
223 | 223 | ||
224 | struct mxser_port { | 224 | struct mxser_port { |
225 | struct tty_port port; | ||
225 | struct mxser_board *board; | 226 | struct mxser_board *board; |
226 | struct tty_struct *tty; | ||
227 | 227 | ||
228 | unsigned long ioaddr; | 228 | unsigned long ioaddr; |
229 | unsigned long opmode_ioaddr; | 229 | unsigned long opmode_ioaddr; |
@@ -234,7 +234,6 @@ struct mxser_port { | |||
234 | int rx_low_water; | 234 | int rx_low_water; |
235 | int baud_base; /* max. speed */ | 235 | int baud_base; /* max. speed */ |
236 | int type; /* UART type */ | 236 | int type; /* UART type */ |
237 | int flags; /* defined in tty.h */ | ||
238 | 237 | ||
239 | int x_char; /* xon/xoff character */ | 238 | int x_char; /* xon/xoff character */ |
240 | int IER; /* Interrupt Enable Register */ | 239 | int IER; /* Interrupt Enable Register */ |
@@ -244,20 +243,14 @@ struct mxser_port { | |||
244 | unsigned char ldisc_stop_rx; | 243 | unsigned char ldisc_stop_rx; |
245 | 244 | ||
246 | int custom_divisor; | 245 | int custom_divisor; |
247 | int close_delay; | ||
248 | unsigned short closing_wait; | ||
249 | unsigned char err_shadow; | 246 | unsigned char err_shadow; |
250 | unsigned long event; | ||
251 | 247 | ||
252 | int count; /* # of fd on device */ | ||
253 | int blocked_open; /* # of blocked opens */ | ||
254 | struct async_icount icount; /* kernel counters for 4 input interrupts */ | 248 | struct async_icount icount; /* kernel counters for 4 input interrupts */ |
255 | int timeout; | 249 | int timeout; |
256 | 250 | ||
257 | int read_status_mask; | 251 | int read_status_mask; |
258 | int ignore_status_mask; | 252 | int ignore_status_mask; |
259 | int xmit_fifo_size; | 253 | int xmit_fifo_size; |
260 | unsigned char *xmit_buf; | ||
261 | int xmit_head; | 254 | int xmit_head; |
262 | int xmit_tail; | 255 | int xmit_tail; |
263 | int xmit_cnt; | 256 | int xmit_cnt; |
@@ -267,7 +260,6 @@ struct mxser_port { | |||
267 | struct mxser_mon mon_data; | 260 | struct mxser_mon mon_data; |
268 | 261 | ||
269 | spinlock_t slock; | 262 | spinlock_t slock; |
270 | wait_queue_head_t open_wait; | ||
271 | wait_queue_head_t delta_msr_wait; | 263 | wait_queue_head_t delta_msr_wait; |
272 | }; | 264 | }; |
273 | 265 | ||
@@ -575,7 +567,7 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, | |||
575 | */ | 567 | */ |
576 | if ((filp->f_flags & O_NONBLOCK) || | 568 | if ((filp->f_flags & O_NONBLOCK) || |
577 | test_bit(TTY_IO_ERROR, &tty->flags)) { | 569 | test_bit(TTY_IO_ERROR, &tty->flags)) { |
578 | port->flags |= ASYNC_NORMAL_ACTIVE; | 570 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
579 | return 0; | 571 | return 0; |
580 | } | 572 | } |
581 | 573 | ||
@@ -585,32 +577,32 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, | |||
585 | /* | 577 | /* |
586 | * Block waiting for the carrier detect and the line to become | 578 | * Block waiting for the carrier detect and the line to become |
587 | * free (i.e., not in use by the callout). While we are in | 579 | * free (i.e., not in use by the callout). While we are in |
588 | * this loop, port->count is dropped by one, so that | 580 | * this loop, port->port.count is dropped by one, so that |
589 | * mxser_close() knows when to free things. We restore it upon | 581 | * mxser_close() knows when to free things. We restore it upon |
590 | * exit, either normal or abnormal. | 582 | * exit, either normal or abnormal. |
591 | */ | 583 | */ |
592 | retval = 0; | 584 | retval = 0; |
593 | add_wait_queue(&port->open_wait, &wait); | 585 | add_wait_queue(&port->port.open_wait, &wait); |
594 | 586 | ||
595 | spin_lock_irqsave(&port->slock, flags); | 587 | spin_lock_irqsave(&port->slock, flags); |
596 | if (!tty_hung_up_p(filp)) | 588 | if (!tty_hung_up_p(filp)) |
597 | port->count--; | 589 | port->port.count--; |
598 | spin_unlock_irqrestore(&port->slock, flags); | 590 | spin_unlock_irqrestore(&port->slock, flags); |
599 | port->blocked_open++; | 591 | port->port.blocked_open++; |
600 | while (1) { | 592 | while (1) { |
601 | spin_lock_irqsave(&port->slock, flags); | 593 | spin_lock_irqsave(&port->slock, flags); |
602 | outb(inb(port->ioaddr + UART_MCR) | | 594 | outb(inb(port->ioaddr + UART_MCR) | |
603 | UART_MCR_DTR | UART_MCR_RTS, port->ioaddr + UART_MCR); | 595 | UART_MCR_DTR | UART_MCR_RTS, port->ioaddr + UART_MCR); |
604 | spin_unlock_irqrestore(&port->slock, flags); | 596 | spin_unlock_irqrestore(&port->slock, flags); |
605 | set_current_state(TASK_INTERRUPTIBLE); | 597 | set_current_state(TASK_INTERRUPTIBLE); |
606 | if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { | 598 | if (tty_hung_up_p(filp) || !(port->port.flags & ASYNC_INITIALIZED)) { |
607 | if (port->flags & ASYNC_HUP_NOTIFY) | 599 | if (port->port.flags & ASYNC_HUP_NOTIFY) |
608 | retval = -EAGAIN; | 600 | retval = -EAGAIN; |
609 | else | 601 | else |
610 | retval = -ERESTARTSYS; | 602 | retval = -ERESTARTSYS; |
611 | break; | 603 | break; |
612 | } | 604 | } |
613 | if (!(port->flags & ASYNC_CLOSING) && | 605 | if (!(port->port.flags & ASYNC_CLOSING) && |
614 | (do_clocal || | 606 | (do_clocal || |
615 | (inb(port->ioaddr + UART_MSR) & UART_MSR_DCD))) | 607 | (inb(port->ioaddr + UART_MSR) & UART_MSR_DCD))) |
616 | break; | 608 | break; |
@@ -621,13 +613,13 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, | |||
621 | schedule(); | 613 | schedule(); |
622 | } | 614 | } |
623 | set_current_state(TASK_RUNNING); | 615 | set_current_state(TASK_RUNNING); |
624 | remove_wait_queue(&port->open_wait, &wait); | 616 | remove_wait_queue(&port->port.open_wait, &wait); |
625 | if (!tty_hung_up_p(filp)) | 617 | if (!tty_hung_up_p(filp)) |
626 | port->count++; | 618 | port->port.count++; |
627 | port->blocked_open--; | 619 | port->port.blocked_open--; |
628 | if (retval) | 620 | if (retval) |
629 | return retval; | 621 | return retval; |
630 | port->flags |= ASYNC_NORMAL_ACTIVE; | 622 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
631 | return 0; | 623 | return 0; |
632 | } | 624 | } |
633 | 625 | ||
@@ -636,7 +628,7 @@ static int mxser_set_baud(struct mxser_port *info, long newspd) | |||
636 | int quot = 0, baud; | 628 | int quot = 0, baud; |
637 | unsigned char cval; | 629 | unsigned char cval; |
638 | 630 | ||
639 | if (!info->tty || !info->tty->termios) | 631 | if (!info->port.tty || !info->port.tty->termios) |
640 | return -1; | 632 | return -1; |
641 | 633 | ||
642 | if (!(info->ioaddr)) | 634 | if (!(info->ioaddr)) |
@@ -647,13 +639,13 @@ static int mxser_set_baud(struct mxser_port *info, long newspd) | |||
647 | 639 | ||
648 | if (newspd == 134) { | 640 | if (newspd == 134) { |
649 | quot = 2 * info->baud_base / 269; | 641 | quot = 2 * info->baud_base / 269; |
650 | tty_encode_baud_rate(info->tty, 134, 134); | 642 | tty_encode_baud_rate(info->port.tty, 134, 134); |
651 | } else if (newspd) { | 643 | } else if (newspd) { |
652 | quot = info->baud_base / newspd; | 644 | quot = info->baud_base / newspd; |
653 | if (quot == 0) | 645 | if (quot == 0) |
654 | quot = 1; | 646 | quot = 1; |
655 | baud = info->baud_base/quot; | 647 | baud = info->baud_base/quot; |
656 | tty_encode_baud_rate(info->tty, baud, baud); | 648 | tty_encode_baud_rate(info->port.tty, baud, baud); |
657 | } else { | 649 | } else { |
658 | quot = 0; | 650 | quot = 0; |
659 | } | 651 | } |
@@ -679,7 +671,7 @@ static int mxser_set_baud(struct mxser_port *info, long newspd) | |||
679 | outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */ | 671 | outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */ |
680 | 672 | ||
681 | #ifdef BOTHER | 673 | #ifdef BOTHER |
682 | if (C_BAUD(info->tty) == BOTHER) { | 674 | if (C_BAUD(info->port.tty) == BOTHER) { |
683 | quot = info->baud_base % newspd; | 675 | quot = info->baud_base % newspd; |
684 | quot *= 8; | 676 | quot *= 8; |
685 | if (quot % newspd > newspd / 2) { | 677 | if (quot % newspd > newspd / 2) { |
@@ -707,14 +699,14 @@ static int mxser_change_speed(struct mxser_port *info, | |||
707 | int ret = 0; | 699 | int ret = 0; |
708 | unsigned char status; | 700 | unsigned char status; |
709 | 701 | ||
710 | if (!info->tty || !info->tty->termios) | 702 | if (!info->port.tty || !info->port.tty->termios) |
711 | return ret; | 703 | return ret; |
712 | cflag = info->tty->termios->c_cflag; | 704 | cflag = info->port.tty->termios->c_cflag; |
713 | if (!(info->ioaddr)) | 705 | if (!(info->ioaddr)) |
714 | return ret; | 706 | return ret; |
715 | 707 | ||
716 | if (mxser_set_baud_method[info->tty->index] == 0) | 708 | if (mxser_set_baud_method[info->port.tty->index] == 0) |
717 | mxser_set_baud(info, tty_get_baud_rate(info->tty)); | 709 | mxser_set_baud(info, tty_get_baud_rate(info->port.tty)); |
718 | 710 | ||
719 | /* byte size and parity */ | 711 | /* byte size and parity */ |
720 | switch (cflag & CSIZE) { | 712 | switch (cflag & CSIZE) { |
@@ -777,15 +769,15 @@ static int mxser_change_speed(struct mxser_port *info, | |||
777 | info->IER &= ~UART_IER_MSI; | 769 | info->IER &= ~UART_IER_MSI; |
778 | info->MCR &= ~UART_MCR_AFE; | 770 | info->MCR &= ~UART_MCR_AFE; |
779 | if (cflag & CRTSCTS) { | 771 | if (cflag & CRTSCTS) { |
780 | info->flags |= ASYNC_CTS_FLOW; | 772 | info->port.flags |= ASYNC_CTS_FLOW; |
781 | info->IER |= UART_IER_MSI; | 773 | info->IER |= UART_IER_MSI; |
782 | if ((info->type == PORT_16550A) || (info->board->chip_flag)) { | 774 | if ((info->type == PORT_16550A) || (info->board->chip_flag)) { |
783 | info->MCR |= UART_MCR_AFE; | 775 | info->MCR |= UART_MCR_AFE; |
784 | } else { | 776 | } else { |
785 | status = inb(info->ioaddr + UART_MSR); | 777 | status = inb(info->ioaddr + UART_MSR); |
786 | if (info->tty->hw_stopped) { | 778 | if (info->port.tty->hw_stopped) { |
787 | if (status & UART_MSR_CTS) { | 779 | if (status & UART_MSR_CTS) { |
788 | info->tty->hw_stopped = 0; | 780 | info->port.tty->hw_stopped = 0; |
789 | if (info->type != PORT_16550A && | 781 | if (info->type != PORT_16550A && |
790 | !info->board->chip_flag) { | 782 | !info->board->chip_flag) { |
791 | outb(info->IER & ~UART_IER_THRI, | 783 | outb(info->IER & ~UART_IER_THRI, |
@@ -795,11 +787,11 @@ static int mxser_change_speed(struct mxser_port *info, | |||
795 | outb(info->IER, info->ioaddr + | 787 | outb(info->IER, info->ioaddr + |
796 | UART_IER); | 788 | UART_IER); |
797 | } | 789 | } |
798 | tty_wakeup(info->tty); | 790 | tty_wakeup(info->port.tty); |
799 | } | 791 | } |
800 | } else { | 792 | } else { |
801 | if (!(status & UART_MSR_CTS)) { | 793 | if (!(status & UART_MSR_CTS)) { |
802 | info->tty->hw_stopped = 1; | 794 | info->port.tty->hw_stopped = 1; |
803 | if ((info->type != PORT_16550A) && | 795 | if ((info->type != PORT_16550A) && |
804 | (!info->board->chip_flag)) { | 796 | (!info->board->chip_flag)) { |
805 | info->IER &= ~UART_IER_THRI; | 797 | info->IER &= ~UART_IER_THRI; |
@@ -810,13 +802,13 @@ static int mxser_change_speed(struct mxser_port *info, | |||
810 | } | 802 | } |
811 | } | 803 | } |
812 | } else { | 804 | } else { |
813 | info->flags &= ~ASYNC_CTS_FLOW; | 805 | info->port.flags &= ~ASYNC_CTS_FLOW; |
814 | } | 806 | } |
815 | outb(info->MCR, info->ioaddr + UART_MCR); | 807 | outb(info->MCR, info->ioaddr + UART_MCR); |
816 | if (cflag & CLOCAL) { | 808 | if (cflag & CLOCAL) { |
817 | info->flags &= ~ASYNC_CHECK_CD; | 809 | info->port.flags &= ~ASYNC_CHECK_CD; |
818 | } else { | 810 | } else { |
819 | info->flags |= ASYNC_CHECK_CD; | 811 | info->port.flags |= ASYNC_CHECK_CD; |
820 | info->IER |= UART_IER_MSI; | 812 | info->IER |= UART_IER_MSI; |
821 | } | 813 | } |
822 | outb(info->IER, info->ioaddr + UART_IER); | 814 | outb(info->IER, info->ioaddr + UART_IER); |
@@ -825,21 +817,21 @@ static int mxser_change_speed(struct mxser_port *info, | |||
825 | * Set up parity check flag | 817 | * Set up parity check flag |
826 | */ | 818 | */ |
827 | info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 819 | info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
828 | if (I_INPCK(info->tty)) | 820 | if (I_INPCK(info->port.tty)) |
829 | info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 821 | info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
830 | if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) | 822 | if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) |
831 | info->read_status_mask |= UART_LSR_BI; | 823 | info->read_status_mask |= UART_LSR_BI; |
832 | 824 | ||
833 | info->ignore_status_mask = 0; | 825 | info->ignore_status_mask = 0; |
834 | 826 | ||
835 | if (I_IGNBRK(info->tty)) { | 827 | if (I_IGNBRK(info->port.tty)) { |
836 | info->ignore_status_mask |= UART_LSR_BI; | 828 | info->ignore_status_mask |= UART_LSR_BI; |
837 | info->read_status_mask |= UART_LSR_BI; | 829 | info->read_status_mask |= UART_LSR_BI; |
838 | /* | 830 | /* |
839 | * If we're ignore parity and break indicators, ignore | 831 | * If we're ignore parity and break indicators, ignore |
840 | * overruns too. (For real raw support). | 832 | * overruns too. (For real raw support). |
841 | */ | 833 | */ |
842 | if (I_IGNPAR(info->tty)) { | 834 | if (I_IGNPAR(info->port.tty)) { |
843 | info->ignore_status_mask |= | 835 | info->ignore_status_mask |= |
844 | UART_LSR_OE | | 836 | UART_LSR_OE | |
845 | UART_LSR_PE | | 837 | UART_LSR_PE | |
@@ -851,16 +843,16 @@ static int mxser_change_speed(struct mxser_port *info, | |||
851 | } | 843 | } |
852 | } | 844 | } |
853 | if (info->board->chip_flag) { | 845 | if (info->board->chip_flag) { |
854 | mxser_set_must_xon1_value(info->ioaddr, START_CHAR(info->tty)); | 846 | mxser_set_must_xon1_value(info->ioaddr, START_CHAR(info->port.tty)); |
855 | mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(info->tty)); | 847 | mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(info->port.tty)); |
856 | if (I_IXON(info->tty)) { | 848 | if (I_IXON(info->port.tty)) { |
857 | mxser_enable_must_rx_software_flow_control( | 849 | mxser_enable_must_rx_software_flow_control( |
858 | info->ioaddr); | 850 | info->ioaddr); |
859 | } else { | 851 | } else { |
860 | mxser_disable_must_rx_software_flow_control( | 852 | mxser_disable_must_rx_software_flow_control( |
861 | info->ioaddr); | 853 | info->ioaddr); |
862 | } | 854 | } |
863 | if (I_IXOFF(info->tty)) { | 855 | if (I_IXOFF(info->port.tty)) { |
864 | mxser_enable_must_tx_software_flow_control( | 856 | mxser_enable_must_tx_software_flow_control( |
865 | info->ioaddr); | 857 | info->ioaddr); |
866 | } else { | 858 | } else { |
@@ -890,15 +882,15 @@ static void mxser_check_modem_status(struct mxser_port *port, int status) | |||
890 | port->mon_data.modem_status = status; | 882 | port->mon_data.modem_status = status; |
891 | wake_up_interruptible(&port->delta_msr_wait); | 883 | wake_up_interruptible(&port->delta_msr_wait); |
892 | 884 | ||
893 | if ((port->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { | 885 | if ((port->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { |
894 | if (status & UART_MSR_DCD) | 886 | if (status & UART_MSR_DCD) |
895 | wake_up_interruptible(&port->open_wait); | 887 | wake_up_interruptible(&port->port.open_wait); |
896 | } | 888 | } |
897 | 889 | ||
898 | if (port->flags & ASYNC_CTS_FLOW) { | 890 | if (port->port.flags & ASYNC_CTS_FLOW) { |
899 | if (port->tty->hw_stopped) { | 891 | if (port->port.tty->hw_stopped) { |
900 | if (status & UART_MSR_CTS) { | 892 | if (status & UART_MSR_CTS) { |
901 | port->tty->hw_stopped = 0; | 893 | port->port.tty->hw_stopped = 0; |
902 | 894 | ||
903 | if ((port->type != PORT_16550A) && | 895 | if ((port->type != PORT_16550A) && |
904 | (!port->board->chip_flag)) { | 896 | (!port->board->chip_flag)) { |
@@ -908,11 +900,11 @@ static void mxser_check_modem_status(struct mxser_port *port, int status) | |||
908 | outb(port->IER, port->ioaddr + | 900 | outb(port->IER, port->ioaddr + |
909 | UART_IER); | 901 | UART_IER); |
910 | } | 902 | } |
911 | tty_wakeup(port->tty); | 903 | tty_wakeup(port->port.tty); |
912 | } | 904 | } |
913 | } else { | 905 | } else { |
914 | if (!(status & UART_MSR_CTS)) { | 906 | if (!(status & UART_MSR_CTS)) { |
915 | port->tty->hw_stopped = 1; | 907 | port->port.tty->hw_stopped = 1; |
916 | if (port->type != PORT_16550A && | 908 | if (port->type != PORT_16550A && |
917 | !port->board->chip_flag) { | 909 | !port->board->chip_flag) { |
918 | port->IER &= ~UART_IER_THRI; | 910 | port->IER &= ~UART_IER_THRI; |
@@ -935,23 +927,23 @@ static int mxser_startup(struct mxser_port *info) | |||
935 | 927 | ||
936 | spin_lock_irqsave(&info->slock, flags); | 928 | spin_lock_irqsave(&info->slock, flags); |
937 | 929 | ||
938 | if (info->flags & ASYNC_INITIALIZED) { | 930 | if (info->port.flags & ASYNC_INITIALIZED) { |
939 | free_page(page); | 931 | free_page(page); |
940 | spin_unlock_irqrestore(&info->slock, flags); | 932 | spin_unlock_irqrestore(&info->slock, flags); |
941 | return 0; | 933 | return 0; |
942 | } | 934 | } |
943 | 935 | ||
944 | if (!info->ioaddr || !info->type) { | 936 | if (!info->ioaddr || !info->type) { |
945 | if (info->tty) | 937 | if (info->port.tty) |
946 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 938 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
947 | free_page(page); | 939 | free_page(page); |
948 | spin_unlock_irqrestore(&info->slock, flags); | 940 | spin_unlock_irqrestore(&info->slock, flags); |
949 | return 0; | 941 | return 0; |
950 | } | 942 | } |
951 | if (info->xmit_buf) | 943 | if (info->port.xmit_buf) |
952 | free_page(page); | 944 | free_page(page); |
953 | else | 945 | else |
954 | info->xmit_buf = (unsigned char *) page; | 946 | info->port.xmit_buf = (unsigned char *) page; |
955 | 947 | ||
956 | /* | 948 | /* |
957 | * Clear the FIFO buffers and disable them | 949 | * Clear the FIFO buffers and disable them |
@@ -973,8 +965,8 @@ static int mxser_startup(struct mxser_port *info) | |||
973 | if (inb(info->ioaddr + UART_LSR) == 0xff) { | 965 | if (inb(info->ioaddr + UART_LSR) == 0xff) { |
974 | spin_unlock_irqrestore(&info->slock, flags); | 966 | spin_unlock_irqrestore(&info->slock, flags); |
975 | if (capable(CAP_SYS_ADMIN)) { | 967 | if (capable(CAP_SYS_ADMIN)) { |
976 | if (info->tty) | 968 | if (info->port.tty) |
977 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 969 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
978 | return 0; | 970 | return 0; |
979 | } else | 971 | } else |
980 | return -ENODEV; | 972 | return -ENODEV; |
@@ -1012,15 +1004,15 @@ static int mxser_startup(struct mxser_port *info) | |||
1012 | (void) inb(info->ioaddr + UART_IIR); | 1004 | (void) inb(info->ioaddr + UART_IIR); |
1013 | (void) inb(info->ioaddr + UART_MSR); | 1005 | (void) inb(info->ioaddr + UART_MSR); |
1014 | 1006 | ||
1015 | if (info->tty) | 1007 | if (info->port.tty) |
1016 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 1008 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
1017 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 1009 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
1018 | 1010 | ||
1019 | /* | 1011 | /* |
1020 | * and set the speed of the serial port | 1012 | * and set the speed of the serial port |
1021 | */ | 1013 | */ |
1022 | mxser_change_speed(info, NULL); | 1014 | mxser_change_speed(info, NULL); |
1023 | info->flags |= ASYNC_INITIALIZED; | 1015 | info->port.flags |= ASYNC_INITIALIZED; |
1024 | spin_unlock_irqrestore(&info->slock, flags); | 1016 | spin_unlock_irqrestore(&info->slock, flags); |
1025 | 1017 | ||
1026 | return 0; | 1018 | return 0; |
@@ -1034,7 +1026,7 @@ static void mxser_shutdown(struct mxser_port *info) | |||
1034 | { | 1026 | { |
1035 | unsigned long flags; | 1027 | unsigned long flags; |
1036 | 1028 | ||
1037 | if (!(info->flags & ASYNC_INITIALIZED)) | 1029 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
1038 | return; | 1030 | return; |
1039 | 1031 | ||
1040 | spin_lock_irqsave(&info->slock, flags); | 1032 | spin_lock_irqsave(&info->slock, flags); |
@@ -1048,15 +1040,15 @@ static void mxser_shutdown(struct mxser_port *info) | |||
1048 | /* | 1040 | /* |
1049 | * Free the IRQ, if necessary | 1041 | * Free the IRQ, if necessary |
1050 | */ | 1042 | */ |
1051 | if (info->xmit_buf) { | 1043 | if (info->port.xmit_buf) { |
1052 | free_page((unsigned long) info->xmit_buf); | 1044 | free_page((unsigned long) info->port.xmit_buf); |
1053 | info->xmit_buf = NULL; | 1045 | info->port.xmit_buf = NULL; |
1054 | } | 1046 | } |
1055 | 1047 | ||
1056 | info->IER = 0; | 1048 | info->IER = 0; |
1057 | outb(0x00, info->ioaddr + UART_IER); | 1049 | outb(0x00, info->ioaddr + UART_IER); |
1058 | 1050 | ||
1059 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) | 1051 | if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) |
1060 | info->MCR &= ~(UART_MCR_DTR | UART_MCR_RTS); | 1052 | info->MCR &= ~(UART_MCR_DTR | UART_MCR_RTS); |
1061 | outb(info->MCR, info->ioaddr + UART_MCR); | 1053 | outb(info->MCR, info->ioaddr + UART_MCR); |
1062 | 1054 | ||
@@ -1072,10 +1064,10 @@ static void mxser_shutdown(struct mxser_port *info) | |||
1072 | /* read data port to reset things */ | 1064 | /* read data port to reset things */ |
1073 | (void) inb(info->ioaddr + UART_RX); | 1065 | (void) inb(info->ioaddr + UART_RX); |
1074 | 1066 | ||
1075 | if (info->tty) | 1067 | if (info->port.tty) |
1076 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 1068 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
1077 | 1069 | ||
1078 | info->flags &= ~ASYNC_INITIALIZED; | 1070 | info->port.flags &= ~ASYNC_INITIALIZED; |
1079 | 1071 | ||
1080 | if (info->board->chip_flag) | 1072 | if (info->board->chip_flag) |
1081 | SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->ioaddr); | 1073 | SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->ioaddr); |
@@ -1105,12 +1097,12 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
1105 | return -ENODEV; | 1097 | return -ENODEV; |
1106 | 1098 | ||
1107 | tty->driver_data = info; | 1099 | tty->driver_data = info; |
1108 | info->tty = tty; | 1100 | info->port.tty = tty; |
1109 | /* | 1101 | /* |
1110 | * Start up serial port | 1102 | * Start up serial port |
1111 | */ | 1103 | */ |
1112 | spin_lock_irqsave(&info->slock, flags); | 1104 | spin_lock_irqsave(&info->slock, flags); |
1113 | info->count++; | 1105 | info->port.count++; |
1114 | spin_unlock_irqrestore(&info->slock, flags); | 1106 | spin_unlock_irqrestore(&info->slock, flags); |
1115 | retval = mxser_startup(info); | 1107 | retval = mxser_startup(info); |
1116 | if (retval) | 1108 | if (retval) |
@@ -1170,42 +1162,42 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1170 | spin_unlock_irqrestore(&info->slock, flags); | 1162 | spin_unlock_irqrestore(&info->slock, flags); |
1171 | return; | 1163 | return; |
1172 | } | 1164 | } |
1173 | if ((tty->count == 1) && (info->count != 1)) { | 1165 | if ((tty->count == 1) && (info->port.count != 1)) { |
1174 | /* | 1166 | /* |
1175 | * Uh, oh. tty->count is 1, which means that the tty | 1167 | * Uh, oh. tty->count is 1, which means that the tty |
1176 | * structure will be freed. Info->count should always | 1168 | * structure will be freed. Info->port.count should always |
1177 | * be one in these conditions. If it's greater than | 1169 | * be one in these conditions. If it's greater than |
1178 | * one, we've got real problems, since it means the | 1170 | * one, we've got real problems, since it means the |
1179 | * serial port won't be shutdown. | 1171 | * serial port won't be shutdown. |
1180 | */ | 1172 | */ |
1181 | printk(KERN_ERR "mxser_close: bad serial port count; " | 1173 | printk(KERN_ERR "mxser_close: bad serial port count; " |
1182 | "tty->count is 1, info->count is %d\n", info->count); | 1174 | "tty->count is 1, info->port.count is %d\n", info->port.count); |
1183 | info->count = 1; | 1175 | info->port.count = 1; |
1184 | } | 1176 | } |
1185 | if (--info->count < 0) { | 1177 | if (--info->port.count < 0) { |
1186 | printk(KERN_ERR "mxser_close: bad serial port count for " | 1178 | printk(KERN_ERR "mxser_close: bad serial port count for " |
1187 | "ttys%d: %d\n", tty->index, info->count); | 1179 | "ttys%d: %d\n", tty->index, info->port.count); |
1188 | info->count = 0; | 1180 | info->port.count = 0; |
1189 | } | 1181 | } |
1190 | if (info->count) { | 1182 | if (info->port.count) { |
1191 | spin_unlock_irqrestore(&info->slock, flags); | 1183 | spin_unlock_irqrestore(&info->slock, flags); |
1192 | return; | 1184 | return; |
1193 | } | 1185 | } |
1194 | info->flags |= ASYNC_CLOSING; | 1186 | info->port.flags |= ASYNC_CLOSING; |
1195 | spin_unlock_irqrestore(&info->slock, flags); | 1187 | spin_unlock_irqrestore(&info->slock, flags); |
1196 | /* | 1188 | /* |
1197 | * Save the termios structure, since this port may have | 1189 | * Save the termios structure, since this port may have |
1198 | * separate termios for callout and dialin. | 1190 | * separate termios for callout and dialin. |
1199 | */ | 1191 | */ |
1200 | if (info->flags & ASYNC_NORMAL_ACTIVE) | 1192 | if (info->port.flags & ASYNC_NORMAL_ACTIVE) |
1201 | info->normal_termios = *tty->termios; | 1193 | info->normal_termios = *tty->termios; |
1202 | /* | 1194 | /* |
1203 | * Now we wait for the transmit buffer to clear; and we notify | 1195 | * Now we wait for the transmit buffer to clear; and we notify |
1204 | * the line discipline to only process XON/XOFF characters. | 1196 | * the line discipline to only process XON/XOFF characters. |
1205 | */ | 1197 | */ |
1206 | tty->closing = 1; | 1198 | tty->closing = 1; |
1207 | if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 1199 | if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) |
1208 | tty_wait_until_sent(tty, info->closing_wait); | 1200 | tty_wait_until_sent(tty, info->port.closing_wait); |
1209 | /* | 1201 | /* |
1210 | * At this point we stop accepting input. To do this, we | 1202 | * At this point we stop accepting input. To do this, we |
1211 | * disable the receive line status interrupts, and tell the | 1203 | * disable the receive line status interrupts, and tell the |
@@ -1216,7 +1208,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1216 | if (info->board->chip_flag) | 1208 | if (info->board->chip_flag) |
1217 | info->IER &= ~MOXA_MUST_RECV_ISR; | 1209 | info->IER &= ~MOXA_MUST_RECV_ISR; |
1218 | 1210 | ||
1219 | if (info->flags & ASYNC_INITIALIZED) { | 1211 | if (info->port.flags & ASYNC_INITIALIZED) { |
1220 | outb(info->IER, info->ioaddr + UART_IER); | 1212 | outb(info->IER, info->ioaddr + UART_IER); |
1221 | /* | 1213 | /* |
1222 | * Before we drop DTR, make sure the UART transmitter | 1214 | * Before we drop DTR, make sure the UART transmitter |
@@ -1236,15 +1228,14 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1236 | tty_ldisc_flush(tty); | 1228 | tty_ldisc_flush(tty); |
1237 | 1229 | ||
1238 | tty->closing = 0; | 1230 | tty->closing = 0; |
1239 | info->event = 0; | 1231 | info->port.tty = NULL; |
1240 | info->tty = NULL; | 1232 | if (info->port.blocked_open) { |
1241 | if (info->blocked_open) { | 1233 | if (info->port.close_delay) |
1242 | if (info->close_delay) | 1234 | schedule_timeout_interruptible(info->port.close_delay); |
1243 | schedule_timeout_interruptible(info->close_delay); | 1235 | wake_up_interruptible(&info->port.open_wait); |
1244 | wake_up_interruptible(&info->open_wait); | ||
1245 | } | 1236 | } |
1246 | 1237 | ||
1247 | info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); | 1238 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); |
1248 | } | 1239 | } |
1249 | 1240 | ||
1250 | static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) | 1241 | static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) |
@@ -1253,7 +1244,7 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou | |||
1253 | struct mxser_port *info = tty->driver_data; | 1244 | struct mxser_port *info = tty->driver_data; |
1254 | unsigned long flags; | 1245 | unsigned long flags; |
1255 | 1246 | ||
1256 | if (!info->xmit_buf) | 1247 | if (!info->port.xmit_buf) |
1257 | return 0; | 1248 | return 0; |
1258 | 1249 | ||
1259 | while (1) { | 1250 | while (1) { |
@@ -1262,7 +1253,7 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou | |||
1262 | if (c <= 0) | 1253 | if (c <= 0) |
1263 | break; | 1254 | break; |
1264 | 1255 | ||
1265 | memcpy(info->xmit_buf + info->xmit_head, buf, c); | 1256 | memcpy(info->port.xmit_buf + info->xmit_head, buf, c); |
1266 | spin_lock_irqsave(&info->slock, flags); | 1257 | spin_lock_irqsave(&info->slock, flags); |
1267 | info->xmit_head = (info->xmit_head + c) & | 1258 | info->xmit_head = (info->xmit_head + c) & |
1268 | (SERIAL_XMIT_SIZE - 1); | 1259 | (SERIAL_XMIT_SIZE - 1); |
@@ -1294,14 +1285,14 @@ static int mxser_put_char(struct tty_struct *tty, unsigned char ch) | |||
1294 | struct mxser_port *info = tty->driver_data; | 1285 | struct mxser_port *info = tty->driver_data; |
1295 | unsigned long flags; | 1286 | unsigned long flags; |
1296 | 1287 | ||
1297 | if (!info->xmit_buf) | 1288 | if (!info->port.xmit_buf) |
1298 | return 0; | 1289 | return 0; |
1299 | 1290 | ||
1300 | if (info->xmit_cnt >= SERIAL_XMIT_SIZE - 1) | 1291 | if (info->xmit_cnt >= SERIAL_XMIT_SIZE - 1) |
1301 | return 0; | 1292 | return 0; |
1302 | 1293 | ||
1303 | spin_lock_irqsave(&info->slock, flags); | 1294 | spin_lock_irqsave(&info->slock, flags); |
1304 | info->xmit_buf[info->xmit_head++] = ch; | 1295 | info->port.xmit_buf[info->xmit_head++] = ch; |
1305 | info->xmit_head &= SERIAL_XMIT_SIZE - 1; | 1296 | info->xmit_head &= SERIAL_XMIT_SIZE - 1; |
1306 | info->xmit_cnt++; | 1297 | info->xmit_cnt++; |
1307 | spin_unlock_irqrestore(&info->slock, flags); | 1298 | spin_unlock_irqrestore(&info->slock, flags); |
@@ -1327,7 +1318,7 @@ static void mxser_flush_chars(struct tty_struct *tty) | |||
1327 | 1318 | ||
1328 | if (info->xmit_cnt <= 0 || | 1319 | if (info->xmit_cnt <= 0 || |
1329 | tty->stopped || | 1320 | tty->stopped || |
1330 | !info->xmit_buf || | 1321 | !info->port.xmit_buf || |
1331 | (tty->hw_stopped && | 1322 | (tty->hw_stopped && |
1332 | (info->type != PORT_16550A) && | 1323 | (info->type != PORT_16550A) && |
1333 | (!info->board->chip_flag) | 1324 | (!info->board->chip_flag) |
@@ -1370,13 +1361,13 @@ static int mxser_get_serial_info(struct mxser_port *info, | |||
1370 | { | 1361 | { |
1371 | struct serial_struct tmp = { | 1362 | struct serial_struct tmp = { |
1372 | .type = info->type, | 1363 | .type = info->type, |
1373 | .line = info->tty->index, | 1364 | .line = info->port.tty->index, |
1374 | .port = info->ioaddr, | 1365 | .port = info->ioaddr, |
1375 | .irq = info->board->irq, | 1366 | .irq = info->board->irq, |
1376 | .flags = info->flags, | 1367 | .flags = info->port.flags, |
1377 | .baud_base = info->baud_base, | 1368 | .baud_base = info->baud_base, |
1378 | .close_delay = info->close_delay, | 1369 | .close_delay = info->port.close_delay, |
1379 | .closing_wait = info->closing_wait, | 1370 | .closing_wait = info->port.closing_wait, |
1380 | .custom_divisor = info->custom_divisor, | 1371 | .custom_divisor = info->custom_divisor, |
1381 | .hub6 = 0 | 1372 | .hub6 = 0 |
1382 | }; | 1373 | }; |
@@ -1403,33 +1394,33 @@ static int mxser_set_serial_info(struct mxser_port *info, | |||
1403 | new_serial.port != info->ioaddr) | 1394 | new_serial.port != info->ioaddr) |
1404 | return -EINVAL; | 1395 | return -EINVAL; |
1405 | 1396 | ||
1406 | flags = info->flags & ASYNC_SPD_MASK; | 1397 | flags = info->port.flags & ASYNC_SPD_MASK; |
1407 | 1398 | ||
1408 | if (!capable(CAP_SYS_ADMIN)) { | 1399 | if (!capable(CAP_SYS_ADMIN)) { |
1409 | if ((new_serial.baud_base != info->baud_base) || | 1400 | if ((new_serial.baud_base != info->baud_base) || |
1410 | (new_serial.close_delay != info->close_delay) || | 1401 | (new_serial.close_delay != info->port.close_delay) || |
1411 | ((new_serial.flags & ~ASYNC_USR_MASK) != (info->flags & ~ASYNC_USR_MASK))) | 1402 | ((new_serial.flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK))) |
1412 | return -EPERM; | 1403 | return -EPERM; |
1413 | info->flags = ((info->flags & ~ASYNC_USR_MASK) | | 1404 | info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) | |
1414 | (new_serial.flags & ASYNC_USR_MASK)); | 1405 | (new_serial.flags & ASYNC_USR_MASK)); |
1415 | } else { | 1406 | } else { |
1416 | /* | 1407 | /* |
1417 | * OK, past this point, all the error checking has been done. | 1408 | * OK, past this point, all the error checking has been done. |
1418 | * At this point, we start making changes..... | 1409 | * At this point, we start making changes..... |
1419 | */ | 1410 | */ |
1420 | info->flags = ((info->flags & ~ASYNC_FLAGS) | | 1411 | info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) | |
1421 | (new_serial.flags & ASYNC_FLAGS)); | 1412 | (new_serial.flags & ASYNC_FLAGS)); |
1422 | info->close_delay = new_serial.close_delay * HZ / 100; | 1413 | info->port.close_delay = new_serial.close_delay * HZ / 100; |
1423 | info->closing_wait = new_serial.closing_wait * HZ / 100; | 1414 | info->port.closing_wait = new_serial.closing_wait * HZ / 100; |
1424 | info->tty->low_latency = | 1415 | info->port.tty->low_latency = |
1425 | (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 1416 | (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
1426 | info->tty->low_latency = 0; | 1417 | info->port.tty->low_latency = 0; |
1427 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST && | 1418 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST && |
1428 | (new_serial.baud_base != info->baud_base || | 1419 | (new_serial.baud_base != info->baud_base || |
1429 | new_serial.custom_divisor != | 1420 | new_serial.custom_divisor != |
1430 | info->custom_divisor)) { | 1421 | info->custom_divisor)) { |
1431 | baud = new_serial.baud_base / new_serial.custom_divisor; | 1422 | baud = new_serial.baud_base / new_serial.custom_divisor; |
1432 | tty_encode_baud_rate(info->tty, baud, baud); | 1423 | tty_encode_baud_rate(info->port.tty, baud, baud); |
1433 | } | 1424 | } |
1434 | } | 1425 | } |
1435 | 1426 | ||
@@ -1437,8 +1428,8 @@ static int mxser_set_serial_info(struct mxser_port *info, | |||
1437 | 1428 | ||
1438 | process_txrx_fifo(info); | 1429 | process_txrx_fifo(info); |
1439 | 1430 | ||
1440 | if (info->flags & ASYNC_INITIALIZED) { | 1431 | if (info->port.flags & ASYNC_INITIALIZED) { |
1441 | if (flags != (info->flags & ASYNC_SPD_MASK)) { | 1432 | if (flags != (info->port.flags & ASYNC_SPD_MASK)) { |
1442 | spin_lock_irqsave(&info->slock, sl_flags); | 1433 | spin_lock_irqsave(&info->slock, sl_flags); |
1443 | mxser_change_speed(info, NULL); | 1434 | mxser_change_speed(info, NULL); |
1444 | spin_unlock_irqrestore(&info->slock, sl_flags); | 1435 | spin_unlock_irqrestore(&info->slock, sl_flags); |
@@ -1693,12 +1684,12 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1693 | continue; | 1684 | continue; |
1694 | } | 1685 | } |
1695 | 1686 | ||
1696 | if (!port->tty || !port->tty->termios) | 1687 | if (!port->port.tty || !port->port.tty->termios) |
1697 | GMStatus[i].cflag = | 1688 | GMStatus[i].cflag = |
1698 | port->normal_termios.c_cflag; | 1689 | port->normal_termios.c_cflag; |
1699 | else | 1690 | else |
1700 | GMStatus[i].cflag = | 1691 | GMStatus[i].cflag = |
1701 | port->tty->termios->c_cflag; | 1692 | port->port.tty->termios->c_cflag; |
1702 | 1693 | ||
1703 | status = inb(port->ioaddr + UART_MSR); | 1694 | status = inb(port->ioaddr + UART_MSR); |
1704 | if (status & 0x80 /*UART_MSR_DCD */ ) | 1695 | if (status & 0x80 /*UART_MSR_DCD */ ) |
@@ -1755,14 +1746,14 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1755 | mon_data_ext.modem_status[i] = | 1746 | mon_data_ext.modem_status[i] = |
1756 | port->mon_data.modem_status; | 1747 | port->mon_data.modem_status; |
1757 | mon_data_ext.baudrate[i] = | 1748 | mon_data_ext.baudrate[i] = |
1758 | tty_get_baud_rate(port->tty); | 1749 | tty_get_baud_rate(port->port.tty); |
1759 | 1750 | ||
1760 | if (!port->tty || !port->tty->termios) { | 1751 | if (!port->port.tty || !port->port.tty->termios) { |
1761 | cflag = port->normal_termios.c_cflag; | 1752 | cflag = port->normal_termios.c_cflag; |
1762 | iflag = port->normal_termios.c_iflag; | 1753 | iflag = port->normal_termios.c_iflag; |
1763 | } else { | 1754 | } else { |
1764 | cflag = port->tty->termios->c_cflag; | 1755 | cflag = port->port.tty->termios->c_cflag; |
1765 | iflag = port->tty->termios->c_iflag; | 1756 | iflag = port->port.tty->termios->c_iflag; |
1766 | } | 1757 | } |
1767 | 1758 | ||
1768 | mon_data_ext.databits[i] = cflag & CSIZE; | 1759 | mon_data_ext.databits[i] = cflag & CSIZE; |
@@ -1989,7 +1980,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, | |||
1989 | else | 1980 | else |
1990 | info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFXENT; | 1981 | info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFXENT; |
1991 | 1982 | ||
1992 | if (info->tty->hw_stopped) | 1983 | if (info->port.tty->hw_stopped) |
1993 | info->mon_data.hold_reason |= NPPI_NOTIFY_CTSHOLD; | 1984 | info->mon_data.hold_reason |= NPPI_NOTIFY_CTSHOLD; |
1994 | else | 1985 | else |
1995 | info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; | 1986 | info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; |
@@ -2038,7 +2029,7 @@ static void mxser_stoprx(struct tty_struct *tty) | |||
2038 | } | 2029 | } |
2039 | } | 2030 | } |
2040 | 2031 | ||
2041 | if (info->tty->termios->c_cflag & CRTSCTS) { | 2032 | if (info->port.tty->termios->c_cflag & CRTSCTS) { |
2042 | info->MCR &= ~UART_MCR_RTS; | 2033 | info->MCR &= ~UART_MCR_RTS; |
2043 | outb(info->MCR, info->ioaddr + UART_MCR); | 2034 | outb(info->MCR, info->ioaddr + UART_MCR); |
2044 | } | 2035 | } |
@@ -2075,7 +2066,7 @@ static void mxser_unthrottle(struct tty_struct *tty) | |||
2075 | } | 2066 | } |
2076 | } | 2067 | } |
2077 | 2068 | ||
2078 | if (info->tty->termios->c_cflag & CRTSCTS) { | 2069 | if (info->port.tty->termios->c_cflag & CRTSCTS) { |
2079 | info->MCR |= UART_MCR_RTS; | 2070 | info->MCR |= UART_MCR_RTS; |
2080 | outb(info->MCR, info->ioaddr + UART_MCR); | 2071 | outb(info->MCR, info->ioaddr + UART_MCR); |
2081 | } | 2072 | } |
@@ -2106,7 +2097,7 @@ static void mxser_start(struct tty_struct *tty) | |||
2106 | unsigned long flags; | 2097 | unsigned long flags; |
2107 | 2098 | ||
2108 | spin_lock_irqsave(&info->slock, flags); | 2099 | spin_lock_irqsave(&info->slock, flags); |
2109 | if (info->xmit_cnt && info->xmit_buf) { | 2100 | if (info->xmit_cnt && info->port.xmit_buf) { |
2110 | outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); | 2101 | outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); |
2111 | info->IER |= UART_IER_THRI; | 2102 | info->IER |= UART_IER_THRI; |
2112 | outb(info->IER, info->ioaddr + UART_IER); | 2103 | outb(info->IER, info->ioaddr + UART_IER); |
@@ -2219,11 +2210,10 @@ static void mxser_hangup(struct tty_struct *tty) | |||
2219 | 2210 | ||
2220 | mxser_flush_buffer(tty); | 2211 | mxser_flush_buffer(tty); |
2221 | mxser_shutdown(info); | 2212 | mxser_shutdown(info); |
2222 | info->event = 0; | 2213 | info->port.count = 0; |
2223 | info->count = 0; | 2214 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
2224 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 2215 | info->port.tty = NULL; |
2225 | info->tty = NULL; | 2216 | wake_up_interruptible(&info->port.open_wait); |
2226 | wake_up_interruptible(&info->open_wait); | ||
2227 | } | 2217 | } |
2228 | 2218 | ||
2229 | /* | 2219 | /* |
@@ -2246,7 +2236,7 @@ static void mxser_rs_break(struct tty_struct *tty, int break_state) | |||
2246 | 2236 | ||
2247 | static void mxser_receive_chars(struct mxser_port *port, int *status) | 2237 | static void mxser_receive_chars(struct mxser_port *port, int *status) |
2248 | { | 2238 | { |
2249 | struct tty_struct *tty = port->tty; | 2239 | struct tty_struct *tty = port->port.tty; |
2250 | unsigned char ch, gdl; | 2240 | unsigned char ch, gdl; |
2251 | int ignored = 0; | 2241 | int ignored = 0; |
2252 | int cnt = 0; | 2242 | int cnt = 0; |
@@ -2302,7 +2292,7 @@ intr_old: | |||
2302 | flag = TTY_BREAK; | 2292 | flag = TTY_BREAK; |
2303 | port->icount.brk++; | 2293 | port->icount.brk++; |
2304 | 2294 | ||
2305 | if (port->flags & ASYNC_SAK) | 2295 | if (port->port.flags & ASYNC_SAK) |
2306 | do_SAK(tty); | 2296 | do_SAK(tty); |
2307 | } else if (*status & UART_LSR_PE) { | 2297 | } else if (*status & UART_LSR_PE) { |
2308 | flag = TTY_PARITY; | 2298 | flag = TTY_PARITY; |
@@ -2333,7 +2323,7 @@ intr_old: | |||
2333 | } while (*status & UART_LSR_DR); | 2323 | } while (*status & UART_LSR_DR); |
2334 | 2324 | ||
2335 | end_intr: | 2325 | end_intr: |
2336 | mxvar_log.rxcnt[port->tty->index] += cnt; | 2326 | mxvar_log.rxcnt[port->port.tty->index] += cnt; |
2337 | port->mon_data.rxcnt += cnt; | 2327 | port->mon_data.rxcnt += cnt; |
2338 | port->mon_data.up_rxcnt += cnt; | 2328 | port->mon_data.up_rxcnt += cnt; |
2339 | 2329 | ||
@@ -2354,18 +2344,18 @@ static void mxser_transmit_chars(struct mxser_port *port) | |||
2354 | if (port->x_char) { | 2344 | if (port->x_char) { |
2355 | outb(port->x_char, port->ioaddr + UART_TX); | 2345 | outb(port->x_char, port->ioaddr + UART_TX); |
2356 | port->x_char = 0; | 2346 | port->x_char = 0; |
2357 | mxvar_log.txcnt[port->tty->index]++; | 2347 | mxvar_log.txcnt[port->port.tty->index]++; |
2358 | port->mon_data.txcnt++; | 2348 | port->mon_data.txcnt++; |
2359 | port->mon_data.up_txcnt++; | 2349 | port->mon_data.up_txcnt++; |
2360 | port->icount.tx++; | 2350 | port->icount.tx++; |
2361 | return; | 2351 | return; |
2362 | } | 2352 | } |
2363 | 2353 | ||
2364 | if (port->xmit_buf == NULL) | 2354 | if (port->port.xmit_buf == NULL) |
2365 | return; | 2355 | return; |
2366 | 2356 | ||
2367 | if ((port->xmit_cnt <= 0) || port->tty->stopped || | 2357 | if ((port->xmit_cnt <= 0) || port->port.tty->stopped || |
2368 | (port->tty->hw_stopped && | 2358 | (port->port.tty->hw_stopped && |
2369 | (port->type != PORT_16550A) && | 2359 | (port->type != PORT_16550A) && |
2370 | (!port->board->chip_flag))) { | 2360 | (!port->board->chip_flag))) { |
2371 | port->IER &= ~UART_IER_THRI; | 2361 | port->IER &= ~UART_IER_THRI; |
@@ -2376,20 +2366,20 @@ static void mxser_transmit_chars(struct mxser_port *port) | |||
2376 | cnt = port->xmit_cnt; | 2366 | cnt = port->xmit_cnt; |
2377 | count = port->xmit_fifo_size; | 2367 | count = port->xmit_fifo_size; |
2378 | do { | 2368 | do { |
2379 | outb(port->xmit_buf[port->xmit_tail++], | 2369 | outb(port->port.xmit_buf[port->xmit_tail++], |
2380 | port->ioaddr + UART_TX); | 2370 | port->ioaddr + UART_TX); |
2381 | port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE - 1); | 2371 | port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE - 1); |
2382 | if (--port->xmit_cnt <= 0) | 2372 | if (--port->xmit_cnt <= 0) |
2383 | break; | 2373 | break; |
2384 | } while (--count > 0); | 2374 | } while (--count > 0); |
2385 | mxvar_log.txcnt[port->tty->index] += (cnt - port->xmit_cnt); | 2375 | mxvar_log.txcnt[port->port.tty->index] += (cnt - port->xmit_cnt); |
2386 | 2376 | ||
2387 | port->mon_data.txcnt += (cnt - port->xmit_cnt); | 2377 | port->mon_data.txcnt += (cnt - port->xmit_cnt); |
2388 | port->mon_data.up_txcnt += (cnt - port->xmit_cnt); | 2378 | port->mon_data.up_txcnt += (cnt - port->xmit_cnt); |
2389 | port->icount.tx += (cnt - port->xmit_cnt); | 2379 | port->icount.tx += (cnt - port->xmit_cnt); |
2390 | 2380 | ||
2391 | if (port->xmit_cnt < WAKEUP_CHARS) | 2381 | if (port->xmit_cnt < WAKEUP_CHARS) |
2392 | tty_wakeup(port->tty); | 2382 | tty_wakeup(port->port.tty); |
2393 | 2383 | ||
2394 | if (port->xmit_cnt <= 0) { | 2384 | if (port->xmit_cnt <= 0) { |
2395 | port->IER &= ~UART_IER_THRI; | 2385 | port->IER &= ~UART_IER_THRI; |
@@ -2440,9 +2430,9 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id) | |||
2440 | if (iir & UART_IIR_NO_INT) | 2430 | if (iir & UART_IIR_NO_INT) |
2441 | break; | 2431 | break; |
2442 | iir &= MOXA_MUST_IIR_MASK; | 2432 | iir &= MOXA_MUST_IIR_MASK; |
2443 | if (!port->tty || | 2433 | if (!port->port.tty || |
2444 | (port->flags & ASYNC_CLOSING) || | 2434 | (port->port.flags & ASYNC_CLOSING) || |
2445 | !(port->flags & | 2435 | !(port->port.flags & |
2446 | ASYNC_INITIALIZED)) { | 2436 | ASYNC_INITIALIZED)) { |
2447 | status = inb(port->ioaddr + UART_LSR); | 2437 | status = inb(port->ioaddr + UART_LSR); |
2448 | outb(0x27, port->ioaddr + UART_FCR); | 2438 | outb(0x27, port->ioaddr + UART_FCR); |
@@ -2550,6 +2540,7 @@ static int __devinit mxser_initbrd(struct mxser_board *brd, | |||
2550 | 2540 | ||
2551 | for (i = 0; i < brd->info->nports; i++) { | 2541 | for (i = 0; i < brd->info->nports; i++) { |
2552 | info = &brd->ports[i]; | 2542 | info = &brd->ports[i]; |
2543 | tty_port_init(&info->port); | ||
2553 | info->board = brd; | 2544 | info->board = brd; |
2554 | info->stop_rx = 0; | 2545 | info->stop_rx = 0; |
2555 | info->ldisc_stop_rx = 0; | 2546 | info->ldisc_stop_rx = 0; |
@@ -2558,16 +2549,15 @@ static int __devinit mxser_initbrd(struct mxser_board *brd, | |||
2558 | if (brd->chip_flag != MOXA_OTHER_UART) | 2549 | if (brd->chip_flag != MOXA_OTHER_UART) |
2559 | mxser_enable_must_enchance_mode(info->ioaddr); | 2550 | mxser_enable_must_enchance_mode(info->ioaddr); |
2560 | 2551 | ||
2561 | info->flags = ASYNC_SHARE_IRQ; | 2552 | info->port.flags = ASYNC_SHARE_IRQ; |
2562 | info->type = brd->uart_type; | 2553 | info->type = brd->uart_type; |
2563 | 2554 | ||
2564 | process_txrx_fifo(info); | 2555 | process_txrx_fifo(info); |
2565 | 2556 | ||
2566 | info->custom_divisor = info->baud_base * 16; | 2557 | info->custom_divisor = info->baud_base * 16; |
2567 | info->close_delay = 5 * HZ / 10; | 2558 | info->port.close_delay = 5 * HZ / 10; |
2568 | info->closing_wait = 30 * HZ; | 2559 | info->port.closing_wait = 30 * HZ; |
2569 | info->normal_termios = mxvar_sdriver->init_termios; | 2560 | info->normal_termios = mxvar_sdriver->init_termios; |
2570 | init_waitqueue_head(&info->open_wait); | ||
2571 | init_waitqueue_head(&info->delta_msr_wait); | 2561 | init_waitqueue_head(&info->delta_msr_wait); |
2572 | memset(&info->mon_data, 0, sizeof(struct mxser_mon)); | 2562 | memset(&info->mon_data, 0, sizeof(struct mxser_mon)); |
2573 | info->err_shadow = 0; | 2563 | info->err_shadow = 0; |
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index a35bfd7ee80e..ed4e03333ab4 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c | |||
@@ -199,7 +199,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty); | |||
199 | #define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) | 199 | #define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) |
200 | #define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty) | 200 | #define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty) |
201 | 201 | ||
202 | static struct tty_ldisc n_hdlc_ldisc = { | 202 | static struct tty_ldisc_ops n_hdlc_ldisc = { |
203 | .owner = THIS_MODULE, | 203 | .owner = THIS_MODULE, |
204 | .magic = TTY_LDISC_MAGIC, | 204 | .magic = TTY_LDISC_MAGIC, |
205 | .name = "hdlc", | 205 | .name = "hdlc", |
@@ -342,8 +342,8 @@ static int n_hdlc_tty_open (struct tty_struct *tty) | |||
342 | #endif | 342 | #endif |
343 | 343 | ||
344 | /* Flush any pending characters in the driver and discipline. */ | 344 | /* Flush any pending characters in the driver and discipline. */ |
345 | if (tty->ldisc.flush_buffer) | 345 | if (tty->ldisc.ops->flush_buffer) |
346 | tty->ldisc.flush_buffer(tty); | 346 | tty->ldisc.ops->flush_buffer(tty); |
347 | 347 | ||
348 | tty_driver_flush_buffer(tty); | 348 | tty_driver_flush_buffer(tty); |
349 | 349 | ||
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index 902169062332..ae377aa473ba 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c | |||
@@ -143,7 +143,7 @@ static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, | |||
143 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, | 143 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
144 | char *fp, int count); | 144 | char *fp, int count); |
145 | 145 | ||
146 | static struct tty_ldisc tty_ldisc_N_R3964 = { | 146 | static struct tty_ldisc_ops tty_ldisc_N_R3964 = { |
147 | .owner = THIS_MODULE, | 147 | .owner = THIS_MODULE, |
148 | .magic = TTY_LDISC_MAGIC, | 148 | .magic = TTY_LDISC_MAGIC, |
149 | .name = "R3964", | 149 | .name = "R3964", |
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 8096389b0dc2..708c2b1dbe51 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -1573,7 +1573,7 @@ static unsigned int normal_poll(struct tty_struct *tty, struct file *file, | |||
1573 | return mask; | 1573 | return mask; |
1574 | } | 1574 | } |
1575 | 1575 | ||
1576 | struct tty_ldisc tty_ldisc_N_TTY = { | 1576 | struct tty_ldisc_ops tty_ldisc_N_TTY = { |
1577 | .magic = TTY_LDISC_MAGIC, | 1577 | .magic = TTY_LDISC_MAGIC, |
1578 | .name = "n_tty", | 1578 | .name = "n_tty", |
1579 | .open = n_tty_open, | 1579 | .open = n_tty_open, |
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 197cd7a0c332..a22662b6a1a5 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
@@ -444,7 +444,7 @@ nvram_init(void) | |||
444 | 444 | ||
445 | /* First test whether the driver should init at all */ | 445 | /* First test whether the driver should init at all */ |
446 | if (!CHECK_DRIVER_INIT()) | 446 | if (!CHECK_DRIVER_INIT()) |
447 | return -ENXIO; | 447 | return -ENODEV; |
448 | 448 | ||
449 | ret = misc_register(&nvram_dev); | 449 | ret = misc_register(&nvram_dev); |
450 | if (ret) { | 450 | if (ret) { |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 1dd0e992c83d..b694d430f10e 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -514,8 +514,8 @@ static void ldisc_receive_buf(struct tty_struct *tty, | |||
514 | return; | 514 | return; |
515 | ld = tty_ldisc_ref(tty); | 515 | ld = tty_ldisc_ref(tty); |
516 | if (ld) { | 516 | if (ld) { |
517 | if (ld->receive_buf) | 517 | if (ld->ops->receive_buf) |
518 | ld->receive_buf(tty, data, flags, count); | 518 | ld->ops->receive_buf(tty, data, flags, count); |
519 | tty_ldisc_deref(ld); | 519 | tty_ldisc_deref(ld); |
520 | } | 520 | } |
521 | } | 521 | } |
@@ -3886,9 +3886,8 @@ static bool rx_get_frame(MGSLPC_INFO *info) | |||
3886 | framesize = 0; | 3886 | framesize = 0; |
3887 | #if SYNCLINK_GENERIC_HDLC | 3887 | #if SYNCLINK_GENERIC_HDLC |
3888 | { | 3888 | { |
3889 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 3889 | info->netdev->stats.rx_errors++; |
3890 | stats->rx_errors++; | 3890 | info->netdev->stats.rx_frame_errors++; |
3891 | stats->rx_frame_errors++; | ||
3892 | } | 3891 | } |
3893 | #endif | 3892 | #endif |
3894 | } else | 3893 | } else |
@@ -4144,7 +4143,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding, | |||
4144 | static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | 4143 | static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) |
4145 | { | 4144 | { |
4146 | MGSLPC_INFO *info = dev_to_port(dev); | 4145 | MGSLPC_INFO *info = dev_to_port(dev); |
4147 | struct net_device_stats *stats = hdlc_stats(dev); | ||
4148 | unsigned long flags; | 4146 | unsigned long flags; |
4149 | 4147 | ||
4150 | if (debug_level >= DEBUG_LEVEL_INFO) | 4148 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -4159,8 +4157,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4159 | info->tx_put = info->tx_count = skb->len; | 4157 | info->tx_put = info->tx_count = skb->len; |
4160 | 4158 | ||
4161 | /* update network statistics */ | 4159 | /* update network statistics */ |
4162 | stats->tx_packets++; | 4160 | dev->stats.tx_packets++; |
4163 | stats->tx_bytes += skb->len; | 4161 | dev->stats.tx_bytes += skb->len; |
4164 | 4162 | ||
4165 | /* done with socket buffer, so free it */ | 4163 | /* done with socket buffer, so free it */ |
4166 | dev_kfree_skb(skb); | 4164 | dev_kfree_skb(skb); |
@@ -4376,14 +4374,13 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
4376 | static void hdlcdev_tx_timeout(struct net_device *dev) | 4374 | static void hdlcdev_tx_timeout(struct net_device *dev) |
4377 | { | 4375 | { |
4378 | MGSLPC_INFO *info = dev_to_port(dev); | 4376 | MGSLPC_INFO *info = dev_to_port(dev); |
4379 | struct net_device_stats *stats = hdlc_stats(dev); | ||
4380 | unsigned long flags; | 4377 | unsigned long flags; |
4381 | 4378 | ||
4382 | if (debug_level >= DEBUG_LEVEL_INFO) | 4379 | if (debug_level >= DEBUG_LEVEL_INFO) |
4383 | printk("hdlcdev_tx_timeout(%s)\n",dev->name); | 4380 | printk("hdlcdev_tx_timeout(%s)\n",dev->name); |
4384 | 4381 | ||
4385 | stats->tx_errors++; | 4382 | dev->stats.tx_errors++; |
4386 | stats->tx_aborted_errors++; | 4383 | dev->stats.tx_aborted_errors++; |
4387 | 4384 | ||
4388 | spin_lock_irqsave(&info->lock,flags); | 4385 | spin_lock_irqsave(&info->lock,flags); |
4389 | tx_stop(info); | 4386 | tx_stop(info); |
@@ -4416,27 +4413,26 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size) | |||
4416 | { | 4413 | { |
4417 | struct sk_buff *skb = dev_alloc_skb(size); | 4414 | struct sk_buff *skb = dev_alloc_skb(size); |
4418 | struct net_device *dev = info->netdev; | 4415 | struct net_device *dev = info->netdev; |
4419 | struct net_device_stats *stats = hdlc_stats(dev); | ||
4420 | 4416 | ||
4421 | if (debug_level >= DEBUG_LEVEL_INFO) | 4417 | if (debug_level >= DEBUG_LEVEL_INFO) |
4422 | printk("hdlcdev_rx(%s)\n",dev->name); | 4418 | printk("hdlcdev_rx(%s)\n",dev->name); |
4423 | 4419 | ||
4424 | if (skb == NULL) { | 4420 | if (skb == NULL) { |
4425 | printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); | 4421 | printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); |
4426 | stats->rx_dropped++; | 4422 | dev->stats.rx_dropped++; |
4427 | return; | 4423 | return; |
4428 | } | 4424 | } |
4429 | 4425 | ||
4430 | memcpy(skb_put(skb, size),buf,size); | 4426 | memcpy(skb_put(skb, size), buf, size); |
4431 | 4427 | ||
4432 | skb->protocol = hdlc_type_trans(skb, info->netdev); | 4428 | skb->protocol = hdlc_type_trans(skb, dev); |
4433 | 4429 | ||
4434 | stats->rx_packets++; | 4430 | dev->stats.rx_packets++; |
4435 | stats->rx_bytes += size; | 4431 | dev->stats.rx_bytes += size; |
4436 | 4432 | ||
4437 | netif_rx(skb); | 4433 | netif_rx(skb); |
4438 | 4434 | ||
4439 | info->netdev->last_rx = jiffies; | 4435 | dev->last_rx = jiffies; |
4440 | } | 4436 | } |
4441 | 4437 | ||
4442 | /** | 4438 | /** |
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 0a05c038ae6f..76b27932d229 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -111,7 +111,7 @@ static int pty_write(struct tty_struct * tty, const unsigned char *buf, int coun | |||
111 | c = to->receive_room; | 111 | c = to->receive_room; |
112 | if (c > count) | 112 | if (c > count) |
113 | c = count; | 113 | c = count; |
114 | to->ldisc.receive_buf(to, buf, NULL, c); | 114 | to->ldisc.ops->receive_buf(to, buf, NULL, c); |
115 | 115 | ||
116 | return c; | 116 | return c; |
117 | } | 117 | } |
@@ -149,11 +149,11 @@ static int pty_chars_in_buffer(struct tty_struct *tty) | |||
149 | int count; | 149 | int count; |
150 | 150 | ||
151 | /* We should get the line discipline lock for "tty->link" */ | 151 | /* We should get the line discipline lock for "tty->link" */ |
152 | if (!to || !to->ldisc.chars_in_buffer) | 152 | if (!to || !to->ldisc.ops->chars_in_buffer) |
153 | return 0; | 153 | return 0; |
154 | 154 | ||
155 | /* The ldisc must report 0 if no characters available to be read */ | 155 | /* The ldisc must report 0 if no characters available to be read */ |
156 | count = to->ldisc.chars_in_buffer(to); | 156 | count = to->ldisc.ops->chars_in_buffer(to); |
157 | 157 | ||
158 | if (tty->driver->subtype == PTY_TYPE_SLAVE) return count; | 158 | if (tty->driver->subtype == PTY_TYPE_SLAVE) return count; |
159 | 159 | ||
@@ -186,8 +186,8 @@ static void pty_flush_buffer(struct tty_struct *tty) | |||
186 | if (!to) | 186 | if (!to) |
187 | return; | 187 | return; |
188 | 188 | ||
189 | if (to->ldisc.flush_buffer) | 189 | if (to->ldisc.ops->flush_buffer) |
190 | to->ldisc.flush_buffer(to); | 190 | to->ldisc.ops->flush_buffer(to); |
191 | 191 | ||
192 | if (to->packet) { | 192 | if (to->packet) { |
193 | spin_lock_irqsave(&tty->ctrl_lock, flags); | 193 | spin_lock_irqsave(&tty->ctrl_lock, flags); |
diff --git a/drivers/char/rio/cirrus.h b/drivers/char/rio/cirrus.h index a03a538a3efb..5ab51679caa2 100644 --- a/drivers/char/rio/cirrus.h +++ b/drivers/char/rio/cirrus.h | |||
@@ -35,9 +35,6 @@ | |||
35 | ***************************************************************************/ | 35 | ***************************************************************************/ |
36 | 36 | ||
37 | #ifndef _cirrus_h | 37 | #ifndef _cirrus_h |
38 | #ifndef lint | ||
39 | /* static char* _cirrus_h_sccs = "@(#)cirrus.h 1.16"; */ | ||
40 | #endif | ||
41 | #define _cirrus_h 1 | 38 | #define _cirrus_h 1 |
42 | 39 | ||
43 | /* Bit fields for particular registers shared with driver */ | 40 | /* Bit fields for particular registers shared with driver */ |
diff --git a/drivers/char/rio/cmdblk.h b/drivers/char/rio/cmdblk.h index c46b2fdb6626..9ed4f861675a 100644 --- a/drivers/char/rio/cmdblk.h +++ b/drivers/char/rio/cmdblk.h | |||
@@ -33,12 +33,6 @@ | |||
33 | #ifndef __rio_cmdblk_h__ | 33 | #ifndef __rio_cmdblk_h__ |
34 | #define __rio_cmdblk_h__ | 34 | #define __rio_cmdblk_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | #ifndef lint | ||
38 | static char *_cmdblk_h_sccs_ = "@(#)cmdblk.h 1.2"; | ||
39 | #endif | ||
40 | #endif | ||
41 | |||
42 | /* | 36 | /* |
43 | ** the structure of a command block, used to queue commands destined for | 37 | ** the structure of a command block, used to queue commands destined for |
44 | ** a rup. | 38 | ** a rup. |
diff --git a/drivers/char/rio/cmdpkt.h b/drivers/char/rio/cmdpkt.h index 357ae5722436..c1e7a2798070 100644 --- a/drivers/char/rio/cmdpkt.h +++ b/drivers/char/rio/cmdpkt.h | |||
@@ -32,12 +32,6 @@ | |||
32 | #ifndef __rio_cmdpkt_h__ | 32 | #ifndef __rio_cmdpkt_h__ |
33 | #define __rio_cmdpkt_h__ | 33 | #define __rio_cmdpkt_h__ |
34 | 34 | ||
35 | #ifdef SCCS_LABELS | ||
36 | #ifndef lint | ||
37 | static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2"; | ||
38 | #endif | ||
39 | #endif | ||
40 | |||
41 | /* | 35 | /* |
42 | ** overlays for the data area of a packet. Used in both directions | 36 | ** overlays for the data area of a packet. Used in both directions |
43 | ** (to build a packet to send, and to interpret a packet that arrives) | 37 | ** (to build a packet to send, and to interpret a packet that arrives) |
diff --git a/drivers/char/rio/daemon.h b/drivers/char/rio/daemon.h index 6e63f8b2c479..4af90323fd00 100644 --- a/drivers/char/rio/daemon.h +++ b/drivers/char/rio/daemon.h | |||
@@ -33,12 +33,6 @@ | |||
33 | #ifndef __rio_daemon_h__ | 33 | #ifndef __rio_daemon_h__ |
34 | #define __rio_daemon_h__ | 34 | #define __rio_daemon_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | #ifndef lint | ||
38 | static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3"; | ||
39 | #endif | ||
40 | #endif | ||
41 | |||
42 | 36 | ||
43 | /* | 37 | /* |
44 | ** structures used on /dev/rio | 38 | ** structures used on /dev/rio |
diff --git a/drivers/char/rio/errors.h b/drivers/char/rio/errors.h index 1d0d89144337..bdb05234090a 100644 --- a/drivers/char/rio/errors.h +++ b/drivers/char/rio/errors.h | |||
@@ -33,12 +33,6 @@ | |||
33 | #ifndef __rio_errors_h__ | 33 | #ifndef __rio_errors_h__ |
34 | #define __rio_errors_h__ | 34 | #define __rio_errors_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | #ifndef lint | ||
38 | static char *_errors_h_sccs_ = "@(#)errors.h 1.2"; | ||
39 | #endif | ||
40 | #endif | ||
41 | |||
42 | /* | 36 | /* |
43 | ** error codes | 37 | ** error codes |
44 | */ | 38 | */ |
diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h index 9e7283bd81a0..078d44f85e45 100644 --- a/drivers/char/rio/func.h +++ b/drivers/char/rio/func.h | |||
@@ -35,12 +35,6 @@ | |||
35 | 35 | ||
36 | #include <linux/kdev_t.h> | 36 | #include <linux/kdev_t.h> |
37 | 37 | ||
38 | #ifdef SCCS_LABELS | ||
39 | #ifndef lint | ||
40 | static char *_func_h_sccs_ = "@(#)func.h 1.3"; | ||
41 | #endif | ||
42 | #endif | ||
43 | |||
44 | /* rioboot.c */ | 38 | /* rioboot.c */ |
45 | int RIOBootCodeRTA(struct rio_info *, struct DownLoad *); | 39 | int RIOBootCodeRTA(struct rio_info *, struct DownLoad *); |
46 | int RIOBootCodeHOST(struct rio_info *, struct DownLoad *); | 40 | int RIOBootCodeHOST(struct rio_info *, struct DownLoad *); |
diff --git a/drivers/char/rio/map.h b/drivers/char/rio/map.h index bdbcd09c8b81..8366978578c1 100644 --- a/drivers/char/rio/map.h +++ b/drivers/char/rio/map.h | |||
@@ -33,10 +33,6 @@ | |||
33 | #ifndef __rio_map_h__ | 33 | #ifndef __rio_map_h__ |
34 | #define __rio_map_h__ | 34 | #define __rio_map_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | static char *_map_h_sccs_ = "@(#)map.h 1.2"; | ||
38 | #endif | ||
39 | |||
40 | /* | 36 | /* |
41 | ** mapping structure passed to and from the config.rio program to | 37 | ** mapping structure passed to and from the config.rio program to |
42 | ** determine the current topology of the world | 38 | ** determine the current topology of the world |
diff --git a/drivers/char/rio/param.h b/drivers/char/rio/param.h index 675c200b2459..7e9b6283e8aa 100644 --- a/drivers/char/rio/param.h +++ b/drivers/char/rio/param.h | |||
@@ -33,11 +33,6 @@ | |||
33 | #ifndef __rio_param_h__ | 33 | #ifndef __rio_param_h__ |
34 | #define __rio_param_h__ | 34 | #define __rio_param_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | static char *_param_h_sccs_ = "@(#)param.h 1.2"; | ||
38 | #endif | ||
39 | |||
40 | |||
41 | /* | 36 | /* |
42 | ** the param command block, as used in OPEN and PARAM calls. | 37 | ** the param command block, as used in OPEN and PARAM calls. |
43 | */ | 38 | */ |
diff --git a/drivers/char/rio/parmmap.h b/drivers/char/rio/parmmap.h index 9764ef85c5a6..acc8fa439df5 100644 --- a/drivers/char/rio/parmmap.h +++ b/drivers/char/rio/parmmap.h | |||
@@ -37,13 +37,6 @@ | |||
37 | #ifndef _parmap_h | 37 | #ifndef _parmap_h |
38 | #define _parmap_h | 38 | #define _parmap_h |
39 | 39 | ||
40 | |||
41 | #ifdef SCCS_LABELS | ||
42 | #ifndef lint | ||
43 | /* static char *_rio_parmmap_h_sccs = "@(#)parmmap.h 1.4"; */ | ||
44 | #endif | ||
45 | #endif | ||
46 | |||
47 | typedef struct PARM_MAP PARM_MAP; | 40 | typedef struct PARM_MAP PARM_MAP; |
48 | 41 | ||
49 | struct PARM_MAP { | 42 | struct PARM_MAP { |
diff --git a/drivers/char/rio/pci.h b/drivers/char/rio/pci.h index 1eba9118079b..6032f9135956 100644 --- a/drivers/char/rio/pci.h +++ b/drivers/char/rio/pci.h | |||
@@ -33,10 +33,6 @@ | |||
33 | #ifndef __rio_pci_h__ | 33 | #ifndef __rio_pci_h__ |
34 | #define __rio_pci_h__ | 34 | #define __rio_pci_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | static char *_pci_h_sccs_ = "@(#)pci.h 1.2"; | ||
38 | #endif | ||
39 | |||
40 | /* | 36 | /* |
41 | ** PCI stuff | 37 | ** PCI stuff |
42 | */ | 38 | */ |
diff --git a/drivers/char/rio/protsts.h b/drivers/char/rio/protsts.h index 69fc4bc34153..8ab79401d3ee 100644 --- a/drivers/char/rio/protsts.h +++ b/drivers/char/rio/protsts.h | |||
@@ -37,13 +37,6 @@ | |||
37 | #ifndef _protsts_h | 37 | #ifndef _protsts_h |
38 | #define _protsts_h 1 | 38 | #define _protsts_h 1 |
39 | 39 | ||
40 | |||
41 | #ifdef SCCS_LABELS | ||
42 | #ifndef lint | ||
43 | /* static char *_rio_protsts_h_sccs = "@(#)protsts.h 1.4"; */ | ||
44 | #endif | ||
45 | #endif | ||
46 | |||
47 | /************************************************* | 40 | /************************************************* |
48 | * ACK bit. Last Packet received OK. Set by | 41 | * ACK bit. Last Packet received OK. Set by |
49 | * rxpkt to indicate that the Packet has been | 42 | * rxpkt to indicate that the Packet has been |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 412777cd1e68..0cdfee152916 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -25,11 +25,6 @@ | |||
25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, | 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, |
26 | * USA. | 26 | * USA. |
27 | * | 27 | * |
28 | * Revision history: | ||
29 | * $Log: rio.c,v $ | ||
30 | * Revision 1.1 1999/07/11 10:13:54 wolff | ||
31 | * Initial revision | ||
32 | * | ||
33 | * */ | 28 | * */ |
34 | 29 | ||
35 | #include <linux/module.h> | 30 | #include <linux/module.h> |
@@ -436,7 +431,7 @@ static void rio_disable_tx_interrupts(void *ptr) | |||
436 | { | 431 | { |
437 | func_enter(); | 432 | func_enter(); |
438 | 433 | ||
439 | /* port->gs.flags &= ~GS_TX_INTEN; */ | 434 | /* port->gs.port.flags &= ~GS_TX_INTEN; */ |
440 | 435 | ||
441 | func_exit(); | 436 | func_exit(); |
442 | } | 437 | } |
@@ -460,7 +455,7 @@ static void rio_enable_tx_interrupts(void *ptr) | |||
460 | * In general we cannot count on "tx empty" interrupts, although | 455 | * In general we cannot count on "tx empty" interrupts, although |
461 | * the interrupt routine seems to be able to tell the difference. | 456 | * the interrupt routine seems to be able to tell the difference. |
462 | */ | 457 | */ |
463 | PortP->gs.flags &= ~GS_TX_INTEN; | 458 | PortP->gs.port.flags &= ~GS_TX_INTEN; |
464 | 459 | ||
465 | func_exit(); | 460 | func_exit(); |
466 | } | 461 | } |
@@ -515,7 +510,7 @@ static void rio_shutdown_port(void *ptr) | |||
515 | func_enter(); | 510 | func_enter(); |
516 | 511 | ||
517 | PortP = (struct Port *) ptr; | 512 | PortP = (struct Port *) ptr; |
518 | PortP->gs.tty = NULL; | 513 | PortP->gs.port.tty = NULL; |
519 | func_exit(); | 514 | func_exit(); |
520 | } | 515 | } |
521 | 516 | ||
@@ -534,7 +529,7 @@ static void rio_hungup(void *ptr) | |||
534 | func_enter(); | 529 | func_enter(); |
535 | 530 | ||
536 | PortP = (struct Port *) ptr; | 531 | PortP = (struct Port *) ptr; |
537 | PortP->gs.tty = NULL; | 532 | PortP->gs.port.tty = NULL; |
538 | 533 | ||
539 | func_exit(); | 534 | func_exit(); |
540 | } | 535 | } |
@@ -554,12 +549,12 @@ static void rio_close(void *ptr) | |||
554 | 549 | ||
555 | riotclose(ptr); | 550 | riotclose(ptr); |
556 | 551 | ||
557 | if (PortP->gs.count) { | 552 | if (PortP->gs.port.count) { |
558 | printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count); | 553 | printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.port.count); |
559 | PortP->gs.count = 0; | 554 | PortP->gs.port.count = 0; |
560 | } | 555 | } |
561 | 556 | ||
562 | PortP->gs.tty = NULL; | 557 | PortP->gs.port.tty = NULL; |
563 | func_exit(); | 558 | func_exit(); |
564 | } | 559 | } |
565 | 560 | ||
@@ -854,8 +849,8 @@ static int rio_init_datastructures(void) | |||
854 | /* | 849 | /* |
855 | * Initializing wait queue | 850 | * Initializing wait queue |
856 | */ | 851 | */ |
857 | init_waitqueue_head(&port->gs.open_wait); | 852 | init_waitqueue_head(&port->gs.port.open_wait); |
858 | init_waitqueue_head(&port->gs.close_wait); | 853 | init_waitqueue_head(&port->gs.port.close_wait); |
859 | } | 854 | } |
860 | #else | 855 | #else |
861 | /* We could postpone initializing them to when they are configured. */ | 856 | /* We could postpone initializing them to when they are configured. */ |
diff --git a/drivers/char/rio/rioboard.h b/drivers/char/rio/rioboard.h index 822c071a693b..252230043c82 100644 --- a/drivers/char/rio/rioboard.h +++ b/drivers/char/rio/rioboard.h | |||
@@ -29,12 +29,6 @@ | |||
29 | /* */ | 29 | /* */ |
30 | /************************************************************************/ | 30 | /************************************************************************/ |
31 | 31 | ||
32 | /* History... | ||
33 | |||
34 | 1.0.0 26/04/99 NPV Creation. | ||
35 | |||
36 | */ | ||
37 | |||
38 | #ifndef _rioboard_h /* If RIOBOARD.H not already defined */ | 32 | #ifndef _rioboard_h /* If RIOBOARD.H not already defined */ |
39 | #define _rioboard_h 1 | 33 | #define _rioboard_h 1 |
40 | 34 | ||
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 7b96e0814887..01f2654d5a2e 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c | |||
@@ -30,9 +30,6 @@ | |||
30 | ** | 30 | ** |
31 | ** ----------------------------------------------------------------------------- | 31 | ** ----------------------------------------------------------------------------- |
32 | */ | 32 | */ |
33 | #ifdef SCCS_LABELS | ||
34 | static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; | ||
35 | #endif | ||
36 | 33 | ||
37 | #include <linux/module.h> | 34 | #include <linux/module.h> |
38 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
@@ -487,12 +484,12 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc | |||
487 | ** If the device is a modem, then check the modem | 484 | ** If the device is a modem, then check the modem |
488 | ** carrier. | 485 | ** carrier. |
489 | */ | 486 | */ |
490 | if (PortP->gs.tty == NULL) | 487 | if (PortP->gs.port.tty == NULL) |
491 | break; | 488 | break; |
492 | if (PortP->gs.tty->termios == NULL) | 489 | if (PortP->gs.port.tty->termios == NULL) |
493 | break; | 490 | break; |
494 | 491 | ||
495 | if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) { | 492 | if (!(PortP->gs.port.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) { |
496 | 493 | ||
497 | rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n"); | 494 | rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n"); |
498 | /* | 495 | /* |
@@ -509,7 +506,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc | |||
509 | ** wakeup anyone in WOPEN | 506 | ** wakeup anyone in WOPEN |
510 | */ | 507 | */ |
511 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) | 508 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) |
512 | wake_up_interruptible(&PortP->gs.open_wait); | 509 | wake_up_interruptible(&PortP->gs.port.open_wait); |
513 | } | 510 | } |
514 | } else { | 511 | } else { |
515 | /* | 512 | /* |
@@ -517,7 +514,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc | |||
517 | */ | 514 | */ |
518 | if (PortP->State & RIO_CARR_ON) { | 515 | if (PortP->State & RIO_CARR_ON) { |
519 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN)) | 516 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN)) |
520 | tty_hangup(PortP->gs.tty); | 517 | tty_hangup(PortP->gs.port.tty); |
521 | PortP->State &= ~RIO_CARR_ON; | 518 | PortP->State &= ~RIO_CARR_ON; |
522 | rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); | 519 | rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); |
523 | } | 520 | } |
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index d65ceb9a434a..eecee0f576d2 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c | |||
@@ -29,10 +29,6 @@ | |||
29 | ** | 29 | ** |
30 | ** ----------------------------------------------------------------------------- | 30 | ** ----------------------------------------------------------------------------- |
31 | */ | 31 | */ |
32 | #ifdef SCCS_LABELS | ||
33 | static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3"; | ||
34 | #endif | ||
35 | |||
36 | 32 | ||
37 | #include <linux/module.h> | 33 | #include <linux/module.h> |
38 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
diff --git a/drivers/char/rio/riodrvr.h b/drivers/char/rio/riodrvr.h index 3cffe275f216..0907e711b355 100644 --- a/drivers/char/rio/riodrvr.h +++ b/drivers/char/rio/riodrvr.h | |||
@@ -35,10 +35,6 @@ | |||
35 | 35 | ||
36 | #include <asm/param.h> /* for HZ */ | 36 | #include <asm/param.h> /* for HZ */ |
37 | 37 | ||
38 | #ifdef SCCS_LABELS | ||
39 | static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3"; | ||
40 | #endif | ||
41 | |||
42 | #define MEMDUMP_SIZE 32 | 38 | #define MEMDUMP_SIZE 32 |
43 | #define MOD_DISABLE (RIO_NOREAD|RIO_NOWRITE|RIO_NOXPRINT) | 39 | #define MOD_DISABLE (RIO_NOREAD|RIO_NOWRITE|RIO_NOXPRINT) |
44 | 40 | ||
diff --git a/drivers/char/rio/rioinfo.h b/drivers/char/rio/rioinfo.h index 8de7966e603a..42ff1e79d96f 100644 --- a/drivers/char/rio/rioinfo.h +++ b/drivers/char/rio/rioinfo.h | |||
@@ -33,10 +33,6 @@ | |||
33 | #ifndef __rioinfo_h | 33 | #ifndef __rioinfo_h |
34 | #define __rioinfo_h | 34 | #define __rioinfo_h |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | static char *_rioinfo_h_sccs_ = "@(#)rioinfo.h 1.2"; | ||
38 | #endif | ||
39 | |||
40 | /* | 36 | /* |
41 | ** Host card data structure | 37 | ** Host card data structure |
42 | */ | 38 | */ |
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index add1718295ef..be0ba401966e 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c | |||
@@ -29,9 +29,6 @@ | |||
29 | ** | 29 | ** |
30 | ** ----------------------------------------------------------------------------- | 30 | ** ----------------------------------------------------------------------------- |
31 | */ | 31 | */ |
32 | #ifdef SCCS_LABELS | ||
33 | static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; | ||
34 | #endif | ||
35 | 32 | ||
36 | #include <linux/module.h> | 33 | #include <linux/module.h> |
37 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index ea21686c69a4..71f87600907c 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c | |||
@@ -29,10 +29,6 @@ | |||
29 | ** | 29 | ** |
30 | ** ----------------------------------------------------------------------------- | 30 | ** ----------------------------------------------------------------------------- |
31 | */ | 31 | */ |
32 | #ifdef SCCS_LABELS | ||
33 | static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2"; | ||
34 | #endif | ||
35 | |||
36 | 32 | ||
37 | #include <linux/module.h> | 33 | #include <linux/module.h> |
38 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
@@ -106,7 +102,7 @@ void RIOTxEnable(char *en) | |||
106 | 102 | ||
107 | PortP = (struct Port *) en; | 103 | PortP = (struct Port *) en; |
108 | p = (struct rio_info *) PortP->p; | 104 | p = (struct rio_info *) PortP->p; |
109 | tty = PortP->gs.tty; | 105 | tty = PortP->gs.port.tty; |
110 | 106 | ||
111 | 107 | ||
112 | rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt); | 108 | rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt); |
@@ -162,7 +158,7 @@ void RIOTxEnable(char *en) | |||
162 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 158 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
163 | 159 | ||
164 | if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) | 160 | if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) |
165 | tty_wakeup(PortP->gs.tty); | 161 | tty_wakeup(PortP->gs.port.tty); |
166 | 162 | ||
167 | } | 163 | } |
168 | 164 | ||
@@ -245,7 +241,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP) | |||
245 | ** find corresponding tty structure. The process of mapping | 241 | ** find corresponding tty structure. The process of mapping |
246 | ** the ports puts these here. | 242 | ** the ports puts these here. |
247 | */ | 243 | */ |
248 | ttyP = PortP->gs.tty; | 244 | ttyP = PortP->gs.port.tty; |
249 | 245 | ||
250 | /* | 246 | /* |
251 | ** Lock the port before we begin working on it. | 247 | ** Lock the port before we begin working on it. |
@@ -339,7 +335,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP) | |||
339 | ** find corresponding tty structure. The process of mapping | 335 | ** find corresponding tty structure. The process of mapping |
340 | ** the ports puts these here. | 336 | ** the ports puts these here. |
341 | */ | 337 | */ |
342 | ttyP = PortP->gs.tty; | 338 | ttyP = PortP->gs.port.tty; |
343 | /* If ttyP is NULL, the port is getting closed. Forget about it. */ | 339 | /* If ttyP is NULL, the port is getting closed. Forget about it. */ |
344 | if (!ttyP) { | 340 | if (!ttyP) { |
345 | rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n"); | 341 | rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n"); |
@@ -546,7 +542,7 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP) | |||
546 | 542 | ||
547 | intCount++; | 543 | intCount++; |
548 | 544 | ||
549 | TtyP = PortP->gs.tty; | 545 | TtyP = PortP->gs.port.tty; |
550 | if (!TtyP) { | 546 | if (!TtyP) { |
551 | rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); | 547 | rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); |
552 | return; | 548 | return; |
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index 4810b845cc21..d687c17be152 100644 --- a/drivers/char/rio/rioparam.c +++ b/drivers/char/rio/rioparam.c | |||
@@ -30,10 +30,6 @@ | |||
30 | ** ----------------------------------------------------------------------------- | 30 | ** ----------------------------------------------------------------------------- |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #ifdef SCCS_LABELS | ||
34 | static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3"; | ||
35 | #endif | ||
36 | |||
37 | #include <linux/module.h> | 33 | #include <linux/module.h> |
38 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
39 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
@@ -164,7 +160,7 @@ int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag) | |||
164 | 160 | ||
165 | func_enter(); | 161 | func_enter(); |
166 | 162 | ||
167 | TtyP = PortP->gs.tty; | 163 | TtyP = PortP->gs.port.tty; |
168 | 164 | ||
169 | rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP); | 165 | rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP); |
170 | 166 | ||
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c index 7a9df7dcf9a8..706c2a25f7aa 100644 --- a/drivers/char/rio/rioroute.c +++ b/drivers/char/rio/rioroute.c | |||
@@ -29,9 +29,6 @@ | |||
29 | ** | 29 | ** |
30 | ** ----------------------------------------------------------------------------- | 30 | ** ----------------------------------------------------------------------------- |
31 | */ | 31 | */ |
32 | #ifdef SCCS_LABELS | ||
33 | static char *_rioroute_c_sccs_ = "@(#)rioroute.c 1.3"; | ||
34 | #endif | ||
35 | 32 | ||
36 | #include <linux/module.h> | 33 | #include <linux/module.h> |
37 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
diff --git a/drivers/char/rio/riospace.h b/drivers/char/rio/riospace.h index 534f1f5b9f53..ffb31d4332b9 100644 --- a/drivers/char/rio/riospace.h +++ b/drivers/char/rio/riospace.h | |||
@@ -33,10 +33,6 @@ | |||
33 | #ifndef __rio_riospace_h__ | 33 | #ifndef __rio_riospace_h__ |
34 | #define __rio_riospace_h__ | 34 | #define __rio_riospace_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | static char *_riospace_h_sccs_ = "@(#)riospace.h 1.2"; | ||
38 | #endif | ||
39 | |||
40 | #define RIO_LOCATOR_LEN 16 | 36 | #define RIO_LOCATOR_LEN 16 |
41 | #define MAX_RIO_BOARDS 4 | 37 | #define MAX_RIO_BOARDS 4 |
42 | 38 | ||
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c index 2b24488e95f2..3d15802dc0f3 100644 --- a/drivers/char/rio/riotable.c +++ b/drivers/char/rio/riotable.c | |||
@@ -29,9 +29,6 @@ | |||
29 | ** | 29 | ** |
30 | ** ----------------------------------------------------------------------------- | 30 | ** ----------------------------------------------------------------------------- |
31 | */ | 31 | */ |
32 | #ifdef SCCS_LABELS | ||
33 | static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2"; | ||
34 | #endif | ||
35 | 32 | ||
36 | #include <linux/module.h> | 33 | #include <linux/module.h> |
37 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c index c99354843be1..2fb49e89b324 100644 --- a/drivers/char/rio/riotty.c +++ b/drivers/char/rio/riotty.c | |||
@@ -29,10 +29,6 @@ | |||
29 | ** | 29 | ** |
30 | ** ----------------------------------------------------------------------------- | 30 | ** ----------------------------------------------------------------------------- |
31 | */ | 31 | */ |
32 | #ifdef SCCS_LABELS | ||
33 | static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3"; | ||
34 | #endif | ||
35 | |||
36 | 32 | ||
37 | #define __EXPLICIT_DEF_H__ | 33 | #define __EXPLICIT_DEF_H__ |
38 | 34 | ||
@@ -144,14 +140,14 @@ int riotopen(struct tty_struct *tty, struct file *filp) | |||
144 | 140 | ||
145 | tty->driver_data = PortP; | 141 | tty->driver_data = PortP; |
146 | 142 | ||
147 | PortP->gs.tty = tty; | 143 | PortP->gs.port.tty = tty; |
148 | PortP->gs.count++; | 144 | PortP->gs.port.count++; |
149 | 145 | ||
150 | rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt); | 146 | rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt); |
151 | 147 | ||
152 | retval = gs_init_port(&PortP->gs); | 148 | retval = gs_init_port(&PortP->gs); |
153 | if (retval) { | 149 | if (retval) { |
154 | PortP->gs.count--; | 150 | PortP->gs.port.count--; |
155 | return -ENXIO; | 151 | return -ENXIO; |
156 | } | 152 | } |
157 | /* | 153 | /* |
@@ -297,7 +293,7 @@ int riotopen(struct tty_struct *tty, struct file *filp) | |||
297 | ** insert test for carrier here. -- ??? | 293 | ** insert test for carrier here. -- ??? |
298 | ** I already see that test here. What's the deal? -- REW | 294 | ** I already see that test here. What's the deal? -- REW |
299 | */ | 295 | */ |
300 | if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || | 296 | if ((PortP->gs.port.tty->termios->c_cflag & CLOCAL) || |
301 | (PortP->ModemState & RIOC_MSVR1_CD)) { | 297 | (PortP->ModemState & RIOC_MSVR1_CD)) { |
302 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); | 298 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); |
303 | /* | 299 | /* |
@@ -305,16 +301,16 @@ int riotopen(struct tty_struct *tty, struct file *filp) | |||
305 | wakeup((caddr_t) &tp->tm.c_canq); | 301 | wakeup((caddr_t) &tp->tm.c_canq); |
306 | */ | 302 | */ |
307 | PortP->State |= RIO_CARR_ON; | 303 | PortP->State |= RIO_CARR_ON; |
308 | wake_up_interruptible(&PortP->gs.open_wait); | 304 | wake_up_interruptible(&PortP->gs.port.open_wait); |
309 | } else { /* no carrier - wait for DCD */ | 305 | } else { /* no carrier - wait for DCD */ |
310 | /* | 306 | /* |
311 | while (!(PortP->gs.tty->termios->c_state & CARR_ON) && | 307 | while (!(PortP->gs.port.tty->termios->c_state & CARR_ON) && |
312 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) | 308 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) |
313 | */ | 309 | */ |
314 | while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { | 310 | while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { |
315 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); | 311 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); |
316 | /* | 312 | /* |
317 | PortP->gs.tty->termios->c_state |= WOPEN; | 313 | PortP->gs.port.tty->termios->c_state |= WOPEN; |
318 | */ | 314 | */ |
319 | PortP->State |= RIO_WOPEN; | 315 | PortP->State |= RIO_WOPEN; |
320 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 316 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
@@ -384,7 +380,7 @@ int riotclose(void *ptr) | |||
384 | /* PortP = p->RIOPortp[SysPort]; */ | 380 | /* PortP = p->RIOPortp[SysPort]; */ |
385 | rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP); | 381 | rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP); |
386 | /* tp = PortP->TtyP; *//* Get tty */ | 382 | /* tp = PortP->TtyP; *//* Get tty */ |
387 | tty = PortP->gs.tty; | 383 | tty = PortP->gs.port.tty; |
388 | rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty); | 384 | rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty); |
389 | 385 | ||
390 | if (PortP->gs.closing_wait) | 386 | if (PortP->gs.closing_wait) |
diff --git a/drivers/char/rio/route.h b/drivers/char/rio/route.h index 769744e575ab..20ed73f3fd7b 100644 --- a/drivers/char/rio/route.h +++ b/drivers/char/rio/route.h | |||
@@ -37,12 +37,6 @@ | |||
37 | #ifndef _route_h | 37 | #ifndef _route_h |
38 | #define _route_h | 38 | #define _route_h |
39 | 39 | ||
40 | #ifdef SCCS_LABELS | ||
41 | #ifndef lint | ||
42 | /* static char *_rio_route_h_sccs = "@(#)route.h 1.3"; */ | ||
43 | #endif | ||
44 | #endif | ||
45 | |||
46 | #define MAX_LINKS 4 | 40 | #define MAX_LINKS 4 |
47 | #define MAX_NODES 17 /* Maximum nodes in a subnet */ | 41 | #define MAX_NODES 17 /* Maximum nodes in a subnet */ |
48 | #define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for | 42 | #define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for |
diff --git a/drivers/char/rio/unixrup.h b/drivers/char/rio/unixrup.h index 46bd532f7746..7abf0cba0f2c 100644 --- a/drivers/char/rio/unixrup.h +++ b/drivers/char/rio/unixrup.h | |||
@@ -33,10 +33,6 @@ | |||
33 | #ifndef __rio_unixrup_h__ | 33 | #ifndef __rio_unixrup_h__ |
34 | #define __rio_unixrup_h__ | 34 | #define __rio_unixrup_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | static char *_unixrup_h_sccs_ = "@(#)unixrup.h 1.2"; | ||
38 | #endif | ||
39 | |||
40 | /* | 36 | /* |
41 | ** UnixRup data structure. This contains pointers to actual RUPs on the | 37 | ** UnixRup data structure. This contains pointers to actual RUPs on the |
42 | ** host card, and all the command/boot control stuff. | 38 | ** host card, and all the command/boot control stuff. |
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index f073c710ab8d..724b2b20f4b2 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -322,7 +322,7 @@ static struct riscom_port *rc_get_port(struct riscom_board const *bp, | |||
322 | channel = rc_in(bp, CD180_GICR) >> GICR_CHAN_OFF; | 322 | channel = rc_in(bp, CD180_GICR) >> GICR_CHAN_OFF; |
323 | if (channel < CD180_NCH) { | 323 | if (channel < CD180_NCH) { |
324 | port = &rc_port[board_No(bp) * RC_NPORT + channel]; | 324 | port = &rc_port[board_No(bp) * RC_NPORT + channel]; |
325 | if (port->flags & ASYNC_INITIALIZED) | 325 | if (port->port.flags & ASYNC_INITIALIZED) |
326 | return port; | 326 | return port; |
327 | } | 327 | } |
328 | printk(KERN_ERR "rc%d: %s interrupt from invalid port %d\n", | 328 | printk(KERN_ERR "rc%d: %s interrupt from invalid port %d\n", |
@@ -341,7 +341,7 @@ static void rc_receive_exc(struct riscom_board const *bp) | |||
341 | if (port == NULL) | 341 | if (port == NULL) |
342 | return; | 342 | return; |
343 | 343 | ||
344 | tty = port->tty; | 344 | tty = port->port.tty; |
345 | 345 | ||
346 | #ifdef RC_REPORT_OVERRUN | 346 | #ifdef RC_REPORT_OVERRUN |
347 | status = rc_in(bp, CD180_RCSR); | 347 | status = rc_in(bp, CD180_RCSR); |
@@ -364,7 +364,7 @@ static void rc_receive_exc(struct riscom_board const *bp) | |||
364 | printk(KERN_INFO "rc%d: port %d: Handling break...\n", | 364 | printk(KERN_INFO "rc%d: port %d: Handling break...\n", |
365 | board_No(bp), port_No(port)); | 365 | board_No(bp), port_No(port)); |
366 | flag = TTY_BREAK; | 366 | flag = TTY_BREAK; |
367 | if (port->flags & ASYNC_SAK) | 367 | if (port->port.flags & ASYNC_SAK) |
368 | do_SAK(tty); | 368 | do_SAK(tty); |
369 | 369 | ||
370 | } else if (status & RCSR_PE) | 370 | } else if (status & RCSR_PE) |
@@ -392,7 +392,7 @@ static void rc_receive(struct riscom_board const *bp) | |||
392 | if (port == NULL) | 392 | if (port == NULL) |
393 | return; | 393 | return; |
394 | 394 | ||
395 | tty = port->tty; | 395 | tty = port->port.tty; |
396 | 396 | ||
397 | count = rc_in(bp, CD180_RDCR); | 397 | count = rc_in(bp, CD180_RDCR); |
398 | 398 | ||
@@ -422,7 +422,7 @@ static void rc_transmit(struct riscom_board const *bp) | |||
422 | if (port == NULL) | 422 | if (port == NULL) |
423 | return; | 423 | return; |
424 | 424 | ||
425 | tty = port->tty; | 425 | tty = port->port.tty; |
426 | 426 | ||
427 | if (port->IER & IER_TXEMPTY) { | 427 | if (port->IER & IER_TXEMPTY) { |
428 | /* FIFO drained */ | 428 | /* FIFO drained */ |
@@ -467,7 +467,7 @@ static void rc_transmit(struct riscom_board const *bp) | |||
467 | 467 | ||
468 | count = CD180_NFIFO; | 468 | count = CD180_NFIFO; |
469 | do { | 469 | do { |
470 | rc_out(bp, CD180_TDR, port->xmit_buf[port->xmit_tail++]); | 470 | rc_out(bp, CD180_TDR, port->port.xmit_buf[port->xmit_tail++]); |
471 | port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE-1); | 471 | port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE-1); |
472 | if (--port->xmit_cnt <= 0) | 472 | if (--port->xmit_cnt <= 0) |
473 | break; | 473 | break; |
@@ -492,12 +492,12 @@ static void rc_check_modem(struct riscom_board const *bp) | |||
492 | if (port == NULL) | 492 | if (port == NULL) |
493 | return; | 493 | return; |
494 | 494 | ||
495 | tty = port->tty; | 495 | tty = port->port.tty; |
496 | 496 | ||
497 | mcr = rc_in(bp, CD180_MCR); | 497 | mcr = rc_in(bp, CD180_MCR); |
498 | if (mcr & MCR_CDCHG) { | 498 | if (mcr & MCR_CDCHG) { |
499 | if (rc_in(bp, CD180_MSVR) & MSVR_CD) | 499 | if (rc_in(bp, CD180_MSVR) & MSVR_CD) |
500 | wake_up_interruptible(&port->open_wait); | 500 | wake_up_interruptible(&port->port.open_wait); |
501 | else | 501 | else |
502 | tty_hangup(tty); | 502 | tty_hangup(tty); |
503 | } | 503 | } |
@@ -632,15 +632,12 @@ static void rc_shutdown_board(struct riscom_board *bp) | |||
632 | */ | 632 | */ |
633 | static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port) | 633 | static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port) |
634 | { | 634 | { |
635 | struct tty_struct *tty = port->tty; | 635 | struct tty_struct *tty = port->port.tty; |
636 | unsigned long baud; | 636 | unsigned long baud; |
637 | long tmp; | 637 | long tmp; |
638 | unsigned char cor1 = 0, cor3 = 0; | 638 | unsigned char cor1 = 0, cor3 = 0; |
639 | unsigned char mcor1 = 0, mcor2 = 0; | 639 | unsigned char mcor1 = 0, mcor2 = 0; |
640 | 640 | ||
641 | if (tty == NULL || tty->termios == NULL) | ||
642 | return; | ||
643 | |||
644 | port->IER = 0; | 641 | port->IER = 0; |
645 | port->COR2 = 0; | 642 | port->COR2 = 0; |
646 | port->MSVR = MSVR_RTS; | 643 | port->MSVR = MSVR_RTS; |
@@ -786,39 +783,30 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port) | |||
786 | { | 783 | { |
787 | unsigned long flags; | 784 | unsigned long flags; |
788 | 785 | ||
789 | if (port->flags & ASYNC_INITIALIZED) | 786 | if (port->port.flags & ASYNC_INITIALIZED) |
790 | return 0; | 787 | return 0; |
791 | 788 | ||
792 | if (!port->xmit_buf) { | 789 | if (tty_port_alloc_xmit_buf(&port->port) < 0) |
793 | /* We may sleep in get_zeroed_page() */ | 790 | return -ENOMEM; |
794 | unsigned long tmp = get_zeroed_page(GFP_KERNEL); | 791 | |
795 | if (tmp == 0) | ||
796 | return -ENOMEM; | ||
797 | if (port->xmit_buf) | ||
798 | free_page(tmp); | ||
799 | else | ||
800 | port->xmit_buf = (unsigned char *) tmp; | ||
801 | } | ||
802 | spin_lock_irqsave(&riscom_lock, flags); | 792 | spin_lock_irqsave(&riscom_lock, flags); |
803 | 793 | ||
804 | if (port->tty) | 794 | clear_bit(TTY_IO_ERROR, &port->port.tty->flags); |
805 | clear_bit(TTY_IO_ERROR, &port->tty->flags); | 795 | if (port->port.count == 1) |
806 | if (port->count == 1) | ||
807 | bp->count++; | 796 | bp->count++; |
808 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; | 797 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; |
809 | rc_change_speed(bp, port); | 798 | rc_change_speed(bp, port); |
810 | port->flags |= ASYNC_INITIALIZED; | 799 | port->port.flags |= ASYNC_INITIALIZED; |
811 | 800 | ||
812 | spin_unlock_irqrestore(&riscom_lock, flags); | 801 | spin_unlock_irqrestore(&riscom_lock, flags); |
813 | return 0; | 802 | return 0; |
814 | } | 803 | } |
815 | 804 | ||
816 | /* Must be called with interrupts disabled */ | 805 | /* Must be called with interrupts disabled */ |
817 | static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port) | 806 | static void rc_shutdown_port(struct tty_struct *tty, |
807 | struct riscom_board *bp, struct riscom_port *port) | ||
818 | { | 808 | { |
819 | struct tty_struct *tty; | 809 | if (!(port->port.flags & ASYNC_INITIALIZED)) |
820 | |||
821 | if (!(port->flags & ASYNC_INITIALIZED)) | ||
822 | return; | 810 | return; |
823 | 811 | ||
824 | #ifdef RC_REPORT_OVERRUN | 812 | #ifdef RC_REPORT_OVERRUN |
@@ -836,14 +824,8 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port) | |||
836 | printk("].\n"); | 824 | printk("].\n"); |
837 | } | 825 | } |
838 | #endif | 826 | #endif |
839 | if (port->xmit_buf) { | 827 | tty_port_free_xmit_buf(&port->port); |
840 | free_page((unsigned long) port->xmit_buf); | 828 | if (C_HUPCL(tty)) { |
841 | port->xmit_buf = NULL; | ||
842 | } | ||
843 | |||
844 | tty = port->tty; | ||
845 | |||
846 | if (tty == NULL || C_HUPCL(tty)) { | ||
847 | /* Drop DTR */ | 829 | /* Drop DTR */ |
848 | bp->DTR |= (1u << port_No(port)); | 830 | bp->DTR |= (1u << port_No(port)); |
849 | rc_out(bp, RC_DTR, bp->DTR); | 831 | rc_out(bp, RC_DTR, bp->DTR); |
@@ -858,9 +840,8 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port) | |||
858 | port->IER = 0; | 840 | port->IER = 0; |
859 | rc_out(bp, CD180_IER, port->IER); | 841 | rc_out(bp, CD180_IER, port->IER); |
860 | 842 | ||
861 | if (tty) | 843 | set_bit(TTY_IO_ERROR, &tty->flags); |
862 | set_bit(TTY_IO_ERROR, &tty->flags); | 844 | port->port.flags &= ~ASYNC_INITIALIZED; |
863 | port->flags &= ~ASYNC_INITIALIZED; | ||
864 | 845 | ||
865 | if (--bp->count < 0) { | 846 | if (--bp->count < 0) { |
866 | printk(KERN_INFO "rc%d: rc_shutdown_port: " | 847 | printk(KERN_INFO "rc%d: rc_shutdown_port: " |
@@ -890,9 +871,9 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
890 | * If the device is in the middle of being closed, then block | 871 | * If the device is in the middle of being closed, then block |
891 | * until it's done, and then try again. | 872 | * until it's done, and then try again. |
892 | */ | 873 | */ |
893 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { | 874 | if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) { |
894 | interruptible_sleep_on(&port->close_wait); | 875 | interruptible_sleep_on(&port->port.close_wait); |
895 | if (port->flags & ASYNC_HUP_NOTIFY) | 876 | if (port->port.flags & ASYNC_HUP_NOTIFY) |
896 | return -EAGAIN; | 877 | return -EAGAIN; |
897 | else | 878 | else |
898 | return -ERESTARTSYS; | 879 | return -ERESTARTSYS; |
@@ -904,7 +885,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
904 | */ | 885 | */ |
905 | if ((filp->f_flags & O_NONBLOCK) || | 886 | if ((filp->f_flags & O_NONBLOCK) || |
906 | (tty->flags & (1 << TTY_IO_ERROR))) { | 887 | (tty->flags & (1 << TTY_IO_ERROR))) { |
907 | port->flags |= ASYNC_NORMAL_ACTIVE; | 888 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
908 | return 0; | 889 | return 0; |
909 | } | 890 | } |
910 | 891 | ||
@@ -919,16 +900,16 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
919 | * exit, either normal or abnormal. | 900 | * exit, either normal or abnormal. |
920 | */ | 901 | */ |
921 | retval = 0; | 902 | retval = 0; |
922 | add_wait_queue(&port->open_wait, &wait); | 903 | add_wait_queue(&port->port.open_wait, &wait); |
923 | 904 | ||
924 | spin_lock_irqsave(&riscom_lock, flags); | 905 | spin_lock_irqsave(&riscom_lock, flags); |
925 | 906 | ||
926 | if (!tty_hung_up_p(filp)) | 907 | if (!tty_hung_up_p(filp)) |
927 | port->count--; | 908 | port->port.count--; |
928 | 909 | ||
929 | spin_unlock_irqrestore(&riscom_lock, flags); | 910 | spin_unlock_irqrestore(&riscom_lock, flags); |
930 | 911 | ||
931 | port->blocked_open++; | 912 | port->port.blocked_open++; |
932 | while (1) { | 913 | while (1) { |
933 | spin_lock_irqsave(&riscom_lock, flags); | 914 | spin_lock_irqsave(&riscom_lock, flags); |
934 | 915 | ||
@@ -942,14 +923,14 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
942 | 923 | ||
943 | set_current_state(TASK_INTERRUPTIBLE); | 924 | set_current_state(TASK_INTERRUPTIBLE); |
944 | if (tty_hung_up_p(filp) || | 925 | if (tty_hung_up_p(filp) || |
945 | !(port->flags & ASYNC_INITIALIZED)) { | 926 | !(port->port.flags & ASYNC_INITIALIZED)) { |
946 | if (port->flags & ASYNC_HUP_NOTIFY) | 927 | if (port->port.flags & ASYNC_HUP_NOTIFY) |
947 | retval = -EAGAIN; | 928 | retval = -EAGAIN; |
948 | else | 929 | else |
949 | retval = -ERESTARTSYS; | 930 | retval = -ERESTARTSYS; |
950 | break; | 931 | break; |
951 | } | 932 | } |
952 | if (!(port->flags & ASYNC_CLOSING) && | 933 | if (!(port->port.flags & ASYNC_CLOSING) && |
953 | (do_clocal || CD)) | 934 | (do_clocal || CD)) |
954 | break; | 935 | break; |
955 | if (signal_pending(current)) { | 936 | if (signal_pending(current)) { |
@@ -959,14 +940,14 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
959 | schedule(); | 940 | schedule(); |
960 | } | 941 | } |
961 | __set_current_state(TASK_RUNNING); | 942 | __set_current_state(TASK_RUNNING); |
962 | remove_wait_queue(&port->open_wait, &wait); | 943 | remove_wait_queue(&port->port.open_wait, &wait); |
963 | if (!tty_hung_up_p(filp)) | 944 | if (!tty_hung_up_p(filp)) |
964 | port->count++; | 945 | port->port.count++; |
965 | port->blocked_open--; | 946 | port->port.blocked_open--; |
966 | if (retval) | 947 | if (retval) |
967 | return retval; | 948 | return retval; |
968 | 949 | ||
969 | port->flags |= ASYNC_NORMAL_ACTIVE; | 950 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
970 | return 0; | 951 | return 0; |
971 | } | 952 | } |
972 | 953 | ||
@@ -990,9 +971,9 @@ static int rc_open(struct tty_struct *tty, struct file *filp) | |||
990 | if (error) | 971 | if (error) |
991 | return error; | 972 | return error; |
992 | 973 | ||
993 | port->count++; | 974 | port->port.count++; |
994 | tty->driver_data = port; | 975 | tty->driver_data = port; |
995 | port->tty = tty; | 976 | port->port.tty = tty; |
996 | 977 | ||
997 | error = rc_setup_port(bp, port); | 978 | error = rc_setup_port(bp, port); |
998 | if (error == 0) | 979 | if (error == 0) |
@@ -1031,28 +1012,28 @@ static void rc_close(struct tty_struct *tty, struct file *filp) | |||
1031 | goto out; | 1012 | goto out; |
1032 | 1013 | ||
1033 | bp = port_Board(port); | 1014 | bp = port_Board(port); |
1034 | if ((tty->count == 1) && (port->count != 1)) { | 1015 | if ((tty->count == 1) && (port->port.count != 1)) { |
1035 | printk(KERN_INFO "rc%d: rc_close: bad port count;" | 1016 | printk(KERN_INFO "rc%d: rc_close: bad port count;" |
1036 | " tty->count is 1, port count is %d\n", | 1017 | " tty->count is 1, port count is %d\n", |
1037 | board_No(bp), port->count); | 1018 | board_No(bp), port->port.count); |
1038 | port->count = 1; | 1019 | port->port.count = 1; |
1039 | } | 1020 | } |
1040 | if (--port->count < 0) { | 1021 | if (--port->port.count < 0) { |
1041 | printk(KERN_INFO "rc%d: rc_close: bad port count " | 1022 | printk(KERN_INFO "rc%d: rc_close: bad port count " |
1042 | "for tty%d: %d\n", | 1023 | "for tty%d: %d\n", |
1043 | board_No(bp), port_No(port), port->count); | 1024 | board_No(bp), port_No(port), port->port.count); |
1044 | port->count = 0; | 1025 | port->port.count = 0; |
1045 | } | 1026 | } |
1046 | if (port->count) | 1027 | if (port->port.count) |
1047 | goto out; | 1028 | goto out; |
1048 | port->flags |= ASYNC_CLOSING; | 1029 | port->port.flags |= ASYNC_CLOSING; |
1049 | /* | 1030 | /* |
1050 | * Now we wait for the transmit buffer to clear; and we notify | 1031 | * Now we wait for the transmit buffer to clear; and we notify |
1051 | * the line discipline to only process XON/XOFF characters. | 1032 | * the line discipline to only process XON/XOFF characters. |
1052 | */ | 1033 | */ |
1053 | tty->closing = 1; | 1034 | tty->closing = 1; |
1054 | if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 1035 | if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) |
1055 | tty_wait_until_sent(tty, port->closing_wait); | 1036 | tty_wait_until_sent(tty, port->port.closing_wait); |
1056 | /* | 1037 | /* |
1057 | * At this point we stop accepting input. To do this, we | 1038 | * At this point we stop accepting input. To do this, we |
1058 | * disable the receive line status interrupts, and tell the | 1039 | * disable the receive line status interrupts, and tell the |
@@ -1060,7 +1041,7 @@ static void rc_close(struct tty_struct *tty, struct file *filp) | |||
1060 | * line status register. | 1041 | * line status register. |
1061 | */ | 1042 | */ |
1062 | port->IER &= ~IER_RXD; | 1043 | port->IER &= ~IER_RXD; |
1063 | if (port->flags & ASYNC_INITIALIZED) { | 1044 | if (port->port.flags & ASYNC_INITIALIZED) { |
1064 | port->IER &= ~IER_TXRDY; | 1045 | port->IER &= ~IER_TXRDY; |
1065 | port->IER |= IER_TXEMPTY; | 1046 | port->IER |= IER_TXEMPTY; |
1066 | rc_out(bp, CD180_CAR, port_No(port)); | 1047 | rc_out(bp, CD180_CAR, port_No(port)); |
@@ -1077,19 +1058,19 @@ static void rc_close(struct tty_struct *tty, struct file *filp) | |||
1077 | break; | 1058 | break; |
1078 | } | 1059 | } |
1079 | } | 1060 | } |
1080 | rc_shutdown_port(bp, port); | 1061 | rc_shutdown_port(tty, bp, port); |
1081 | rc_flush_buffer(tty); | 1062 | rc_flush_buffer(tty); |
1082 | tty_ldisc_flush(tty); | 1063 | tty_ldisc_flush(tty); |
1083 | 1064 | ||
1084 | tty->closing = 0; | 1065 | tty->closing = 0; |
1085 | port->tty = NULL; | 1066 | port->port.tty = NULL; |
1086 | if (port->blocked_open) { | 1067 | if (port->port.blocked_open) { |
1087 | if (port->close_delay) | 1068 | if (port->port.close_delay) |
1088 | msleep_interruptible(jiffies_to_msecs(port->close_delay)); | 1069 | msleep_interruptible(jiffies_to_msecs(port->port.close_delay)); |
1089 | wake_up_interruptible(&port->open_wait); | 1070 | wake_up_interruptible(&port->port.open_wait); |
1090 | } | 1071 | } |
1091 | port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 1072 | port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
1092 | wake_up_interruptible(&port->close_wait); | 1073 | wake_up_interruptible(&port->port.close_wait); |
1093 | 1074 | ||
1094 | out: | 1075 | out: |
1095 | spin_unlock_irqrestore(&riscom_lock, flags); | 1076 | spin_unlock_irqrestore(&riscom_lock, flags); |
@@ -1108,9 +1089,6 @@ static int rc_write(struct tty_struct *tty, | |||
1108 | 1089 | ||
1109 | bp = port_Board(port); | 1090 | bp = port_Board(port); |
1110 | 1091 | ||
1111 | if (!tty || !port->xmit_buf) | ||
1112 | return 0; | ||
1113 | |||
1114 | while (1) { | 1092 | while (1) { |
1115 | spin_lock_irqsave(&riscom_lock, flags); | 1093 | spin_lock_irqsave(&riscom_lock, flags); |
1116 | 1094 | ||
@@ -1119,7 +1097,7 @@ static int rc_write(struct tty_struct *tty, | |||
1119 | if (c <= 0) | 1097 | if (c <= 0) |
1120 | break; /* lock continues to be held */ | 1098 | break; /* lock continues to be held */ |
1121 | 1099 | ||
1122 | memcpy(port->xmit_buf + port->xmit_head, buf, c); | 1100 | memcpy(port->port.xmit_buf + port->xmit_head, buf, c); |
1123 | port->xmit_head = (port->xmit_head + c) & (SERIAL_XMIT_SIZE-1); | 1101 | port->xmit_head = (port->xmit_head + c) & (SERIAL_XMIT_SIZE-1); |
1124 | port->xmit_cnt += c; | 1102 | port->xmit_cnt += c; |
1125 | 1103 | ||
@@ -1151,15 +1129,12 @@ static int rc_put_char(struct tty_struct *tty, unsigned char ch) | |||
1151 | if (rc_paranoia_check(port, tty->name, "rc_put_char")) | 1129 | if (rc_paranoia_check(port, tty->name, "rc_put_char")) |
1152 | return 0; | 1130 | return 0; |
1153 | 1131 | ||
1154 | if (!tty || !port->xmit_buf) | ||
1155 | return 0; | ||
1156 | |||
1157 | spin_lock_irqsave(&riscom_lock, flags); | 1132 | spin_lock_irqsave(&riscom_lock, flags); |
1158 | 1133 | ||
1159 | if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) | 1134 | if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) |
1160 | goto out; | 1135 | goto out; |
1161 | 1136 | ||
1162 | port->xmit_buf[port->xmit_head++] = ch; | 1137 | port->port.xmit_buf[port->xmit_head++] = ch; |
1163 | port->xmit_head &= SERIAL_XMIT_SIZE - 1; | 1138 | port->xmit_head &= SERIAL_XMIT_SIZE - 1; |
1164 | port->xmit_cnt++; | 1139 | port->xmit_cnt++; |
1165 | ret = 1; | 1140 | ret = 1; |
@@ -1177,8 +1152,7 @@ static void rc_flush_chars(struct tty_struct *tty) | |||
1177 | if (rc_paranoia_check(port, tty->name, "rc_flush_chars")) | 1152 | if (rc_paranoia_check(port, tty->name, "rc_flush_chars")) |
1178 | return; | 1153 | return; |
1179 | 1154 | ||
1180 | if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || | 1155 | if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped) |
1181 | !port->xmit_buf) | ||
1182 | return; | 1156 | return; |
1183 | 1157 | ||
1184 | spin_lock_irqsave(&riscom_lock, flags); | 1158 | spin_lock_irqsave(&riscom_lock, flags); |
@@ -1317,22 +1291,22 @@ static int rc_set_serial_info(struct riscom_port *port, | |||
1317 | return -EINVAL; | 1291 | return -EINVAL; |
1318 | #endif | 1292 | #endif |
1319 | 1293 | ||
1320 | change_speed = ((port->flags & ASYNC_SPD_MASK) != | 1294 | change_speed = ((port->port.flags & ASYNC_SPD_MASK) != |
1321 | (tmp.flags & ASYNC_SPD_MASK)); | 1295 | (tmp.flags & ASYNC_SPD_MASK)); |
1322 | 1296 | ||
1323 | if (!capable(CAP_SYS_ADMIN)) { | 1297 | if (!capable(CAP_SYS_ADMIN)) { |
1324 | if ((tmp.close_delay != port->close_delay) || | 1298 | if ((tmp.close_delay != port->port.close_delay) || |
1325 | (tmp.closing_wait != port->closing_wait) || | 1299 | (tmp.closing_wait != port->port.closing_wait) || |
1326 | ((tmp.flags & ~ASYNC_USR_MASK) != | 1300 | ((tmp.flags & ~ASYNC_USR_MASK) != |
1327 | (port->flags & ~ASYNC_USR_MASK))) | 1301 | (port->port.flags & ~ASYNC_USR_MASK))) |
1328 | return -EPERM; | 1302 | return -EPERM; |
1329 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | | 1303 | port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) | |
1330 | (tmp.flags & ASYNC_USR_MASK)); | 1304 | (tmp.flags & ASYNC_USR_MASK)); |
1331 | } else { | 1305 | } else { |
1332 | port->flags = ((port->flags & ~ASYNC_FLAGS) | | 1306 | port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) | |
1333 | (tmp.flags & ASYNC_FLAGS)); | 1307 | (tmp.flags & ASYNC_FLAGS)); |
1334 | port->close_delay = tmp.close_delay; | 1308 | port->port.close_delay = tmp.close_delay; |
1335 | port->closing_wait = tmp.closing_wait; | 1309 | port->port.closing_wait = tmp.closing_wait; |
1336 | } | 1310 | } |
1337 | if (change_speed) { | 1311 | if (change_speed) { |
1338 | unsigned long flags; | 1312 | unsigned long flags; |
@@ -1355,10 +1329,10 @@ static int rc_get_serial_info(struct riscom_port *port, | |||
1355 | tmp.line = port - rc_port; | 1329 | tmp.line = port - rc_port; |
1356 | tmp.port = bp->base; | 1330 | tmp.port = bp->base; |
1357 | tmp.irq = bp->irq; | 1331 | tmp.irq = bp->irq; |
1358 | tmp.flags = port->flags; | 1332 | tmp.flags = port->port.flags; |
1359 | tmp.baud_base = (RC_OSCFREQ + CD180_TPC/2) / CD180_TPC; | 1333 | tmp.baud_base = (RC_OSCFREQ + CD180_TPC/2) / CD180_TPC; |
1360 | tmp.close_delay = port->close_delay * HZ/100; | 1334 | tmp.close_delay = port->port.close_delay * HZ/100; |
1361 | tmp.closing_wait = port->closing_wait * HZ/100; | 1335 | tmp.closing_wait = port->port.closing_wait * HZ/100; |
1362 | tmp.xmit_fifo_size = CD180_NFIFO; | 1336 | tmp.xmit_fifo_size = CD180_NFIFO; |
1363 | return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0; | 1337 | return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0; |
1364 | } | 1338 | } |
@@ -1480,7 +1454,7 @@ static void rc_start(struct tty_struct *tty) | |||
1480 | 1454 | ||
1481 | spin_lock_irqsave(&riscom_lock, flags); | 1455 | spin_lock_irqsave(&riscom_lock, flags); |
1482 | 1456 | ||
1483 | if (port->xmit_cnt && port->xmit_buf && !(port->IER & IER_TXRDY)) { | 1457 | if (port->xmit_cnt && port->port.xmit_buf && !(port->IER & IER_TXRDY)) { |
1484 | port->IER |= IER_TXRDY; | 1458 | port->IER |= IER_TXRDY; |
1485 | rc_out(bp, CD180_CAR, port_No(port)); | 1459 | rc_out(bp, CD180_CAR, port_No(port)); |
1486 | rc_out(bp, CD180_IER, port->IER); | 1460 | rc_out(bp, CD180_IER, port->IER); |
@@ -1498,11 +1472,11 @@ static void rc_hangup(struct tty_struct *tty) | |||
1498 | 1472 | ||
1499 | bp = port_Board(port); | 1473 | bp = port_Board(port); |
1500 | 1474 | ||
1501 | rc_shutdown_port(bp, port); | 1475 | rc_shutdown_port(tty, bp, port); |
1502 | port->count = 0; | 1476 | port->port.count = 0; |
1503 | port->flags &= ~ASYNC_NORMAL_ACTIVE; | 1477 | port->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
1504 | port->tty = NULL; | 1478 | port->port.tty = NULL; |
1505 | wake_up_interruptible(&port->open_wait); | 1479 | wake_up_interruptible(&port->port.open_wait); |
1506 | } | 1480 | } |
1507 | 1481 | ||
1508 | static void rc_set_termios(struct tty_struct *tty, | 1482 | static void rc_set_termios(struct tty_struct *tty, |
@@ -1575,11 +1549,8 @@ static int __init rc_init_drivers(void) | |||
1575 | } | 1549 | } |
1576 | memset(rc_port, 0, sizeof(rc_port)); | 1550 | memset(rc_port, 0, sizeof(rc_port)); |
1577 | for (i = 0; i < RC_NPORT * RC_NBOARD; i++) { | 1551 | for (i = 0; i < RC_NPORT * RC_NBOARD; i++) { |
1552 | tty_port_init(&rc_port[i].port); | ||
1578 | rc_port[i].magic = RISCOM8_MAGIC; | 1553 | rc_port[i].magic = RISCOM8_MAGIC; |
1579 | rc_port[i].close_delay = 50 * HZ / 100; | ||
1580 | rc_port[i].closing_wait = 3000 * HZ / 100; | ||
1581 | init_waitqueue_head(&rc_port[i].open_wait); | ||
1582 | init_waitqueue_head(&rc_port[i].close_wait); | ||
1583 | } | 1554 | } |
1584 | return 0; | 1555 | return 0; |
1585 | } | 1556 | } |
diff --git a/drivers/char/riscom8.h b/drivers/char/riscom8.h index cdfdf4394477..c9876b3f9714 100644 --- a/drivers/char/riscom8.h +++ b/drivers/char/riscom8.h | |||
@@ -66,23 +66,15 @@ struct riscom_board { | |||
66 | 66 | ||
67 | struct riscom_port { | 67 | struct riscom_port { |
68 | int magic; | 68 | int magic; |
69 | struct tty_port port; | ||
69 | int baud_base; | 70 | int baud_base; |
70 | int flags; | ||
71 | struct tty_struct * tty; | ||
72 | int count; | ||
73 | int blocked_open; | ||
74 | int timeout; | 71 | int timeout; |
75 | int close_delay; | ||
76 | unsigned char * xmit_buf; | ||
77 | int custom_divisor; | 72 | int custom_divisor; |
78 | int xmit_head; | 73 | int xmit_head; |
79 | int xmit_tail; | 74 | int xmit_tail; |
80 | int xmit_cnt; | 75 | int xmit_cnt; |
81 | wait_queue_head_t open_wait; | ||
82 | wait_queue_head_t close_wait; | ||
83 | short wakeup_chars; | 76 | short wakeup_chars; |
84 | short break_length; | 77 | short break_length; |
85 | unsigned short closing_wait; | ||
86 | unsigned char mark_mask; | 78 | unsigned char mark_mask; |
87 | unsigned char IER; | 79 | unsigned char IER; |
88 | unsigned char MSVR; | 80 | unsigned char MSVR; |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 743dc80a9325..e670eae2f510 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -72,6 +72,7 @@ | |||
72 | #include <linux/tty.h> | 72 | #include <linux/tty.h> |
73 | #include <linux/tty_driver.h> | 73 | #include <linux/tty_driver.h> |
74 | #include <linux/tty_flip.h> | 74 | #include <linux/tty_flip.h> |
75 | #include <linux/serial.h> | ||
75 | #include <linux/string.h> | 76 | #include <linux/string.h> |
76 | #include <linux/fcntl.h> | 77 | #include <linux/fcntl.h> |
77 | #include <linux/ptrace.h> | 78 | #include <linux/ptrace.h> |
@@ -81,7 +82,7 @@ | |||
81 | #include <linux/completion.h> | 82 | #include <linux/completion.h> |
82 | #include <linux/wait.h> | 83 | #include <linux/wait.h> |
83 | #include <linux/pci.h> | 84 | #include <linux/pci.h> |
84 | #include <asm/uaccess.h> | 85 | #include <linux/uaccess.h> |
85 | #include <asm/atomic.h> | 86 | #include <asm/atomic.h> |
86 | #include <asm/unaligned.h> | 87 | #include <asm/unaligned.h> |
87 | #include <linux/bitops.h> | 88 | #include <linux/bitops.h> |
@@ -434,15 +435,15 @@ static void rp_do_transmit(struct r_port *info) | |||
434 | #endif | 435 | #endif |
435 | if (!info) | 436 | if (!info) |
436 | return; | 437 | return; |
437 | if (!info->tty) { | 438 | if (!info->port.tty) { |
438 | printk(KERN_WARNING "rp: WARNING %s called with " | 439 | printk(KERN_WARNING "rp: WARNING %s called with " |
439 | "info->tty==NULL\n", __func__); | 440 | "info->port.tty==NULL\n", __func__); |
440 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); | 441 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); |
441 | return; | 442 | return; |
442 | } | 443 | } |
443 | 444 | ||
444 | spin_lock_irqsave(&info->slock, flags); | 445 | spin_lock_irqsave(&info->slock, flags); |
445 | tty = info->tty; | 446 | tty = info->port.tty; |
446 | info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp); | 447 | info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp); |
447 | 448 | ||
448 | /* Loop sending data to FIFO until done or FIFO full */ | 449 | /* Loop sending data to FIFO until done or FIFO full */ |
@@ -502,13 +503,13 @@ static void rp_handle_port(struct r_port *info) | |||
502 | "info->flags & NOT_INIT\n"); | 503 | "info->flags & NOT_INIT\n"); |
503 | return; | 504 | return; |
504 | } | 505 | } |
505 | if (!info->tty) { | 506 | if (!info->port.tty) { |
506 | printk(KERN_WARNING "rp: WARNING: rp_handle_port called with " | 507 | printk(KERN_WARNING "rp: WARNING: rp_handle_port called with " |
507 | "info->tty==NULL\n"); | 508 | "info->port.tty==NULL\n"); |
508 | return; | 509 | return; |
509 | } | 510 | } |
510 | cp = &info->channel; | 511 | cp = &info->channel; |
511 | tty = info->tty; | 512 | tty = info->port.tty; |
512 | 513 | ||
513 | IntMask = sGetChanIntID(cp) & info->intmask; | 514 | IntMask = sGetChanIntID(cp) & info->intmask; |
514 | #ifdef ROCKET_DEBUG_INTR | 515 | #ifdef ROCKET_DEBUG_INTR |
@@ -530,7 +531,7 @@ static void rp_handle_port(struct r_port *info) | |||
530 | tty_hangup(tty); | 531 | tty_hangup(tty); |
531 | } | 532 | } |
532 | info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; | 533 | info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; |
533 | wake_up_interruptible(&info->open_wait); | 534 | wake_up_interruptible(&info->port.open_wait); |
534 | } | 535 | } |
535 | #ifdef ROCKET_DEBUG_INTR | 536 | #ifdef ROCKET_DEBUG_INTR |
536 | if (IntMask & DELTA_CTS) { /* CTS change */ | 537 | if (IntMask & DELTA_CTS) { /* CTS change */ |
@@ -648,9 +649,9 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) | |||
648 | info->board = board; | 649 | info->board = board; |
649 | info->aiop = aiop; | 650 | info->aiop = aiop; |
650 | info->chan = chan; | 651 | info->chan = chan; |
651 | info->closing_wait = 3000; | 652 | info->port.closing_wait = 3000; |
652 | info->close_delay = 50; | 653 | info->port.close_delay = 50; |
653 | init_waitqueue_head(&info->open_wait); | 654 | init_waitqueue_head(&info->port.open_wait); |
654 | init_completion(&info->close_wait); | 655 | init_completion(&info->close_wait); |
655 | info->flags &= ~ROCKET_MODE_MASK; | 656 | info->flags &= ~ROCKET_MODE_MASK; |
656 | switch (pc104[board][line]) { | 657 | switch (pc104[board][line]) { |
@@ -717,7 +718,7 @@ static void configure_r_port(struct r_port *info, | |||
717 | unsigned rocketMode; | 718 | unsigned rocketMode; |
718 | int bits, baud, divisor; | 719 | int bits, baud, divisor; |
719 | CHANNEL_t *cp; | 720 | CHANNEL_t *cp; |
720 | struct ktermios *t = info->tty->termios; | 721 | struct ktermios *t = info->port.tty->termios; |
721 | 722 | ||
722 | cp = &info->channel; | 723 | cp = &info->channel; |
723 | cflag = t->c_cflag; | 724 | cflag = t->c_cflag; |
@@ -750,7 +751,7 @@ static void configure_r_port(struct r_port *info, | |||
750 | } | 751 | } |
751 | 752 | ||
752 | /* baud rate */ | 753 | /* baud rate */ |
753 | baud = tty_get_baud_rate(info->tty); | 754 | baud = tty_get_baud_rate(info->port.tty); |
754 | if (!baud) | 755 | if (!baud) |
755 | baud = 9600; | 756 | baud = 9600; |
756 | divisor = ((rp_baud_base[info->board] + (baud >> 1)) / baud) - 1; | 757 | divisor = ((rp_baud_base[info->board] + (baud >> 1)) / baud) - 1; |
@@ -768,7 +769,7 @@ static void configure_r_port(struct r_port *info, | |||
768 | sSetBaud(cp, divisor); | 769 | sSetBaud(cp, divisor); |
769 | 770 | ||
770 | /* FIXME: Should really back compute a baud rate from the divisor */ | 771 | /* FIXME: Should really back compute a baud rate from the divisor */ |
771 | tty_encode_baud_rate(info->tty, baud, baud); | 772 | tty_encode_baud_rate(info->port.tty, baud, baud); |
772 | 773 | ||
773 | if (cflag & CRTSCTS) { | 774 | if (cflag & CRTSCTS) { |
774 | info->intmask |= DELTA_CTS; | 775 | info->intmask |= DELTA_CTS; |
@@ -793,15 +794,15 @@ static void configure_r_port(struct r_port *info, | |||
793 | * Handle software flow control in the board | 794 | * Handle software flow control in the board |
794 | */ | 795 | */ |
795 | #ifdef ROCKET_SOFT_FLOW | 796 | #ifdef ROCKET_SOFT_FLOW |
796 | if (I_IXON(info->tty)) { | 797 | if (I_IXON(info->port.tty)) { |
797 | sEnTxSoftFlowCtl(cp); | 798 | sEnTxSoftFlowCtl(cp); |
798 | if (I_IXANY(info->tty)) { | 799 | if (I_IXANY(info->port.tty)) { |
799 | sEnIXANY(cp); | 800 | sEnIXANY(cp); |
800 | } else { | 801 | } else { |
801 | sDisIXANY(cp); | 802 | sDisIXANY(cp); |
802 | } | 803 | } |
803 | sSetTxXONChar(cp, START_CHAR(info->tty)); | 804 | sSetTxXONChar(cp, START_CHAR(info->port.tty)); |
804 | sSetTxXOFFChar(cp, STOP_CHAR(info->tty)); | 805 | sSetTxXOFFChar(cp, STOP_CHAR(info->port.tty)); |
805 | } else { | 806 | } else { |
806 | sDisTxSoftFlowCtl(cp); | 807 | sDisTxSoftFlowCtl(cp); |
807 | sDisIXANY(cp); | 808 | sDisIXANY(cp); |
@@ -813,24 +814,24 @@ static void configure_r_port(struct r_port *info, | |||
813 | * Set up ignore/read mask words | 814 | * Set up ignore/read mask words |
814 | */ | 815 | */ |
815 | info->read_status_mask = STMRCVROVRH | 0xFF; | 816 | info->read_status_mask = STMRCVROVRH | 0xFF; |
816 | if (I_INPCK(info->tty)) | 817 | if (I_INPCK(info->port.tty)) |
817 | info->read_status_mask |= STMFRAMEH | STMPARITYH; | 818 | info->read_status_mask |= STMFRAMEH | STMPARITYH; |
818 | if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) | 819 | if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) |
819 | info->read_status_mask |= STMBREAKH; | 820 | info->read_status_mask |= STMBREAKH; |
820 | 821 | ||
821 | /* | 822 | /* |
822 | * Characters to ignore | 823 | * Characters to ignore |
823 | */ | 824 | */ |
824 | info->ignore_status_mask = 0; | 825 | info->ignore_status_mask = 0; |
825 | if (I_IGNPAR(info->tty)) | 826 | if (I_IGNPAR(info->port.tty)) |
826 | info->ignore_status_mask |= STMFRAMEH | STMPARITYH; | 827 | info->ignore_status_mask |= STMFRAMEH | STMPARITYH; |
827 | if (I_IGNBRK(info->tty)) { | 828 | if (I_IGNBRK(info->port.tty)) { |
828 | info->ignore_status_mask |= STMBREAKH; | 829 | info->ignore_status_mask |= STMBREAKH; |
829 | /* | 830 | /* |
830 | * If we're ignoring parity and break indicators, | 831 | * If we're ignoring parity and break indicators, |
831 | * ignore overruns too. (For real raw support). | 832 | * ignore overruns too. (For real raw support). |
832 | */ | 833 | */ |
833 | if (I_IGNPAR(info->tty)) | 834 | if (I_IGNPAR(info->port.tty)) |
834 | info->ignore_status_mask |= STMRCVROVRH; | 835 | info->ignore_status_mask |= STMRCVROVRH; |
835 | } | 836 | } |
836 | 837 | ||
@@ -863,7 +864,7 @@ static void configure_r_port(struct r_port *info, | |||
863 | } | 864 | } |
864 | } | 865 | } |
865 | 866 | ||
866 | /* info->count is considered critical, protected by spinlocks. */ | 867 | /* info->port.count is considered critical, protected by spinlocks. */ |
867 | static int block_til_ready(struct tty_struct *tty, struct file *filp, | 868 | static int block_til_ready(struct tty_struct *tty, struct file *filp, |
868 | struct r_port *info) | 869 | struct r_port *info) |
869 | { | 870 | { |
@@ -897,13 +898,13 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
897 | 898 | ||
898 | /* | 899 | /* |
899 | * Block waiting for the carrier detect and the line to become free. While we are in | 900 | * Block waiting for the carrier detect and the line to become free. While we are in |
900 | * this loop, info->count is dropped by one, so that rp_close() knows when to free things. | 901 | * this loop, info->port.count is dropped by one, so that rp_close() knows when to free things. |
901 | * We restore it upon exit, either normal or abnormal. | 902 | * We restore it upon exit, either normal or abnormal. |
902 | */ | 903 | */ |
903 | retval = 0; | 904 | retval = 0; |
904 | add_wait_queue(&info->open_wait, &wait); | 905 | add_wait_queue(&info->port.open_wait, &wait); |
905 | #ifdef ROCKET_DEBUG_OPEN | 906 | #ifdef ROCKET_DEBUG_OPEN |
906 | printk(KERN_INFO "block_til_ready before block: ttyR%d, count = %d\n", info->line, info->count); | 907 | printk(KERN_INFO "block_til_ready before block: ttyR%d, count = %d\n", info->line, info->port.count); |
907 | #endif | 908 | #endif |
908 | spin_lock_irqsave(&info->slock, flags); | 909 | spin_lock_irqsave(&info->slock, flags); |
909 | 910 | ||
@@ -912,10 +913,10 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
912 | #else | 913 | #else |
913 | if (!tty_hung_up_p(filp)) { | 914 | if (!tty_hung_up_p(filp)) { |
914 | extra_count = 1; | 915 | extra_count = 1; |
915 | info->count--; | 916 | info->port.count--; |
916 | } | 917 | } |
917 | #endif | 918 | #endif |
918 | info->blocked_open++; | 919 | info->port.blocked_open++; |
919 | 920 | ||
920 | spin_unlock_irqrestore(&info->slock, flags); | 921 | spin_unlock_irqrestore(&info->slock, flags); |
921 | 922 | ||
@@ -940,24 +941,24 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
940 | } | 941 | } |
941 | #ifdef ROCKET_DEBUG_OPEN | 942 | #ifdef ROCKET_DEBUG_OPEN |
942 | printk(KERN_INFO "block_til_ready blocking: ttyR%d, count = %d, flags=0x%0x\n", | 943 | printk(KERN_INFO "block_til_ready blocking: ttyR%d, count = %d, flags=0x%0x\n", |
943 | info->line, info->count, info->flags); | 944 | info->line, info->port.count, info->flags); |
944 | #endif | 945 | #endif |
945 | schedule(); /* Don't hold spinlock here, will hang PC */ | 946 | schedule(); /* Don't hold spinlock here, will hang PC */ |
946 | } | 947 | } |
947 | __set_current_state(TASK_RUNNING); | 948 | __set_current_state(TASK_RUNNING); |
948 | remove_wait_queue(&info->open_wait, &wait); | 949 | remove_wait_queue(&info->port.open_wait, &wait); |
949 | 950 | ||
950 | spin_lock_irqsave(&info->slock, flags); | 951 | spin_lock_irqsave(&info->slock, flags); |
951 | 952 | ||
952 | if (extra_count) | 953 | if (extra_count) |
953 | info->count++; | 954 | info->port.count++; |
954 | info->blocked_open--; | 955 | info->port.blocked_open--; |
955 | 956 | ||
956 | spin_unlock_irqrestore(&info->slock, flags); | 957 | spin_unlock_irqrestore(&info->slock, flags); |
957 | 958 | ||
958 | #ifdef ROCKET_DEBUG_OPEN | 959 | #ifdef ROCKET_DEBUG_OPEN |
959 | printk(KERN_INFO "block_til_ready after blocking: ttyR%d, count = %d\n", | 960 | printk(KERN_INFO "block_til_ready after blocking: ttyR%d, count = %d\n", |
960 | info->line, info->count); | 961 | info->line, info->port.count); |
961 | #endif | 962 | #endif |
962 | if (retval) | 963 | if (retval) |
963 | return retval; | 964 | return retval; |
@@ -1001,9 +1002,9 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1001 | info->xmit_buf = (unsigned char *) page; | 1002 | info->xmit_buf = (unsigned char *) page; |
1002 | 1003 | ||
1003 | tty->driver_data = info; | 1004 | tty->driver_data = info; |
1004 | info->tty = tty; | 1005 | info->port.tty = tty; |
1005 | 1006 | ||
1006 | if (info->count++ == 0) { | 1007 | if (info->port.count++ == 0) { |
1007 | atomic_inc(&rp_num_ports_open); | 1008 | atomic_inc(&rp_num_ports_open); |
1008 | 1009 | ||
1009 | #ifdef ROCKET_DEBUG_OPEN | 1010 | #ifdef ROCKET_DEBUG_OPEN |
@@ -1012,7 +1013,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1012 | #endif | 1013 | #endif |
1013 | } | 1014 | } |
1014 | #ifdef ROCKET_DEBUG_OPEN | 1015 | #ifdef ROCKET_DEBUG_OPEN |
1015 | printk(KERN_INFO "rp_open ttyR%d, count=%d\n", info->line, info->count); | 1016 | printk(KERN_INFO "rp_open ttyR%d, count=%d\n", info->line, info->port.count); |
1016 | #endif | 1017 | #endif |
1017 | 1018 | ||
1018 | /* | 1019 | /* |
@@ -1048,13 +1049,13 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1048 | * Set up the tty->alt_speed kludge | 1049 | * Set up the tty->alt_speed kludge |
1049 | */ | 1050 | */ |
1050 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) | 1051 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) |
1051 | info->tty->alt_speed = 57600; | 1052 | info->port.tty->alt_speed = 57600; |
1052 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) | 1053 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) |
1053 | info->tty->alt_speed = 115200; | 1054 | info->port.tty->alt_speed = 115200; |
1054 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) | 1055 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) |
1055 | info->tty->alt_speed = 230400; | 1056 | info->port.tty->alt_speed = 230400; |
1056 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) | 1057 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) |
1057 | info->tty->alt_speed = 460800; | 1058 | info->port.tty->alt_speed = 460800; |
1058 | 1059 | ||
1059 | configure_r_port(info, NULL); | 1060 | configure_r_port(info, NULL); |
1060 | if (tty->termios->c_cflag & CBAUD) { | 1061 | if (tty->termios->c_cflag & CBAUD) { |
@@ -1076,7 +1077,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1076 | } | 1077 | } |
1077 | 1078 | ||
1078 | /* | 1079 | /* |
1079 | * Exception handler that closes a serial port. info->count is considered critical. | 1080 | * Exception handler that closes a serial port. info->port.count is considered critical. |
1080 | */ | 1081 | */ |
1081 | static void rp_close(struct tty_struct *tty, struct file *filp) | 1082 | static void rp_close(struct tty_struct *tty, struct file *filp) |
1082 | { | 1083 | { |
@@ -1089,14 +1090,14 @@ static void rp_close(struct tty_struct *tty, struct file *filp) | |||
1089 | return; | 1090 | return; |
1090 | 1091 | ||
1091 | #ifdef ROCKET_DEBUG_OPEN | 1092 | #ifdef ROCKET_DEBUG_OPEN |
1092 | printk(KERN_INFO "rp_close ttyR%d, count = %d\n", info->line, info->count); | 1093 | printk(KERN_INFO "rp_close ttyR%d, count = %d\n", info->line, info->port.count); |
1093 | #endif | 1094 | #endif |
1094 | 1095 | ||
1095 | if (tty_hung_up_p(filp)) | 1096 | if (tty_hung_up_p(filp)) |
1096 | return; | 1097 | return; |
1097 | spin_lock_irqsave(&info->slock, flags); | 1098 | spin_lock_irqsave(&info->slock, flags); |
1098 | 1099 | ||
1099 | if ((tty->count == 1) && (info->count != 1)) { | 1100 | if ((tty->count == 1) && (info->port.count != 1)) { |
1100 | /* | 1101 | /* |
1101 | * Uh, oh. tty->count is 1, which means that the tty | 1102 | * Uh, oh. tty->count is 1, which means that the tty |
1102 | * structure will be freed. Info->count should always | 1103 | * structure will be freed. Info->count should always |
@@ -1105,15 +1106,15 @@ static void rp_close(struct tty_struct *tty, struct file *filp) | |||
1105 | * serial port won't be shutdown. | 1106 | * serial port won't be shutdown. |
1106 | */ | 1107 | */ |
1107 | printk(KERN_WARNING "rp_close: bad serial port count; " | 1108 | printk(KERN_WARNING "rp_close: bad serial port count; " |
1108 | "tty->count is 1, info->count is %d\n", info->count); | 1109 | "tty->count is 1, info->port.count is %d\n", info->port.count); |
1109 | info->count = 1; | 1110 | info->port.count = 1; |
1110 | } | 1111 | } |
1111 | if (--info->count < 0) { | 1112 | if (--info->port.count < 0) { |
1112 | printk(KERN_WARNING "rp_close: bad serial port count for " | 1113 | printk(KERN_WARNING "rp_close: bad serial port count for " |
1113 | "ttyR%d: %d\n", info->line, info->count); | 1114 | "ttyR%d: %d\n", info->line, info->port.count); |
1114 | info->count = 0; | 1115 | info->port.count = 0; |
1115 | } | 1116 | } |
1116 | if (info->count) { | 1117 | if (info->port.count) { |
1117 | spin_unlock_irqrestore(&info->slock, flags); | 1118 | spin_unlock_irqrestore(&info->slock, flags); |
1118 | return; | 1119 | return; |
1119 | } | 1120 | } |
@@ -1137,8 +1138,8 @@ static void rp_close(struct tty_struct *tty, struct file *filp) | |||
1137 | /* | 1138 | /* |
1138 | * Wait for the transmit buffer to clear | 1139 | * Wait for the transmit buffer to clear |
1139 | */ | 1140 | */ |
1140 | if (info->closing_wait != ROCKET_CLOSING_WAIT_NONE) | 1141 | if (info->port.closing_wait != ROCKET_CLOSING_WAIT_NONE) |
1141 | tty_wait_until_sent(tty, info->closing_wait); | 1142 | tty_wait_until_sent(tty, info->port.closing_wait); |
1142 | /* | 1143 | /* |
1143 | * Before we drop DTR, make sure the UART transmitter | 1144 | * Before we drop DTR, make sure the UART transmitter |
1144 | * has completely drained; this is especially | 1145 | * has completely drained; this is especially |
@@ -1167,11 +1168,11 @@ static void rp_close(struct tty_struct *tty, struct file *filp) | |||
1167 | 1168 | ||
1168 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); | 1169 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); |
1169 | 1170 | ||
1170 | if (info->blocked_open) { | 1171 | if (info->port.blocked_open) { |
1171 | if (info->close_delay) { | 1172 | if (info->port.close_delay) { |
1172 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | 1173 | msleep_interruptible(jiffies_to_msecs(info->port.close_delay)); |
1173 | } | 1174 | } |
1174 | wake_up_interruptible(&info->open_wait); | 1175 | wake_up_interruptible(&info->port.open_wait); |
1175 | } else { | 1176 | } else { |
1176 | if (info->xmit_buf) { | 1177 | if (info->xmit_buf) { |
1177 | free_page((unsigned long) info->xmit_buf); | 1178 | free_page((unsigned long) info->xmit_buf); |
@@ -1327,8 +1328,8 @@ static int get_config(struct r_port *info, struct rocket_config __user *retinfo) | |||
1327 | memset(&tmp, 0, sizeof (tmp)); | 1328 | memset(&tmp, 0, sizeof (tmp)); |
1328 | tmp.line = info->line; | 1329 | tmp.line = info->line; |
1329 | tmp.flags = info->flags; | 1330 | tmp.flags = info->flags; |
1330 | tmp.close_delay = info->close_delay; | 1331 | tmp.close_delay = info->port.close_delay; |
1331 | tmp.closing_wait = info->closing_wait; | 1332 | tmp.closing_wait = info->port.closing_wait; |
1332 | tmp.port = rcktpt_io_addr[(info->line >> 5) & 3]; | 1333 | tmp.port = rcktpt_io_addr[(info->line >> 5) & 3]; |
1333 | 1334 | ||
1334 | if (copy_to_user(retinfo, &tmp, sizeof (*retinfo))) | 1335 | if (copy_to_user(retinfo, &tmp, sizeof (*retinfo))) |
@@ -1353,17 +1354,17 @@ static int set_config(struct r_port *info, struct rocket_config __user *new_info | |||
1353 | } | 1354 | } |
1354 | 1355 | ||
1355 | info->flags = ((info->flags & ~ROCKET_FLAGS) | (new_serial.flags & ROCKET_FLAGS)); | 1356 | info->flags = ((info->flags & ~ROCKET_FLAGS) | (new_serial.flags & ROCKET_FLAGS)); |
1356 | info->close_delay = new_serial.close_delay; | 1357 | info->port.close_delay = new_serial.close_delay; |
1357 | info->closing_wait = new_serial.closing_wait; | 1358 | info->port.closing_wait = new_serial.closing_wait; |
1358 | 1359 | ||
1359 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) | 1360 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) |
1360 | info->tty->alt_speed = 57600; | 1361 | info->port.tty->alt_speed = 57600; |
1361 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) | 1362 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) |
1362 | info->tty->alt_speed = 115200; | 1363 | info->port.tty->alt_speed = 115200; |
1363 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) | 1364 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) |
1364 | info->tty->alt_speed = 230400; | 1365 | info->port.tty->alt_speed = 230400; |
1365 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) | 1366 | if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) |
1366 | info->tty->alt_speed = 460800; | 1367 | info->port.tty->alt_speed = 460800; |
1367 | 1368 | ||
1368 | configure_r_port(info, NULL); | 1369 | configure_r_port(info, NULL); |
1369 | return 0; | 1370 | return 0; |
@@ -1636,13 +1637,13 @@ static void rp_hangup(struct tty_struct *tty) | |||
1636 | rp_flush_buffer(tty); | 1637 | rp_flush_buffer(tty); |
1637 | if (info->flags & ROCKET_CLOSING) | 1638 | if (info->flags & ROCKET_CLOSING) |
1638 | return; | 1639 | return; |
1639 | if (info->count) | 1640 | if (info->port.count) |
1640 | atomic_dec(&rp_num_ports_open); | 1641 | atomic_dec(&rp_num_ports_open); |
1641 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); | 1642 | clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); |
1642 | 1643 | ||
1643 | info->count = 0; | 1644 | info->port.count = 0; |
1644 | info->flags &= ~ROCKET_NORMAL_ACTIVE; | 1645 | info->flags &= ~ROCKET_NORMAL_ACTIVE; |
1645 | info->tty = NULL; | 1646 | info->port.tty = NULL; |
1646 | 1647 | ||
1647 | cp = &info->channel; | 1648 | cp = &info->channel; |
1648 | sDisRxFIFO(cp); | 1649 | sDisRxFIFO(cp); |
@@ -1653,7 +1654,7 @@ static void rp_hangup(struct tty_struct *tty) | |||
1653 | sClrTxXOFF(cp); | 1654 | sClrTxXOFF(cp); |
1654 | info->flags &= ~ROCKET_INITIALIZED; | 1655 | info->flags &= ~ROCKET_INITIALIZED; |
1655 | 1656 | ||
1656 | wake_up_interruptible(&info->open_wait); | 1657 | wake_up_interruptible(&info->port.open_wait); |
1657 | } | 1658 | } |
1658 | 1659 | ||
1659 | /* | 1660 | /* |
@@ -1762,7 +1763,7 @@ static int rp_write(struct tty_struct *tty, | |||
1762 | 1763 | ||
1763 | /* Write remaining data into the port's xmit_buf */ | 1764 | /* Write remaining data into the port's xmit_buf */ |
1764 | while (1) { | 1765 | while (1) { |
1765 | if (!info->tty) /* Seemingly obligatory check... */ | 1766 | if (!info->port.tty) /* Seemingly obligatory check... */ |
1766 | goto end; | 1767 | goto end; |
1767 | c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1); | 1768 | c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1); |
1768 | c = min(c, XMIT_BUF_SIZE - info->xmit_head); | 1769 | c = min(c, XMIT_BUF_SIZE - info->xmit_head); |
diff --git a/drivers/char/rocket.h b/drivers/char/rocket.h index ae6b04f90c03..a8b09195ebba 100644 --- a/drivers/char/rocket.h +++ b/drivers/char/rocket.h | |||
@@ -64,8 +64,8 @@ struct rocket_version { | |||
64 | /* | 64 | /* |
65 | * For closing_wait and closing_wait2 | 65 | * For closing_wait and closing_wait2 |
66 | */ | 66 | */ |
67 | #define ROCKET_CLOSING_WAIT_NONE 65535 | 67 | #define ROCKET_CLOSING_WAIT_NONE ASYNC_CLOSING_WAIT_NONE |
68 | #define ROCKET_CLOSING_WAIT_INF 0 | 68 | #define ROCKET_CLOSING_WAIT_INF ASYNC_CLOSING_WAIT_INF |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * Rocketport ioctls -- "RP" | 71 | * Rocketport ioctls -- "RP" |
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h index 143cc432fdb2..21f3ff53ba32 100644 --- a/drivers/char/rocket_int.h +++ b/drivers/char/rocket_int.h | |||
@@ -1125,18 +1125,14 @@ Warnings: This function writes the data byte without checking to see if | |||
1125 | 1125 | ||
1126 | struct r_port { | 1126 | struct r_port { |
1127 | int magic; | 1127 | int magic; |
1128 | struct tty_port port; | ||
1128 | int line; | 1129 | int line; |
1129 | int flags; | 1130 | int flags; /* Don't yet match the ASY_ flags!! */ |
1130 | int count; | ||
1131 | int blocked_open; | ||
1132 | struct tty_struct *tty; | ||
1133 | unsigned int board:3; | 1131 | unsigned int board:3; |
1134 | unsigned int aiop:2; | 1132 | unsigned int aiop:2; |
1135 | unsigned int chan:3; | 1133 | unsigned int chan:3; |
1136 | CONTROLLER_t *ctlp; | 1134 | CONTROLLER_t *ctlp; |
1137 | CHANNEL_t channel; | 1135 | CHANNEL_t channel; |
1138 | int closing_wait; | ||
1139 | int close_delay; | ||
1140 | int intmask; | 1136 | int intmask; |
1141 | int xmit_fifo_room; /* room in xmit fifo */ | 1137 | int xmit_fifo_room; /* room in xmit fifo */ |
1142 | unsigned char *xmit_buf; | 1138 | unsigned char *xmit_buf; |
@@ -1148,8 +1144,7 @@ struct r_port { | |||
1148 | int read_status_mask; | 1144 | int read_status_mask; |
1149 | int cps; | 1145 | int cps; |
1150 | 1146 | ||
1151 | wait_queue_head_t open_wait; | 1147 | struct completion close_wait; /* Not yet matching the core */ |
1152 | struct completion close_wait; | ||
1153 | spinlock_t slock; | 1148 | spinlock_t slock; |
1154 | struct mutex write_mtx; | 1149 | struct mutex write_mtx; |
1155 | }; | 1150 | }; |
diff --git a/drivers/char/selection.c b/drivers/char/selection.c index d63f5ccc29e6..2978a49a172b 100644 --- a/drivers/char/selection.c +++ b/drivers/char/selection.c | |||
@@ -327,7 +327,8 @@ int paste_selection(struct tty_struct *tty) | |||
327 | } | 327 | } |
328 | count = sel_buffer_lth - pasted; | 328 | count = sel_buffer_lth - pasted; |
329 | count = min(count, tty->receive_room); | 329 | count = min(count, tty->receive_room); |
330 | tty->ldisc.receive_buf(tty, sel_buffer + pasted, NULL, count); | 330 | tty->ldisc.ops->receive_buf(tty, sel_buffer + pasted, |
331 | NULL, count); | ||
331 | pasted += count; | 332 | pasted += count; |
332 | } | 333 | } |
333 | remove_wait_queue(&vc->paste_wait, &wait); | 334 | remove_wait_queue(&vc->paste_wait, &wait); |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 2ee4d9893757..037dc47e4cb1 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -608,9 +608,9 @@ static inline struct specialix_port * sx_get_port(struct specialix_board * bp, | |||
608 | dprintk (SX_DEBUG_CHAN, "channel: %d\n", channel); | 608 | dprintk (SX_DEBUG_CHAN, "channel: %d\n", channel); |
609 | if (channel < CD186x_NCH) { | 609 | if (channel < CD186x_NCH) { |
610 | port = &sx_port[board_No(bp) * SX_NPORT + channel]; | 610 | port = &sx_port[board_No(bp) * SX_NPORT + channel]; |
611 | dprintk (SX_DEBUG_CHAN, "port: %d %p flags: 0x%x\n",board_No(bp) * SX_NPORT + channel, port, port->flags & ASYNC_INITIALIZED); | 611 | dprintk (SX_DEBUG_CHAN, "port: %d %p flags: 0x%lx\n",board_No(bp) * SX_NPORT + channel, port, port->port.flags & ASYNC_INITIALIZED); |
612 | 612 | ||
613 | if (port->flags & ASYNC_INITIALIZED) { | 613 | if (port->port.flags & ASYNC_INITIALIZED) { |
614 | dprintk (SX_DEBUG_CHAN, "port: %d %p\n", channel, port); | 614 | dprintk (SX_DEBUG_CHAN, "port: %d %p\n", channel, port); |
615 | func_exit(); | 615 | func_exit(); |
616 | return port; | 616 | return port; |
@@ -637,7 +637,7 @@ static inline void sx_receive_exc(struct specialix_board * bp) | |||
637 | func_exit(); | 637 | func_exit(); |
638 | return; | 638 | return; |
639 | } | 639 | } |
640 | tty = port->tty; | 640 | tty = port->port.tty; |
641 | 641 | ||
642 | status = sx_in(bp, CD186x_RCSR); | 642 | status = sx_in(bp, CD186x_RCSR); |
643 | 643 | ||
@@ -673,7 +673,7 @@ static inline void sx_receive_exc(struct specialix_board * bp) | |||
673 | dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n", | 673 | dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n", |
674 | board_No(bp), port_No(port)); | 674 | board_No(bp), port_No(port)); |
675 | flag = TTY_BREAK; | 675 | flag = TTY_BREAK; |
676 | if (port->flags & ASYNC_SAK) | 676 | if (port->port.flags & ASYNC_SAK) |
677 | do_SAK(tty); | 677 | do_SAK(tty); |
678 | 678 | ||
679 | } else if (status & RCSR_PE) | 679 | } else if (status & RCSR_PE) |
@@ -707,7 +707,7 @@ static inline void sx_receive(struct specialix_board * bp) | |||
707 | func_exit(); | 707 | func_exit(); |
708 | return; | 708 | return; |
709 | } | 709 | } |
710 | tty = port->tty; | 710 | tty = port->port.tty; |
711 | 711 | ||
712 | count = sx_in(bp, CD186x_RDCR); | 712 | count = sx_in(bp, CD186x_RDCR); |
713 | dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count); | 713 | dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count); |
@@ -734,7 +734,7 @@ static inline void sx_transmit(struct specialix_board * bp) | |||
734 | return; | 734 | return; |
735 | } | 735 | } |
736 | dprintk (SX_DEBUG_TX, "port: %p\n", port); | 736 | dprintk (SX_DEBUG_TX, "port: %p\n", port); |
737 | tty = port->tty; | 737 | tty = port->port.tty; |
738 | 738 | ||
739 | if (port->IER & IER_TXEMPTY) { | 739 | if (port->IER & IER_TXEMPTY) { |
740 | /* FIFO drained */ | 740 | /* FIFO drained */ |
@@ -811,7 +811,7 @@ static inline void sx_check_modem(struct specialix_board * bp) | |||
811 | if (!(port = sx_get_port(bp, "Modem"))) | 811 | if (!(port = sx_get_port(bp, "Modem"))) |
812 | return; | 812 | return; |
813 | 813 | ||
814 | tty = port->tty; | 814 | tty = port->port.tty; |
815 | 815 | ||
816 | mcr = sx_in(bp, CD186x_MCR); | 816 | mcr = sx_in(bp, CD186x_MCR); |
817 | printk ("mcr = %02x.\n", mcr); | 817 | printk ("mcr = %02x.\n", mcr); |
@@ -821,7 +821,7 @@ static inline void sx_check_modem(struct specialix_board * bp) | |||
821 | msvr_cd = sx_in(bp, CD186x_MSVR) & MSVR_CD; | 821 | msvr_cd = sx_in(bp, CD186x_MSVR) & MSVR_CD; |
822 | if (msvr_cd) { | 822 | if (msvr_cd) { |
823 | dprintk (SX_DEBUG_SIGNALS, "Waking up guys in open.\n"); | 823 | dprintk (SX_DEBUG_SIGNALS, "Waking up guys in open.\n"); |
824 | wake_up_interruptible(&port->open_wait); | 824 | wake_up_interruptible(&port->port.open_wait); |
825 | } else { | 825 | } else { |
826 | dprintk (SX_DEBUG_SIGNALS, "Sending HUP.\n"); | 826 | dprintk (SX_DEBUG_SIGNALS, "Sending HUP.\n"); |
827 | tty_hangup(tty); | 827 | tty_hangup(tty); |
@@ -1030,7 +1030,7 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1030 | 1030 | ||
1031 | func_enter(); | 1031 | func_enter(); |
1032 | 1032 | ||
1033 | if (!(tty = port->tty) || !tty->termios) { | 1033 | if (!(tty = port->port.tty) || !tty->termios) { |
1034 | func_exit(); | 1034 | func_exit(); |
1035 | return; | 1035 | return; |
1036 | } | 1036 | } |
@@ -1052,9 +1052,9 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1052 | baud = tty_get_baud_rate(tty); | 1052 | baud = tty_get_baud_rate(tty); |
1053 | 1053 | ||
1054 | if (baud == 38400) { | 1054 | if (baud == 38400) { |
1055 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 1055 | if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
1056 | baud = 57600; | 1056 | baud = 57600; |
1057 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 1057 | if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
1058 | baud = 115200; | 1058 | baud = 115200; |
1059 | } | 1059 | } |
1060 | 1060 | ||
@@ -1244,7 +1244,7 @@ static int sx_setup_port(struct specialix_board *bp, struct specialix_port *port | |||
1244 | 1244 | ||
1245 | func_enter(); | 1245 | func_enter(); |
1246 | 1246 | ||
1247 | if (port->flags & ASYNC_INITIALIZED) { | 1247 | if (port->port.flags & ASYNC_INITIALIZED) { |
1248 | func_exit(); | 1248 | func_exit(); |
1249 | return 0; | 1249 | return 0; |
1250 | } | 1250 | } |
@@ -1268,12 +1268,12 @@ static int sx_setup_port(struct specialix_board *bp, struct specialix_port *port | |||
1268 | 1268 | ||
1269 | spin_lock_irqsave(&port->lock, flags); | 1269 | spin_lock_irqsave(&port->lock, flags); |
1270 | 1270 | ||
1271 | if (port->tty) | 1271 | if (port->port.tty) |
1272 | clear_bit(TTY_IO_ERROR, &port->tty->flags); | 1272 | clear_bit(TTY_IO_ERROR, &port->port.tty->flags); |
1273 | 1273 | ||
1274 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; | 1274 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; |
1275 | sx_change_speed(bp, port); | 1275 | sx_change_speed(bp, port); |
1276 | port->flags |= ASYNC_INITIALIZED; | 1276 | port->port.flags |= ASYNC_INITIALIZED; |
1277 | 1277 | ||
1278 | spin_unlock_irqrestore(&port->lock, flags); | 1278 | spin_unlock_irqrestore(&port->lock, flags); |
1279 | 1279 | ||
@@ -1292,7 +1292,7 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port * | |||
1292 | 1292 | ||
1293 | func_enter(); | 1293 | func_enter(); |
1294 | 1294 | ||
1295 | if (!(port->flags & ASYNC_INITIALIZED)) { | 1295 | if (!(port->port.flags & ASYNC_INITIALIZED)) { |
1296 | func_exit(); | 1296 | func_exit(); |
1297 | return; | 1297 | return; |
1298 | } | 1298 | } |
@@ -1315,7 +1315,7 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port * | |||
1315 | spin_lock_irqsave(&bp->lock, flags); | 1315 | spin_lock_irqsave(&bp->lock, flags); |
1316 | sx_out(bp, CD186x_CAR, port_No(port)); | 1316 | sx_out(bp, CD186x_CAR, port_No(port)); |
1317 | 1317 | ||
1318 | if (!(tty = port->tty) || C_HUPCL(tty)) { | 1318 | if (!(tty = port->port.tty) || C_HUPCL(tty)) { |
1319 | /* Drop DTR */ | 1319 | /* Drop DTR */ |
1320 | sx_out(bp, CD186x_MSVDTR, 0); | 1320 | sx_out(bp, CD186x_MSVDTR, 0); |
1321 | } | 1321 | } |
@@ -1330,7 +1330,7 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port * | |||
1330 | spin_unlock_irqrestore(&bp->lock, flags); | 1330 | spin_unlock_irqrestore(&bp->lock, flags); |
1331 | if (tty) | 1331 | if (tty) |
1332 | set_bit(TTY_IO_ERROR, &tty->flags); | 1332 | set_bit(TTY_IO_ERROR, &tty->flags); |
1333 | port->flags &= ~ASYNC_INITIALIZED; | 1333 | port->port.flags &= ~ASYNC_INITIALIZED; |
1334 | 1334 | ||
1335 | if (!bp->count) | 1335 | if (!bp->count) |
1336 | sx_shutdown_board(bp); | 1336 | sx_shutdown_board(bp); |
@@ -1354,9 +1354,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1354 | * If the device is in the middle of being closed, then block | 1354 | * If the device is in the middle of being closed, then block |
1355 | * until it's done, and then try again. | 1355 | * until it's done, and then try again. |
1356 | */ | 1356 | */ |
1357 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { | 1357 | if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) { |
1358 | interruptible_sleep_on(&port->close_wait); | 1358 | interruptible_sleep_on(&port->port.close_wait); |
1359 | if (port->flags & ASYNC_HUP_NOTIFY) { | 1359 | if (port->port.flags & ASYNC_HUP_NOTIFY) { |
1360 | func_exit(); | 1360 | func_exit(); |
1361 | return -EAGAIN; | 1361 | return -EAGAIN; |
1362 | } else { | 1362 | } else { |
@@ -1371,7 +1371,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1371 | */ | 1371 | */ |
1372 | if ((filp->f_flags & O_NONBLOCK) || | 1372 | if ((filp->f_flags & O_NONBLOCK) || |
1373 | (tty->flags & (1 << TTY_IO_ERROR))) { | 1373 | (tty->flags & (1 << TTY_IO_ERROR))) { |
1374 | port->flags |= ASYNC_NORMAL_ACTIVE; | 1374 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
1375 | func_exit(); | 1375 | func_exit(); |
1376 | return 0; | 1376 | return 0; |
1377 | } | 1377 | } |
@@ -1387,13 +1387,13 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1387 | * exit, either normal or abnormal. | 1387 | * exit, either normal or abnormal. |
1388 | */ | 1388 | */ |
1389 | retval = 0; | 1389 | retval = 0; |
1390 | add_wait_queue(&port->open_wait, &wait); | 1390 | add_wait_queue(&port->port.open_wait, &wait); |
1391 | spin_lock_irqsave(&port->lock, flags); | 1391 | spin_lock_irqsave(&port->lock, flags); |
1392 | if (!tty_hung_up_p(filp)) { | 1392 | if (!tty_hung_up_p(filp)) { |
1393 | port->count--; | 1393 | port->port.count--; |
1394 | } | 1394 | } |
1395 | spin_unlock_irqrestore(&port->lock, flags); | 1395 | spin_unlock_irqrestore(&port->lock, flags); |
1396 | port->blocked_open++; | 1396 | port->port.blocked_open++; |
1397 | while (1) { | 1397 | while (1) { |
1398 | spin_lock_irqsave(&bp->lock, flags); | 1398 | spin_lock_irqsave(&bp->lock, flags); |
1399 | sx_out(bp, CD186x_CAR, port_No(port)); | 1399 | sx_out(bp, CD186x_CAR, port_No(port)); |
@@ -1410,14 +1410,14 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1410 | spin_unlock_irqrestore(&bp->lock, flags); | 1410 | spin_unlock_irqrestore(&bp->lock, flags); |
1411 | set_current_state(TASK_INTERRUPTIBLE); | 1411 | set_current_state(TASK_INTERRUPTIBLE); |
1412 | if (tty_hung_up_p(filp) || | 1412 | if (tty_hung_up_p(filp) || |
1413 | !(port->flags & ASYNC_INITIALIZED)) { | 1413 | !(port->port.flags & ASYNC_INITIALIZED)) { |
1414 | if (port->flags & ASYNC_HUP_NOTIFY) | 1414 | if (port->port.flags & ASYNC_HUP_NOTIFY) |
1415 | retval = -EAGAIN; | 1415 | retval = -EAGAIN; |
1416 | else | 1416 | else |
1417 | retval = -ERESTARTSYS; | 1417 | retval = -ERESTARTSYS; |
1418 | break; | 1418 | break; |
1419 | } | 1419 | } |
1420 | if (!(port->flags & ASYNC_CLOSING) && | 1420 | if (!(port->port.flags & ASYNC_CLOSING) && |
1421 | (do_clocal || CD)) | 1421 | (do_clocal || CD)) |
1422 | break; | 1422 | break; |
1423 | if (signal_pending(current)) { | 1423 | if (signal_pending(current)) { |
@@ -1428,19 +1428,19 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1428 | } | 1428 | } |
1429 | 1429 | ||
1430 | set_current_state(TASK_RUNNING); | 1430 | set_current_state(TASK_RUNNING); |
1431 | remove_wait_queue(&port->open_wait, &wait); | 1431 | remove_wait_queue(&port->port.open_wait, &wait); |
1432 | spin_lock_irqsave(&port->lock, flags); | 1432 | spin_lock_irqsave(&port->lock, flags); |
1433 | if (!tty_hung_up_p(filp)) { | 1433 | if (!tty_hung_up_p(filp)) { |
1434 | port->count++; | 1434 | port->port.count++; |
1435 | } | 1435 | } |
1436 | port->blocked_open--; | 1436 | port->port.blocked_open--; |
1437 | spin_unlock_irqrestore(&port->lock, flags); | 1437 | spin_unlock_irqrestore(&port->lock, flags); |
1438 | if (retval) { | 1438 | if (retval) { |
1439 | func_exit(); | 1439 | func_exit(); |
1440 | return retval; | 1440 | return retval; |
1441 | } | 1441 | } |
1442 | 1442 | ||
1443 | port->flags |= ASYNC_NORMAL_ACTIVE; | 1443 | port->port.flags |= ASYNC_NORMAL_ACTIVE; |
1444 | func_exit(); | 1444 | func_exit(); |
1445 | return 0; | 1445 | return 0; |
1446 | } | 1446 | } |
@@ -1484,10 +1484,10 @@ static int sx_open(struct tty_struct * tty, struct file * filp) | |||
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | spin_lock_irqsave(&bp->lock, flags); | 1486 | spin_lock_irqsave(&bp->lock, flags); |
1487 | port->count++; | 1487 | port->port.count++; |
1488 | bp->count++; | 1488 | bp->count++; |
1489 | tty->driver_data = port; | 1489 | tty->driver_data = port; |
1490 | port->tty = tty; | 1490 | port->port.tty = tty; |
1491 | spin_unlock_irqrestore(&bp->lock, flags); | 1491 | spin_unlock_irqrestore(&bp->lock, flags); |
1492 | 1492 | ||
1493 | if ((error = sx_setup_port(bp, port))) { | 1493 | if ((error = sx_setup_port(bp, port))) { |
@@ -1547,15 +1547,15 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1547 | } | 1547 | } |
1548 | 1548 | ||
1549 | bp = port_Board(port); | 1549 | bp = port_Board(port); |
1550 | if ((tty->count == 1) && (port->count != 1)) { | 1550 | if ((tty->count == 1) && (port->port.count != 1)) { |
1551 | printk(KERN_ERR "sx%d: sx_close: bad port count;" | 1551 | printk(KERN_ERR "sx%d: sx_close: bad port count;" |
1552 | " tty->count is 1, port count is %d\n", | 1552 | " tty->count is 1, port count is %d\n", |
1553 | board_No(bp), port->count); | 1553 | board_No(bp), port->port.count); |
1554 | port->count = 1; | 1554 | port->port.count = 1; |
1555 | } | 1555 | } |
1556 | 1556 | ||
1557 | if (port->count > 1) { | 1557 | if (port->port.count > 1) { |
1558 | port->count--; | 1558 | port->port.count--; |
1559 | bp->count--; | 1559 | bp->count--; |
1560 | 1560 | ||
1561 | spin_unlock_irqrestore(&port->lock, flags); | 1561 | spin_unlock_irqrestore(&port->lock, flags); |
@@ -1563,7 +1563,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1563 | func_exit(); | 1563 | func_exit(); |
1564 | return; | 1564 | return; |
1565 | } | 1565 | } |
1566 | port->flags |= ASYNC_CLOSING; | 1566 | port->port.flags |= ASYNC_CLOSING; |
1567 | /* | 1567 | /* |
1568 | * Now we wait for the transmit buffer to clear; and we notify | 1568 | * Now we wait for the transmit buffer to clear; and we notify |
1569 | * the line discipline to only process XON/XOFF characters. | 1569 | * the line discipline to only process XON/XOFF characters. |
@@ -1571,8 +1571,8 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1571 | tty->closing = 1; | 1571 | tty->closing = 1; |
1572 | spin_unlock_irqrestore(&port->lock, flags); | 1572 | spin_unlock_irqrestore(&port->lock, flags); |
1573 | dprintk (SX_DEBUG_OPEN, "Closing\n"); | 1573 | dprintk (SX_DEBUG_OPEN, "Closing\n"); |
1574 | if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) { | 1574 | if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) { |
1575 | tty_wait_until_sent(tty, port->closing_wait); | 1575 | tty_wait_until_sent(tty, port->port.closing_wait); |
1576 | } | 1576 | } |
1577 | /* | 1577 | /* |
1578 | * At this point we stop accepting input. To do this, we | 1578 | * At this point we stop accepting input. To do this, we |
@@ -1582,7 +1582,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1582 | */ | 1582 | */ |
1583 | dprintk (SX_DEBUG_OPEN, "Closed\n"); | 1583 | dprintk (SX_DEBUG_OPEN, "Closed\n"); |
1584 | port->IER &= ~IER_RXD; | 1584 | port->IER &= ~IER_RXD; |
1585 | if (port->flags & ASYNC_INITIALIZED) { | 1585 | if (port->port.flags & ASYNC_INITIALIZED) { |
1586 | port->IER &= ~IER_TXRDY; | 1586 | port->IER &= ~IER_TXRDY; |
1587 | port->IER |= IER_TXEMPTY; | 1587 | port->IER |= IER_TXEMPTY; |
1588 | spin_lock_irqsave(&bp->lock, flags); | 1588 | spin_lock_irqsave(&bp->lock, flags); |
@@ -1611,10 +1611,10 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1611 | board_No(bp), bp->count, tty->index); | 1611 | board_No(bp), bp->count, tty->index); |
1612 | bp->count = 0; | 1612 | bp->count = 0; |
1613 | } | 1613 | } |
1614 | if (--port->count < 0) { | 1614 | if (--port->port.count < 0) { |
1615 | printk(KERN_ERR "sx%d: sx_close: bad port count for tty%d: %d\n", | 1615 | printk(KERN_ERR "sx%d: sx_close: bad port count for tty%d: %d\n", |
1616 | board_No(bp), port_No(port), port->count); | 1616 | board_No(bp), port_No(port), port->port.count); |
1617 | port->count = 0; | 1617 | port->port.count = 0; |
1618 | } | 1618 | } |
1619 | 1619 | ||
1620 | sx_shutdown_port(bp, port); | 1620 | sx_shutdown_port(bp, port); |
@@ -1622,16 +1622,16 @@ static void sx_close(struct tty_struct * tty, struct file * filp) | |||
1622 | tty_ldisc_flush(tty); | 1622 | tty_ldisc_flush(tty); |
1623 | spin_lock_irqsave(&port->lock, flags); | 1623 | spin_lock_irqsave(&port->lock, flags); |
1624 | tty->closing = 0; | 1624 | tty->closing = 0; |
1625 | port->tty = NULL; | 1625 | port->port.tty = NULL; |
1626 | spin_unlock_irqrestore(&port->lock, flags); | 1626 | spin_unlock_irqrestore(&port->lock, flags); |
1627 | if (port->blocked_open) { | 1627 | if (port->port.blocked_open) { |
1628 | if (port->close_delay) { | 1628 | if (port->port.close_delay) { |
1629 | msleep_interruptible(jiffies_to_msecs(port->close_delay)); | 1629 | msleep_interruptible(jiffies_to_msecs(port->port.close_delay)); |
1630 | } | 1630 | } |
1631 | wake_up_interruptible(&port->open_wait); | 1631 | wake_up_interruptible(&port->port.open_wait); |
1632 | } | 1632 | } |
1633 | port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 1633 | port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
1634 | wake_up_interruptible(&port->close_wait); | 1634 | wake_up_interruptible(&port->port.close_wait); |
1635 | 1635 | ||
1636 | func_exit(); | 1636 | func_exit(); |
1637 | } | 1637 | } |
@@ -1815,7 +1815,7 @@ static int sx_tiocmget(struct tty_struct *tty, struct file *file) | |||
1815 | dprintk (SX_DEBUG_INIT, "Got msvr[%d] = %02x, car = %d.\n", | 1815 | dprintk (SX_DEBUG_INIT, "Got msvr[%d] = %02x, car = %d.\n", |
1816 | port_No(port), status, sx_in (bp, CD186x_CAR)); | 1816 | port_No(port), status, sx_in (bp, CD186x_CAR)); |
1817 | dprintk (SX_DEBUG_INIT, "sx_port = %p, port = %p\n", sx_port, port); | 1817 | dprintk (SX_DEBUG_INIT, "sx_port = %p, port = %p\n", sx_port, port); |
1818 | if (SX_CRTSCTS(port->tty)) { | 1818 | if (SX_CRTSCTS(port->port.tty)) { |
1819 | result = /* (status & MSVR_RTS) ? */ TIOCM_DTR /* : 0) */ | 1819 | result = /* (status & MSVR_RTS) ? */ TIOCM_DTR /* : 0) */ |
1820 | | ((status & MSVR_DTR) ? TIOCM_RTS : 0) | 1820 | | ((status & MSVR_DTR) ? TIOCM_RTS : 0) |
1821 | | ((status & MSVR_CD) ? TIOCM_CAR : 0) | 1821 | | ((status & MSVR_CD) ? TIOCM_CAR : 0) |
@@ -1857,7 +1857,7 @@ static int sx_tiocmset(struct tty_struct *tty, struct file *file, | |||
1857 | /* if (set & TIOCM_DTR) | 1857 | /* if (set & TIOCM_DTR) |
1858 | port->MSVR |= MSVR_DTR; */ | 1858 | port->MSVR |= MSVR_DTR; */ |
1859 | 1859 | ||
1860 | if (SX_CRTSCTS(port->tty)) { | 1860 | if (SX_CRTSCTS(port->port.tty)) { |
1861 | if (set & TIOCM_RTS) | 1861 | if (set & TIOCM_RTS) |
1862 | port->MSVR |= MSVR_DTR; | 1862 | port->MSVR |= MSVR_DTR; |
1863 | } else { | 1863 | } else { |
@@ -1869,7 +1869,7 @@ static int sx_tiocmset(struct tty_struct *tty, struct file *file, | |||
1869 | port->MSVR &= ~MSVR_RTS; */ | 1869 | port->MSVR &= ~MSVR_RTS; */ |
1870 | /* if (clear & TIOCM_DTR) | 1870 | /* if (clear & TIOCM_DTR) |
1871 | port->MSVR &= ~MSVR_DTR; */ | 1871 | port->MSVR &= ~MSVR_DTR; */ |
1872 | if (SX_CRTSCTS(port->tty)) { | 1872 | if (SX_CRTSCTS(port->port.tty)) { |
1873 | if (clear & TIOCM_RTS) | 1873 | if (clear & TIOCM_RTS) |
1874 | port->MSVR &= ~MSVR_DTR; | 1874 | port->MSVR &= ~MSVR_DTR; |
1875 | } else { | 1875 | } else { |
@@ -1929,27 +1929,27 @@ static inline int sx_set_serial_info(struct specialix_port * port, | |||
1929 | 1929 | ||
1930 | lock_kernel(); | 1930 | lock_kernel(); |
1931 | 1931 | ||
1932 | change_speed = ((port->flags & ASYNC_SPD_MASK) != | 1932 | change_speed = ((port->port.flags & ASYNC_SPD_MASK) != |
1933 | (tmp.flags & ASYNC_SPD_MASK)); | 1933 | (tmp.flags & ASYNC_SPD_MASK)); |
1934 | change_speed |= (tmp.custom_divisor != port->custom_divisor); | 1934 | change_speed |= (tmp.custom_divisor != port->custom_divisor); |
1935 | 1935 | ||
1936 | if (!capable(CAP_SYS_ADMIN)) { | 1936 | if (!capable(CAP_SYS_ADMIN)) { |
1937 | if ((tmp.close_delay != port->close_delay) || | 1937 | if ((tmp.close_delay != port->port.close_delay) || |
1938 | (tmp.closing_wait != port->closing_wait) || | 1938 | (tmp.closing_wait != port->port.closing_wait) || |
1939 | ((tmp.flags & ~ASYNC_USR_MASK) != | 1939 | ((tmp.flags & ~ASYNC_USR_MASK) != |
1940 | (port->flags & ~ASYNC_USR_MASK))) { | 1940 | (port->port.flags & ~ASYNC_USR_MASK))) { |
1941 | func_exit(); | 1941 | func_exit(); |
1942 | unlock_kernel(); | 1942 | unlock_kernel(); |
1943 | return -EPERM; | 1943 | return -EPERM; |
1944 | } | 1944 | } |
1945 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | | 1945 | port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) | |
1946 | (tmp.flags & ASYNC_USR_MASK)); | 1946 | (tmp.flags & ASYNC_USR_MASK)); |
1947 | port->custom_divisor = tmp.custom_divisor; | 1947 | port->custom_divisor = tmp.custom_divisor; |
1948 | } else { | 1948 | } else { |
1949 | port->flags = ((port->flags & ~ASYNC_FLAGS) | | 1949 | port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) | |
1950 | (tmp.flags & ASYNC_FLAGS)); | 1950 | (tmp.flags & ASYNC_FLAGS)); |
1951 | port->close_delay = tmp.close_delay; | 1951 | port->port.close_delay = tmp.close_delay; |
1952 | port->closing_wait = tmp.closing_wait; | 1952 | port->port.closing_wait = tmp.closing_wait; |
1953 | port->custom_divisor = tmp.custom_divisor; | 1953 | port->custom_divisor = tmp.custom_divisor; |
1954 | } | 1954 | } |
1955 | if (change_speed) { | 1955 | if (change_speed) { |
@@ -1975,10 +1975,10 @@ static inline int sx_get_serial_info(struct specialix_port * port, | |||
1975 | tmp.line = port - sx_port; | 1975 | tmp.line = port - sx_port; |
1976 | tmp.port = bp->base; | 1976 | tmp.port = bp->base; |
1977 | tmp.irq = bp->irq; | 1977 | tmp.irq = bp->irq; |
1978 | tmp.flags = port->flags; | 1978 | tmp.flags = port->port.flags; |
1979 | tmp.baud_base = (SX_OSCFREQ + CD186x_TPC/2) / CD186x_TPC; | 1979 | tmp.baud_base = (SX_OSCFREQ + CD186x_TPC/2) / CD186x_TPC; |
1980 | tmp.close_delay = port->close_delay * HZ/100; | 1980 | tmp.close_delay = port->port.close_delay * HZ/100; |
1981 | tmp.closing_wait = port->closing_wait * HZ/100; | 1981 | tmp.closing_wait = port->port.closing_wait * HZ/100; |
1982 | tmp.custom_divisor = port->custom_divisor; | 1982 | tmp.custom_divisor = port->custom_divisor; |
1983 | tmp.xmit_fifo_size = CD186x_NFIFO; | 1983 | tmp.xmit_fifo_size = CD186x_NFIFO; |
1984 | unlock_kernel(); | 1984 | unlock_kernel(); |
@@ -2199,17 +2199,17 @@ static void sx_hangup(struct tty_struct * tty) | |||
2199 | 2199 | ||
2200 | sx_shutdown_port(bp, port); | 2200 | sx_shutdown_port(bp, port); |
2201 | spin_lock_irqsave(&port->lock, flags); | 2201 | spin_lock_irqsave(&port->lock, flags); |
2202 | bp->count -= port->count; | 2202 | bp->count -= port->port.count; |
2203 | if (bp->count < 0) { | 2203 | if (bp->count < 0) { |
2204 | printk(KERN_ERR "sx%d: sx_hangup: bad board count: %d port: %d\n", | 2204 | printk(KERN_ERR "sx%d: sx_hangup: bad board count: %d port: %d\n", |
2205 | board_No(bp), bp->count, tty->index); | 2205 | board_No(bp), bp->count, tty->index); |
2206 | bp->count = 0; | 2206 | bp->count = 0; |
2207 | } | 2207 | } |
2208 | port->count = 0; | 2208 | port->port.count = 0; |
2209 | port->flags &= ~ASYNC_NORMAL_ACTIVE; | 2209 | port->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
2210 | port->tty = NULL; | 2210 | port->port.tty = NULL; |
2211 | spin_unlock_irqrestore(&port->lock, flags); | 2211 | spin_unlock_irqrestore(&port->lock, flags); |
2212 | wake_up_interruptible(&port->open_wait); | 2212 | wake_up_interruptible(&port->port.open_wait); |
2213 | 2213 | ||
2214 | func_exit(); | 2214 | func_exit(); |
2215 | } | 2215 | } |
@@ -2224,10 +2224,6 @@ static void sx_set_termios(struct tty_struct * tty, struct ktermios * old_termio | |||
2224 | if (sx_paranoia_check(port, tty->name, "sx_set_termios")) | 2224 | if (sx_paranoia_check(port, tty->name, "sx_set_termios")) |
2225 | return; | 2225 | return; |
2226 | 2226 | ||
2227 | if (tty->termios->c_cflag == old_termios->c_cflag && | ||
2228 | tty->termios->c_iflag == old_termios->c_iflag) | ||
2229 | return; | ||
2230 | |||
2231 | bp = port_Board(port); | 2227 | bp = port_Board(port); |
2232 | spin_lock_irqsave(&port->lock, flags); | 2228 | spin_lock_irqsave(&port->lock, flags); |
2233 | sx_change_speed(port_Board(port), port); | 2229 | sx_change_speed(port_Board(port), port); |
@@ -2297,10 +2293,7 @@ static int sx_init_drivers(void) | |||
2297 | memset(sx_port, 0, sizeof(sx_port)); | 2293 | memset(sx_port, 0, sizeof(sx_port)); |
2298 | for (i = 0; i < SX_NPORT * SX_NBOARD; i++) { | 2294 | for (i = 0; i < SX_NPORT * SX_NBOARD; i++) { |
2299 | sx_port[i].magic = SPECIALIX_MAGIC; | 2295 | sx_port[i].magic = SPECIALIX_MAGIC; |
2300 | sx_port[i].close_delay = 50 * HZ/100; | 2296 | tty_port_init(&sx_port[i].port); |
2301 | sx_port[i].closing_wait = 3000 * HZ/100; | ||
2302 | init_waitqueue_head(&sx_port[i].open_wait); | ||
2303 | init_waitqueue_head(&sx_port[i].close_wait); | ||
2304 | spin_lock_init(&sx_port[i].lock); | 2297 | spin_lock_init(&sx_port[i].lock); |
2305 | } | 2298 | } |
2306 | 2299 | ||
diff --git a/drivers/char/specialix_io8.h b/drivers/char/specialix_io8.h index 3f2f85bdf516..c63005274d9b 100644 --- a/drivers/char/specialix_io8.h +++ b/drivers/char/specialix_io8.h | |||
@@ -107,23 +107,17 @@ struct specialix_board { | |||
107 | 107 | ||
108 | struct specialix_port { | 108 | struct specialix_port { |
109 | int magic; | 109 | int magic; |
110 | struct tty_port port; | ||
110 | int baud_base; | 111 | int baud_base; |
111 | int flags; | 112 | int flags; |
112 | struct tty_struct * tty; | ||
113 | int count; | ||
114 | int blocked_open; | ||
115 | int timeout; | 113 | int timeout; |
116 | int close_delay; | ||
117 | unsigned char * xmit_buf; | 114 | unsigned char * xmit_buf; |
118 | int custom_divisor; | 115 | int custom_divisor; |
119 | int xmit_head; | 116 | int xmit_head; |
120 | int xmit_tail; | 117 | int xmit_tail; |
121 | int xmit_cnt; | 118 | int xmit_cnt; |
122 | wait_queue_head_t open_wait; | ||
123 | wait_queue_head_t close_wait; | ||
124 | short wakeup_chars; | 119 | short wakeup_chars; |
125 | short break_length; | 120 | short break_length; |
126 | unsigned short closing_wait; | ||
127 | unsigned char mark_mask; | 121 | unsigned char mark_mask; |
128 | unsigned char IER; | 122 | unsigned char IER; |
129 | unsigned char MSVR; | 123 | unsigned char MSVR; |
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index d17be10c5d21..0243efb0be95 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -613,17 +613,17 @@ static void stl_cd_change(struct stlport *portp) | |||
613 | { | 613 | { |
614 | unsigned int oldsigs = portp->sigs; | 614 | unsigned int oldsigs = portp->sigs; |
615 | 615 | ||
616 | if (!portp->tty) | 616 | if (!portp->port.tty) |
617 | return; | 617 | return; |
618 | 618 | ||
619 | portp->sigs = stl_getsignals(portp); | 619 | portp->sigs = stl_getsignals(portp); |
620 | 620 | ||
621 | if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0)) | 621 | if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0)) |
622 | wake_up_interruptible(&portp->open_wait); | 622 | wake_up_interruptible(&portp->port.open_wait); |
623 | 623 | ||
624 | if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0)) | 624 | if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0)) |
625 | if (portp->flags & ASYNC_CHECK_CD) | 625 | if (portp->port.flags & ASYNC_CHECK_CD) |
626 | tty_hangup(portp->tty); | 626 | tty_hangup(portp->port.tty); |
627 | } | 627 | } |
628 | 628 | ||
629 | /* | 629 | /* |
@@ -734,11 +734,11 @@ static int stl_open(struct tty_struct *tty, struct file *filp) | |||
734 | * On the first open of the device setup the port hardware, and | 734 | * On the first open of the device setup the port hardware, and |
735 | * initialize the per port data structure. | 735 | * initialize the per port data structure. |
736 | */ | 736 | */ |
737 | portp->tty = tty; | 737 | portp->port.tty = tty; |
738 | tty->driver_data = portp; | 738 | tty->driver_data = portp; |
739 | portp->refcount++; | 739 | portp->port.count++; |
740 | 740 | ||
741 | if ((portp->flags & ASYNC_INITIALIZED) == 0) { | 741 | if ((portp->port.flags & ASYNC_INITIALIZED) == 0) { |
742 | if (!portp->tx.buf) { | 742 | if (!portp->tx.buf) { |
743 | portp->tx.buf = kmalloc(STL_TXBUFSIZE, GFP_KERNEL); | 743 | portp->tx.buf = kmalloc(STL_TXBUFSIZE, GFP_KERNEL); |
744 | if (!portp->tx.buf) | 744 | if (!portp->tx.buf) |
@@ -752,7 +752,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp) | |||
752 | stl_enablerxtx(portp, 1, 1); | 752 | stl_enablerxtx(portp, 1, 1); |
753 | stl_startrxtx(portp, 1, 0); | 753 | stl_startrxtx(portp, 1, 0); |
754 | clear_bit(TTY_IO_ERROR, &tty->flags); | 754 | clear_bit(TTY_IO_ERROR, &tty->flags); |
755 | portp->flags |= ASYNC_INITIALIZED; | 755 | portp->port.flags |= ASYNC_INITIALIZED; |
756 | } | 756 | } |
757 | 757 | ||
758 | /* | 758 | /* |
@@ -761,9 +761,9 @@ static int stl_open(struct tty_struct *tty, struct file *filp) | |||
761 | * The sleep here does not need interrupt protection since the wakeup | 761 | * The sleep here does not need interrupt protection since the wakeup |
762 | * for it is done with the same context. | 762 | * for it is done with the same context. |
763 | */ | 763 | */ |
764 | if (portp->flags & ASYNC_CLOSING) { | 764 | if (portp->port.flags & ASYNC_CLOSING) { |
765 | interruptible_sleep_on(&portp->close_wait); | 765 | interruptible_sleep_on(&portp->port.close_wait); |
766 | if (portp->flags & ASYNC_HUP_NOTIFY) | 766 | if (portp->port.flags & ASYNC_HUP_NOTIFY) |
767 | return -EAGAIN; | 767 | return -EAGAIN; |
768 | return -ERESTARTSYS; | 768 | return -ERESTARTSYS; |
769 | } | 769 | } |
@@ -777,7 +777,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp) | |||
777 | if ((rc = stl_waitcarrier(portp, filp)) != 0) | 777 | if ((rc = stl_waitcarrier(portp, filp)) != 0) |
778 | return rc; | 778 | return rc; |
779 | 779 | ||
780 | portp->flags |= ASYNC_NORMAL_ACTIVE; | 780 | portp->port.flags |= ASYNC_NORMAL_ACTIVE; |
781 | 781 | ||
782 | return 0; | 782 | return 0; |
783 | } | 783 | } |
@@ -801,25 +801,25 @@ static int stl_waitcarrier(struct stlport *portp, struct file *filp) | |||
801 | 801 | ||
802 | spin_lock_irqsave(&stallion_lock, flags); | 802 | spin_lock_irqsave(&stallion_lock, flags); |
803 | 803 | ||
804 | if (portp->tty->termios->c_cflag & CLOCAL) | 804 | if (portp->port.tty->termios->c_cflag & CLOCAL) |
805 | doclocal++; | 805 | doclocal++; |
806 | 806 | ||
807 | portp->openwaitcnt++; | 807 | portp->openwaitcnt++; |
808 | if (! tty_hung_up_p(filp)) | 808 | if (! tty_hung_up_p(filp)) |
809 | portp->refcount--; | 809 | portp->port.count--; |
810 | 810 | ||
811 | for (;;) { | 811 | for (;;) { |
812 | /* Takes brd_lock internally */ | 812 | /* Takes brd_lock internally */ |
813 | stl_setsignals(portp, 1, 1); | 813 | stl_setsignals(portp, 1, 1); |
814 | if (tty_hung_up_p(filp) || | 814 | if (tty_hung_up_p(filp) || |
815 | ((portp->flags & ASYNC_INITIALIZED) == 0)) { | 815 | ((portp->port.flags & ASYNC_INITIALIZED) == 0)) { |
816 | if (portp->flags & ASYNC_HUP_NOTIFY) | 816 | if (portp->port.flags & ASYNC_HUP_NOTIFY) |
817 | rc = -EBUSY; | 817 | rc = -EBUSY; |
818 | else | 818 | else |
819 | rc = -ERESTARTSYS; | 819 | rc = -ERESTARTSYS; |
820 | break; | 820 | break; |
821 | } | 821 | } |
822 | if (((portp->flags & ASYNC_CLOSING) == 0) && | 822 | if (((portp->port.flags & ASYNC_CLOSING) == 0) && |
823 | (doclocal || (portp->sigs & TIOCM_CD))) | 823 | (doclocal || (portp->sigs & TIOCM_CD))) |
824 | break; | 824 | break; |
825 | if (signal_pending(current)) { | 825 | if (signal_pending(current)) { |
@@ -827,11 +827,11 @@ static int stl_waitcarrier(struct stlport *portp, struct file *filp) | |||
827 | break; | 827 | break; |
828 | } | 828 | } |
829 | /* FIXME */ | 829 | /* FIXME */ |
830 | interruptible_sleep_on(&portp->open_wait); | 830 | interruptible_sleep_on(&portp->port.open_wait); |
831 | } | 831 | } |
832 | 832 | ||
833 | if (! tty_hung_up_p(filp)) | 833 | if (! tty_hung_up_p(filp)) |
834 | portp->refcount++; | 834 | portp->port.count++; |
835 | portp->openwaitcnt--; | 835 | portp->openwaitcnt--; |
836 | spin_unlock_irqrestore(&stallion_lock, flags); | 836 | spin_unlock_irqrestore(&stallion_lock, flags); |
837 | 837 | ||
@@ -904,15 +904,15 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
904 | spin_unlock_irqrestore(&stallion_lock, flags); | 904 | spin_unlock_irqrestore(&stallion_lock, flags); |
905 | return; | 905 | return; |
906 | } | 906 | } |
907 | if ((tty->count == 1) && (portp->refcount != 1)) | 907 | if ((tty->count == 1) && (portp->port.count != 1)) |
908 | portp->refcount = 1; | 908 | portp->port.count = 1; |
909 | if (portp->refcount-- > 1) { | 909 | if (portp->port.count-- > 1) { |
910 | spin_unlock_irqrestore(&stallion_lock, flags); | 910 | spin_unlock_irqrestore(&stallion_lock, flags); |
911 | return; | 911 | return; |
912 | } | 912 | } |
913 | 913 | ||
914 | portp->refcount = 0; | 914 | portp->port.count = 0; |
915 | portp->flags |= ASYNC_CLOSING; | 915 | portp->port.flags |= ASYNC_CLOSING; |
916 | 916 | ||
917 | /* | 917 | /* |
918 | * May want to wait for any data to drain before closing. The BUSY | 918 | * May want to wait for any data to drain before closing. The BUSY |
@@ -930,7 +930,7 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
930 | 930 | ||
931 | 931 | ||
932 | spin_lock_irqsave(&stallion_lock, flags); | 932 | spin_lock_irqsave(&stallion_lock, flags); |
933 | portp->flags &= ~ASYNC_INITIALIZED; | 933 | portp->port.flags &= ~ASYNC_INITIALIZED; |
934 | spin_unlock_irqrestore(&stallion_lock, flags); | 934 | spin_unlock_irqrestore(&stallion_lock, flags); |
935 | 935 | ||
936 | stl_disableintrs(portp); | 936 | stl_disableintrs(portp); |
@@ -949,16 +949,16 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
949 | tty_ldisc_flush(tty); | 949 | tty_ldisc_flush(tty); |
950 | 950 | ||
951 | tty->closing = 0; | 951 | tty->closing = 0; |
952 | portp->tty = NULL; | 952 | portp->port.tty = NULL; |
953 | 953 | ||
954 | if (portp->openwaitcnt) { | 954 | if (portp->openwaitcnt) { |
955 | if (portp->close_delay) | 955 | if (portp->close_delay) |
956 | msleep_interruptible(jiffies_to_msecs(portp->close_delay)); | 956 | msleep_interruptible(jiffies_to_msecs(portp->close_delay)); |
957 | wake_up_interruptible(&portp->open_wait); | 957 | wake_up_interruptible(&portp->port.open_wait); |
958 | } | 958 | } |
959 | 959 | ||
960 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 960 | portp->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
961 | wake_up_interruptible(&portp->close_wait); | 961 | wake_up_interruptible(&portp->port.close_wait); |
962 | } | 962 | } |
963 | 963 | ||
964 | /*****************************************************************************/ | 964 | /*****************************************************************************/ |
@@ -1153,7 +1153,7 @@ static int stl_getserial(struct stlport *portp, struct serial_struct __user *sp) | |||
1153 | memset(&sio, 0, sizeof(struct serial_struct)); | 1153 | memset(&sio, 0, sizeof(struct serial_struct)); |
1154 | sio.line = portp->portnr; | 1154 | sio.line = portp->portnr; |
1155 | sio.port = portp->ioaddr; | 1155 | sio.port = portp->ioaddr; |
1156 | sio.flags = portp->flags; | 1156 | sio.flags = portp->port.flags; |
1157 | sio.baud_base = portp->baud_base; | 1157 | sio.baud_base = portp->baud_base; |
1158 | sio.close_delay = portp->close_delay; | 1158 | sio.close_delay = portp->close_delay; |
1159 | sio.closing_wait = portp->closing_wait; | 1159 | sio.closing_wait = portp->closing_wait; |
@@ -1194,17 +1194,17 @@ static int stl_setserial(struct stlport *portp, struct serial_struct __user *sp) | |||
1194 | if ((sio.baud_base != portp->baud_base) || | 1194 | if ((sio.baud_base != portp->baud_base) || |
1195 | (sio.close_delay != portp->close_delay) || | 1195 | (sio.close_delay != portp->close_delay) || |
1196 | ((sio.flags & ~ASYNC_USR_MASK) != | 1196 | ((sio.flags & ~ASYNC_USR_MASK) != |
1197 | (portp->flags & ~ASYNC_USR_MASK))) | 1197 | (portp->port.flags & ~ASYNC_USR_MASK))) |
1198 | return -EPERM; | 1198 | return -EPERM; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | portp->flags = (portp->flags & ~ASYNC_USR_MASK) | | 1201 | portp->port.flags = (portp->port.flags & ~ASYNC_USR_MASK) | |
1202 | (sio.flags & ASYNC_USR_MASK); | 1202 | (sio.flags & ASYNC_USR_MASK); |
1203 | portp->baud_base = sio.baud_base; | 1203 | portp->baud_base = sio.baud_base; |
1204 | portp->close_delay = sio.close_delay; | 1204 | portp->close_delay = sio.close_delay; |
1205 | portp->closing_wait = sio.closing_wait; | 1205 | portp->closing_wait = sio.closing_wait; |
1206 | portp->custom_divisor = sio.custom_divisor; | 1206 | portp->custom_divisor = sio.custom_divisor; |
1207 | stl_setport(portp, portp->tty->termios); | 1207 | stl_setport(portp, portp->port.tty->termios); |
1208 | return 0; | 1208 | return 0; |
1209 | } | 1209 | } |
1210 | 1210 | ||
@@ -1353,7 +1353,7 @@ static void stl_settermios(struct tty_struct *tty, struct ktermios *old) | |||
1353 | stl_start(tty); | 1353 | stl_start(tty); |
1354 | } | 1354 | } |
1355 | if (((old->c_cflag & CLOCAL) == 0) && (tiosp->c_cflag & CLOCAL)) | 1355 | if (((old->c_cflag & CLOCAL) == 0) && (tiosp->c_cflag & CLOCAL)) |
1356 | wake_up_interruptible(&portp->open_wait); | 1356 | wake_up_interruptible(&portp->port.open_wait); |
1357 | } | 1357 | } |
1358 | 1358 | ||
1359 | /*****************************************************************************/ | 1359 | /*****************************************************************************/ |
@@ -1438,7 +1438,7 @@ static void stl_hangup(struct tty_struct *tty) | |||
1438 | if (portp == NULL) | 1438 | if (portp == NULL) |
1439 | return; | 1439 | return; |
1440 | 1440 | ||
1441 | portp->flags &= ~ASYNC_INITIALIZED; | 1441 | portp->port.flags &= ~ASYNC_INITIALIZED; |
1442 | stl_disableintrs(portp); | 1442 | stl_disableintrs(portp); |
1443 | if (tty->termios->c_cflag & HUPCL) | 1443 | if (tty->termios->c_cflag & HUPCL) |
1444 | stl_setsignals(portp, 0, 0); | 1444 | stl_setsignals(portp, 0, 0); |
@@ -1452,10 +1452,10 @@ static void stl_hangup(struct tty_struct *tty) | |||
1452 | portp->tx.head = NULL; | 1452 | portp->tx.head = NULL; |
1453 | portp->tx.tail = NULL; | 1453 | portp->tx.tail = NULL; |
1454 | } | 1454 | } |
1455 | portp->tty = NULL; | 1455 | portp->port.tty = NULL; |
1456 | portp->flags &= ~ASYNC_NORMAL_ACTIVE; | 1456 | portp->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
1457 | portp->refcount = 0; | 1457 | portp->port.count = 0; |
1458 | wake_up_interruptible(&portp->open_wait); | 1458 | wake_up_interruptible(&portp->port.open_wait); |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | /*****************************************************************************/ | 1461 | /*****************************************************************************/ |
@@ -1814,8 +1814,8 @@ static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp) | |||
1814 | portp->baud_base = STL_BAUDBASE; | 1814 | portp->baud_base = STL_BAUDBASE; |
1815 | portp->close_delay = STL_CLOSEDELAY; | 1815 | portp->close_delay = STL_CLOSEDELAY; |
1816 | portp->closing_wait = 30 * HZ; | 1816 | portp->closing_wait = 30 * HZ; |
1817 | init_waitqueue_head(&portp->open_wait); | 1817 | init_waitqueue_head(&portp->port.open_wait); |
1818 | init_waitqueue_head(&portp->close_wait); | 1818 | init_waitqueue_head(&portp->port.close_wait); |
1819 | portp->stats.brd = portp->brdnr; | 1819 | portp->stats.brd = portp->brdnr; |
1820 | portp->stats.panel = portp->panelnr; | 1820 | portp->stats.panel = portp->panelnr; |
1821 | portp->stats.port = portp->portnr; | 1821 | portp->stats.port = portp->portnr; |
@@ -1840,8 +1840,8 @@ static void stl_cleanup_panels(struct stlbrd *brdp) | |||
1840 | portp = panelp->ports[k]; | 1840 | portp = panelp->ports[k]; |
1841 | if (portp == NULL) | 1841 | if (portp == NULL) |
1842 | continue; | 1842 | continue; |
1843 | if (portp->tty != NULL) | 1843 | if (portp->port.tty != NULL) |
1844 | stl_hangup(portp->tty); | 1844 | stl_hangup(portp->port.tty); |
1845 | kfree(portp->tx.buf); | 1845 | kfree(portp->tx.buf); |
1846 | kfree(portp); | 1846 | kfree(portp); |
1847 | } | 1847 | } |
@@ -2513,7 +2513,7 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) | |||
2513 | } | 2513 | } |
2514 | 2514 | ||
2515 | portp->stats.state = portp->istate; | 2515 | portp->stats.state = portp->istate; |
2516 | portp->stats.flags = portp->flags; | 2516 | portp->stats.flags = portp->port.flags; |
2517 | portp->stats.hwid = portp->hwid; | 2517 | portp->stats.hwid = portp->hwid; |
2518 | 2518 | ||
2519 | portp->stats.ttystate = 0; | 2519 | portp->stats.ttystate = 0; |
@@ -2524,16 +2524,16 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp) | |||
2524 | portp->stats.rxbuffered = 0; | 2524 | portp->stats.rxbuffered = 0; |
2525 | 2525 | ||
2526 | spin_lock_irqsave(&stallion_lock, flags); | 2526 | spin_lock_irqsave(&stallion_lock, flags); |
2527 | if (portp->tty != NULL) | 2527 | if (portp->port.tty != NULL) |
2528 | if (portp->tty->driver_data == portp) { | 2528 | if (portp->port.tty->driver_data == portp) { |
2529 | portp->stats.ttystate = portp->tty->flags; | 2529 | portp->stats.ttystate = portp->port.tty->flags; |
2530 | /* No longer available as a statistic */ | 2530 | /* No longer available as a statistic */ |
2531 | portp->stats.rxbuffered = 1; /*portp->tty->flip.count; */ | 2531 | portp->stats.rxbuffered = 1; /*portp->port.tty->flip.count; */ |
2532 | if (portp->tty->termios != NULL) { | 2532 | if (portp->port.tty->termios != NULL) { |
2533 | portp->stats.cflags = portp->tty->termios->c_cflag; | 2533 | portp->stats.cflags = portp->port.tty->termios->c_cflag; |
2534 | portp->stats.iflags = portp->tty->termios->c_iflag; | 2534 | portp->stats.iflags = portp->port.tty->termios->c_iflag; |
2535 | portp->stats.oflags = portp->tty->termios->c_oflag; | 2535 | portp->stats.oflags = portp->port.tty->termios->c_oflag; |
2536 | portp->stats.lflags = portp->tty->termios->c_lflag; | 2536 | portp->stats.lflags = portp->port.tty->termios->c_lflag; |
2537 | } | 2537 | } |
2538 | } | 2538 | } |
2539 | spin_unlock_irqrestore(&stallion_lock, flags); | 2539 | spin_unlock_irqrestore(&stallion_lock, flags); |
@@ -2939,15 +2939,15 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp) | |||
2939 | } | 2939 | } |
2940 | baudrate = stl_baudrates[baudrate]; | 2940 | baudrate = stl_baudrates[baudrate]; |
2941 | if ((tiosp->c_cflag & CBAUD) == B38400) { | 2941 | if ((tiosp->c_cflag & CBAUD) == B38400) { |
2942 | if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 2942 | if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
2943 | baudrate = 57600; | 2943 | baudrate = 57600; |
2944 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 2944 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
2945 | baudrate = 115200; | 2945 | baudrate = 115200; |
2946 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) | 2946 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) |
2947 | baudrate = 230400; | 2947 | baudrate = 230400; |
2948 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) | 2948 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) |
2949 | baudrate = 460800; | 2949 | baudrate = 460800; |
2950 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) | 2950 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) |
2951 | baudrate = (portp->baud_base / portp->custom_divisor); | 2951 | baudrate = (portp->baud_base / portp->custom_divisor); |
2952 | } | 2952 | } |
2953 | if (baudrate > STL_CD1400MAXBAUD) | 2953 | if (baudrate > STL_CD1400MAXBAUD) |
@@ -2969,9 +2969,9 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp) | |||
2969 | mcor1 |= MCOR1_DCD; | 2969 | mcor1 |= MCOR1_DCD; |
2970 | mcor2 |= MCOR2_DCD; | 2970 | mcor2 |= MCOR2_DCD; |
2971 | sreron |= SRER_MODEM; | 2971 | sreron |= SRER_MODEM; |
2972 | portp->flags |= ASYNC_CHECK_CD; | 2972 | portp->port.flags |= ASYNC_CHECK_CD; |
2973 | } else | 2973 | } else |
2974 | portp->flags &= ~ASYNC_CHECK_CD; | 2974 | portp->port.flags &= ~ASYNC_CHECK_CD; |
2975 | 2975 | ||
2976 | /* | 2976 | /* |
2977 | * Setup cd1400 enhanced modes if we can. In particular we want to | 2977 | * Setup cd1400 enhanced modes if we can. In particular we want to |
@@ -3242,7 +3242,7 @@ static void stl_cd1400flowctrl(struct stlport *portp, int state) | |||
3242 | 3242 | ||
3243 | if (portp == NULL) | 3243 | if (portp == NULL) |
3244 | return; | 3244 | return; |
3245 | tty = portp->tty; | 3245 | tty = portp->port.tty; |
3246 | if (tty == NULL) | 3246 | if (tty == NULL) |
3247 | return; | 3247 | return; |
3248 | 3248 | ||
@@ -3304,7 +3304,7 @@ static void stl_cd1400sendflow(struct stlport *portp, int state) | |||
3304 | 3304 | ||
3305 | if (portp == NULL) | 3305 | if (portp == NULL) |
3306 | return; | 3306 | return; |
3307 | tty = portp->tty; | 3307 | tty = portp->port.tty; |
3308 | if (tty == NULL) | 3308 | if (tty == NULL) |
3309 | return; | 3309 | return; |
3310 | 3310 | ||
@@ -3503,8 +3503,8 @@ static void stl_cd1400txisr(struct stlpanel *panelp, int ioaddr) | |||
3503 | if ((len == 0) || ((len < STL_TXBUFLOW) && | 3503 | if ((len == 0) || ((len < STL_TXBUFLOW) && |
3504 | (test_bit(ASYI_TXLOW, &portp->istate) == 0))) { | 3504 | (test_bit(ASYI_TXLOW, &portp->istate) == 0))) { |
3505 | set_bit(ASYI_TXLOW, &portp->istate); | 3505 | set_bit(ASYI_TXLOW, &portp->istate); |
3506 | if (portp->tty) | 3506 | if (portp->port.tty) |
3507 | tty_wakeup(portp->tty); | 3507 | tty_wakeup(portp->port.tty); |
3508 | } | 3508 | } |
3509 | 3509 | ||
3510 | if (len == 0) { | 3510 | if (len == 0) { |
@@ -3568,7 +3568,7 @@ static void stl_cd1400rxisr(struct stlpanel *panelp, int ioaddr) | |||
3568 | return; | 3568 | return; |
3569 | } | 3569 | } |
3570 | portp = panelp->ports[(ioack >> 3)]; | 3570 | portp = panelp->ports[(ioack >> 3)]; |
3571 | tty = portp->tty; | 3571 | tty = portp->port.tty; |
3572 | 3572 | ||
3573 | if ((ioack & ACK_TYPMASK) == ACK_TYPRXGOOD) { | 3573 | if ((ioack & ACK_TYPMASK) == ACK_TYPRXGOOD) { |
3574 | outb((RDCR + portp->uartaddr), ioaddr); | 3574 | outb((RDCR + portp->uartaddr), ioaddr); |
@@ -3613,7 +3613,7 @@ static void stl_cd1400rxisr(struct stlpanel *panelp, int ioaddr) | |||
3613 | if (portp->rxmarkmsk & status) { | 3613 | if (portp->rxmarkmsk & status) { |
3614 | if (status & ST_BREAK) { | 3614 | if (status & ST_BREAK) { |
3615 | status = TTY_BREAK; | 3615 | status = TTY_BREAK; |
3616 | if (portp->flags & ASYNC_SAK) { | 3616 | if (portp->port.flags & ASYNC_SAK) { |
3617 | do_SAK(tty); | 3617 | do_SAK(tty); |
3618 | BRDENABLE(portp->brdnr, portp->pagenr); | 3618 | BRDENABLE(portp->brdnr, portp->pagenr); |
3619 | } | 3619 | } |
@@ -3899,15 +3899,15 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp) | |||
3899 | } | 3899 | } |
3900 | baudrate = stl_baudrates[baudrate]; | 3900 | baudrate = stl_baudrates[baudrate]; |
3901 | if ((tiosp->c_cflag & CBAUD) == B38400) { | 3901 | if ((tiosp->c_cflag & CBAUD) == B38400) { |
3902 | if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 3902 | if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
3903 | baudrate = 57600; | 3903 | baudrate = 57600; |
3904 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 3904 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
3905 | baudrate = 115200; | 3905 | baudrate = 115200; |
3906 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) | 3906 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) |
3907 | baudrate = 230400; | 3907 | baudrate = 230400; |
3908 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) | 3908 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) |
3909 | baudrate = 460800; | 3909 | baudrate = 460800; |
3910 | else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) | 3910 | else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) |
3911 | baudrate = (portp->baud_base / portp->custom_divisor); | 3911 | baudrate = (portp->baud_base / portp->custom_divisor); |
3912 | } | 3912 | } |
3913 | if (baudrate > STL_SC26198MAXBAUD) | 3913 | if (baudrate > STL_SC26198MAXBAUD) |
@@ -3922,11 +3922,11 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp) | |||
3922 | * Check what form of modem signaling is required and set it up. | 3922 | * Check what form of modem signaling is required and set it up. |
3923 | */ | 3923 | */ |
3924 | if (tiosp->c_cflag & CLOCAL) { | 3924 | if (tiosp->c_cflag & CLOCAL) { |
3925 | portp->flags &= ~ASYNC_CHECK_CD; | 3925 | portp->port.flags &= ~ASYNC_CHECK_CD; |
3926 | } else { | 3926 | } else { |
3927 | iopr |= IOPR_DCDCOS; | 3927 | iopr |= IOPR_DCDCOS; |
3928 | imron |= IR_IOPORT; | 3928 | imron |= IR_IOPORT; |
3929 | portp->flags |= ASYNC_CHECK_CD; | 3929 | portp->port.flags |= ASYNC_CHECK_CD; |
3930 | } | 3930 | } |
3931 | 3931 | ||
3932 | /* | 3932 | /* |
@@ -4174,7 +4174,7 @@ static void stl_sc26198flowctrl(struct stlport *portp, int state) | |||
4174 | 4174 | ||
4175 | if (portp == NULL) | 4175 | if (portp == NULL) |
4176 | return; | 4176 | return; |
4177 | tty = portp->tty; | 4177 | tty = portp->port.tty; |
4178 | if (tty == NULL) | 4178 | if (tty == NULL) |
4179 | return; | 4179 | return; |
4180 | 4180 | ||
@@ -4243,7 +4243,7 @@ static void stl_sc26198sendflow(struct stlport *portp, int state) | |||
4243 | 4243 | ||
4244 | if (portp == NULL) | 4244 | if (portp == NULL) |
4245 | return; | 4245 | return; |
4246 | tty = portp->tty; | 4246 | tty = portp->port.tty; |
4247 | if (tty == NULL) | 4247 | if (tty == NULL) |
4248 | return; | 4248 | return; |
4249 | 4249 | ||
@@ -4421,8 +4421,8 @@ static void stl_sc26198txisr(struct stlport *portp) | |||
4421 | if ((len == 0) || ((len < STL_TXBUFLOW) && | 4421 | if ((len == 0) || ((len < STL_TXBUFLOW) && |
4422 | (test_bit(ASYI_TXLOW, &portp->istate) == 0))) { | 4422 | (test_bit(ASYI_TXLOW, &portp->istate) == 0))) { |
4423 | set_bit(ASYI_TXLOW, &portp->istate); | 4423 | set_bit(ASYI_TXLOW, &portp->istate); |
4424 | if (portp->tty) | 4424 | if (portp->port.tty) |
4425 | tty_wakeup(portp->tty); | 4425 | tty_wakeup(portp->port.tty); |
4426 | } | 4426 | } |
4427 | 4427 | ||
4428 | if (len == 0) { | 4428 | if (len == 0) { |
@@ -4475,7 +4475,7 @@ static void stl_sc26198rxisr(struct stlport *portp, unsigned int iack) | |||
4475 | 4475 | ||
4476 | pr_debug("stl_sc26198rxisr(portp=%p,iack=%x)\n", portp, iack); | 4476 | pr_debug("stl_sc26198rxisr(portp=%p,iack=%x)\n", portp, iack); |
4477 | 4477 | ||
4478 | tty = portp->tty; | 4478 | tty = portp->port.tty; |
4479 | ioaddr = portp->ioaddr; | 4479 | ioaddr = portp->ioaddr; |
4480 | outb(GIBCR, (ioaddr + XP_ADDR)); | 4480 | outb(GIBCR, (ioaddr + XP_ADDR)); |
4481 | len = inb(ioaddr + XP_DATA) + 1; | 4481 | len = inb(ioaddr + XP_DATA) + 1; |
@@ -4527,7 +4527,7 @@ static void stl_sc26198rxbadch(struct stlport *portp, unsigned char status, char | |||
4527 | struct tty_struct *tty; | 4527 | struct tty_struct *tty; |
4528 | unsigned int ioaddr; | 4528 | unsigned int ioaddr; |
4529 | 4529 | ||
4530 | tty = portp->tty; | 4530 | tty = portp->port.tty; |
4531 | ioaddr = portp->ioaddr; | 4531 | ioaddr = portp->ioaddr; |
4532 | 4532 | ||
4533 | if (status & SR_RXPARITY) | 4533 | if (status & SR_RXPARITY) |
@@ -4544,7 +4544,7 @@ static void stl_sc26198rxbadch(struct stlport *portp, unsigned char status, char | |||
4544 | if (portp->rxmarkmsk & status) { | 4544 | if (portp->rxmarkmsk & status) { |
4545 | if (status & SR_RXBREAK) { | 4545 | if (status & SR_RXBREAK) { |
4546 | status = TTY_BREAK; | 4546 | status = TTY_BREAK; |
4547 | if (portp->flags & ASYNC_SAK) { | 4547 | if (portp->port.flags & ASYNC_SAK) { |
4548 | do_SAK(tty); | 4548 | do_SAK(tty); |
4549 | BRDENABLE(portp->brdnr, portp->pagenr); | 4549 | BRDENABLE(portp->brdnr, portp->pagenr); |
4550 | } | 4550 | } |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index b1a7a8cb65ea..d5cffcd6a572 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* sx.c -- driver for the Specialix SX series cards. | 1 | /* sx.c -- driver for the Specialix SX series cards. |
3 | * | 2 | * |
4 | * This driver will also support the older SI, and XIO cards. | 3 | * This driver will also support the older SI, and XIO cards. |
@@ -930,7 +929,7 @@ static int sx_set_real_termios(void *ptr) | |||
930 | 929 | ||
931 | func_enter2(); | 930 | func_enter2(); |
932 | 931 | ||
933 | if (!port->gs.tty) | 932 | if (!port->gs.port.tty) |
934 | return 0; | 933 | return 0; |
935 | 934 | ||
936 | /* What is this doing here? -- REW | 935 | /* What is this doing here? -- REW |
@@ -941,19 +940,19 @@ static int sx_set_real_termios(void *ptr) | |||
941 | 940 | ||
942 | sx_set_baud(port); | 941 | sx_set_baud(port); |
943 | 942 | ||
944 | #define CFLAG port->gs.tty->termios->c_cflag | 943 | #define CFLAG port->gs.port.tty->termios->c_cflag |
945 | sx_write_channel_byte(port, hi_mr1, | 944 | sx_write_channel_byte(port, hi_mr1, |
946 | (C_PARENB(port->gs.tty) ? MR1_WITH : MR1_NONE) | | 945 | (C_PARENB(port->gs.port.tty) ? MR1_WITH : MR1_NONE) | |
947 | (C_PARODD(port->gs.tty) ? MR1_ODD : MR1_EVEN) | | 946 | (C_PARODD(port->gs.port.tty) ? MR1_ODD : MR1_EVEN) | |
948 | (C_CRTSCTS(port->gs.tty) ? MR1_RTS_RXFLOW : 0) | | 947 | (C_CRTSCTS(port->gs.port.tty) ? MR1_RTS_RXFLOW : 0) | |
949 | (((CFLAG & CSIZE) == CS8) ? MR1_8_BITS : 0) | | 948 | (((CFLAG & CSIZE) == CS8) ? MR1_8_BITS : 0) | |
950 | (((CFLAG & CSIZE) == CS7) ? MR1_7_BITS : 0) | | 949 | (((CFLAG & CSIZE) == CS7) ? MR1_7_BITS : 0) | |
951 | (((CFLAG & CSIZE) == CS6) ? MR1_6_BITS : 0) | | 950 | (((CFLAG & CSIZE) == CS6) ? MR1_6_BITS : 0) | |
952 | (((CFLAG & CSIZE) == CS5) ? MR1_5_BITS : 0)); | 951 | (((CFLAG & CSIZE) == CS5) ? MR1_5_BITS : 0)); |
953 | 952 | ||
954 | sx_write_channel_byte(port, hi_mr2, | 953 | sx_write_channel_byte(port, hi_mr2, |
955 | (C_CRTSCTS(port->gs.tty) ? MR2_CTS_TXFLOW : 0) | | 954 | (C_CRTSCTS(port->gs.port.tty) ? MR2_CTS_TXFLOW : 0) | |
956 | (C_CSTOPB(port->gs.tty) ? MR2_2_STOP : | 955 | (C_CSTOPB(port->gs.port.tty) ? MR2_2_STOP : |
957 | MR2_1_STOP)); | 956 | MR2_1_STOP)); |
958 | 957 | ||
959 | switch (CFLAG & CSIZE) { | 958 | switch (CFLAG & CSIZE) { |
@@ -976,44 +975,44 @@ static int sx_set_real_termios(void *ptr) | |||
976 | } | 975 | } |
977 | 976 | ||
978 | sx_write_channel_byte(port, hi_prtcl, | 977 | sx_write_channel_byte(port, hi_prtcl, |
979 | (I_IXON(port->gs.tty) ? SP_TXEN : 0) | | 978 | (I_IXON(port->gs.port.tty) ? SP_TXEN : 0) | |
980 | (I_IXOFF(port->gs.tty) ? SP_RXEN : 0) | | 979 | (I_IXOFF(port->gs.port.tty) ? SP_RXEN : 0) | |
981 | (I_IXANY(port->gs.tty) ? SP_TANY : 0) | SP_DCEN); | 980 | (I_IXANY(port->gs.port.tty) ? SP_TANY : 0) | SP_DCEN); |
982 | 981 | ||
983 | sx_write_channel_byte(port, hi_break, | 982 | sx_write_channel_byte(port, hi_break, |
984 | (I_IGNBRK(port->gs.tty) ? BR_IGN : 0 | | 983 | (I_IGNBRK(port->gs.port.tty) ? BR_IGN : 0 | |
985 | I_BRKINT(port->gs.tty) ? BR_INT : 0)); | 984 | I_BRKINT(port->gs.port.tty) ? BR_INT : 0)); |
986 | 985 | ||
987 | sx_write_channel_byte(port, hi_txon, START_CHAR(port->gs.tty)); | 986 | sx_write_channel_byte(port, hi_txon, START_CHAR(port->gs.port.tty)); |
988 | sx_write_channel_byte(port, hi_rxon, START_CHAR(port->gs.tty)); | 987 | sx_write_channel_byte(port, hi_rxon, START_CHAR(port->gs.port.tty)); |
989 | sx_write_channel_byte(port, hi_txoff, STOP_CHAR(port->gs.tty)); | 988 | sx_write_channel_byte(port, hi_txoff, STOP_CHAR(port->gs.port.tty)); |
990 | sx_write_channel_byte(port, hi_rxoff, STOP_CHAR(port->gs.tty)); | 989 | sx_write_channel_byte(port, hi_rxoff, STOP_CHAR(port->gs.port.tty)); |
991 | 990 | ||
992 | sx_reconfigure_port(port); | 991 | sx_reconfigure_port(port); |
993 | 992 | ||
994 | /* Tell line discipline whether we will do input cooking */ | 993 | /* Tell line discipline whether we will do input cooking */ |
995 | if (I_OTHER(port->gs.tty)) { | 994 | if (I_OTHER(port->gs.port.tty)) { |
996 | clear_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); | 995 | clear_bit(TTY_HW_COOK_IN, &port->gs.port.tty->flags); |
997 | } else { | 996 | } else { |
998 | set_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); | 997 | set_bit(TTY_HW_COOK_IN, &port->gs.port.tty->flags); |
999 | } | 998 | } |
1000 | sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ", | 999 | sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ", |
1001 | (unsigned int)port->gs.tty->termios->c_iflag, | 1000 | (unsigned int)port->gs.port.tty->termios->c_iflag, |
1002 | I_OTHER(port->gs.tty)); | 1001 | I_OTHER(port->gs.port.tty)); |
1003 | 1002 | ||
1004 | /* Tell line discipline whether we will do output cooking. | 1003 | /* Tell line discipline whether we will do output cooking. |
1005 | * If OPOST is set and no other output flags are set then we can do output | 1004 | * If OPOST is set and no other output flags are set then we can do output |
1006 | * processing. Even if only *one* other flag in the O_OTHER group is set | 1005 | * processing. Even if only *one* other flag in the O_OTHER group is set |
1007 | * we do cooking in software. | 1006 | * we do cooking in software. |
1008 | */ | 1007 | */ |
1009 | if (O_OPOST(port->gs.tty) && !O_OTHER(port->gs.tty)) { | 1008 | if (O_OPOST(port->gs.port.tty) && !O_OTHER(port->gs.port.tty)) { |
1010 | set_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); | 1009 | set_bit(TTY_HW_COOK_OUT, &port->gs.port.tty->flags); |
1011 | } else { | 1010 | } else { |
1012 | clear_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); | 1011 | clear_bit(TTY_HW_COOK_OUT, &port->gs.port.tty->flags); |
1013 | } | 1012 | } |
1014 | sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", | 1013 | sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", |
1015 | (unsigned int)port->gs.tty->termios->c_oflag, | 1014 | (unsigned int)port->gs.port.tty->termios->c_oflag, |
1016 | O_OTHER(port->gs.tty)); | 1015 | O_OTHER(port->gs.port.tty)); |
1017 | /* port->c_dcd = sx_get_CD (port); */ | 1016 | /* port->c_dcd = sx_get_CD (port); */ |
1018 | func_exit(); | 1017 | func_exit(); |
1019 | return 0; | 1018 | return 0; |
@@ -1102,8 +1101,8 @@ static void sx_transmit_chars(struct sx_port *port) | |||
1102 | sx_disable_tx_interrupts(port); | 1101 | sx_disable_tx_interrupts(port); |
1103 | } | 1102 | } |
1104 | 1103 | ||
1105 | if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.tty) { | 1104 | if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.port.tty) { |
1106 | tty_wakeup(port->gs.tty); | 1105 | tty_wakeup(port->gs.port.tty); |
1107 | sx_dprintk(SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n", | 1106 | sx_dprintk(SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n", |
1108 | port->gs.wakeup_chars); | 1107 | port->gs.wakeup_chars); |
1109 | } | 1108 | } |
@@ -1126,7 +1125,7 @@ static inline void sx_receive_chars(struct sx_port *port) | |||
1126 | unsigned char *rp; | 1125 | unsigned char *rp; |
1127 | 1126 | ||
1128 | func_enter2(); | 1127 | func_enter2(); |
1129 | tty = port->gs.tty; | 1128 | tty = port->gs.port.tty; |
1130 | while (1) { | 1129 | while (1) { |
1131 | rx_op = sx_read_channel_byte(port, hi_rxopos); | 1130 | rx_op = sx_read_channel_byte(port, hi_rxopos); |
1132 | c = (sx_read_channel_byte(port, hi_rxipos) - rx_op) & 0xff; | 1131 | c = (sx_read_channel_byte(port, hi_rxipos) - rx_op) & 0xff; |
@@ -1211,12 +1210,12 @@ static inline void sx_check_modem_signals(struct sx_port *port) | |||
1211 | /* DCD went UP */ | 1210 | /* DCD went UP */ |
1212 | if ((sx_read_channel_byte(port, hi_hstat) != | 1211 | if ((sx_read_channel_byte(port, hi_hstat) != |
1213 | HS_IDLE_CLOSED) && | 1212 | HS_IDLE_CLOSED) && |
1214 | !(port->gs.tty->termios-> | 1213 | !(port->gs.port.tty->termios-> |
1215 | c_cflag & CLOCAL)) { | 1214 | c_cflag & CLOCAL)) { |
1216 | /* Are we blocking in open? */ | 1215 | /* Are we blocking in open? */ |
1217 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " | 1216 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1218 | "active, unblocking open\n"); | 1217 | "active, unblocking open\n"); |
1219 | wake_up_interruptible(&port->gs. | 1218 | wake_up_interruptible(&port->gs.port. |
1220 | open_wait); | 1219 | open_wait); |
1221 | } else { | 1220 | } else { |
1222 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " | 1221 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
@@ -1224,10 +1223,10 @@ static inline void sx_check_modem_signals(struct sx_port *port) | |||
1224 | } | 1223 | } |
1225 | } else { | 1224 | } else { |
1226 | /* DCD went down! */ | 1225 | /* DCD went down! */ |
1227 | if (!(port->gs.tty->termios->c_cflag & CLOCAL)){ | 1226 | if (!(port->gs.port.tty->termios->c_cflag & CLOCAL)){ |
1228 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " | 1227 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1229 | "dropped. hanging up....\n"); | 1228 | "dropped. hanging up....\n"); |
1230 | tty_hangup(port->gs.tty); | 1229 | tty_hangup(port->gs.port.tty); |
1231 | } else { | 1230 | } else { |
1232 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " | 1231 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " |
1233 | "dropped. ignoring.\n"); | 1232 | "dropped. ignoring.\n"); |
@@ -1325,7 +1324,7 @@ static irqreturn_t sx_interrupt(int irq, void *ptr) | |||
1325 | 1324 | ||
1326 | for (i = 0; i < board->nports; i++) { | 1325 | for (i = 0; i < board->nports; i++) { |
1327 | port = &board->ports[i]; | 1326 | port = &board->ports[i]; |
1328 | if (port->gs.flags & GS_ACTIVE) { | 1327 | if (port->gs.port.flags & GS_ACTIVE) { |
1329 | if (sx_read_channel_byte(port, hi_state)) { | 1328 | if (sx_read_channel_byte(port, hi_state)) { |
1330 | sx_dprintk(SX_DEBUG_INTERRUPTS, "Port %d: " | 1329 | sx_dprintk(SX_DEBUG_INTERRUPTS, "Port %d: " |
1331 | "modem signal change?... \n",i); | 1330 | "modem signal change?... \n",i); |
@@ -1334,7 +1333,7 @@ static irqreturn_t sx_interrupt(int irq, void *ptr) | |||
1334 | if (port->gs.xmit_cnt) { | 1333 | if (port->gs.xmit_cnt) { |
1335 | sx_transmit_chars(port); | 1334 | sx_transmit_chars(port); |
1336 | } | 1335 | } |
1337 | if (!(port->gs.flags & SX_RX_THROTTLE)) { | 1336 | if (!(port->gs.port.flags & SX_RX_THROTTLE)) { |
1338 | sx_receive_chars(port); | 1337 | sx_receive_chars(port); |
1339 | } | 1338 | } |
1340 | } | 1339 | } |
@@ -1373,7 +1372,7 @@ static void sx_disable_tx_interrupts(void *ptr) | |||
1373 | struct sx_port *port = ptr; | 1372 | struct sx_port *port = ptr; |
1374 | func_enter2(); | 1373 | func_enter2(); |
1375 | 1374 | ||
1376 | port->gs.flags &= ~GS_TX_INTEN; | 1375 | port->gs.port.flags &= ~GS_TX_INTEN; |
1377 | 1376 | ||
1378 | func_exit(); | 1377 | func_exit(); |
1379 | } | 1378 | } |
@@ -1394,7 +1393,7 @@ static void sx_enable_tx_interrupts(void *ptr) | |||
1394 | 1393 | ||
1395 | /* XXX Must be "HIGH_WATER" for SI card according to doc. */ | 1394 | /* XXX Must be "HIGH_WATER" for SI card according to doc. */ |
1396 | if (data_in_buffer < LOW_WATER) | 1395 | if (data_in_buffer < LOW_WATER) |
1397 | port->gs.flags &= ~GS_TX_INTEN; | 1396 | port->gs.port.flags &= ~GS_TX_INTEN; |
1398 | 1397 | ||
1399 | func_exit(); | 1398 | func_exit(); |
1400 | } | 1399 | } |
@@ -1442,8 +1441,8 @@ static void sx_shutdown_port(void *ptr) | |||
1442 | 1441 | ||
1443 | func_enter(); | 1442 | func_enter(); |
1444 | 1443 | ||
1445 | port->gs.flags &= ~GS_ACTIVE; | 1444 | port->gs.port.flags &= ~GS_ACTIVE; |
1446 | if (port->gs.tty && (port->gs.tty->termios->c_cflag & HUPCL)) { | 1445 | if (port->gs.port.tty && (port->gs.port.tty->termios->c_cflag & HUPCL)) { |
1447 | sx_setsignals(port, 0, 0); | 1446 | sx_setsignals(port, 0, 0); |
1448 | sx_reconfigure_port(port); | 1447 | sx_reconfigure_port(port); |
1449 | } | 1448 | } |
@@ -1485,8 +1484,8 @@ static int sx_open(struct tty_struct *tty, struct file *filp) | |||
1485 | spin_lock_irqsave(&port->gs.driver_lock, flags); | 1484 | spin_lock_irqsave(&port->gs.driver_lock, flags); |
1486 | 1485 | ||
1487 | tty->driver_data = port; | 1486 | tty->driver_data = port; |
1488 | port->gs.tty = tty; | 1487 | port->gs.port.tty = tty; |
1489 | port->gs.count++; | 1488 | port->gs.port.count++; |
1490 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); | 1489 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); |
1491 | 1490 | ||
1492 | sx_dprintk(SX_DEBUG_OPEN, "starting port\n"); | 1491 | sx_dprintk(SX_DEBUG_OPEN, "starting port\n"); |
@@ -1497,12 +1496,12 @@ static int sx_open(struct tty_struct *tty, struct file *filp) | |||
1497 | retval = gs_init_port(&port->gs); | 1496 | retval = gs_init_port(&port->gs); |
1498 | sx_dprintk(SX_DEBUG_OPEN, "done gs_init\n"); | 1497 | sx_dprintk(SX_DEBUG_OPEN, "done gs_init\n"); |
1499 | if (retval) { | 1498 | if (retval) { |
1500 | port->gs.count--; | 1499 | port->gs.port.count--; |
1501 | return retval; | 1500 | return retval; |
1502 | } | 1501 | } |
1503 | 1502 | ||
1504 | port->gs.flags |= GS_ACTIVE; | 1503 | port->gs.port.flags |= GS_ACTIVE; |
1505 | if (port->gs.count <= 1) | 1504 | if (port->gs.port.count <= 1) |
1506 | sx_setsignals(port, 1, 1); | 1505 | sx_setsignals(port, 1, 1); |
1507 | 1506 | ||
1508 | #if 0 | 1507 | #if 0 |
@@ -1513,12 +1512,12 @@ static int sx_open(struct tty_struct *tty, struct file *filp) | |||
1513 | my_hd_io(port->board->base + port->ch_base, sizeof(*port)); | 1512 | my_hd_io(port->board->base + port->ch_base, sizeof(*port)); |
1514 | #endif | 1513 | #endif |
1515 | 1514 | ||
1516 | if (port->gs.count <= 1) { | 1515 | if (port->gs.port.count <= 1) { |
1517 | if (sx_send_command(port, HS_LOPEN, -1, HS_IDLE_OPEN) != 1) { | 1516 | if (sx_send_command(port, HS_LOPEN, -1, HS_IDLE_OPEN) != 1) { |
1518 | printk(KERN_ERR "sx: Card didn't respond to LOPEN " | 1517 | printk(KERN_ERR "sx: Card didn't respond to LOPEN " |
1519 | "command.\n"); | 1518 | "command.\n"); |
1520 | spin_lock_irqsave(&port->gs.driver_lock, flags); | 1519 | spin_lock_irqsave(&port->gs.driver_lock, flags); |
1521 | port->gs.count--; | 1520 | port->gs.port.count--; |
1522 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); | 1521 | spin_unlock_irqrestore(&port->gs.driver_lock, flags); |
1523 | return -EIO; | 1522 | return -EIO; |
1524 | } | 1523 | } |
@@ -1526,11 +1525,11 @@ static int sx_open(struct tty_struct *tty, struct file *filp) | |||
1526 | 1525 | ||
1527 | retval = gs_block_til_ready(port, filp); | 1526 | retval = gs_block_til_ready(port, filp); |
1528 | sx_dprintk(SX_DEBUG_OPEN, "Block til ready returned %d. Count=%d\n", | 1527 | sx_dprintk(SX_DEBUG_OPEN, "Block til ready returned %d. Count=%d\n", |
1529 | retval, port->gs.count); | 1528 | retval, port->gs.port.count); |
1530 | 1529 | ||
1531 | if (retval) { | 1530 | if (retval) { |
1532 | /* | 1531 | /* |
1533 | * Don't lower gs.count here because sx_close() will be called later | 1532 | * Don't lower gs.port.count here because sx_close() will be called later |
1534 | */ | 1533 | */ |
1535 | 1534 | ||
1536 | return retval; | 1535 | return retval; |
@@ -1571,14 +1570,14 @@ static void sx_close(void *ptr) | |||
1571 | } | 1570 | } |
1572 | 1571 | ||
1573 | sx_dprintk(SX_DEBUG_CLOSE, "waited %d jiffies for close. count=%d\n", | 1572 | sx_dprintk(SX_DEBUG_CLOSE, "waited %d jiffies for close. count=%d\n", |
1574 | 5 * HZ - to - 1, port->gs.count); | 1573 | 5 * HZ - to - 1, port->gs.port.count); |
1575 | 1574 | ||
1576 | if (port->gs.count) { | 1575 | if (port->gs.port.count) { |
1577 | sx_dprintk(SX_DEBUG_CLOSE, "WARNING port count:%d\n", | 1576 | sx_dprintk(SX_DEBUG_CLOSE, "WARNING port count:%d\n", |
1578 | port->gs.count); | 1577 | port->gs.port.count); |
1579 | /*printk("%s SETTING port count to zero: %p count: %d\n", | 1578 | /*printk("%s SETTING port count to zero: %p count: %d\n", |
1580 | __func__, port, port->gs.count); | 1579 | __func__, port, port->gs.port.count); |
1581 | port->gs.count = 0;*/ | 1580 | port->gs.port.count = 0;*/ |
1582 | } | 1581 | } |
1583 | 1582 | ||
1584 | func_exit(); | 1583 | func_exit(); |
@@ -1939,7 +1938,7 @@ static void sx_throttle(struct tty_struct *tty) | |||
1939 | * control then throttle the port. | 1938 | * control then throttle the port. |
1940 | */ | 1939 | */ |
1941 | if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) { | 1940 | if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) { |
1942 | port->gs.flags |= SX_RX_THROTTLE; | 1941 | port->gs.port.flags |= SX_RX_THROTTLE; |
1943 | } | 1942 | } |
1944 | func_exit(); | 1943 | func_exit(); |
1945 | } | 1944 | } |
@@ -1953,7 +1952,7 @@ static void sx_unthrottle(struct tty_struct *tty) | |||
1953 | * this port in case we disabled flow control while the port | 1952 | * this port in case we disabled flow control while the port |
1954 | * was throttled | 1953 | * was throttled |
1955 | */ | 1954 | */ |
1956 | port->gs.flags &= ~SX_RX_THROTTLE; | 1955 | port->gs.port.flags &= ~SX_RX_THROTTLE; |
1957 | func_exit(); | 1956 | func_exit(); |
1958 | return; | 1957 | return; |
1959 | } | 1958 | } |
@@ -2396,6 +2395,7 @@ static int sx_init_portstructs(int nboards, int nports) | |||
2396 | board->ports = port; | 2395 | board->ports = port; |
2397 | for (j = 0; j < boards[i].nports; j++) { | 2396 | for (j = 0; j < boards[i].nports; j++) { |
2398 | sx_dprintk(SX_DEBUG_INIT, "initing port %d\n", j); | 2397 | sx_dprintk(SX_DEBUG_INIT, "initing port %d\n", j); |
2398 | tty_port_init(&port->gs.port); | ||
2399 | port->gs.magic = SX_MAGIC; | 2399 | port->gs.magic = SX_MAGIC; |
2400 | port->gs.close_delay = HZ / 2; | 2400 | port->gs.close_delay = HZ / 2; |
2401 | port->gs.closing_wait = 30 * HZ; | 2401 | port->gs.closing_wait = 30 * HZ; |
@@ -2408,9 +2408,6 @@ static int sx_init_portstructs(int nboards, int nports) | |||
2408 | /* | 2408 | /* |
2409 | * Initializing wait queue | 2409 | * Initializing wait queue |
2410 | */ | 2410 | */ |
2411 | init_waitqueue_head(&port->gs.open_wait); | ||
2412 | init_waitqueue_head(&port->gs.close_wait); | ||
2413 | |||
2414 | port++; | 2411 | port++; |
2415 | } | 2412 | } |
2416 | } | 2413 | } |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index ac5080df2565..527d220aa4aa 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -180,19 +180,14 @@ struct tx_holding_buffer { | |||
180 | 180 | ||
181 | struct mgsl_struct { | 181 | struct mgsl_struct { |
182 | int magic; | 182 | int magic; |
183 | int flags; | 183 | struct tty_port port; |
184 | int count; /* count of opens */ | ||
185 | int line; | 184 | int line; |
186 | int hw_version; | 185 | int hw_version; |
187 | unsigned short close_delay; | ||
188 | unsigned short closing_wait; /* time to wait before closing */ | ||
189 | 186 | ||
190 | struct mgsl_icount icount; | 187 | struct mgsl_icount icount; |
191 | 188 | ||
192 | struct tty_struct *tty; | ||
193 | int timeout; | 189 | int timeout; |
194 | int x_char; /* xon/xoff character */ | 190 | int x_char; /* xon/xoff character */ |
195 | int blocked_open; /* # of blocked opens */ | ||
196 | u16 read_status_mask; | 191 | u16 read_status_mask; |
197 | u16 ignore_status_mask; | 192 | u16 ignore_status_mask; |
198 | unsigned char *xmit_buf; | 193 | unsigned char *xmit_buf; |
@@ -200,9 +195,6 @@ struct mgsl_struct { | |||
200 | int xmit_tail; | 195 | int xmit_tail; |
201 | int xmit_cnt; | 196 | int xmit_cnt; |
202 | 197 | ||
203 | wait_queue_head_t open_wait; | ||
204 | wait_queue_head_t close_wait; | ||
205 | |||
206 | wait_queue_head_t status_event_wait_q; | 198 | wait_queue_head_t status_event_wait_q; |
207 | wait_queue_head_t event_wait_q; | 199 | wait_queue_head_t event_wait_q; |
208 | struct timer_list tx_timer; /* HDLC transmit timeout timer */ | 200 | struct timer_list tx_timer; /* HDLC transmit timeout timer */ |
@@ -975,8 +967,8 @@ static void ldisc_receive_buf(struct tty_struct *tty, | |||
975 | return; | 967 | return; |
976 | ld = tty_ldisc_ref(tty); | 968 | ld = tty_ldisc_ref(tty); |
977 | if (ld) { | 969 | if (ld) { |
978 | if (ld->receive_buf) | 970 | if (ld->ops->receive_buf) |
979 | ld->receive_buf(tty, data, flags, count); | 971 | ld->ops->receive_buf(tty, data, flags, count); |
980 | tty_ldisc_deref(ld); | 972 | tty_ldisc_deref(ld); |
981 | } | 973 | } |
982 | } | 974 | } |
@@ -1134,7 +1126,7 @@ static void mgsl_bh_receive(struct mgsl_struct *info) | |||
1134 | 1126 | ||
1135 | static void mgsl_bh_transmit(struct mgsl_struct *info) | 1127 | static void mgsl_bh_transmit(struct mgsl_struct *info) |
1136 | { | 1128 | { |
1137 | struct tty_struct *tty = info->tty; | 1129 | struct tty_struct *tty = info->port.tty; |
1138 | unsigned long flags; | 1130 | unsigned long flags; |
1139 | 1131 | ||
1140 | if ( debug_level >= DEBUG_LEVEL_BH ) | 1132 | if ( debug_level >= DEBUG_LEVEL_BH ) |
@@ -1276,7 +1268,7 @@ static void mgsl_isr_transmit_status( struct mgsl_struct *info ) | |||
1276 | else | 1268 | else |
1277 | #endif | 1269 | #endif |
1278 | { | 1270 | { |
1279 | if (info->tty->stopped || info->tty->hw_stopped) { | 1271 | if (info->port.tty->stopped || info->port.tty->hw_stopped) { |
1280 | usc_stop_transmitter(info); | 1272 | usc_stop_transmitter(info); |
1281 | return; | 1273 | return; |
1282 | } | 1274 | } |
@@ -1357,29 +1349,29 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info ) | |||
1357 | wake_up_interruptible(&info->status_event_wait_q); | 1349 | wake_up_interruptible(&info->status_event_wait_q); |
1358 | wake_up_interruptible(&info->event_wait_q); | 1350 | wake_up_interruptible(&info->event_wait_q); |
1359 | 1351 | ||
1360 | if ( (info->flags & ASYNC_CHECK_CD) && | 1352 | if ( (info->port.flags & ASYNC_CHECK_CD) && |
1361 | (status & MISCSTATUS_DCD_LATCHED) ) { | 1353 | (status & MISCSTATUS_DCD_LATCHED) ) { |
1362 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 1354 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
1363 | printk("%s CD now %s...", info->device_name, | 1355 | printk("%s CD now %s...", info->device_name, |
1364 | (status & MISCSTATUS_DCD) ? "on" : "off"); | 1356 | (status & MISCSTATUS_DCD) ? "on" : "off"); |
1365 | if (status & MISCSTATUS_DCD) | 1357 | if (status & MISCSTATUS_DCD) |
1366 | wake_up_interruptible(&info->open_wait); | 1358 | wake_up_interruptible(&info->port.open_wait); |
1367 | else { | 1359 | else { |
1368 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 1360 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
1369 | printk("doing serial hangup..."); | 1361 | printk("doing serial hangup..."); |
1370 | if (info->tty) | 1362 | if (info->port.tty) |
1371 | tty_hangup(info->tty); | 1363 | tty_hangup(info->port.tty); |
1372 | } | 1364 | } |
1373 | } | 1365 | } |
1374 | 1366 | ||
1375 | if ( (info->flags & ASYNC_CTS_FLOW) && | 1367 | if ( (info->port.flags & ASYNC_CTS_FLOW) && |
1376 | (status & MISCSTATUS_CTS_LATCHED) ) { | 1368 | (status & MISCSTATUS_CTS_LATCHED) ) { |
1377 | if (info->tty->hw_stopped) { | 1369 | if (info->port.tty->hw_stopped) { |
1378 | if (status & MISCSTATUS_CTS) { | 1370 | if (status & MISCSTATUS_CTS) { |
1379 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 1371 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
1380 | printk("CTS tx start..."); | 1372 | printk("CTS tx start..."); |
1381 | if (info->tty) | 1373 | if (info->port.tty) |
1382 | info->tty->hw_stopped = 0; | 1374 | info->port.tty->hw_stopped = 0; |
1383 | usc_start_transmitter(info); | 1375 | usc_start_transmitter(info); |
1384 | info->pending_bh |= BH_TRANSMIT; | 1376 | info->pending_bh |= BH_TRANSMIT; |
1385 | return; | 1377 | return; |
@@ -1388,8 +1380,8 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info ) | |||
1388 | if (!(status & MISCSTATUS_CTS)) { | 1380 | if (!(status & MISCSTATUS_CTS)) { |
1389 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 1381 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
1390 | printk("CTS tx stop..."); | 1382 | printk("CTS tx stop..."); |
1391 | if (info->tty) | 1383 | if (info->port.tty) |
1392 | info->tty->hw_stopped = 1; | 1384 | info->port.tty->hw_stopped = 1; |
1393 | usc_stop_transmitter(info); | 1385 | usc_stop_transmitter(info); |
1394 | } | 1386 | } |
1395 | } | 1387 | } |
@@ -1423,7 +1415,7 @@ static void mgsl_isr_transmit_data( struct mgsl_struct *info ) | |||
1423 | 1415 | ||
1424 | usc_ClearIrqPendingBits( info, TRANSMIT_DATA ); | 1416 | usc_ClearIrqPendingBits( info, TRANSMIT_DATA ); |
1425 | 1417 | ||
1426 | if (info->tty->stopped || info->tty->hw_stopped) { | 1418 | if (info->port.tty->stopped || info->port.tty->hw_stopped) { |
1427 | usc_stop_transmitter(info); | 1419 | usc_stop_transmitter(info); |
1428 | return; | 1420 | return; |
1429 | } | 1421 | } |
@@ -1453,7 +1445,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1453 | u16 status; | 1445 | u16 status; |
1454 | int work = 0; | 1446 | int work = 0; |
1455 | unsigned char DataByte; | 1447 | unsigned char DataByte; |
1456 | struct tty_struct *tty = info->tty; | 1448 | struct tty_struct *tty = info->port.tty; |
1457 | struct mgsl_icount *icount = &info->icount; | 1449 | struct mgsl_icount *icount = &info->icount; |
1458 | 1450 | ||
1459 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 1451 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
@@ -1514,7 +1506,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1514 | 1506 | ||
1515 | if (status & RXSTATUS_BREAK_RECEIVED) { | 1507 | if (status & RXSTATUS_BREAK_RECEIVED) { |
1516 | flag = TTY_BREAK; | 1508 | flag = TTY_BREAK; |
1517 | if (info->flags & ASYNC_SAK) | 1509 | if (info->port.flags & ASYNC_SAK) |
1518 | do_SAK(tty); | 1510 | do_SAK(tty); |
1519 | } else if (status & RXSTATUS_PARITY_ERROR) | 1511 | } else if (status & RXSTATUS_PARITY_ERROR) |
1520 | flag = TTY_PARITY; | 1512 | flag = TTY_PARITY; |
@@ -1771,7 +1763,7 @@ static int startup(struct mgsl_struct * info) | |||
1771 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 1763 | if ( debug_level >= DEBUG_LEVEL_INFO ) |
1772 | printk("%s(%d):mgsl_startup(%s)\n",__FILE__,__LINE__,info->device_name); | 1764 | printk("%s(%d):mgsl_startup(%s)\n",__FILE__,__LINE__,info->device_name); |
1773 | 1765 | ||
1774 | if (info->flags & ASYNC_INITIALIZED) | 1766 | if (info->port.flags & ASYNC_INITIALIZED) |
1775 | return 0; | 1767 | return 0; |
1776 | 1768 | ||
1777 | if (!info->xmit_buf) { | 1769 | if (!info->xmit_buf) { |
@@ -1798,8 +1790,8 @@ static int startup(struct mgsl_struct * info) | |||
1798 | retval = mgsl_adapter_test(info); | 1790 | retval = mgsl_adapter_test(info); |
1799 | 1791 | ||
1800 | if ( retval ) { | 1792 | if ( retval ) { |
1801 | if (capable(CAP_SYS_ADMIN) && info->tty) | 1793 | if (capable(CAP_SYS_ADMIN) && info->port.tty) |
1802 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 1794 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
1803 | mgsl_release_resources(info); | 1795 | mgsl_release_resources(info); |
1804 | return retval; | 1796 | return retval; |
1805 | } | 1797 | } |
@@ -1807,10 +1799,10 @@ static int startup(struct mgsl_struct * info) | |||
1807 | /* program hardware for current parameters */ | 1799 | /* program hardware for current parameters */ |
1808 | mgsl_change_params(info); | 1800 | mgsl_change_params(info); |
1809 | 1801 | ||
1810 | if (info->tty) | 1802 | if (info->port.tty) |
1811 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 1803 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
1812 | 1804 | ||
1813 | info->flags |= ASYNC_INITIALIZED; | 1805 | info->port.flags |= ASYNC_INITIALIZED; |
1814 | 1806 | ||
1815 | return 0; | 1807 | return 0; |
1816 | 1808 | ||
@@ -1827,7 +1819,7 @@ static void shutdown(struct mgsl_struct * info) | |||
1827 | { | 1819 | { |
1828 | unsigned long flags; | 1820 | unsigned long flags; |
1829 | 1821 | ||
1830 | if (!(info->flags & ASYNC_INITIALIZED)) | 1822 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
1831 | return; | 1823 | return; |
1832 | 1824 | ||
1833 | if (debug_level >= DEBUG_LEVEL_INFO) | 1825 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -1864,7 +1856,7 @@ static void shutdown(struct mgsl_struct * info) | |||
1864 | /* on the ISA adapter. This has no effect for the PCI adapter */ | 1856 | /* on the ISA adapter. This has no effect for the PCI adapter */ |
1865 | usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) | BIT12)); | 1857 | usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) | BIT12)); |
1866 | 1858 | ||
1867 | if (!info->tty || info->tty->termios->c_cflag & HUPCL) { | 1859 | if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) { |
1868 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); | 1860 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); |
1869 | usc_set_serial_signals(info); | 1861 | usc_set_serial_signals(info); |
1870 | } | 1862 | } |
@@ -1873,10 +1865,10 @@ static void shutdown(struct mgsl_struct * info) | |||
1873 | 1865 | ||
1874 | mgsl_release_resources(info); | 1866 | mgsl_release_resources(info); |
1875 | 1867 | ||
1876 | if (info->tty) | 1868 | if (info->port.tty) |
1877 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 1869 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
1878 | 1870 | ||
1879 | info->flags &= ~ASYNC_INITIALIZED; | 1871 | info->port.flags &= ~ASYNC_INITIALIZED; |
1880 | 1872 | ||
1881 | } /* end of shutdown() */ | 1873 | } /* end of shutdown() */ |
1882 | 1874 | ||
@@ -1908,7 +1900,7 @@ static void mgsl_program_hw(struct mgsl_struct *info) | |||
1908 | usc_EnableInterrupts(info, IO_PIN); | 1900 | usc_EnableInterrupts(info, IO_PIN); |
1909 | usc_get_serial_signals(info); | 1901 | usc_get_serial_signals(info); |
1910 | 1902 | ||
1911 | if (info->netcount || info->tty->termios->c_cflag & CREAD) | 1903 | if (info->netcount || info->port.tty->termios->c_cflag & CREAD) |
1912 | usc_start_receiver(info); | 1904 | usc_start_receiver(info); |
1913 | 1905 | ||
1914 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 1906 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
@@ -1921,14 +1913,14 @@ static void mgsl_change_params(struct mgsl_struct *info) | |||
1921 | unsigned cflag; | 1913 | unsigned cflag; |
1922 | int bits_per_char; | 1914 | int bits_per_char; |
1923 | 1915 | ||
1924 | if (!info->tty || !info->tty->termios) | 1916 | if (!info->port.tty || !info->port.tty->termios) |
1925 | return; | 1917 | return; |
1926 | 1918 | ||
1927 | if (debug_level >= DEBUG_LEVEL_INFO) | 1919 | if (debug_level >= DEBUG_LEVEL_INFO) |
1928 | printk("%s(%d):mgsl_change_params(%s)\n", | 1920 | printk("%s(%d):mgsl_change_params(%s)\n", |
1929 | __FILE__,__LINE__, info->device_name ); | 1921 | __FILE__,__LINE__, info->device_name ); |
1930 | 1922 | ||
1931 | cflag = info->tty->termios->c_cflag; | 1923 | cflag = info->port.tty->termios->c_cflag; |
1932 | 1924 | ||
1933 | /* if B0 rate (hangup) specified then negate DTR and RTS */ | 1925 | /* if B0 rate (hangup) specified then negate DTR and RTS */ |
1934 | /* otherwise assert DTR and RTS */ | 1926 | /* otherwise assert DTR and RTS */ |
@@ -1976,7 +1968,7 @@ static void mgsl_change_params(struct mgsl_struct *info) | |||
1976 | * current data rate. | 1968 | * current data rate. |
1977 | */ | 1969 | */ |
1978 | if (info->params.data_rate <= 460800) | 1970 | if (info->params.data_rate <= 460800) |
1979 | info->params.data_rate = tty_get_baud_rate(info->tty); | 1971 | info->params.data_rate = tty_get_baud_rate(info->port.tty); |
1980 | 1972 | ||
1981 | if ( info->params.data_rate ) { | 1973 | if ( info->params.data_rate ) { |
1982 | info->timeout = (32*HZ*bits_per_char) / | 1974 | info->timeout = (32*HZ*bits_per_char) / |
@@ -1985,31 +1977,31 @@ static void mgsl_change_params(struct mgsl_struct *info) | |||
1985 | info->timeout += HZ/50; /* Add .02 seconds of slop */ | 1977 | info->timeout += HZ/50; /* Add .02 seconds of slop */ |
1986 | 1978 | ||
1987 | if (cflag & CRTSCTS) | 1979 | if (cflag & CRTSCTS) |
1988 | info->flags |= ASYNC_CTS_FLOW; | 1980 | info->port.flags |= ASYNC_CTS_FLOW; |
1989 | else | 1981 | else |
1990 | info->flags &= ~ASYNC_CTS_FLOW; | 1982 | info->port.flags &= ~ASYNC_CTS_FLOW; |
1991 | 1983 | ||
1992 | if (cflag & CLOCAL) | 1984 | if (cflag & CLOCAL) |
1993 | info->flags &= ~ASYNC_CHECK_CD; | 1985 | info->port.flags &= ~ASYNC_CHECK_CD; |
1994 | else | 1986 | else |
1995 | info->flags |= ASYNC_CHECK_CD; | 1987 | info->port.flags |= ASYNC_CHECK_CD; |
1996 | 1988 | ||
1997 | /* process tty input control flags */ | 1989 | /* process tty input control flags */ |
1998 | 1990 | ||
1999 | info->read_status_mask = RXSTATUS_OVERRUN; | 1991 | info->read_status_mask = RXSTATUS_OVERRUN; |
2000 | if (I_INPCK(info->tty)) | 1992 | if (I_INPCK(info->port.tty)) |
2001 | info->read_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR; | 1993 | info->read_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR; |
2002 | if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) | 1994 | if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) |
2003 | info->read_status_mask |= RXSTATUS_BREAK_RECEIVED; | 1995 | info->read_status_mask |= RXSTATUS_BREAK_RECEIVED; |
2004 | 1996 | ||
2005 | if (I_IGNPAR(info->tty)) | 1997 | if (I_IGNPAR(info->port.tty)) |
2006 | info->ignore_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR; | 1998 | info->ignore_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR; |
2007 | if (I_IGNBRK(info->tty)) { | 1999 | if (I_IGNBRK(info->port.tty)) { |
2008 | info->ignore_status_mask |= RXSTATUS_BREAK_RECEIVED; | 2000 | info->ignore_status_mask |= RXSTATUS_BREAK_RECEIVED; |
2009 | /* If ignoring parity and break indicators, ignore | 2001 | /* If ignoring parity and break indicators, ignore |
2010 | * overruns too. (For real raw support). | 2002 | * overruns too. (For real raw support). |
2011 | */ | 2003 | */ |
2012 | if (I_IGNPAR(info->tty)) | 2004 | if (I_IGNPAR(info->port.tty)) |
2013 | info->ignore_status_mask |= RXSTATUS_OVERRUN; | 2005 | info->ignore_status_mask |= RXSTATUS_OVERRUN; |
2014 | } | 2006 | } |
2015 | 2007 | ||
@@ -3113,32 +3105,32 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp) | |||
3113 | 3105 | ||
3114 | if (debug_level >= DEBUG_LEVEL_INFO) | 3106 | if (debug_level >= DEBUG_LEVEL_INFO) |
3115 | printk("%s(%d):mgsl_close(%s) entry, count=%d\n", | 3107 | printk("%s(%d):mgsl_close(%s) entry, count=%d\n", |
3116 | __FILE__,__LINE__, info->device_name, info->count); | 3108 | __FILE__,__LINE__, info->device_name, info->port.count); |
3117 | 3109 | ||
3118 | if (!info->count) | 3110 | if (!info->port.count) |
3119 | return; | 3111 | return; |
3120 | 3112 | ||
3121 | if (tty_hung_up_p(filp)) | 3113 | if (tty_hung_up_p(filp)) |
3122 | goto cleanup; | 3114 | goto cleanup; |
3123 | 3115 | ||
3124 | if ((tty->count == 1) && (info->count != 1)) { | 3116 | if ((tty->count == 1) && (info->port.count != 1)) { |
3125 | /* | 3117 | /* |
3126 | * tty->count is 1 and the tty structure will be freed. | 3118 | * tty->count is 1 and the tty structure will be freed. |
3127 | * info->count should be one in this case. | 3119 | * info->port.count should be one in this case. |
3128 | * if it's not, correct it so that the port is shutdown. | 3120 | * if it's not, correct it so that the port is shutdown. |
3129 | */ | 3121 | */ |
3130 | printk("mgsl_close: bad refcount; tty->count is 1, " | 3122 | printk("mgsl_close: bad refcount; tty->count is 1, " |
3131 | "info->count is %d\n", info->count); | 3123 | "info->port.count is %d\n", info->port.count); |
3132 | info->count = 1; | 3124 | info->port.count = 1; |
3133 | } | 3125 | } |
3134 | 3126 | ||
3135 | info->count--; | 3127 | info->port.count--; |
3136 | 3128 | ||
3137 | /* if at least one open remaining, leave hardware active */ | 3129 | /* if at least one open remaining, leave hardware active */ |
3138 | if (info->count) | 3130 | if (info->port.count) |
3139 | goto cleanup; | 3131 | goto cleanup; |
3140 | 3132 | ||
3141 | info->flags |= ASYNC_CLOSING; | 3133 | info->port.flags |= ASYNC_CLOSING; |
3142 | 3134 | ||
3143 | /* set tty->closing to notify line discipline to | 3135 | /* set tty->closing to notify line discipline to |
3144 | * only process XON/XOFF characters. Only the N_TTY | 3136 | * only process XON/XOFF characters. Only the N_TTY |
@@ -3148,14 +3140,14 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp) | |||
3148 | 3140 | ||
3149 | /* wait for transmit data to clear all layers */ | 3141 | /* wait for transmit data to clear all layers */ |
3150 | 3142 | ||
3151 | if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) { | 3143 | if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) { |
3152 | if (debug_level >= DEBUG_LEVEL_INFO) | 3144 | if (debug_level >= DEBUG_LEVEL_INFO) |
3153 | printk("%s(%d):mgsl_close(%s) calling tty_wait_until_sent\n", | 3145 | printk("%s(%d):mgsl_close(%s) calling tty_wait_until_sent\n", |
3154 | __FILE__,__LINE__, info->device_name ); | 3146 | __FILE__,__LINE__, info->device_name ); |
3155 | tty_wait_until_sent(tty, info->closing_wait); | 3147 | tty_wait_until_sent(tty, info->port.closing_wait); |
3156 | } | 3148 | } |
3157 | 3149 | ||
3158 | if (info->flags & ASYNC_INITIALIZED) | 3150 | if (info->port.flags & ASYNC_INITIALIZED) |
3159 | mgsl_wait_until_sent(tty, info->timeout); | 3151 | mgsl_wait_until_sent(tty, info->timeout); |
3160 | 3152 | ||
3161 | mgsl_flush_buffer(tty); | 3153 | mgsl_flush_buffer(tty); |
@@ -3165,23 +3157,23 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp) | |||
3165 | shutdown(info); | 3157 | shutdown(info); |
3166 | 3158 | ||
3167 | tty->closing = 0; | 3159 | tty->closing = 0; |
3168 | info->tty = NULL; | 3160 | info->port.tty = NULL; |
3169 | 3161 | ||
3170 | if (info->blocked_open) { | 3162 | if (info->port.blocked_open) { |
3171 | if (info->close_delay) { | 3163 | if (info->port.close_delay) { |
3172 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | 3164 | msleep_interruptible(jiffies_to_msecs(info->port.close_delay)); |
3173 | } | 3165 | } |
3174 | wake_up_interruptible(&info->open_wait); | 3166 | wake_up_interruptible(&info->port.open_wait); |
3175 | } | 3167 | } |
3176 | 3168 | ||
3177 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 3169 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
3178 | 3170 | ||
3179 | wake_up_interruptible(&info->close_wait); | 3171 | wake_up_interruptible(&info->port.close_wait); |
3180 | 3172 | ||
3181 | cleanup: | 3173 | cleanup: |
3182 | if (debug_level >= DEBUG_LEVEL_INFO) | 3174 | if (debug_level >= DEBUG_LEVEL_INFO) |
3183 | printk("%s(%d):mgsl_close(%s) exit, count=%d\n", __FILE__,__LINE__, | 3175 | printk("%s(%d):mgsl_close(%s) exit, count=%d\n", __FILE__,__LINE__, |
3184 | tty->driver->name, info->count); | 3176 | tty->driver->name, info->port.count); |
3185 | 3177 | ||
3186 | } /* end of mgsl_close() */ | 3178 | } /* end of mgsl_close() */ |
3187 | 3179 | ||
@@ -3211,7 +3203,7 @@ static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout) | |||
3211 | if (mgsl_paranoia_check(info, tty->name, "mgsl_wait_until_sent")) | 3203 | if (mgsl_paranoia_check(info, tty->name, "mgsl_wait_until_sent")) |
3212 | return; | 3204 | return; |
3213 | 3205 | ||
3214 | if (!(info->flags & ASYNC_INITIALIZED)) | 3206 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
3215 | goto exit; | 3207 | goto exit; |
3216 | 3208 | ||
3217 | orig_jiffies = jiffies; | 3209 | orig_jiffies = jiffies; |
@@ -3283,11 +3275,11 @@ static void mgsl_hangup(struct tty_struct *tty) | |||
3283 | mgsl_flush_buffer(tty); | 3275 | mgsl_flush_buffer(tty); |
3284 | shutdown(info); | 3276 | shutdown(info); |
3285 | 3277 | ||
3286 | info->count = 0; | 3278 | info->port.count = 0; |
3287 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 3279 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
3288 | info->tty = NULL; | 3280 | info->port.tty = NULL; |
3289 | 3281 | ||
3290 | wake_up_interruptible(&info->open_wait); | 3282 | wake_up_interruptible(&info->port.open_wait); |
3291 | 3283 | ||
3292 | } /* end of mgsl_hangup() */ | 3284 | } /* end of mgsl_hangup() */ |
3293 | 3285 | ||
@@ -3319,7 +3311,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3319 | 3311 | ||
3320 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ | 3312 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ |
3321 | /* nonblock mode is set or port is not enabled */ | 3313 | /* nonblock mode is set or port is not enabled */ |
3322 | info->flags |= ASYNC_NORMAL_ACTIVE; | 3314 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
3323 | return 0; | 3315 | return 0; |
3324 | } | 3316 | } |
3325 | 3317 | ||
@@ -3328,25 +3320,25 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3328 | 3320 | ||
3329 | /* Wait for carrier detect and the line to become | 3321 | /* Wait for carrier detect and the line to become |
3330 | * free (i.e., not in use by the callout). While we are in | 3322 | * free (i.e., not in use by the callout). While we are in |
3331 | * this loop, info->count is dropped by one, so that | 3323 | * this loop, info->port.count is dropped by one, so that |
3332 | * mgsl_close() knows when to free things. We restore it upon | 3324 | * mgsl_close() knows when to free things. We restore it upon |
3333 | * exit, either normal or abnormal. | 3325 | * exit, either normal or abnormal. |
3334 | */ | 3326 | */ |
3335 | 3327 | ||
3336 | retval = 0; | 3328 | retval = 0; |
3337 | add_wait_queue(&info->open_wait, &wait); | 3329 | add_wait_queue(&info->port.open_wait, &wait); |
3338 | 3330 | ||
3339 | if (debug_level >= DEBUG_LEVEL_INFO) | 3331 | if (debug_level >= DEBUG_LEVEL_INFO) |
3340 | printk("%s(%d):block_til_ready before block on %s count=%d\n", | 3332 | printk("%s(%d):block_til_ready before block on %s count=%d\n", |
3341 | __FILE__,__LINE__, tty->driver->name, info->count ); | 3333 | __FILE__,__LINE__, tty->driver->name, info->port.count ); |
3342 | 3334 | ||
3343 | spin_lock_irqsave(&info->irq_spinlock, flags); | 3335 | spin_lock_irqsave(&info->irq_spinlock, flags); |
3344 | if (!tty_hung_up_p(filp)) { | 3336 | if (!tty_hung_up_p(filp)) { |
3345 | extra_count = true; | 3337 | extra_count = true; |
3346 | info->count--; | 3338 | info->port.count--; |
3347 | } | 3339 | } |
3348 | spin_unlock_irqrestore(&info->irq_spinlock, flags); | 3340 | spin_unlock_irqrestore(&info->irq_spinlock, flags); |
3349 | info->blocked_open++; | 3341 | info->port.blocked_open++; |
3350 | 3342 | ||
3351 | while (1) { | 3343 | while (1) { |
3352 | if (tty->termios->c_cflag & CBAUD) { | 3344 | if (tty->termios->c_cflag & CBAUD) { |
@@ -3358,8 +3350,8 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3358 | 3350 | ||
3359 | set_current_state(TASK_INTERRUPTIBLE); | 3351 | set_current_state(TASK_INTERRUPTIBLE); |
3360 | 3352 | ||
3361 | if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)){ | 3353 | if (tty_hung_up_p(filp) || !(info->port.flags & ASYNC_INITIALIZED)){ |
3362 | retval = (info->flags & ASYNC_HUP_NOTIFY) ? | 3354 | retval = (info->port.flags & ASYNC_HUP_NOTIFY) ? |
3363 | -EAGAIN : -ERESTARTSYS; | 3355 | -EAGAIN : -ERESTARTSYS; |
3364 | break; | 3356 | break; |
3365 | } | 3357 | } |
@@ -3368,7 +3360,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3368 | usc_get_serial_signals(info); | 3360 | usc_get_serial_signals(info); |
3369 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 3361 | spin_unlock_irqrestore(&info->irq_spinlock,flags); |
3370 | 3362 | ||
3371 | if (!(info->flags & ASYNC_CLOSING) && | 3363 | if (!(info->port.flags & ASYNC_CLOSING) && |
3372 | (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { | 3364 | (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { |
3373 | break; | 3365 | break; |
3374 | } | 3366 | } |
@@ -3380,24 +3372,24 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3380 | 3372 | ||
3381 | if (debug_level >= DEBUG_LEVEL_INFO) | 3373 | if (debug_level >= DEBUG_LEVEL_INFO) |
3382 | printk("%s(%d):block_til_ready blocking on %s count=%d\n", | 3374 | printk("%s(%d):block_til_ready blocking on %s count=%d\n", |
3383 | __FILE__,__LINE__, tty->driver->name, info->count ); | 3375 | __FILE__,__LINE__, tty->driver->name, info->port.count ); |
3384 | 3376 | ||
3385 | schedule(); | 3377 | schedule(); |
3386 | } | 3378 | } |
3387 | 3379 | ||
3388 | set_current_state(TASK_RUNNING); | 3380 | set_current_state(TASK_RUNNING); |
3389 | remove_wait_queue(&info->open_wait, &wait); | 3381 | remove_wait_queue(&info->port.open_wait, &wait); |
3390 | 3382 | ||
3391 | if (extra_count) | 3383 | if (extra_count) |
3392 | info->count++; | 3384 | info->port.count++; |
3393 | info->blocked_open--; | 3385 | info->port.blocked_open--; |
3394 | 3386 | ||
3395 | if (debug_level >= DEBUG_LEVEL_INFO) | 3387 | if (debug_level >= DEBUG_LEVEL_INFO) |
3396 | printk("%s(%d):block_til_ready after blocking on %s count=%d\n", | 3388 | printk("%s(%d):block_til_ready after blocking on %s count=%d\n", |
3397 | __FILE__,__LINE__, tty->driver->name, info->count ); | 3389 | __FILE__,__LINE__, tty->driver->name, info->port.count ); |
3398 | 3390 | ||
3399 | if (!retval) | 3391 | if (!retval) |
3400 | info->flags |= ASYNC_NORMAL_ACTIVE; | 3392 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
3401 | 3393 | ||
3402 | return retval; | 3394 | return retval; |
3403 | 3395 | ||
@@ -3435,22 +3427,22 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp) | |||
3435 | return -ENODEV; | 3427 | return -ENODEV; |
3436 | 3428 | ||
3437 | tty->driver_data = info; | 3429 | tty->driver_data = info; |
3438 | info->tty = tty; | 3430 | info->port.tty = tty; |
3439 | 3431 | ||
3440 | if (debug_level >= DEBUG_LEVEL_INFO) | 3432 | if (debug_level >= DEBUG_LEVEL_INFO) |
3441 | printk("%s(%d):mgsl_open(%s), old ref count = %d\n", | 3433 | printk("%s(%d):mgsl_open(%s), old ref count = %d\n", |
3442 | __FILE__,__LINE__,tty->driver->name, info->count); | 3434 | __FILE__,__LINE__,tty->driver->name, info->port.count); |
3443 | 3435 | ||
3444 | /* If port is closing, signal caller to try again */ | 3436 | /* If port is closing, signal caller to try again */ |
3445 | if (tty_hung_up_p(filp) || info->flags & ASYNC_CLOSING){ | 3437 | if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){ |
3446 | if (info->flags & ASYNC_CLOSING) | 3438 | if (info->port.flags & ASYNC_CLOSING) |
3447 | interruptible_sleep_on(&info->close_wait); | 3439 | interruptible_sleep_on(&info->port.close_wait); |
3448 | retval = ((info->flags & ASYNC_HUP_NOTIFY) ? | 3440 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
3449 | -EAGAIN : -ERESTARTSYS); | 3441 | -EAGAIN : -ERESTARTSYS); |
3450 | goto cleanup; | 3442 | goto cleanup; |
3451 | } | 3443 | } |
3452 | 3444 | ||
3453 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 3445 | info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
3454 | 3446 | ||
3455 | spin_lock_irqsave(&info->netlock, flags); | 3447 | spin_lock_irqsave(&info->netlock, flags); |
3456 | if (info->netcount) { | 3448 | if (info->netcount) { |
@@ -3458,10 +3450,10 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp) | |||
3458 | spin_unlock_irqrestore(&info->netlock, flags); | 3450 | spin_unlock_irqrestore(&info->netlock, flags); |
3459 | goto cleanup; | 3451 | goto cleanup; |
3460 | } | 3452 | } |
3461 | info->count++; | 3453 | info->port.count++; |
3462 | spin_unlock_irqrestore(&info->netlock, flags); | 3454 | spin_unlock_irqrestore(&info->netlock, flags); |
3463 | 3455 | ||
3464 | if (info->count == 1) { | 3456 | if (info->port.count == 1) { |
3465 | /* 1st open on this device, init hardware */ | 3457 | /* 1st open on this device, init hardware */ |
3466 | retval = startup(info); | 3458 | retval = startup(info); |
3467 | if (retval < 0) | 3459 | if (retval < 0) |
@@ -3484,9 +3476,9 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp) | |||
3484 | cleanup: | 3476 | cleanup: |
3485 | if (retval) { | 3477 | if (retval) { |
3486 | if (tty->count == 1) | 3478 | if (tty->count == 1) |
3487 | info->tty = NULL; /* tty layer will release tty struct */ | 3479 | info->port.tty = NULL; /* tty layer will release tty struct */ |
3488 | if(info->count) | 3480 | if(info->port.count) |
3489 | info->count--; | 3481 | info->port.count--; |
3490 | } | 3482 | } |
3491 | 3483 | ||
3492 | return retval; | 3484 | return retval; |
@@ -4332,13 +4324,12 @@ static struct mgsl_struct* mgsl_allocate_device(void) | |||
4332 | if (!info) { | 4324 | if (!info) { |
4333 | printk("Error can't allocate device instance data\n"); | 4325 | printk("Error can't allocate device instance data\n"); |
4334 | } else { | 4326 | } else { |
4327 | tty_port_init(&info->port); | ||
4335 | info->magic = MGSL_MAGIC; | 4328 | info->magic = MGSL_MAGIC; |
4336 | INIT_WORK(&info->task, mgsl_bh_handler); | 4329 | INIT_WORK(&info->task, mgsl_bh_handler); |
4337 | info->max_frame_size = 4096; | 4330 | info->max_frame_size = 4096; |
4338 | info->close_delay = 5*HZ/10; | 4331 | info->port.close_delay = 5*HZ/10; |
4339 | info->closing_wait = 30*HZ; | 4332 | info->port.closing_wait = 30*HZ; |
4340 | init_waitqueue_head(&info->open_wait); | ||
4341 | init_waitqueue_head(&info->close_wait); | ||
4342 | init_waitqueue_head(&info->status_event_wait_q); | 4333 | init_waitqueue_head(&info->status_event_wait_q); |
4343 | init_waitqueue_head(&info->event_wait_q); | 4334 | init_waitqueue_head(&info->event_wait_q); |
4344 | spin_lock_init(&info->irq_spinlock); | 4335 | spin_lock_init(&info->irq_spinlock); |
@@ -6575,7 +6566,7 @@ static bool mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6575 | unsigned int framesize = 0; | 6566 | unsigned int framesize = 0; |
6576 | bool ReturnCode = false; | 6567 | bool ReturnCode = false; |
6577 | unsigned long flags; | 6568 | unsigned long flags; |
6578 | struct tty_struct *tty = info->tty; | 6569 | struct tty_struct *tty = info->port.tty; |
6579 | bool return_frame = false; | 6570 | bool return_frame = false; |
6580 | 6571 | ||
6581 | /* | 6572 | /* |
@@ -6640,9 +6631,8 @@ static bool mgsl_get_rx_frame(struct mgsl_struct *info) | |||
6640 | framesize = 0; | 6631 | framesize = 0; |
6641 | #if SYNCLINK_GENERIC_HDLC | 6632 | #if SYNCLINK_GENERIC_HDLC |
6642 | { | 6633 | { |
6643 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 6634 | info->netdev->stats.rx_errors++; |
6644 | stats->rx_errors++; | 6635 | info->netdev->stats.rx_frame_errors++; |
6645 | stats->rx_frame_errors++; | ||
6646 | } | 6636 | } |
6647 | #endif | 6637 | #endif |
6648 | } else | 6638 | } else |
@@ -6774,7 +6764,7 @@ static bool mgsl_get_raw_rx_frame(struct mgsl_struct *info) | |||
6774 | unsigned int framesize = 0; | 6764 | unsigned int framesize = 0; |
6775 | bool ReturnCode = false; | 6765 | bool ReturnCode = false; |
6776 | unsigned long flags; | 6766 | unsigned long flags; |
6777 | struct tty_struct *tty = info->tty; | 6767 | struct tty_struct *tty = info->port.tty; |
6778 | 6768 | ||
6779 | /* | 6769 | /* |
6780 | * current_rx_buffer points to the 1st buffer of the next available | 6770 | * current_rx_buffer points to the 1st buffer of the next available |
@@ -7711,7 +7701,7 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding, | |||
7711 | unsigned short new_crctype; | 7701 | unsigned short new_crctype; |
7712 | 7702 | ||
7713 | /* return error if TTY interface open */ | 7703 | /* return error if TTY interface open */ |
7714 | if (info->count) | 7704 | if (info->port.count) |
7715 | return -EBUSY; | 7705 | return -EBUSY; |
7716 | 7706 | ||
7717 | switch (encoding) | 7707 | switch (encoding) |
@@ -7753,7 +7743,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding, | |||
7753 | static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | 7743 | static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) |
7754 | { | 7744 | { |
7755 | struct mgsl_struct *info = dev_to_port(dev); | 7745 | struct mgsl_struct *info = dev_to_port(dev); |
7756 | struct net_device_stats *stats = hdlc_stats(dev); | ||
7757 | unsigned long flags; | 7746 | unsigned long flags; |
7758 | 7747 | ||
7759 | if (debug_level >= DEBUG_LEVEL_INFO) | 7748 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -7767,8 +7756,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7767 | mgsl_load_tx_dma_buffer(info, skb->data, skb->len); | 7756 | mgsl_load_tx_dma_buffer(info, skb->data, skb->len); |
7768 | 7757 | ||
7769 | /* update network statistics */ | 7758 | /* update network statistics */ |
7770 | stats->tx_packets++; | 7759 | dev->stats.tx_packets++; |
7771 | stats->tx_bytes += skb->len; | 7760 | dev->stats.tx_bytes += skb->len; |
7772 | 7761 | ||
7773 | /* done with socket buffer, so free it */ | 7762 | /* done with socket buffer, so free it */ |
7774 | dev_kfree_skb(skb); | 7763 | dev_kfree_skb(skb); |
@@ -7808,7 +7797,7 @@ static int hdlcdev_open(struct net_device *dev) | |||
7808 | 7797 | ||
7809 | /* arbitrate between network and tty opens */ | 7798 | /* arbitrate between network and tty opens */ |
7810 | spin_lock_irqsave(&info->netlock, flags); | 7799 | spin_lock_irqsave(&info->netlock, flags); |
7811 | if (info->count != 0 || info->netcount != 0) { | 7800 | if (info->port.count != 0 || info->netcount != 0) { |
7812 | printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name); | 7801 | printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name); |
7813 | spin_unlock_irqrestore(&info->netlock, flags); | 7802 | spin_unlock_irqrestore(&info->netlock, flags); |
7814 | return -EBUSY; | 7803 | return -EBUSY; |
@@ -7894,7 +7883,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
7894 | printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); | 7883 | printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); |
7895 | 7884 | ||
7896 | /* return error if TTY interface open */ | 7885 | /* return error if TTY interface open */ |
7897 | if (info->count) | 7886 | if (info->port.count) |
7898 | return -EBUSY; | 7887 | return -EBUSY; |
7899 | 7888 | ||
7900 | if (cmd != SIOCWANDEV) | 7889 | if (cmd != SIOCWANDEV) |
@@ -7984,14 +7973,13 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
7984 | static void hdlcdev_tx_timeout(struct net_device *dev) | 7973 | static void hdlcdev_tx_timeout(struct net_device *dev) |
7985 | { | 7974 | { |
7986 | struct mgsl_struct *info = dev_to_port(dev); | 7975 | struct mgsl_struct *info = dev_to_port(dev); |
7987 | struct net_device_stats *stats = hdlc_stats(dev); | ||
7988 | unsigned long flags; | 7976 | unsigned long flags; |
7989 | 7977 | ||
7990 | if (debug_level >= DEBUG_LEVEL_INFO) | 7978 | if (debug_level >= DEBUG_LEVEL_INFO) |
7991 | printk("hdlcdev_tx_timeout(%s)\n",dev->name); | 7979 | printk("hdlcdev_tx_timeout(%s)\n",dev->name); |
7992 | 7980 | ||
7993 | stats->tx_errors++; | 7981 | dev->stats.tx_errors++; |
7994 | stats->tx_aborted_errors++; | 7982 | dev->stats.tx_aborted_errors++; |
7995 | 7983 | ||
7996 | spin_lock_irqsave(&info->irq_spinlock,flags); | 7984 | spin_lock_irqsave(&info->irq_spinlock,flags); |
7997 | usc_stop_transmitter(info); | 7985 | usc_stop_transmitter(info); |
@@ -8024,27 +8012,27 @@ static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size) | |||
8024 | { | 8012 | { |
8025 | struct sk_buff *skb = dev_alloc_skb(size); | 8013 | struct sk_buff *skb = dev_alloc_skb(size); |
8026 | struct net_device *dev = info->netdev; | 8014 | struct net_device *dev = info->netdev; |
8027 | struct net_device_stats *stats = hdlc_stats(dev); | ||
8028 | 8015 | ||
8029 | if (debug_level >= DEBUG_LEVEL_INFO) | 8016 | if (debug_level >= DEBUG_LEVEL_INFO) |
8030 | printk("hdlcdev_rx(%s)\n",dev->name); | 8017 | printk("hdlcdev_rx(%s)\n", dev->name); |
8031 | 8018 | ||
8032 | if (skb == NULL) { | 8019 | if (skb == NULL) { |
8033 | printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); | 8020 | printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", |
8034 | stats->rx_dropped++; | 8021 | dev->name); |
8022 | dev->stats.rx_dropped++; | ||
8035 | return; | 8023 | return; |
8036 | } | 8024 | } |
8037 | 8025 | ||
8038 | memcpy(skb_put(skb, size),buf,size); | 8026 | memcpy(skb_put(skb, size), buf, size); |
8039 | 8027 | ||
8040 | skb->protocol = hdlc_type_trans(skb, info->netdev); | 8028 | skb->protocol = hdlc_type_trans(skb, dev); |
8041 | 8029 | ||
8042 | stats->rx_packets++; | 8030 | dev->stats.rx_packets++; |
8043 | stats->rx_bytes += size; | 8031 | dev->stats.rx_bytes += size; |
8044 | 8032 | ||
8045 | netif_rx(skb); | 8033 | netif_rx(skb); |
8046 | 8034 | ||
8047 | info->netdev->last_rx = jiffies; | 8035 | dev->last_rx = jiffies; |
8048 | } | 8036 | } |
8049 | 8037 | ||
8050 | /** | 8038 | /** |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 55c1653be00c..2c3e43bb2cc9 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -244,11 +244,11 @@ struct _input_signal_events { | |||
244 | */ | 244 | */ |
245 | struct slgt_info { | 245 | struct slgt_info { |
246 | void *if_ptr; /* General purpose pointer (used by SPPP) */ | 246 | void *if_ptr; /* General purpose pointer (used by SPPP) */ |
247 | struct tty_port port; | ||
247 | 248 | ||
248 | struct slgt_info *next_device; /* device list link */ | 249 | struct slgt_info *next_device; /* device list link */ |
249 | 250 | ||
250 | int magic; | 251 | int magic; |
251 | int flags; | ||
252 | 252 | ||
253 | char device_name[25]; | 253 | char device_name[25]; |
254 | struct pci_dev *pdev; | 254 | struct pci_dev *pdev; |
@@ -260,23 +260,15 @@ struct slgt_info { | |||
260 | /* array of pointers to port contexts on this adapter */ | 260 | /* array of pointers to port contexts on this adapter */ |
261 | struct slgt_info *port_array[SLGT_MAX_PORTS]; | 261 | struct slgt_info *port_array[SLGT_MAX_PORTS]; |
262 | 262 | ||
263 | int count; /* count of opens */ | ||
264 | int line; /* tty line instance number */ | 263 | int line; /* tty line instance number */ |
265 | unsigned short close_delay; | ||
266 | unsigned short closing_wait; /* time to wait before closing */ | ||
267 | 264 | ||
268 | struct mgsl_icount icount; | 265 | struct mgsl_icount icount; |
269 | 266 | ||
270 | struct tty_struct *tty; | ||
271 | int timeout; | 267 | int timeout; |
272 | int x_char; /* xon/xoff character */ | 268 | int x_char; /* xon/xoff character */ |
273 | int blocked_open; /* # of blocked opens */ | ||
274 | unsigned int read_status_mask; | 269 | unsigned int read_status_mask; |
275 | unsigned int ignore_status_mask; | 270 | unsigned int ignore_status_mask; |
276 | 271 | ||
277 | wait_queue_head_t open_wait; | ||
278 | wait_queue_head_t close_wait; | ||
279 | |||
280 | wait_queue_head_t status_event_wait_q; | 272 | wait_queue_head_t status_event_wait_q; |
281 | wait_queue_head_t event_wait_q; | 273 | wait_queue_head_t event_wait_q; |
282 | struct timer_list tx_timer; | 274 | struct timer_list tx_timer; |
@@ -641,8 +633,8 @@ static void ldisc_receive_buf(struct tty_struct *tty, | |||
641 | return; | 633 | return; |
642 | ld = tty_ldisc_ref(tty); | 634 | ld = tty_ldisc_ref(tty); |
643 | if (ld) { | 635 | if (ld) { |
644 | if (ld->receive_buf) | 636 | if (ld->ops->receive_buf) |
645 | ld->receive_buf(tty, data, flags, count); | 637 | ld->ops->receive_buf(tty, data, flags, count); |
646 | tty_ldisc_deref(ld); | 638 | tty_ldisc_deref(ld); |
647 | } | 639 | } |
648 | } | 640 | } |
@@ -672,20 +664,20 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
672 | } | 664 | } |
673 | 665 | ||
674 | tty->driver_data = info; | 666 | tty->driver_data = info; |
675 | info->tty = tty; | 667 | info->port.tty = tty; |
676 | 668 | ||
677 | DBGINFO(("%s open, old ref count = %d\n", info->device_name, info->count)); | 669 | DBGINFO(("%s open, old ref count = %d\n", info->device_name, info->port.count)); |
678 | 670 | ||
679 | /* If port is closing, signal caller to try again */ | 671 | /* If port is closing, signal caller to try again */ |
680 | if (tty_hung_up_p(filp) || info->flags & ASYNC_CLOSING){ | 672 | if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){ |
681 | if (info->flags & ASYNC_CLOSING) | 673 | if (info->port.flags & ASYNC_CLOSING) |
682 | interruptible_sleep_on(&info->close_wait); | 674 | interruptible_sleep_on(&info->port.close_wait); |
683 | retval = ((info->flags & ASYNC_HUP_NOTIFY) ? | 675 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
684 | -EAGAIN : -ERESTARTSYS); | 676 | -EAGAIN : -ERESTARTSYS); |
685 | goto cleanup; | 677 | goto cleanup; |
686 | } | 678 | } |
687 | 679 | ||
688 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 680 | info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
689 | 681 | ||
690 | spin_lock_irqsave(&info->netlock, flags); | 682 | spin_lock_irqsave(&info->netlock, flags); |
691 | if (info->netcount) { | 683 | if (info->netcount) { |
@@ -693,10 +685,10 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
693 | spin_unlock_irqrestore(&info->netlock, flags); | 685 | spin_unlock_irqrestore(&info->netlock, flags); |
694 | goto cleanup; | 686 | goto cleanup; |
695 | } | 687 | } |
696 | info->count++; | 688 | info->port.count++; |
697 | spin_unlock_irqrestore(&info->netlock, flags); | 689 | spin_unlock_irqrestore(&info->netlock, flags); |
698 | 690 | ||
699 | if (info->count == 1) { | 691 | if (info->port.count == 1) { |
700 | /* 1st open on this device, init hardware */ | 692 | /* 1st open on this device, init hardware */ |
701 | retval = startup(info); | 693 | retval = startup(info); |
702 | if (retval < 0) | 694 | if (retval < 0) |
@@ -714,9 +706,9 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
714 | cleanup: | 706 | cleanup: |
715 | if (retval) { | 707 | if (retval) { |
716 | if (tty->count == 1) | 708 | if (tty->count == 1) |
717 | info->tty = NULL; /* tty layer will release tty struct */ | 709 | info->port.tty = NULL; /* tty layer will release tty struct */ |
718 | if(info->count) | 710 | if(info->port.count) |
719 | info->count--; | 711 | info->port.count--; |
720 | } | 712 | } |
721 | 713 | ||
722 | DBGINFO(("%s open rc=%d\n", info->device_name, retval)); | 714 | DBGINFO(("%s open rc=%d\n", info->device_name, retval)); |
@@ -729,32 +721,32 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
729 | 721 | ||
730 | if (sanity_check(info, tty->name, "close")) | 722 | if (sanity_check(info, tty->name, "close")) |
731 | return; | 723 | return; |
732 | DBGINFO(("%s close entry, count=%d\n", info->device_name, info->count)); | 724 | DBGINFO(("%s close entry, count=%d\n", info->device_name, info->port.count)); |
733 | 725 | ||
734 | if (!info->count) | 726 | if (!info->port.count) |
735 | return; | 727 | return; |
736 | 728 | ||
737 | if (tty_hung_up_p(filp)) | 729 | if (tty_hung_up_p(filp)) |
738 | goto cleanup; | 730 | goto cleanup; |
739 | 731 | ||
740 | if ((tty->count == 1) && (info->count != 1)) { | 732 | if ((tty->count == 1) && (info->port.count != 1)) { |
741 | /* | 733 | /* |
742 | * tty->count is 1 and the tty structure will be freed. | 734 | * tty->count is 1 and the tty structure will be freed. |
743 | * info->count should be one in this case. | 735 | * info->port.count should be one in this case. |
744 | * if it's not, correct it so that the port is shutdown. | 736 | * if it's not, correct it so that the port is shutdown. |
745 | */ | 737 | */ |
746 | DBGERR(("%s close: bad refcount; tty->count=1, " | 738 | DBGERR(("%s close: bad refcount; tty->count=1, " |
747 | "info->count=%d\n", info->device_name, info->count)); | 739 | "info->port.count=%d\n", info->device_name, info->port.count)); |
748 | info->count = 1; | 740 | info->port.count = 1; |
749 | } | 741 | } |
750 | 742 | ||
751 | info->count--; | 743 | info->port.count--; |
752 | 744 | ||
753 | /* if at least one open remaining, leave hardware active */ | 745 | /* if at least one open remaining, leave hardware active */ |
754 | if (info->count) | 746 | if (info->port.count) |
755 | goto cleanup; | 747 | goto cleanup; |
756 | 748 | ||
757 | info->flags |= ASYNC_CLOSING; | 749 | info->port.flags |= ASYNC_CLOSING; |
758 | 750 | ||
759 | /* set tty->closing to notify line discipline to | 751 | /* set tty->closing to notify line discipline to |
760 | * only process XON/XOFF characters. Only the N_TTY | 752 | * only process XON/XOFF characters. Only the N_TTY |
@@ -764,12 +756,12 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
764 | 756 | ||
765 | /* wait for transmit data to clear all layers */ | 757 | /* wait for transmit data to clear all layers */ |
766 | 758 | ||
767 | if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) { | 759 | if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) { |
768 | DBGINFO(("%s call tty_wait_until_sent\n", info->device_name)); | 760 | DBGINFO(("%s call tty_wait_until_sent\n", info->device_name)); |
769 | tty_wait_until_sent(tty, info->closing_wait); | 761 | tty_wait_until_sent(tty, info->port.closing_wait); |
770 | } | 762 | } |
771 | 763 | ||
772 | if (info->flags & ASYNC_INITIALIZED) | 764 | if (info->port.flags & ASYNC_INITIALIZED) |
773 | wait_until_sent(tty, info->timeout); | 765 | wait_until_sent(tty, info->timeout); |
774 | flush_buffer(tty); | 766 | flush_buffer(tty); |
775 | tty_ldisc_flush(tty); | 767 | tty_ldisc_flush(tty); |
@@ -777,21 +769,21 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
777 | shutdown(info); | 769 | shutdown(info); |
778 | 770 | ||
779 | tty->closing = 0; | 771 | tty->closing = 0; |
780 | info->tty = NULL; | 772 | info->port.tty = NULL; |
781 | 773 | ||
782 | if (info->blocked_open) { | 774 | if (info->port.blocked_open) { |
783 | if (info->close_delay) { | 775 | if (info->port.close_delay) { |
784 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | 776 | msleep_interruptible(jiffies_to_msecs(info->port.close_delay)); |
785 | } | 777 | } |
786 | wake_up_interruptible(&info->open_wait); | 778 | wake_up_interruptible(&info->port.open_wait); |
787 | } | 779 | } |
788 | 780 | ||
789 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 781 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
790 | 782 | ||
791 | wake_up_interruptible(&info->close_wait); | 783 | wake_up_interruptible(&info->port.close_wait); |
792 | 784 | ||
793 | cleanup: | 785 | cleanup: |
794 | DBGINFO(("%s close exit, count=%d\n", tty->driver->name, info->count)); | 786 | DBGINFO(("%s close exit, count=%d\n", tty->driver->name, info->port.count)); |
795 | } | 787 | } |
796 | 788 | ||
797 | static void hangup(struct tty_struct *tty) | 789 | static void hangup(struct tty_struct *tty) |
@@ -805,11 +797,11 @@ static void hangup(struct tty_struct *tty) | |||
805 | flush_buffer(tty); | 797 | flush_buffer(tty); |
806 | shutdown(info); | 798 | shutdown(info); |
807 | 799 | ||
808 | info->count = 0; | 800 | info->port.count = 0; |
809 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 801 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
810 | info->tty = NULL; | 802 | info->port.tty = NULL; |
811 | 803 | ||
812 | wake_up_interruptible(&info->open_wait); | 804 | wake_up_interruptible(&info->port.open_wait); |
813 | } | 805 | } |
814 | 806 | ||
815 | static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) | 807 | static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
@@ -959,7 +951,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout) | |||
959 | if (sanity_check(info, tty->name, "wait_until_sent")) | 951 | if (sanity_check(info, tty->name, "wait_until_sent")) |
960 | return; | 952 | return; |
961 | DBGINFO(("%s wait_until_sent entry\n", info->device_name)); | 953 | DBGINFO(("%s wait_until_sent entry\n", info->device_name)); |
962 | if (!(info->flags & ASYNC_INITIALIZED)) | 954 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
963 | goto exit; | 955 | goto exit; |
964 | 956 | ||
965 | orig_jiffies = jiffies; | 957 | orig_jiffies = jiffies; |
@@ -1500,7 +1492,7 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding, | |||
1500 | unsigned short new_crctype; | 1492 | unsigned short new_crctype; |
1501 | 1493 | ||
1502 | /* return error if TTY interface open */ | 1494 | /* return error if TTY interface open */ |
1503 | if (info->count) | 1495 | if (info->port.count) |
1504 | return -EBUSY; | 1496 | return -EBUSY; |
1505 | 1497 | ||
1506 | DBGINFO(("%s hdlcdev_attach\n", info->device_name)); | 1498 | DBGINFO(("%s hdlcdev_attach\n", info->device_name)); |
@@ -1544,7 +1536,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding, | |||
1544 | static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | 1536 | static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) |
1545 | { | 1537 | { |
1546 | struct slgt_info *info = dev_to_port(dev); | 1538 | struct slgt_info *info = dev_to_port(dev); |
1547 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1548 | unsigned long flags; | 1539 | unsigned long flags; |
1549 | 1540 | ||
1550 | DBGINFO(("%s hdlc_xmit\n", dev->name)); | 1541 | DBGINFO(("%s hdlc_xmit\n", dev->name)); |
@@ -1557,8 +1548,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1557 | tx_load(info, skb->data, skb->len); | 1548 | tx_load(info, skb->data, skb->len); |
1558 | 1549 | ||
1559 | /* update network statistics */ | 1550 | /* update network statistics */ |
1560 | stats->tx_packets++; | 1551 | dev->stats.tx_packets++; |
1561 | stats->tx_bytes += skb->len; | 1552 | dev->stats.tx_bytes += skb->len; |
1562 | 1553 | ||
1563 | /* done with socket buffer, so free it */ | 1554 | /* done with socket buffer, so free it */ |
1564 | dev_kfree_skb(skb); | 1555 | dev_kfree_skb(skb); |
@@ -1600,7 +1591,7 @@ static int hdlcdev_open(struct net_device *dev) | |||
1600 | 1591 | ||
1601 | /* arbitrate between network and tty opens */ | 1592 | /* arbitrate between network and tty opens */ |
1602 | spin_lock_irqsave(&info->netlock, flags); | 1593 | spin_lock_irqsave(&info->netlock, flags); |
1603 | if (info->count != 0 || info->netcount != 0) { | 1594 | if (info->port.count != 0 || info->netcount != 0) { |
1604 | DBGINFO(("%s hdlc_open busy\n", dev->name)); | 1595 | DBGINFO(("%s hdlc_open busy\n", dev->name)); |
1605 | spin_unlock_irqrestore(&info->netlock, flags); | 1596 | spin_unlock_irqrestore(&info->netlock, flags); |
1606 | return -EBUSY; | 1597 | return -EBUSY; |
@@ -1685,7 +1676,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1685 | DBGINFO(("%s hdlcdev_ioctl\n", dev->name)); | 1676 | DBGINFO(("%s hdlcdev_ioctl\n", dev->name)); |
1686 | 1677 | ||
1687 | /* return error if TTY interface open */ | 1678 | /* return error if TTY interface open */ |
1688 | if (info->count) | 1679 | if (info->port.count) |
1689 | return -EBUSY; | 1680 | return -EBUSY; |
1690 | 1681 | ||
1691 | if (cmd != SIOCWANDEV) | 1682 | if (cmd != SIOCWANDEV) |
@@ -1775,13 +1766,12 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1775 | static void hdlcdev_tx_timeout(struct net_device *dev) | 1766 | static void hdlcdev_tx_timeout(struct net_device *dev) |
1776 | { | 1767 | { |
1777 | struct slgt_info *info = dev_to_port(dev); | 1768 | struct slgt_info *info = dev_to_port(dev); |
1778 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1779 | unsigned long flags; | 1769 | unsigned long flags; |
1780 | 1770 | ||
1781 | DBGINFO(("%s hdlcdev_tx_timeout\n", dev->name)); | 1771 | DBGINFO(("%s hdlcdev_tx_timeout\n", dev->name)); |
1782 | 1772 | ||
1783 | stats->tx_errors++; | 1773 | dev->stats.tx_errors++; |
1784 | stats->tx_aborted_errors++; | 1774 | dev->stats.tx_aborted_errors++; |
1785 | 1775 | ||
1786 | spin_lock_irqsave(&info->lock,flags); | 1776 | spin_lock_irqsave(&info->lock,flags); |
1787 | tx_stop(info); | 1777 | tx_stop(info); |
@@ -1814,26 +1804,25 @@ static void hdlcdev_rx(struct slgt_info *info, char *buf, int size) | |||
1814 | { | 1804 | { |
1815 | struct sk_buff *skb = dev_alloc_skb(size); | 1805 | struct sk_buff *skb = dev_alloc_skb(size); |
1816 | struct net_device *dev = info->netdev; | 1806 | struct net_device *dev = info->netdev; |
1817 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1818 | 1807 | ||
1819 | DBGINFO(("%s hdlcdev_rx\n", dev->name)); | 1808 | DBGINFO(("%s hdlcdev_rx\n", dev->name)); |
1820 | 1809 | ||
1821 | if (skb == NULL) { | 1810 | if (skb == NULL) { |
1822 | DBGERR(("%s: can't alloc skb, drop packet\n", dev->name)); | 1811 | DBGERR(("%s: can't alloc skb, drop packet\n", dev->name)); |
1823 | stats->rx_dropped++; | 1812 | dev->stats.rx_dropped++; |
1824 | return; | 1813 | return; |
1825 | } | 1814 | } |
1826 | 1815 | ||
1827 | memcpy(skb_put(skb, size),buf,size); | 1816 | memcpy(skb_put(skb, size), buf, size); |
1828 | 1817 | ||
1829 | skb->protocol = hdlc_type_trans(skb, info->netdev); | 1818 | skb->protocol = hdlc_type_trans(skb, dev); |
1830 | 1819 | ||
1831 | stats->rx_packets++; | 1820 | dev->stats.rx_packets++; |
1832 | stats->rx_bytes += size; | 1821 | dev->stats.rx_bytes += size; |
1833 | 1822 | ||
1834 | netif_rx(skb); | 1823 | netif_rx(skb); |
1835 | 1824 | ||
1836 | info->netdev->last_rx = jiffies; | 1825 | dev->last_rx = jiffies; |
1837 | } | 1826 | } |
1838 | 1827 | ||
1839 | /** | 1828 | /** |
@@ -1906,7 +1895,7 @@ static void hdlcdev_exit(struct slgt_info *info) | |||
1906 | */ | 1895 | */ |
1907 | static void rx_async(struct slgt_info *info) | 1896 | static void rx_async(struct slgt_info *info) |
1908 | { | 1897 | { |
1909 | struct tty_struct *tty = info->tty; | 1898 | struct tty_struct *tty = info->port.tty; |
1910 | struct mgsl_icount *icount = &info->icount; | 1899 | struct mgsl_icount *icount = &info->icount; |
1911 | unsigned int start, end; | 1900 | unsigned int start, end; |
1912 | unsigned char *p; | 1901 | unsigned char *p; |
@@ -2057,7 +2046,7 @@ static void bh_handler(struct work_struct *work) | |||
2057 | 2046 | ||
2058 | static void bh_transmit(struct slgt_info *info) | 2047 | static void bh_transmit(struct slgt_info *info) |
2059 | { | 2048 | { |
2060 | struct tty_struct *tty = info->tty; | 2049 | struct tty_struct *tty = info->port.tty; |
2061 | 2050 | ||
2062 | DBGBH(("%s bh_transmit\n", info->device_name)); | 2051 | DBGBH(("%s bh_transmit\n", info->device_name)); |
2063 | if (tty) | 2052 | if (tty) |
@@ -2103,17 +2092,17 @@ static void cts_change(struct slgt_info *info, unsigned short status) | |||
2103 | wake_up_interruptible(&info->event_wait_q); | 2092 | wake_up_interruptible(&info->event_wait_q); |
2104 | info->pending_bh |= BH_STATUS; | 2093 | info->pending_bh |= BH_STATUS; |
2105 | 2094 | ||
2106 | if (info->flags & ASYNC_CTS_FLOW) { | 2095 | if (info->port.flags & ASYNC_CTS_FLOW) { |
2107 | if (info->tty) { | 2096 | if (info->port.tty) { |
2108 | if (info->tty->hw_stopped) { | 2097 | if (info->port.tty->hw_stopped) { |
2109 | if (info->signals & SerialSignal_CTS) { | 2098 | if (info->signals & SerialSignal_CTS) { |
2110 | info->tty->hw_stopped = 0; | 2099 | info->port.tty->hw_stopped = 0; |
2111 | info->pending_bh |= BH_TRANSMIT; | 2100 | info->pending_bh |= BH_TRANSMIT; |
2112 | return; | 2101 | return; |
2113 | } | 2102 | } |
2114 | } else { | 2103 | } else { |
2115 | if (!(info->signals & SerialSignal_CTS)) | 2104 | if (!(info->signals & SerialSignal_CTS)) |
2116 | info->tty->hw_stopped = 1; | 2105 | info->port.tty->hw_stopped = 1; |
2117 | } | 2106 | } |
2118 | } | 2107 | } |
2119 | } | 2108 | } |
@@ -2146,12 +2135,12 @@ static void dcd_change(struct slgt_info *info, unsigned short status) | |||
2146 | wake_up_interruptible(&info->event_wait_q); | 2135 | wake_up_interruptible(&info->event_wait_q); |
2147 | info->pending_bh |= BH_STATUS; | 2136 | info->pending_bh |= BH_STATUS; |
2148 | 2137 | ||
2149 | if (info->flags & ASYNC_CHECK_CD) { | 2138 | if (info->port.flags & ASYNC_CHECK_CD) { |
2150 | if (info->signals & SerialSignal_DCD) | 2139 | if (info->signals & SerialSignal_DCD) |
2151 | wake_up_interruptible(&info->open_wait); | 2140 | wake_up_interruptible(&info->port.open_wait); |
2152 | else { | 2141 | else { |
2153 | if (info->tty) | 2142 | if (info->port.tty) |
2154 | tty_hangup(info->tty); | 2143 | tty_hangup(info->port.tty); |
2155 | } | 2144 | } |
2156 | } | 2145 | } |
2157 | } | 2146 | } |
@@ -2194,12 +2183,12 @@ static void isr_serial(struct slgt_info *info) | |||
2194 | if ((status & IRQ_RXBREAK) && (status & RXBREAK)) { | 2183 | if ((status & IRQ_RXBREAK) && (status & RXBREAK)) { |
2195 | info->icount.brk++; | 2184 | info->icount.brk++; |
2196 | /* process break detection if tty control allows */ | 2185 | /* process break detection if tty control allows */ |
2197 | if (info->tty) { | 2186 | if (info->port.tty) { |
2198 | if (!(status & info->ignore_status_mask)) { | 2187 | if (!(status & info->ignore_status_mask)) { |
2199 | if (info->read_status_mask & MASK_BREAK) { | 2188 | if (info->read_status_mask & MASK_BREAK) { |
2200 | tty_insert_flip_char(info->tty, 0, TTY_BREAK); | 2189 | tty_insert_flip_char(info->port.tty, 0, TTY_BREAK); |
2201 | if (info->flags & ASYNC_SAK) | 2190 | if (info->port.flags & ASYNC_SAK) |
2202 | do_SAK(info->tty); | 2191 | do_SAK(info->port.tty); |
2203 | } | 2192 | } |
2204 | } | 2193 | } |
2205 | } | 2194 | } |
@@ -2319,7 +2308,7 @@ static void isr_txeom(struct slgt_info *info, unsigned short status) | |||
2319 | else | 2308 | else |
2320 | #endif | 2309 | #endif |
2321 | { | 2310 | { |
2322 | if (info->tty && (info->tty->stopped || info->tty->hw_stopped)) { | 2311 | if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { |
2323 | tx_stop(info); | 2312 | tx_stop(info); |
2324 | return; | 2313 | return; |
2325 | } | 2314 | } |
@@ -2395,7 +2384,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id) | |||
2395 | for(i=0; i < info->port_count ; i++) { | 2384 | for(i=0; i < info->port_count ; i++) { |
2396 | struct slgt_info *port = info->port_array[i]; | 2385 | struct slgt_info *port = info->port_array[i]; |
2397 | 2386 | ||
2398 | if (port && (port->count || port->netcount) && | 2387 | if (port && (port->port.count || port->netcount) && |
2399 | port->pending_bh && !port->bh_running && | 2388 | port->pending_bh && !port->bh_running && |
2400 | !port->bh_requested) { | 2389 | !port->bh_requested) { |
2401 | DBGISR(("%s bh queued\n", port->device_name)); | 2390 | DBGISR(("%s bh queued\n", port->device_name)); |
@@ -2414,7 +2403,7 @@ static int startup(struct slgt_info *info) | |||
2414 | { | 2403 | { |
2415 | DBGINFO(("%s startup\n", info->device_name)); | 2404 | DBGINFO(("%s startup\n", info->device_name)); |
2416 | 2405 | ||
2417 | if (info->flags & ASYNC_INITIALIZED) | 2406 | if (info->port.flags & ASYNC_INITIALIZED) |
2418 | return 0; | 2407 | return 0; |
2419 | 2408 | ||
2420 | if (!info->tx_buf) { | 2409 | if (!info->tx_buf) { |
@@ -2432,10 +2421,10 @@ static int startup(struct slgt_info *info) | |||
2432 | /* program hardware for current parameters */ | 2421 | /* program hardware for current parameters */ |
2433 | change_params(info); | 2422 | change_params(info); |
2434 | 2423 | ||
2435 | if (info->tty) | 2424 | if (info->port.tty) |
2436 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 2425 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2437 | 2426 | ||
2438 | info->flags |= ASYNC_INITIALIZED; | 2427 | info->port.flags |= ASYNC_INITIALIZED; |
2439 | 2428 | ||
2440 | return 0; | 2429 | return 0; |
2441 | } | 2430 | } |
@@ -2447,7 +2436,7 @@ static void shutdown(struct slgt_info *info) | |||
2447 | { | 2436 | { |
2448 | unsigned long flags; | 2437 | unsigned long flags; |
2449 | 2438 | ||
2450 | if (!(info->flags & ASYNC_INITIALIZED)) | 2439 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
2451 | return; | 2440 | return; |
2452 | 2441 | ||
2453 | DBGINFO(("%s shutdown\n", info->device_name)); | 2442 | DBGINFO(("%s shutdown\n", info->device_name)); |
@@ -2470,7 +2459,7 @@ static void shutdown(struct slgt_info *info) | |||
2470 | 2459 | ||
2471 | slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); | 2460 | slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); |
2472 | 2461 | ||
2473 | if (!info->tty || info->tty->termios->c_cflag & HUPCL) { | 2462 | if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) { |
2474 | info->signals &= ~(SerialSignal_DTR + SerialSignal_RTS); | 2463 | info->signals &= ~(SerialSignal_DTR + SerialSignal_RTS); |
2475 | set_signals(info); | 2464 | set_signals(info); |
2476 | } | 2465 | } |
@@ -2479,10 +2468,10 @@ static void shutdown(struct slgt_info *info) | |||
2479 | 2468 | ||
2480 | spin_unlock_irqrestore(&info->lock,flags); | 2469 | spin_unlock_irqrestore(&info->lock,flags); |
2481 | 2470 | ||
2482 | if (info->tty) | 2471 | if (info->port.tty) |
2483 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2472 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2484 | 2473 | ||
2485 | info->flags &= ~ASYNC_INITIALIZED; | 2474 | info->port.flags &= ~ASYNC_INITIALIZED; |
2486 | } | 2475 | } |
2487 | 2476 | ||
2488 | static void program_hw(struct slgt_info *info) | 2477 | static void program_hw(struct slgt_info *info) |
@@ -2511,7 +2500,7 @@ static void program_hw(struct slgt_info *info) | |||
2511 | get_signals(info); | 2500 | get_signals(info); |
2512 | 2501 | ||
2513 | if (info->netcount || | 2502 | if (info->netcount || |
2514 | (info->tty && info->tty->termios->c_cflag & CREAD)) | 2503 | (info->port.tty && info->port.tty->termios->c_cflag & CREAD)) |
2515 | rx_start(info); | 2504 | rx_start(info); |
2516 | 2505 | ||
2517 | spin_unlock_irqrestore(&info->lock,flags); | 2506 | spin_unlock_irqrestore(&info->lock,flags); |
@@ -2525,11 +2514,11 @@ static void change_params(struct slgt_info *info) | |||
2525 | unsigned cflag; | 2514 | unsigned cflag; |
2526 | int bits_per_char; | 2515 | int bits_per_char; |
2527 | 2516 | ||
2528 | if (!info->tty || !info->tty->termios) | 2517 | if (!info->port.tty || !info->port.tty->termios) |
2529 | return; | 2518 | return; |
2530 | DBGINFO(("%s change_params\n", info->device_name)); | 2519 | DBGINFO(("%s change_params\n", info->device_name)); |
2531 | 2520 | ||
2532 | cflag = info->tty->termios->c_cflag; | 2521 | cflag = info->port.tty->termios->c_cflag; |
2533 | 2522 | ||
2534 | /* if B0 rate (hangup) specified then negate DTR and RTS */ | 2523 | /* if B0 rate (hangup) specified then negate DTR and RTS */ |
2535 | /* otherwise assert DTR and RTS */ | 2524 | /* otherwise assert DTR and RTS */ |
@@ -2561,7 +2550,7 @@ static void change_params(struct slgt_info *info) | |||
2561 | bits_per_char = info->params.data_bits + | 2550 | bits_per_char = info->params.data_bits + |
2562 | info->params.stop_bits + 1; | 2551 | info->params.stop_bits + 1; |
2563 | 2552 | ||
2564 | info->params.data_rate = tty_get_baud_rate(info->tty); | 2553 | info->params.data_rate = tty_get_baud_rate(info->port.tty); |
2565 | 2554 | ||
2566 | if (info->params.data_rate) { | 2555 | if (info->params.data_rate) { |
2567 | info->timeout = (32*HZ*bits_per_char) / | 2556 | info->timeout = (32*HZ*bits_per_char) / |
@@ -2570,30 +2559,30 @@ static void change_params(struct slgt_info *info) | |||
2570 | info->timeout += HZ/50; /* Add .02 seconds of slop */ | 2559 | info->timeout += HZ/50; /* Add .02 seconds of slop */ |
2571 | 2560 | ||
2572 | if (cflag & CRTSCTS) | 2561 | if (cflag & CRTSCTS) |
2573 | info->flags |= ASYNC_CTS_FLOW; | 2562 | info->port.flags |= ASYNC_CTS_FLOW; |
2574 | else | 2563 | else |
2575 | info->flags &= ~ASYNC_CTS_FLOW; | 2564 | info->port.flags &= ~ASYNC_CTS_FLOW; |
2576 | 2565 | ||
2577 | if (cflag & CLOCAL) | 2566 | if (cflag & CLOCAL) |
2578 | info->flags &= ~ASYNC_CHECK_CD; | 2567 | info->port.flags &= ~ASYNC_CHECK_CD; |
2579 | else | 2568 | else |
2580 | info->flags |= ASYNC_CHECK_CD; | 2569 | info->port.flags |= ASYNC_CHECK_CD; |
2581 | 2570 | ||
2582 | /* process tty input control flags */ | 2571 | /* process tty input control flags */ |
2583 | 2572 | ||
2584 | info->read_status_mask = IRQ_RXOVER; | 2573 | info->read_status_mask = IRQ_RXOVER; |
2585 | if (I_INPCK(info->tty)) | 2574 | if (I_INPCK(info->port.tty)) |
2586 | info->read_status_mask |= MASK_PARITY | MASK_FRAMING; | 2575 | info->read_status_mask |= MASK_PARITY | MASK_FRAMING; |
2587 | if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) | 2576 | if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) |
2588 | info->read_status_mask |= MASK_BREAK; | 2577 | info->read_status_mask |= MASK_BREAK; |
2589 | if (I_IGNPAR(info->tty)) | 2578 | if (I_IGNPAR(info->port.tty)) |
2590 | info->ignore_status_mask |= MASK_PARITY | MASK_FRAMING; | 2579 | info->ignore_status_mask |= MASK_PARITY | MASK_FRAMING; |
2591 | if (I_IGNBRK(info->tty)) { | 2580 | if (I_IGNBRK(info->port.tty)) { |
2592 | info->ignore_status_mask |= MASK_BREAK; | 2581 | info->ignore_status_mask |= MASK_BREAK; |
2593 | /* If ignoring parity and break indicators, ignore | 2582 | /* If ignoring parity and break indicators, ignore |
2594 | * overruns too. (For real raw support). | 2583 | * overruns too. (For real raw support). |
2595 | */ | 2584 | */ |
2596 | if (I_IGNPAR(info->tty)) | 2585 | if (I_IGNPAR(info->port.tty)) |
2597 | info->ignore_status_mask |= MASK_OVERRUN; | 2586 | info->ignore_status_mask |= MASK_OVERRUN; |
2598 | } | 2587 | } |
2599 | 2588 | ||
@@ -3144,7 +3133,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3144 | 3133 | ||
3145 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ | 3134 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ |
3146 | /* nonblock mode is set or port is not enabled */ | 3135 | /* nonblock mode is set or port is not enabled */ |
3147 | info->flags |= ASYNC_NORMAL_ACTIVE; | 3136 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
3148 | return 0; | 3137 | return 0; |
3149 | } | 3138 | } |
3150 | 3139 | ||
@@ -3153,21 +3142,21 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3153 | 3142 | ||
3154 | /* Wait for carrier detect and the line to become | 3143 | /* Wait for carrier detect and the line to become |
3155 | * free (i.e., not in use by the callout). While we are in | 3144 | * free (i.e., not in use by the callout). While we are in |
3156 | * this loop, info->count is dropped by one, so that | 3145 | * this loop, info->port.count is dropped by one, so that |
3157 | * close() knows when to free things. We restore it upon | 3146 | * close() knows when to free things. We restore it upon |
3158 | * exit, either normal or abnormal. | 3147 | * exit, either normal or abnormal. |
3159 | */ | 3148 | */ |
3160 | 3149 | ||
3161 | retval = 0; | 3150 | retval = 0; |
3162 | add_wait_queue(&info->open_wait, &wait); | 3151 | add_wait_queue(&info->port.open_wait, &wait); |
3163 | 3152 | ||
3164 | spin_lock_irqsave(&info->lock, flags); | 3153 | spin_lock_irqsave(&info->lock, flags); |
3165 | if (!tty_hung_up_p(filp)) { | 3154 | if (!tty_hung_up_p(filp)) { |
3166 | extra_count = true; | 3155 | extra_count = true; |
3167 | info->count--; | 3156 | info->port.count--; |
3168 | } | 3157 | } |
3169 | spin_unlock_irqrestore(&info->lock, flags); | 3158 | spin_unlock_irqrestore(&info->lock, flags); |
3170 | info->blocked_open++; | 3159 | info->port.blocked_open++; |
3171 | 3160 | ||
3172 | while (1) { | 3161 | while (1) { |
3173 | if ((tty->termios->c_cflag & CBAUD)) { | 3162 | if ((tty->termios->c_cflag & CBAUD)) { |
@@ -3179,8 +3168,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3179 | 3168 | ||
3180 | set_current_state(TASK_INTERRUPTIBLE); | 3169 | set_current_state(TASK_INTERRUPTIBLE); |
3181 | 3170 | ||
3182 | if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)){ | 3171 | if (tty_hung_up_p(filp) || !(info->port.flags & ASYNC_INITIALIZED)){ |
3183 | retval = (info->flags & ASYNC_HUP_NOTIFY) ? | 3172 | retval = (info->port.flags & ASYNC_HUP_NOTIFY) ? |
3184 | -EAGAIN : -ERESTARTSYS; | 3173 | -EAGAIN : -ERESTARTSYS; |
3185 | break; | 3174 | break; |
3186 | } | 3175 | } |
@@ -3189,7 +3178,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3189 | get_signals(info); | 3178 | get_signals(info); |
3190 | spin_unlock_irqrestore(&info->lock,flags); | 3179 | spin_unlock_irqrestore(&info->lock,flags); |
3191 | 3180 | ||
3192 | if (!(info->flags & ASYNC_CLOSING) && | 3181 | if (!(info->port.flags & ASYNC_CLOSING) && |
3193 | (do_clocal || (info->signals & SerialSignal_DCD)) ) { | 3182 | (do_clocal || (info->signals & SerialSignal_DCD)) ) { |
3194 | break; | 3183 | break; |
3195 | } | 3184 | } |
@@ -3204,14 +3193,14 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3204 | } | 3193 | } |
3205 | 3194 | ||
3206 | set_current_state(TASK_RUNNING); | 3195 | set_current_state(TASK_RUNNING); |
3207 | remove_wait_queue(&info->open_wait, &wait); | 3196 | remove_wait_queue(&info->port.open_wait, &wait); |
3208 | 3197 | ||
3209 | if (extra_count) | 3198 | if (extra_count) |
3210 | info->count++; | 3199 | info->port.count++; |
3211 | info->blocked_open--; | 3200 | info->port.blocked_open--; |
3212 | 3201 | ||
3213 | if (!retval) | 3202 | if (!retval) |
3214 | info->flags |= ASYNC_NORMAL_ACTIVE; | 3203 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
3215 | 3204 | ||
3216 | DBGINFO(("%s block_til_ready ready, rc=%d\n", tty->driver->name, retval)); | 3205 | DBGINFO(("%s block_til_ready ready, rc=%d\n", tty->driver->name, retval)); |
3217 | return retval; | 3206 | return retval; |
@@ -3454,14 +3443,13 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev | |||
3454 | DBGERR(("%s device alloc failed adapter=%d port=%d\n", | 3443 | DBGERR(("%s device alloc failed adapter=%d port=%d\n", |
3455 | driver_name, adapter_num, port_num)); | 3444 | driver_name, adapter_num, port_num)); |
3456 | } else { | 3445 | } else { |
3446 | tty_port_init(&info->port); | ||
3457 | info->magic = MGSL_MAGIC; | 3447 | info->magic = MGSL_MAGIC; |
3458 | INIT_WORK(&info->task, bh_handler); | 3448 | INIT_WORK(&info->task, bh_handler); |
3459 | info->max_frame_size = 4096; | 3449 | info->max_frame_size = 4096; |
3460 | info->raw_rx_size = DMABUFSIZE; | 3450 | info->raw_rx_size = DMABUFSIZE; |
3461 | info->close_delay = 5*HZ/10; | 3451 | info->port.close_delay = 5*HZ/10; |
3462 | info->closing_wait = 30*HZ; | 3452 | info->port.closing_wait = 30*HZ; |
3463 | init_waitqueue_head(&info->open_wait); | ||
3464 | init_waitqueue_head(&info->close_wait); | ||
3465 | init_waitqueue_head(&info->status_event_wait_q); | 3453 | init_waitqueue_head(&info->status_event_wait_q); |
3466 | init_waitqueue_head(&info->event_wait_q); | 3454 | init_waitqueue_head(&info->event_wait_q); |
3467 | spin_lock_init(&info->netlock); | 3455 | spin_lock_init(&info->netlock); |
@@ -4505,7 +4493,7 @@ static bool rx_get_frame(struct slgt_info *info) | |||
4505 | unsigned short status; | 4493 | unsigned short status; |
4506 | unsigned int framesize = 0; | 4494 | unsigned int framesize = 0; |
4507 | unsigned long flags; | 4495 | unsigned long flags; |
4508 | struct tty_struct *tty = info->tty; | 4496 | struct tty_struct *tty = info->port.tty; |
4509 | unsigned char addr_field = 0xff; | 4497 | unsigned char addr_field = 0xff; |
4510 | unsigned int crc_size = 0; | 4498 | unsigned int crc_size = 0; |
4511 | 4499 | ||
@@ -4577,9 +4565,8 @@ check_again: | |||
4577 | 4565 | ||
4578 | #if SYNCLINK_GENERIC_HDLC | 4566 | #if SYNCLINK_GENERIC_HDLC |
4579 | if (framesize == 0) { | 4567 | if (framesize == 0) { |
4580 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 4568 | info->netdev->stats.rx_errors++; |
4581 | stats->rx_errors++; | 4569 | info->netdev->stats.rx_frame_errors++; |
4582 | stats->rx_frame_errors++; | ||
4583 | } | 4570 | } |
4584 | #endif | 4571 | #endif |
4585 | 4572 | ||
@@ -4656,7 +4643,7 @@ static bool rx_get_buf(struct slgt_info *info) | |||
4656 | DBGDATA(info, info->rbufs[i].buf, count, "rx"); | 4643 | DBGDATA(info, info->rbufs[i].buf, count, "rx"); |
4657 | DBGINFO(("rx_get_buf size=%d\n", count)); | 4644 | DBGINFO(("rx_get_buf size=%d\n", count)); |
4658 | if (count) | 4645 | if (count) |
4659 | ldisc_receive_buf(info->tty, info->rbufs[i].buf, | 4646 | ldisc_receive_buf(info->port.tty, info->rbufs[i].buf, |
4660 | info->flag_buf, count); | 4647 | info->flag_buf, count); |
4661 | free_rbufs(info, i, i); | 4648 | free_rbufs(info, i, i); |
4662 | return true; | 4649 | return true; |
@@ -4765,11 +4752,11 @@ static int irq_test(struct slgt_info *info) | |||
4765 | { | 4752 | { |
4766 | unsigned long timeout; | 4753 | unsigned long timeout; |
4767 | unsigned long flags; | 4754 | unsigned long flags; |
4768 | struct tty_struct *oldtty = info->tty; | 4755 | struct tty_struct *oldtty = info->port.tty; |
4769 | u32 speed = info->params.data_rate; | 4756 | u32 speed = info->params.data_rate; |
4770 | 4757 | ||
4771 | info->params.data_rate = 921600; | 4758 | info->params.data_rate = 921600; |
4772 | info->tty = NULL; | 4759 | info->port.tty = NULL; |
4773 | 4760 | ||
4774 | spin_lock_irqsave(&info->lock, flags); | 4761 | spin_lock_irqsave(&info->lock, flags); |
4775 | async_mode(info); | 4762 | async_mode(info); |
@@ -4797,7 +4784,7 @@ static int irq_test(struct slgt_info *info) | |||
4797 | spin_unlock_irqrestore(&info->lock,flags); | 4784 | spin_unlock_irqrestore(&info->lock,flags); |
4798 | 4785 | ||
4799 | info->params.data_rate = speed; | 4786 | info->params.data_rate = speed; |
4800 | info->tty = oldtty; | 4787 | info->port.tty = oldtty; |
4801 | 4788 | ||
4802 | info->init_error = info->irq_occurred ? 0 : DiagStatus_IrqFailure; | 4789 | info->init_error = info->irq_occurred ? 0 : DiagStatus_IrqFailure; |
4803 | return info->irq_occurred ? 0 : -ENODEV; | 4790 | return info->irq_occurred ? 0 : -ENODEV; |
@@ -4837,7 +4824,7 @@ static int loopback_test(struct slgt_info *info) | |||
4837 | int rc = -ENODEV; | 4824 | int rc = -ENODEV; |
4838 | unsigned long flags; | 4825 | unsigned long flags; |
4839 | 4826 | ||
4840 | struct tty_struct *oldtty = info->tty; | 4827 | struct tty_struct *oldtty = info->port.tty; |
4841 | MGSL_PARAMS params; | 4828 | MGSL_PARAMS params; |
4842 | 4829 | ||
4843 | memcpy(¶ms, &info->params, sizeof(params)); | 4830 | memcpy(¶ms, &info->params, sizeof(params)); |
@@ -4845,7 +4832,7 @@ static int loopback_test(struct slgt_info *info) | |||
4845 | info->params.mode = MGSL_MODE_ASYNC; | 4832 | info->params.mode = MGSL_MODE_ASYNC; |
4846 | info->params.data_rate = 921600; | 4833 | info->params.data_rate = 921600; |
4847 | info->params.loopback = 1; | 4834 | info->params.loopback = 1; |
4848 | info->tty = NULL; | 4835 | info->port.tty = NULL; |
4849 | 4836 | ||
4850 | /* build and send transmit frame */ | 4837 | /* build and send transmit frame */ |
4851 | for (count = 0; count < TESTFRAMESIZE; ++count) | 4838 | for (count = 0; count < TESTFRAMESIZE; ++count) |
@@ -4883,7 +4870,7 @@ static int loopback_test(struct slgt_info *info) | |||
4883 | spin_unlock_irqrestore(&info->lock,flags); | 4870 | spin_unlock_irqrestore(&info->lock,flags); |
4884 | 4871 | ||
4885 | memcpy(&info->params, ¶ms, sizeof(info->params)); | 4872 | memcpy(&info->params, ¶ms, sizeof(info->params)); |
4886 | info->tty = oldtty; | 4873 | info->port.tty = oldtty; |
4887 | 4874 | ||
4888 | info->init_error = rc ? DiagStatus_DmaFailure : 0; | 4875 | info->init_error = rc ? DiagStatus_DmaFailure : 0; |
4889 | return rc; | 4876 | return rc; |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index bec54866e0bb..5768c4136342 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -151,18 +151,15 @@ struct _input_signal_events { | |||
151 | typedef struct _synclinkmp_info { | 151 | typedef struct _synclinkmp_info { |
152 | void *if_ptr; /* General purpose pointer (used by SPPP) */ | 152 | void *if_ptr; /* General purpose pointer (used by SPPP) */ |
153 | int magic; | 153 | int magic; |
154 | int flags; | 154 | struct tty_port port; |
155 | int count; /* count of opens */ | ||
156 | int line; | 155 | int line; |
157 | unsigned short close_delay; | 156 | unsigned short close_delay; |
158 | unsigned short closing_wait; /* time to wait before closing */ | 157 | unsigned short closing_wait; /* time to wait before closing */ |
159 | 158 | ||
160 | struct mgsl_icount icount; | 159 | struct mgsl_icount icount; |
161 | 160 | ||
162 | struct tty_struct *tty; | ||
163 | int timeout; | 161 | int timeout; |
164 | int x_char; /* xon/xoff character */ | 162 | int x_char; /* xon/xoff character */ |
165 | int blocked_open; /* # of blocked opens */ | ||
166 | u16 read_status_mask1; /* break detection (SR1 indications) */ | 163 | u16 read_status_mask1; /* break detection (SR1 indications) */ |
167 | u16 read_status_mask2; /* parity/framing/overun (SR2 indications) */ | 164 | u16 read_status_mask2; /* parity/framing/overun (SR2 indications) */ |
168 | unsigned char ignore_status_mask1; /* break detection (SR1 indications) */ | 165 | unsigned char ignore_status_mask1; /* break detection (SR1 indications) */ |
@@ -172,9 +169,6 @@ typedef struct _synclinkmp_info { | |||
172 | int tx_get; | 169 | int tx_get; |
173 | int tx_count; | 170 | int tx_count; |
174 | 171 | ||
175 | wait_queue_head_t open_wait; | ||
176 | wait_queue_head_t close_wait; | ||
177 | |||
178 | wait_queue_head_t status_event_wait_q; | 172 | wait_queue_head_t status_event_wait_q; |
179 | wait_queue_head_t event_wait_q; | 173 | wait_queue_head_t event_wait_q; |
180 | struct timer_list tx_timer; /* HDLC transmit timeout timer */ | 174 | struct timer_list tx_timer; /* HDLC transmit timeout timer */ |
@@ -462,13 +456,13 @@ static int synclinkmp_device_count = 0; | |||
462 | * .text section address and breakpoint on module load. | 456 | * .text section address and breakpoint on module load. |
463 | * This is useful for use with gdb and add-symbol-file command. | 457 | * This is useful for use with gdb and add-symbol-file command. |
464 | */ | 458 | */ |
465 | static int break_on_load=0; | 459 | static int break_on_load = 0; |
466 | 460 | ||
467 | /* | 461 | /* |
468 | * Driver major number, defaults to zero to get auto | 462 | * Driver major number, defaults to zero to get auto |
469 | * assigned major number. May be forced as module parameter. | 463 | * assigned major number. May be forced as module parameter. |
470 | */ | 464 | */ |
471 | static int ttymajor=0; | 465 | static int ttymajor = 0; |
472 | 466 | ||
473 | /* | 467 | /* |
474 | * Array of user specified options for ISA adapters. | 468 | * Array of user specified options for ISA adapters. |
@@ -712,8 +706,8 @@ static void ldisc_receive_buf(struct tty_struct *tty, | |||
712 | return; | 706 | return; |
713 | ld = tty_ldisc_ref(tty); | 707 | ld = tty_ldisc_ref(tty); |
714 | if (ld) { | 708 | if (ld) { |
715 | if (ld->receive_buf) | 709 | if (ld->ops->receive_buf) |
716 | ld->receive_buf(tty, data, flags, count); | 710 | ld->ops->receive_buf(tty, data, flags, count); |
717 | tty_ldisc_deref(ld); | 711 | tty_ldisc_deref(ld); |
718 | } | 712 | } |
719 | } | 713 | } |
@@ -747,22 +741,22 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
747 | } | 741 | } |
748 | 742 | ||
749 | tty->driver_data = info; | 743 | tty->driver_data = info; |
750 | info->tty = tty; | 744 | info->port.tty = tty; |
751 | 745 | ||
752 | if (debug_level >= DEBUG_LEVEL_INFO) | 746 | if (debug_level >= DEBUG_LEVEL_INFO) |
753 | printk("%s(%d):%s open(), old ref count = %d\n", | 747 | printk("%s(%d):%s open(), old ref count = %d\n", |
754 | __FILE__,__LINE__,tty->driver->name, info->count); | 748 | __FILE__,__LINE__,tty->driver->name, info->port.count); |
755 | 749 | ||
756 | /* If port is closing, signal caller to try again */ | 750 | /* If port is closing, signal caller to try again */ |
757 | if (tty_hung_up_p(filp) || info->flags & ASYNC_CLOSING){ | 751 | if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){ |
758 | if (info->flags & ASYNC_CLOSING) | 752 | if (info->port.flags & ASYNC_CLOSING) |
759 | interruptible_sleep_on(&info->close_wait); | 753 | interruptible_sleep_on(&info->port.close_wait); |
760 | retval = ((info->flags & ASYNC_HUP_NOTIFY) ? | 754 | retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
761 | -EAGAIN : -ERESTARTSYS); | 755 | -EAGAIN : -ERESTARTSYS); |
762 | goto cleanup; | 756 | goto cleanup; |
763 | } | 757 | } |
764 | 758 | ||
765 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 759 | info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
766 | 760 | ||
767 | spin_lock_irqsave(&info->netlock, flags); | 761 | spin_lock_irqsave(&info->netlock, flags); |
768 | if (info->netcount) { | 762 | if (info->netcount) { |
@@ -770,10 +764,10 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
770 | spin_unlock_irqrestore(&info->netlock, flags); | 764 | spin_unlock_irqrestore(&info->netlock, flags); |
771 | goto cleanup; | 765 | goto cleanup; |
772 | } | 766 | } |
773 | info->count++; | 767 | info->port.count++; |
774 | spin_unlock_irqrestore(&info->netlock, flags); | 768 | spin_unlock_irqrestore(&info->netlock, flags); |
775 | 769 | ||
776 | if (info->count == 1) { | 770 | if (info->port.count == 1) { |
777 | /* 1st open on this device, init hardware */ | 771 | /* 1st open on this device, init hardware */ |
778 | retval = startup(info); | 772 | retval = startup(info); |
779 | if (retval < 0) | 773 | if (retval < 0) |
@@ -796,9 +790,9 @@ static int open(struct tty_struct *tty, struct file *filp) | |||
796 | cleanup: | 790 | cleanup: |
797 | if (retval) { | 791 | if (retval) { |
798 | if (tty->count == 1) | 792 | if (tty->count == 1) |
799 | info->tty = NULL; /* tty layer will release tty struct */ | 793 | info->port.tty = NULL; /* tty layer will release tty struct */ |
800 | if(info->count) | 794 | if(info->port.count) |
801 | info->count--; | 795 | info->port.count--; |
802 | } | 796 | } |
803 | 797 | ||
804 | return retval; | 798 | return retval; |
@@ -816,33 +810,33 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
816 | 810 | ||
817 | if (debug_level >= DEBUG_LEVEL_INFO) | 811 | if (debug_level >= DEBUG_LEVEL_INFO) |
818 | printk("%s(%d):%s close() entry, count=%d\n", | 812 | printk("%s(%d):%s close() entry, count=%d\n", |
819 | __FILE__,__LINE__, info->device_name, info->count); | 813 | __FILE__,__LINE__, info->device_name, info->port.count); |
820 | 814 | ||
821 | if (!info->count) | 815 | if (!info->port.count) |
822 | return; | 816 | return; |
823 | 817 | ||
824 | if (tty_hung_up_p(filp)) | 818 | if (tty_hung_up_p(filp)) |
825 | goto cleanup; | 819 | goto cleanup; |
826 | 820 | ||
827 | if ((tty->count == 1) && (info->count != 1)) { | 821 | if ((tty->count == 1) && (info->port.count != 1)) { |
828 | /* | 822 | /* |
829 | * tty->count is 1 and the tty structure will be freed. | 823 | * tty->count is 1 and the tty structure will be freed. |
830 | * info->count should be one in this case. | 824 | * info->port.count should be one in this case. |
831 | * if it's not, correct it so that the port is shutdown. | 825 | * if it's not, correct it so that the port is shutdown. |
832 | */ | 826 | */ |
833 | printk("%s(%d):%s close: bad refcount; tty->count is 1, " | 827 | printk("%s(%d):%s close: bad refcount; tty->count is 1, " |
834 | "info->count is %d\n", | 828 | "info->port.count is %d\n", |
835 | __FILE__,__LINE__, info->device_name, info->count); | 829 | __FILE__,__LINE__, info->device_name, info->port.count); |
836 | info->count = 1; | 830 | info->port.count = 1; |
837 | } | 831 | } |
838 | 832 | ||
839 | info->count--; | 833 | info->port.count--; |
840 | 834 | ||
841 | /* if at least one open remaining, leave hardware active */ | 835 | /* if at least one open remaining, leave hardware active */ |
842 | if (info->count) | 836 | if (info->port.count) |
843 | goto cleanup; | 837 | goto cleanup; |
844 | 838 | ||
845 | info->flags |= ASYNC_CLOSING; | 839 | info->port.flags |= ASYNC_CLOSING; |
846 | 840 | ||
847 | /* set tty->closing to notify line discipline to | 841 | /* set tty->closing to notify line discipline to |
848 | * only process XON/XOFF characters. Only the N_TTY | 842 | * only process XON/XOFF characters. Only the N_TTY |
@@ -852,14 +846,14 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
852 | 846 | ||
853 | /* wait for transmit data to clear all layers */ | 847 | /* wait for transmit data to clear all layers */ |
854 | 848 | ||
855 | if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) { | 849 | if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) { |
856 | if (debug_level >= DEBUG_LEVEL_INFO) | 850 | if (debug_level >= DEBUG_LEVEL_INFO) |
857 | printk("%s(%d):%s close() calling tty_wait_until_sent\n", | 851 | printk("%s(%d):%s close() calling tty_wait_until_sent\n", |
858 | __FILE__,__LINE__, info->device_name ); | 852 | __FILE__,__LINE__, info->device_name ); |
859 | tty_wait_until_sent(tty, info->closing_wait); | 853 | tty_wait_until_sent(tty, info->port.closing_wait); |
860 | } | 854 | } |
861 | 855 | ||
862 | if (info->flags & ASYNC_INITIALIZED) | 856 | if (info->port.flags & ASYNC_INITIALIZED) |
863 | wait_until_sent(tty, info->timeout); | 857 | wait_until_sent(tty, info->timeout); |
864 | 858 | ||
865 | flush_buffer(tty); | 859 | flush_buffer(tty); |
@@ -869,23 +863,23 @@ static void close(struct tty_struct *tty, struct file *filp) | |||
869 | shutdown(info); | 863 | shutdown(info); |
870 | 864 | ||
871 | tty->closing = 0; | 865 | tty->closing = 0; |
872 | info->tty = NULL; | 866 | info->port.tty = NULL; |
873 | 867 | ||
874 | if (info->blocked_open) { | 868 | if (info->port.blocked_open) { |
875 | if (info->close_delay) { | 869 | if (info->port.close_delay) { |
876 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | 870 | msleep_interruptible(jiffies_to_msecs(info->port.close_delay)); |
877 | } | 871 | } |
878 | wake_up_interruptible(&info->open_wait); | 872 | wake_up_interruptible(&info->port.open_wait); |
879 | } | 873 | } |
880 | 874 | ||
881 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 875 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
882 | 876 | ||
883 | wake_up_interruptible(&info->close_wait); | 877 | wake_up_interruptible(&info->port.close_wait); |
884 | 878 | ||
885 | cleanup: | 879 | cleanup: |
886 | if (debug_level >= DEBUG_LEVEL_INFO) | 880 | if (debug_level >= DEBUG_LEVEL_INFO) |
887 | printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__, | 881 | printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__, |
888 | tty->driver->name, info->count); | 882 | tty->driver->name, info->port.count); |
889 | } | 883 | } |
890 | 884 | ||
891 | /* Called by tty_hangup() when a hangup is signaled. | 885 | /* Called by tty_hangup() when a hangup is signaled. |
@@ -905,11 +899,11 @@ static void hangup(struct tty_struct *tty) | |||
905 | flush_buffer(tty); | 899 | flush_buffer(tty); |
906 | shutdown(info); | 900 | shutdown(info); |
907 | 901 | ||
908 | info->count = 0; | 902 | info->port.count = 0; |
909 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 903 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
910 | info->tty = NULL; | 904 | info->port.tty = NULL; |
911 | 905 | ||
912 | wake_up_interruptible(&info->open_wait); | 906 | wake_up_interruptible(&info->port.open_wait); |
913 | } | 907 | } |
914 | 908 | ||
915 | /* Set new termios settings | 909 | /* Set new termios settings |
@@ -1123,7 +1117,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout) | |||
1123 | 1117 | ||
1124 | lock_kernel(); | 1118 | lock_kernel(); |
1125 | 1119 | ||
1126 | if (!(info->flags & ASYNC_INITIALIZED)) | 1120 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
1127 | goto exit; | 1121 | goto exit; |
1128 | 1122 | ||
1129 | orig_jiffies = jiffies; | 1123 | orig_jiffies = jiffies; |
@@ -1636,7 +1630,7 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding, | |||
1636 | unsigned short new_crctype; | 1630 | unsigned short new_crctype; |
1637 | 1631 | ||
1638 | /* return error if TTY interface open */ | 1632 | /* return error if TTY interface open */ |
1639 | if (info->count) | 1633 | if (info->port.count) |
1640 | return -EBUSY; | 1634 | return -EBUSY; |
1641 | 1635 | ||
1642 | switch (encoding) | 1636 | switch (encoding) |
@@ -1678,7 +1672,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding, | |||
1678 | static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | 1672 | static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) |
1679 | { | 1673 | { |
1680 | SLMP_INFO *info = dev_to_port(dev); | 1674 | SLMP_INFO *info = dev_to_port(dev); |
1681 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1682 | unsigned long flags; | 1675 | unsigned long flags; |
1683 | 1676 | ||
1684 | if (debug_level >= DEBUG_LEVEL_INFO) | 1677 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -1692,8 +1685,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1692 | tx_load_dma_buffer(info, skb->data, skb->len); | 1685 | tx_load_dma_buffer(info, skb->data, skb->len); |
1693 | 1686 | ||
1694 | /* update network statistics */ | 1687 | /* update network statistics */ |
1695 | stats->tx_packets++; | 1688 | dev->stats.tx_packets++; |
1696 | stats->tx_bytes += skb->len; | 1689 | dev->stats.tx_bytes += skb->len; |
1697 | 1690 | ||
1698 | /* done with socket buffer, so free it */ | 1691 | /* done with socket buffer, so free it */ |
1699 | dev_kfree_skb(skb); | 1692 | dev_kfree_skb(skb); |
@@ -1733,7 +1726,7 @@ static int hdlcdev_open(struct net_device *dev) | |||
1733 | 1726 | ||
1734 | /* arbitrate between network and tty opens */ | 1727 | /* arbitrate between network and tty opens */ |
1735 | spin_lock_irqsave(&info->netlock, flags); | 1728 | spin_lock_irqsave(&info->netlock, flags); |
1736 | if (info->count != 0 || info->netcount != 0) { | 1729 | if (info->port.count != 0 || info->netcount != 0) { |
1737 | printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name); | 1730 | printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name); |
1738 | spin_unlock_irqrestore(&info->netlock, flags); | 1731 | spin_unlock_irqrestore(&info->netlock, flags); |
1739 | return -EBUSY; | 1732 | return -EBUSY; |
@@ -1819,7 +1812,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1819 | printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); | 1812 | printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); |
1820 | 1813 | ||
1821 | /* return error if TTY interface open */ | 1814 | /* return error if TTY interface open */ |
1822 | if (info->count) | 1815 | if (info->port.count) |
1823 | return -EBUSY; | 1816 | return -EBUSY; |
1824 | 1817 | ||
1825 | if (cmd != SIOCWANDEV) | 1818 | if (cmd != SIOCWANDEV) |
@@ -1909,14 +1902,13 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1909 | static void hdlcdev_tx_timeout(struct net_device *dev) | 1902 | static void hdlcdev_tx_timeout(struct net_device *dev) |
1910 | { | 1903 | { |
1911 | SLMP_INFO *info = dev_to_port(dev); | 1904 | SLMP_INFO *info = dev_to_port(dev); |
1912 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1913 | unsigned long flags; | 1905 | unsigned long flags; |
1914 | 1906 | ||
1915 | if (debug_level >= DEBUG_LEVEL_INFO) | 1907 | if (debug_level >= DEBUG_LEVEL_INFO) |
1916 | printk("hdlcdev_tx_timeout(%s)\n",dev->name); | 1908 | printk("hdlcdev_tx_timeout(%s)\n",dev->name); |
1917 | 1909 | ||
1918 | stats->tx_errors++; | 1910 | dev->stats.tx_errors++; |
1919 | stats->tx_aborted_errors++; | 1911 | dev->stats.tx_aborted_errors++; |
1920 | 1912 | ||
1921 | spin_lock_irqsave(&info->lock,flags); | 1913 | spin_lock_irqsave(&info->lock,flags); |
1922 | tx_stop(info); | 1914 | tx_stop(info); |
@@ -1949,27 +1941,27 @@ static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size) | |||
1949 | { | 1941 | { |
1950 | struct sk_buff *skb = dev_alloc_skb(size); | 1942 | struct sk_buff *skb = dev_alloc_skb(size); |
1951 | struct net_device *dev = info->netdev; | 1943 | struct net_device *dev = info->netdev; |
1952 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1953 | 1944 | ||
1954 | if (debug_level >= DEBUG_LEVEL_INFO) | 1945 | if (debug_level >= DEBUG_LEVEL_INFO) |
1955 | printk("hdlcdev_rx(%s)\n",dev->name); | 1946 | printk("hdlcdev_rx(%s)\n",dev->name); |
1956 | 1947 | ||
1957 | if (skb == NULL) { | 1948 | if (skb == NULL) { |
1958 | printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); | 1949 | printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", |
1959 | stats->rx_dropped++; | 1950 | dev->name); |
1951 | dev->stats.rx_dropped++; | ||
1960 | return; | 1952 | return; |
1961 | } | 1953 | } |
1962 | 1954 | ||
1963 | memcpy(skb_put(skb, size),buf,size); | 1955 | memcpy(skb_put(skb, size), buf, size); |
1964 | 1956 | ||
1965 | skb->protocol = hdlc_type_trans(skb, info->netdev); | 1957 | skb->protocol = hdlc_type_trans(skb, dev); |
1966 | 1958 | ||
1967 | stats->rx_packets++; | 1959 | dev->stats.rx_packets++; |
1968 | stats->rx_bytes += size; | 1960 | dev->stats.rx_bytes += size; |
1969 | 1961 | ||
1970 | netif_rx(skb); | 1962 | netif_rx(skb); |
1971 | 1963 | ||
1972 | info->netdev->last_rx = jiffies; | 1964 | dev->last_rx = jiffies; |
1973 | } | 1965 | } |
1974 | 1966 | ||
1975 | /** | 1967 | /** |
@@ -2128,7 +2120,7 @@ static void bh_receive(SLMP_INFO *info) | |||
2128 | 2120 | ||
2129 | static void bh_transmit(SLMP_INFO *info) | 2121 | static void bh_transmit(SLMP_INFO *info) |
2130 | { | 2122 | { |
2131 | struct tty_struct *tty = info->tty; | 2123 | struct tty_struct *tty = info->port.tty; |
2132 | 2124 | ||
2133 | if ( debug_level >= DEBUG_LEVEL_BH ) | 2125 | if ( debug_level >= DEBUG_LEVEL_BH ) |
2134 | printk( "%s(%d):%s bh_transmit() entry\n", | 2126 | printk( "%s(%d):%s bh_transmit() entry\n", |
@@ -2178,7 +2170,7 @@ static void isr_timer(SLMP_INFO * info) | |||
2178 | 2170 | ||
2179 | static void isr_rxint(SLMP_INFO * info) | 2171 | static void isr_rxint(SLMP_INFO * info) |
2180 | { | 2172 | { |
2181 | struct tty_struct *tty = info->tty; | 2173 | struct tty_struct *tty = info->port.tty; |
2182 | struct mgsl_icount *icount = &info->icount; | 2174 | struct mgsl_icount *icount = &info->icount; |
2183 | unsigned char status = read_reg(info, SR1) & info->ie1_value & (FLGD + IDLD + CDCD + BRKD); | 2175 | unsigned char status = read_reg(info, SR1) & info->ie1_value & (FLGD + IDLD + CDCD + BRKD); |
2184 | unsigned char status2 = read_reg(info, SR2) & info->ie2_value & OVRN; | 2176 | unsigned char status2 = read_reg(info, SR2) & info->ie2_value & OVRN; |
@@ -2205,7 +2197,7 @@ static void isr_rxint(SLMP_INFO * info) | |||
2205 | if (!(status & info->ignore_status_mask1)) { | 2197 | if (!(status & info->ignore_status_mask1)) { |
2206 | if (info->read_status_mask1 & BRKD) { | 2198 | if (info->read_status_mask1 & BRKD) { |
2207 | tty_insert_flip_char(tty, 0, TTY_BREAK); | 2199 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
2208 | if (info->flags & ASYNC_SAK) | 2200 | if (info->port.flags & ASYNC_SAK) |
2209 | do_SAK(tty); | 2201 | do_SAK(tty); |
2210 | } | 2202 | } |
2211 | } | 2203 | } |
@@ -2239,7 +2231,7 @@ static void isr_rxrdy(SLMP_INFO * info) | |||
2239 | { | 2231 | { |
2240 | u16 status; | 2232 | u16 status; |
2241 | unsigned char DataByte; | 2233 | unsigned char DataByte; |
2242 | struct tty_struct *tty = info->tty; | 2234 | struct tty_struct *tty = info->port.tty; |
2243 | struct mgsl_icount *icount = &info->icount; | 2235 | struct mgsl_icount *icount = &info->icount; |
2244 | 2236 | ||
2245 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2237 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
@@ -2352,7 +2344,7 @@ static void isr_txeom(SLMP_INFO * info, unsigned char status) | |||
2352 | else | 2344 | else |
2353 | #endif | 2345 | #endif |
2354 | { | 2346 | { |
2355 | if (info->tty && (info->tty->stopped || info->tty->hw_stopped)) { | 2347 | if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { |
2356 | tx_stop(info); | 2348 | tx_stop(info); |
2357 | return; | 2349 | return; |
2358 | } | 2350 | } |
@@ -2407,7 +2399,7 @@ static void isr_txrdy(SLMP_INFO * info) | |||
2407 | return; | 2399 | return; |
2408 | } | 2400 | } |
2409 | 2401 | ||
2410 | if (info->tty && (info->tty->stopped || info->tty->hw_stopped)) { | 2402 | if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { |
2411 | tx_stop(info); | 2403 | tx_stop(info); |
2412 | return; | 2404 | return; |
2413 | } | 2405 | } |
@@ -2554,29 +2546,29 @@ static void isr_io_pin( SLMP_INFO *info, u16 status ) | |||
2554 | wake_up_interruptible(&info->status_event_wait_q); | 2546 | wake_up_interruptible(&info->status_event_wait_q); |
2555 | wake_up_interruptible(&info->event_wait_q); | 2547 | wake_up_interruptible(&info->event_wait_q); |
2556 | 2548 | ||
2557 | if ( (info->flags & ASYNC_CHECK_CD) && | 2549 | if ( (info->port.flags & ASYNC_CHECK_CD) && |
2558 | (status & MISCSTATUS_DCD_LATCHED) ) { | 2550 | (status & MISCSTATUS_DCD_LATCHED) ) { |
2559 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2551 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2560 | printk("%s CD now %s...", info->device_name, | 2552 | printk("%s CD now %s...", info->device_name, |
2561 | (status & SerialSignal_DCD) ? "on" : "off"); | 2553 | (status & SerialSignal_DCD) ? "on" : "off"); |
2562 | if (status & SerialSignal_DCD) | 2554 | if (status & SerialSignal_DCD) |
2563 | wake_up_interruptible(&info->open_wait); | 2555 | wake_up_interruptible(&info->port.open_wait); |
2564 | else { | 2556 | else { |
2565 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2557 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2566 | printk("doing serial hangup..."); | 2558 | printk("doing serial hangup..."); |
2567 | if (info->tty) | 2559 | if (info->port.tty) |
2568 | tty_hangup(info->tty); | 2560 | tty_hangup(info->port.tty); |
2569 | } | 2561 | } |
2570 | } | 2562 | } |
2571 | 2563 | ||
2572 | if ( (info->flags & ASYNC_CTS_FLOW) && | 2564 | if ( (info->port.flags & ASYNC_CTS_FLOW) && |
2573 | (status & MISCSTATUS_CTS_LATCHED) ) { | 2565 | (status & MISCSTATUS_CTS_LATCHED) ) { |
2574 | if ( info->tty ) { | 2566 | if ( info->port.tty ) { |
2575 | if (info->tty->hw_stopped) { | 2567 | if (info->port.tty->hw_stopped) { |
2576 | if (status & SerialSignal_CTS) { | 2568 | if (status & SerialSignal_CTS) { |
2577 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2569 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2578 | printk("CTS tx start..."); | 2570 | printk("CTS tx start..."); |
2579 | info->tty->hw_stopped = 0; | 2571 | info->port.tty->hw_stopped = 0; |
2580 | tx_start(info); | 2572 | tx_start(info); |
2581 | info->pending_bh |= BH_TRANSMIT; | 2573 | info->pending_bh |= BH_TRANSMIT; |
2582 | return; | 2574 | return; |
@@ -2585,7 +2577,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status ) | |||
2585 | if (!(status & SerialSignal_CTS)) { | 2577 | if (!(status & SerialSignal_CTS)) { |
2586 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2578 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
2587 | printk("CTS tx stop..."); | 2579 | printk("CTS tx stop..."); |
2588 | info->tty->hw_stopped = 1; | 2580 | info->port.tty->hw_stopped = 1; |
2589 | tx_stop(info); | 2581 | tx_stop(info); |
2590 | } | 2582 | } |
2591 | } | 2583 | } |
@@ -2701,7 +2693,7 @@ static irqreturn_t synclinkmp_interrupt(int dummy, void *dev_id) | |||
2701 | * do not request bottom half processing if the | 2693 | * do not request bottom half processing if the |
2702 | * device is not open in a normal mode. | 2694 | * device is not open in a normal mode. |
2703 | */ | 2695 | */ |
2704 | if ( port && (port->count || port->netcount) && | 2696 | if ( port && (port->port.count || port->netcount) && |
2705 | port->pending_bh && !port->bh_running && | 2697 | port->pending_bh && !port->bh_running && |
2706 | !port->bh_requested ) { | 2698 | !port->bh_requested ) { |
2707 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2699 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
@@ -2727,7 +2719,7 @@ static int startup(SLMP_INFO * info) | |||
2727 | if ( debug_level >= DEBUG_LEVEL_INFO ) | 2719 | if ( debug_level >= DEBUG_LEVEL_INFO ) |
2728 | printk("%s(%d):%s tx_releaseup()\n",__FILE__,__LINE__,info->device_name); | 2720 | printk("%s(%d):%s tx_releaseup()\n",__FILE__,__LINE__,info->device_name); |
2729 | 2721 | ||
2730 | if (info->flags & ASYNC_INITIALIZED) | 2722 | if (info->port.flags & ASYNC_INITIALIZED) |
2731 | return 0; | 2723 | return 0; |
2732 | 2724 | ||
2733 | if (!info->tx_buf) { | 2725 | if (!info->tx_buf) { |
@@ -2750,10 +2742,10 @@ static int startup(SLMP_INFO * info) | |||
2750 | 2742 | ||
2751 | mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10)); | 2743 | mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10)); |
2752 | 2744 | ||
2753 | if (info->tty) | 2745 | if (info->port.tty) |
2754 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 2746 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2755 | 2747 | ||
2756 | info->flags |= ASYNC_INITIALIZED; | 2748 | info->port.flags |= ASYNC_INITIALIZED; |
2757 | 2749 | ||
2758 | return 0; | 2750 | return 0; |
2759 | } | 2751 | } |
@@ -2764,7 +2756,7 @@ static void shutdown(SLMP_INFO * info) | |||
2764 | { | 2756 | { |
2765 | unsigned long flags; | 2757 | unsigned long flags; |
2766 | 2758 | ||
2767 | if (!(info->flags & ASYNC_INITIALIZED)) | 2759 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
2768 | return; | 2760 | return; |
2769 | 2761 | ||
2770 | if (debug_level >= DEBUG_LEVEL_INFO) | 2762 | if (debug_level >= DEBUG_LEVEL_INFO) |
@@ -2786,17 +2778,17 @@ static void shutdown(SLMP_INFO * info) | |||
2786 | 2778 | ||
2787 | reset_port(info); | 2779 | reset_port(info); |
2788 | 2780 | ||
2789 | if (!info->tty || info->tty->termios->c_cflag & HUPCL) { | 2781 | if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) { |
2790 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); | 2782 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); |
2791 | set_signals(info); | 2783 | set_signals(info); |
2792 | } | 2784 | } |
2793 | 2785 | ||
2794 | spin_unlock_irqrestore(&info->lock,flags); | 2786 | spin_unlock_irqrestore(&info->lock,flags); |
2795 | 2787 | ||
2796 | if (info->tty) | 2788 | if (info->port.tty) |
2797 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2789 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2798 | 2790 | ||
2799 | info->flags &= ~ASYNC_INITIALIZED; | 2791 | info->port.flags &= ~ASYNC_INITIALIZED; |
2800 | } | 2792 | } |
2801 | 2793 | ||
2802 | static void program_hw(SLMP_INFO *info) | 2794 | static void program_hw(SLMP_INFO *info) |
@@ -2827,7 +2819,7 @@ static void program_hw(SLMP_INFO *info) | |||
2827 | 2819 | ||
2828 | get_signals(info); | 2820 | get_signals(info); |
2829 | 2821 | ||
2830 | if (info->netcount || (info->tty && info->tty->termios->c_cflag & CREAD) ) | 2822 | if (info->netcount || (info->port.tty && info->port.tty->termios->c_cflag & CREAD) ) |
2831 | rx_start(info); | 2823 | rx_start(info); |
2832 | 2824 | ||
2833 | spin_unlock_irqrestore(&info->lock,flags); | 2825 | spin_unlock_irqrestore(&info->lock,flags); |
@@ -2840,14 +2832,14 @@ static void change_params(SLMP_INFO *info) | |||
2840 | unsigned cflag; | 2832 | unsigned cflag; |
2841 | int bits_per_char; | 2833 | int bits_per_char; |
2842 | 2834 | ||
2843 | if (!info->tty || !info->tty->termios) | 2835 | if (!info->port.tty || !info->port.tty->termios) |
2844 | return; | 2836 | return; |
2845 | 2837 | ||
2846 | if (debug_level >= DEBUG_LEVEL_INFO) | 2838 | if (debug_level >= DEBUG_LEVEL_INFO) |
2847 | printk("%s(%d):%s change_params()\n", | 2839 | printk("%s(%d):%s change_params()\n", |
2848 | __FILE__,__LINE__, info->device_name ); | 2840 | __FILE__,__LINE__, info->device_name ); |
2849 | 2841 | ||
2850 | cflag = info->tty->termios->c_cflag; | 2842 | cflag = info->port.tty->termios->c_cflag; |
2851 | 2843 | ||
2852 | /* if B0 rate (hangup) specified then negate DTR and RTS */ | 2844 | /* if B0 rate (hangup) specified then negate DTR and RTS */ |
2853 | /* otherwise assert DTR and RTS */ | 2845 | /* otherwise assert DTR and RTS */ |
@@ -2895,7 +2887,7 @@ static void change_params(SLMP_INFO *info) | |||
2895 | * current data rate. | 2887 | * current data rate. |
2896 | */ | 2888 | */ |
2897 | if (info->params.data_rate <= 460800) { | 2889 | if (info->params.data_rate <= 460800) { |
2898 | info->params.data_rate = tty_get_baud_rate(info->tty); | 2890 | info->params.data_rate = tty_get_baud_rate(info->port.tty); |
2899 | } | 2891 | } |
2900 | 2892 | ||
2901 | if ( info->params.data_rate ) { | 2893 | if ( info->params.data_rate ) { |
@@ -2905,30 +2897,30 @@ static void change_params(SLMP_INFO *info) | |||
2905 | info->timeout += HZ/50; /* Add .02 seconds of slop */ | 2897 | info->timeout += HZ/50; /* Add .02 seconds of slop */ |
2906 | 2898 | ||
2907 | if (cflag & CRTSCTS) | 2899 | if (cflag & CRTSCTS) |
2908 | info->flags |= ASYNC_CTS_FLOW; | 2900 | info->port.flags |= ASYNC_CTS_FLOW; |
2909 | else | 2901 | else |
2910 | info->flags &= ~ASYNC_CTS_FLOW; | 2902 | info->port.flags &= ~ASYNC_CTS_FLOW; |
2911 | 2903 | ||
2912 | if (cflag & CLOCAL) | 2904 | if (cflag & CLOCAL) |
2913 | info->flags &= ~ASYNC_CHECK_CD; | 2905 | info->port.flags &= ~ASYNC_CHECK_CD; |
2914 | else | 2906 | else |
2915 | info->flags |= ASYNC_CHECK_CD; | 2907 | info->port.flags |= ASYNC_CHECK_CD; |
2916 | 2908 | ||
2917 | /* process tty input control flags */ | 2909 | /* process tty input control flags */ |
2918 | 2910 | ||
2919 | info->read_status_mask2 = OVRN; | 2911 | info->read_status_mask2 = OVRN; |
2920 | if (I_INPCK(info->tty)) | 2912 | if (I_INPCK(info->port.tty)) |
2921 | info->read_status_mask2 |= PE | FRME; | 2913 | info->read_status_mask2 |= PE | FRME; |
2922 | if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) | 2914 | if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) |
2923 | info->read_status_mask1 |= BRKD; | 2915 | info->read_status_mask1 |= BRKD; |
2924 | if (I_IGNPAR(info->tty)) | 2916 | if (I_IGNPAR(info->port.tty)) |
2925 | info->ignore_status_mask2 |= PE | FRME; | 2917 | info->ignore_status_mask2 |= PE | FRME; |
2926 | if (I_IGNBRK(info->tty)) { | 2918 | if (I_IGNBRK(info->port.tty)) { |
2927 | info->ignore_status_mask1 |= BRKD; | 2919 | info->ignore_status_mask1 |= BRKD; |
2928 | /* If ignoring parity and break indicators, ignore | 2920 | /* If ignoring parity and break indicators, ignore |
2929 | * overruns too. (For real raw support). | 2921 | * overruns too. (For real raw support). |
2930 | */ | 2922 | */ |
2931 | if (I_IGNPAR(info->tty)) | 2923 | if (I_IGNPAR(info->port.tty)) |
2932 | info->ignore_status_mask2 |= OVRN; | 2924 | info->ignore_status_mask2 |= OVRN; |
2933 | } | 2925 | } |
2934 | 2926 | ||
@@ -3348,7 +3340,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3348 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ | 3340 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ |
3349 | /* nonblock mode is set or port is not enabled */ | 3341 | /* nonblock mode is set or port is not enabled */ |
3350 | /* just verify that callout device is not active */ | 3342 | /* just verify that callout device is not active */ |
3351 | info->flags |= ASYNC_NORMAL_ACTIVE; | 3343 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
3352 | return 0; | 3344 | return 0; |
3353 | } | 3345 | } |
3354 | 3346 | ||
@@ -3357,25 +3349,25 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3357 | 3349 | ||
3358 | /* Wait for carrier detect and the line to become | 3350 | /* Wait for carrier detect and the line to become |
3359 | * free (i.e., not in use by the callout). While we are in | 3351 | * free (i.e., not in use by the callout). While we are in |
3360 | * this loop, info->count is dropped by one, so that | 3352 | * this loop, info->port.count is dropped by one, so that |
3361 | * close() knows when to free things. We restore it upon | 3353 | * close() knows when to free things. We restore it upon |
3362 | * exit, either normal or abnormal. | 3354 | * exit, either normal or abnormal. |
3363 | */ | 3355 | */ |
3364 | 3356 | ||
3365 | retval = 0; | 3357 | retval = 0; |
3366 | add_wait_queue(&info->open_wait, &wait); | 3358 | add_wait_queue(&info->port.open_wait, &wait); |
3367 | 3359 | ||
3368 | if (debug_level >= DEBUG_LEVEL_INFO) | 3360 | if (debug_level >= DEBUG_LEVEL_INFO) |
3369 | printk("%s(%d):%s block_til_ready() before block, count=%d\n", | 3361 | printk("%s(%d):%s block_til_ready() before block, count=%d\n", |
3370 | __FILE__,__LINE__, tty->driver->name, info->count ); | 3362 | __FILE__,__LINE__, tty->driver->name, info->port.count ); |
3371 | 3363 | ||
3372 | spin_lock_irqsave(&info->lock, flags); | 3364 | spin_lock_irqsave(&info->lock, flags); |
3373 | if (!tty_hung_up_p(filp)) { | 3365 | if (!tty_hung_up_p(filp)) { |
3374 | extra_count = true; | 3366 | extra_count = true; |
3375 | info->count--; | 3367 | info->port.count--; |
3376 | } | 3368 | } |
3377 | spin_unlock_irqrestore(&info->lock, flags); | 3369 | spin_unlock_irqrestore(&info->lock, flags); |
3378 | info->blocked_open++; | 3370 | info->port.blocked_open++; |
3379 | 3371 | ||
3380 | while (1) { | 3372 | while (1) { |
3381 | if ((tty->termios->c_cflag & CBAUD)) { | 3373 | if ((tty->termios->c_cflag & CBAUD)) { |
@@ -3387,8 +3379,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3387 | 3379 | ||
3388 | set_current_state(TASK_INTERRUPTIBLE); | 3380 | set_current_state(TASK_INTERRUPTIBLE); |
3389 | 3381 | ||
3390 | if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)){ | 3382 | if (tty_hung_up_p(filp) || !(info->port.flags & ASYNC_INITIALIZED)){ |
3391 | retval = (info->flags & ASYNC_HUP_NOTIFY) ? | 3383 | retval = (info->port.flags & ASYNC_HUP_NOTIFY) ? |
3392 | -EAGAIN : -ERESTARTSYS; | 3384 | -EAGAIN : -ERESTARTSYS; |
3393 | break; | 3385 | break; |
3394 | } | 3386 | } |
@@ -3397,7 +3389,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3397 | get_signals(info); | 3389 | get_signals(info); |
3398 | spin_unlock_irqrestore(&info->lock,flags); | 3390 | spin_unlock_irqrestore(&info->lock,flags); |
3399 | 3391 | ||
3400 | if (!(info->flags & ASYNC_CLOSING) && | 3392 | if (!(info->port.flags & ASYNC_CLOSING) && |
3401 | (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { | 3393 | (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { |
3402 | break; | 3394 | break; |
3403 | } | 3395 | } |
@@ -3409,24 +3401,24 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3409 | 3401 | ||
3410 | if (debug_level >= DEBUG_LEVEL_INFO) | 3402 | if (debug_level >= DEBUG_LEVEL_INFO) |
3411 | printk("%s(%d):%s block_til_ready() count=%d\n", | 3403 | printk("%s(%d):%s block_til_ready() count=%d\n", |
3412 | __FILE__,__LINE__, tty->driver->name, info->count ); | 3404 | __FILE__,__LINE__, tty->driver->name, info->port.count ); |
3413 | 3405 | ||
3414 | schedule(); | 3406 | schedule(); |
3415 | } | 3407 | } |
3416 | 3408 | ||
3417 | set_current_state(TASK_RUNNING); | 3409 | set_current_state(TASK_RUNNING); |
3418 | remove_wait_queue(&info->open_wait, &wait); | 3410 | remove_wait_queue(&info->port.open_wait, &wait); |
3419 | 3411 | ||
3420 | if (extra_count) | 3412 | if (extra_count) |
3421 | info->count++; | 3413 | info->port.count++; |
3422 | info->blocked_open--; | 3414 | info->port.blocked_open--; |
3423 | 3415 | ||
3424 | if (debug_level >= DEBUG_LEVEL_INFO) | 3416 | if (debug_level >= DEBUG_LEVEL_INFO) |
3425 | printk("%s(%d):%s block_til_ready() after, count=%d\n", | 3417 | printk("%s(%d):%s block_til_ready() after, count=%d\n", |
3426 | __FILE__,__LINE__, tty->driver->name, info->count ); | 3418 | __FILE__,__LINE__, tty->driver->name, info->port.count ); |
3427 | 3419 | ||
3428 | if (!retval) | 3420 | if (!retval) |
3429 | info->flags |= ASYNC_NORMAL_ACTIVE; | 3421 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
3430 | 3422 | ||
3431 | return retval; | 3423 | return retval; |
3432 | } | 3424 | } |
@@ -3808,13 +3800,12 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) | |||
3808 | printk("%s(%d) Error can't allocate device instance data for adapter %d, port %d\n", | 3800 | printk("%s(%d) Error can't allocate device instance data for adapter %d, port %d\n", |
3809 | __FILE__,__LINE__, adapter_num, port_num); | 3801 | __FILE__,__LINE__, adapter_num, port_num); |
3810 | } else { | 3802 | } else { |
3803 | tty_port_init(&info->port); | ||
3811 | info->magic = MGSL_MAGIC; | 3804 | info->magic = MGSL_MAGIC; |
3812 | INIT_WORK(&info->task, bh_handler); | 3805 | INIT_WORK(&info->task, bh_handler); |
3813 | info->max_frame_size = 4096; | 3806 | info->max_frame_size = 4096; |
3814 | info->close_delay = 5*HZ/10; | 3807 | info->port.close_delay = 5*HZ/10; |
3815 | info->closing_wait = 30*HZ; | 3808 | info->port.closing_wait = 30*HZ; |
3816 | init_waitqueue_head(&info->open_wait); | ||
3817 | init_waitqueue_head(&info->close_wait); | ||
3818 | init_waitqueue_head(&info->status_event_wait_q); | 3809 | init_waitqueue_head(&info->status_event_wait_q); |
3819 | init_waitqueue_head(&info->event_wait_q); | 3810 | init_waitqueue_head(&info->event_wait_q); |
3820 | spin_lock_init(&info->netlock); | 3811 | spin_lock_init(&info->netlock); |
@@ -4885,7 +4876,7 @@ static bool rx_get_frame(SLMP_INFO *info) | |||
4885 | unsigned int framesize = 0; | 4876 | unsigned int framesize = 0; |
4886 | bool ReturnCode = false; | 4877 | bool ReturnCode = false; |
4887 | unsigned long flags; | 4878 | unsigned long flags; |
4888 | struct tty_struct *tty = info->tty; | 4879 | struct tty_struct *tty = info->port.tty; |
4889 | unsigned char addr_field = 0xff; | 4880 | unsigned char addr_field = 0xff; |
4890 | SCADESC *desc; | 4881 | SCADESC *desc; |
4891 | SCADESC_EX *desc_ex; | 4882 | SCADESC_EX *desc_ex; |
@@ -4983,9 +4974,8 @@ CheckAgain: | |||
4983 | framesize = 0; | 4974 | framesize = 0; |
4984 | #if SYNCLINK_GENERIC_HDLC | 4975 | #if SYNCLINK_GENERIC_HDLC |
4985 | { | 4976 | { |
4986 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 4977 | info->netdev->stats.rx_errors++; |
4987 | stats->rx_errors++; | 4978 | info->netdev->stats.rx_frame_errors++; |
4988 | stats->rx_frame_errors++; | ||
4989 | } | 4979 | } |
4990 | #endif | 4980 | #endif |
4991 | } | 4981 | } |
@@ -5293,11 +5283,11 @@ static bool loopback_test(SLMP_INFO *info) | |||
5293 | bool rc = false; | 5283 | bool rc = false; |
5294 | unsigned long flags; | 5284 | unsigned long flags; |
5295 | 5285 | ||
5296 | struct tty_struct *oldtty = info->tty; | 5286 | struct tty_struct *oldtty = info->port.tty; |
5297 | u32 speed = info->params.clock_speed; | 5287 | u32 speed = info->params.clock_speed; |
5298 | 5288 | ||
5299 | info->params.clock_speed = 3686400; | 5289 | info->params.clock_speed = 3686400; |
5300 | info->tty = NULL; | 5290 | info->port.tty = NULL; |
5301 | 5291 | ||
5302 | /* assume failure */ | 5292 | /* assume failure */ |
5303 | info->init_error = DiagStatus_DmaFailure; | 5293 | info->init_error = DiagStatus_DmaFailure; |
@@ -5341,7 +5331,7 @@ static bool loopback_test(SLMP_INFO *info) | |||
5341 | spin_unlock_irqrestore(&info->lock,flags); | 5331 | spin_unlock_irqrestore(&info->lock,flags); |
5342 | 5332 | ||
5343 | info->params.clock_speed = speed; | 5333 | info->params.clock_speed = speed; |
5344 | info->tty = oldtty; | 5334 | info->port.tty = oldtty; |
5345 | 5335 | ||
5346 | return rc; | 5336 | return rc; |
5347 | } | 5337 | } |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 047a17339f83..82f6a8c86332 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -95,8 +95,9 @@ | |||
95 | #include <linux/wait.h> | 95 | #include <linux/wait.h> |
96 | #include <linux/bitops.h> | 96 | #include <linux/bitops.h> |
97 | #include <linux/delay.h> | 97 | #include <linux/delay.h> |
98 | #include <linux/seq_file.h> | ||
98 | 99 | ||
99 | #include <asm/uaccess.h> | 100 | #include <linux/uaccess.h> |
100 | #include <asm/system.h> | 101 | #include <asm/system.h> |
101 | 102 | ||
102 | #include <linux/kbd_kern.h> | 103 | #include <linux/kbd_kern.h> |
@@ -682,7 +683,7 @@ static void tty_set_termios_ldisc(struct tty_struct *tty, int num) | |||
682 | static DEFINE_SPINLOCK(tty_ldisc_lock); | 683 | static DEFINE_SPINLOCK(tty_ldisc_lock); |
683 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); | 684 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); |
684 | /* Line disc dispatch table */ | 685 | /* Line disc dispatch table */ |
685 | static struct tty_ldisc tty_ldiscs[NR_LDISCS]; | 686 | static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; |
686 | 687 | ||
687 | /** | 688 | /** |
688 | * tty_register_ldisc - install a line discipline | 689 | * tty_register_ldisc - install a line discipline |
@@ -697,7 +698,7 @@ static struct tty_ldisc tty_ldiscs[NR_LDISCS]; | |||
697 | * takes tty_ldisc_lock to guard against ldisc races | 698 | * takes tty_ldisc_lock to guard against ldisc races |
698 | */ | 699 | */ |
699 | 700 | ||
700 | int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc) | 701 | int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc) |
701 | { | 702 | { |
702 | unsigned long flags; | 703 | unsigned long flags; |
703 | int ret = 0; | 704 | int ret = 0; |
@@ -706,10 +707,9 @@ int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc) | |||
706 | return -EINVAL; | 707 | return -EINVAL; |
707 | 708 | ||
708 | spin_lock_irqsave(&tty_ldisc_lock, flags); | 709 | spin_lock_irqsave(&tty_ldisc_lock, flags); |
709 | tty_ldiscs[disc] = *new_ldisc; | 710 | tty_ldiscs[disc] = new_ldisc; |
710 | tty_ldiscs[disc].num = disc; | 711 | new_ldisc->num = disc; |
711 | tty_ldiscs[disc].flags |= LDISC_FLAG_DEFINED; | 712 | new_ldisc->refcount = 0; |
712 | tty_ldiscs[disc].refcount = 0; | ||
713 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 713 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
714 | 714 | ||
715 | return ret; | 715 | return ret; |
@@ -737,19 +737,56 @@ int tty_unregister_ldisc(int disc) | |||
737 | return -EINVAL; | 737 | return -EINVAL; |
738 | 738 | ||
739 | spin_lock_irqsave(&tty_ldisc_lock, flags); | 739 | spin_lock_irqsave(&tty_ldisc_lock, flags); |
740 | if (tty_ldiscs[disc].refcount) | 740 | if (tty_ldiscs[disc]->refcount) |
741 | ret = -EBUSY; | 741 | ret = -EBUSY; |
742 | else | 742 | else |
743 | tty_ldiscs[disc].flags &= ~LDISC_FLAG_DEFINED; | 743 | tty_ldiscs[disc] = NULL; |
744 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 744 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
745 | 745 | ||
746 | return ret; | 746 | return ret; |
747 | } | 747 | } |
748 | EXPORT_SYMBOL(tty_unregister_ldisc); | 748 | EXPORT_SYMBOL(tty_unregister_ldisc); |
749 | 749 | ||
750 | |||
751 | /** | ||
752 | * tty_ldisc_try_get - try and reference an ldisc | ||
753 | * @disc: ldisc number | ||
754 | * @ld: tty ldisc structure to complete | ||
755 | * | ||
756 | * Attempt to open and lock a line discipline into place. Return | ||
757 | * the line discipline refcounted and assigned in ld. On an error | ||
758 | * report the error code back | ||
759 | */ | ||
760 | |||
761 | static int tty_ldisc_try_get(int disc, struct tty_ldisc *ld) | ||
762 | { | ||
763 | unsigned long flags; | ||
764 | struct tty_ldisc_ops *ldops; | ||
765 | int err = -EINVAL; | ||
766 | |||
767 | spin_lock_irqsave(&tty_ldisc_lock, flags); | ||
768 | ld->ops = NULL; | ||
769 | ldops = tty_ldiscs[disc]; | ||
770 | /* Check the entry is defined */ | ||
771 | if (ldops) { | ||
772 | /* If the module is being unloaded we can't use it */ | ||
773 | if (!try_module_get(ldops->owner)) | ||
774 | err = -EAGAIN; | ||
775 | else { | ||
776 | /* lock it */ | ||
777 | ldops->refcount++; | ||
778 | ld->ops = ldops; | ||
779 | err = 0; | ||
780 | } | ||
781 | } | ||
782 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | ||
783 | return err; | ||
784 | } | ||
785 | |||
750 | /** | 786 | /** |
751 | * tty_ldisc_get - take a reference to an ldisc | 787 | * tty_ldisc_get - take a reference to an ldisc |
752 | * @disc: ldisc number | 788 | * @disc: ldisc number |
789 | * @ld: tty line discipline structure to use | ||
753 | * | 790 | * |
754 | * Takes a reference to a line discipline. Deals with refcounts and | 791 | * Takes a reference to a line discipline. Deals with refcounts and |
755 | * module locking counts. Returns NULL if the discipline is not available. | 792 | * module locking counts. Returns NULL if the discipline is not available. |
@@ -760,32 +797,20 @@ EXPORT_SYMBOL(tty_unregister_ldisc); | |||
760 | * takes tty_ldisc_lock to guard against ldisc races | 797 | * takes tty_ldisc_lock to guard against ldisc races |
761 | */ | 798 | */ |
762 | 799 | ||
763 | struct tty_ldisc *tty_ldisc_get(int disc) | 800 | static int tty_ldisc_get(int disc, struct tty_ldisc *ld) |
764 | { | 801 | { |
765 | unsigned long flags; | 802 | int err; |
766 | struct tty_ldisc *ld; | ||
767 | 803 | ||
768 | if (disc < N_TTY || disc >= NR_LDISCS) | 804 | if (disc < N_TTY || disc >= NR_LDISCS) |
769 | return NULL; | 805 | return -EINVAL; |
770 | 806 | err = tty_ldisc_try_get(disc, ld); | |
771 | spin_lock_irqsave(&tty_ldisc_lock, flags); | 807 | if (err == -EAGAIN) { |
772 | 808 | request_module("tty-ldisc-%d", disc); | |
773 | ld = &tty_ldiscs[disc]; | 809 | err = tty_ldisc_try_get(disc, ld); |
774 | /* Check the entry is defined */ | 810 | } |
775 | if (ld->flags & LDISC_FLAG_DEFINED) { | 811 | return err; |
776 | /* If the module is being unloaded we can't use it */ | ||
777 | if (!try_module_get(ld->owner)) | ||
778 | ld = NULL; | ||
779 | else /* lock it */ | ||
780 | ld->refcount++; | ||
781 | } else | ||
782 | ld = NULL; | ||
783 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | ||
784 | return ld; | ||
785 | } | 812 | } |
786 | 813 | ||
787 | EXPORT_SYMBOL_GPL(tty_ldisc_get); | ||
788 | |||
789 | /** | 814 | /** |
790 | * tty_ldisc_put - drop ldisc reference | 815 | * tty_ldisc_put - drop ldisc reference |
791 | * @disc: ldisc number | 816 | * @disc: ldisc number |
@@ -797,22 +822,67 @@ EXPORT_SYMBOL_GPL(tty_ldisc_get); | |||
797 | * takes tty_ldisc_lock to guard against ldisc races | 822 | * takes tty_ldisc_lock to guard against ldisc races |
798 | */ | 823 | */ |
799 | 824 | ||
800 | void tty_ldisc_put(int disc) | 825 | static void tty_ldisc_put(struct tty_ldisc_ops *ld) |
801 | { | 826 | { |
802 | struct tty_ldisc *ld; | ||
803 | unsigned long flags; | 827 | unsigned long flags; |
828 | int disc = ld->num; | ||
804 | 829 | ||
805 | BUG_ON(disc < N_TTY || disc >= NR_LDISCS); | 830 | BUG_ON(disc < N_TTY || disc >= NR_LDISCS); |
806 | 831 | ||
807 | spin_lock_irqsave(&tty_ldisc_lock, flags); | 832 | spin_lock_irqsave(&tty_ldisc_lock, flags); |
808 | ld = &tty_ldiscs[disc]; | 833 | ld = tty_ldiscs[disc]; |
809 | BUG_ON(ld->refcount == 0); | 834 | BUG_ON(ld->refcount == 0); |
810 | ld->refcount--; | 835 | ld->refcount--; |
811 | module_put(ld->owner); | 836 | module_put(ld->owner); |
812 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 837 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
813 | } | 838 | } |
814 | 839 | ||
815 | EXPORT_SYMBOL_GPL(tty_ldisc_put); | 840 | static void * tty_ldiscs_seq_start(struct seq_file *m, loff_t *pos) |
841 | { | ||
842 | return (*pos < NR_LDISCS) ? pos : NULL; | ||
843 | } | ||
844 | |||
845 | static void * tty_ldiscs_seq_next(struct seq_file *m, void *v, loff_t *pos) | ||
846 | { | ||
847 | (*pos)++; | ||
848 | return (*pos < NR_LDISCS) ? pos : NULL; | ||
849 | } | ||
850 | |||
851 | static void tty_ldiscs_seq_stop(struct seq_file *m, void *v) | ||
852 | { | ||
853 | } | ||
854 | |||
855 | static int tty_ldiscs_seq_show(struct seq_file *m, void *v) | ||
856 | { | ||
857 | int i = *(loff_t *)v; | ||
858 | struct tty_ldisc ld; | ||
859 | |||
860 | if (tty_ldisc_get(i, &ld) < 0) | ||
861 | return 0; | ||
862 | seq_printf(m, "%-10s %2d\n", ld.ops->name ? ld.ops->name : "???", i); | ||
863 | tty_ldisc_put(ld.ops); | ||
864 | return 0; | ||
865 | } | ||
866 | |||
867 | static const struct seq_operations tty_ldiscs_seq_ops = { | ||
868 | .start = tty_ldiscs_seq_start, | ||
869 | .next = tty_ldiscs_seq_next, | ||
870 | .stop = tty_ldiscs_seq_stop, | ||
871 | .show = tty_ldiscs_seq_show, | ||
872 | }; | ||
873 | |||
874 | static int proc_tty_ldiscs_open(struct inode *inode, struct file *file) | ||
875 | { | ||
876 | return seq_open(file, &tty_ldiscs_seq_ops); | ||
877 | } | ||
878 | |||
879 | const struct file_operations tty_ldiscs_proc_fops = { | ||
880 | .owner = THIS_MODULE, | ||
881 | .open = proc_tty_ldiscs_open, | ||
882 | .read = seq_read, | ||
883 | .llseek = seq_lseek, | ||
884 | .release = seq_release, | ||
885 | }; | ||
816 | 886 | ||
817 | /** | 887 | /** |
818 | * tty_ldisc_assign - set ldisc on a tty | 888 | * tty_ldisc_assign - set ldisc on a tty |
@@ -829,8 +899,8 @@ EXPORT_SYMBOL_GPL(tty_ldisc_put); | |||
829 | 899 | ||
830 | static void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld) | 900 | static void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld) |
831 | { | 901 | { |
902 | ld->refcount = 0; | ||
832 | tty->ldisc = *ld; | 903 | tty->ldisc = *ld; |
833 | tty->ldisc.refcount = 0; | ||
834 | } | 904 | } |
835 | 905 | ||
836 | /** | 906 | /** |
@@ -954,6 +1024,41 @@ static void tty_ldisc_enable(struct tty_struct *tty) | |||
954 | } | 1024 | } |
955 | 1025 | ||
956 | /** | 1026 | /** |
1027 | * tty_ldisc_restore - helper for tty ldisc change | ||
1028 | * @tty: tty to recover | ||
1029 | * @old: previous ldisc | ||
1030 | * | ||
1031 | * Restore the previous line discipline or N_TTY when a line discipline | ||
1032 | * change fails due to an open error | ||
1033 | */ | ||
1034 | |||
1035 | static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) | ||
1036 | { | ||
1037 | char buf[64]; | ||
1038 | struct tty_ldisc new_ldisc; | ||
1039 | |||
1040 | /* There is an outstanding reference here so this is safe */ | ||
1041 | tty_ldisc_get(old->ops->num, old); | ||
1042 | tty_ldisc_assign(tty, old); | ||
1043 | tty_set_termios_ldisc(tty, old->ops->num); | ||
1044 | if (old->ops->open && (old->ops->open(tty) < 0)) { | ||
1045 | tty_ldisc_put(old->ops); | ||
1046 | /* This driver is always present */ | ||
1047 | if (tty_ldisc_get(N_TTY, &new_ldisc) < 0) | ||
1048 | panic("n_tty: get"); | ||
1049 | tty_ldisc_assign(tty, &new_ldisc); | ||
1050 | tty_set_termios_ldisc(tty, N_TTY); | ||
1051 | if (new_ldisc.ops->open) { | ||
1052 | int r = new_ldisc.ops->open(tty); | ||
1053 | if (r < 0) | ||
1054 | panic("Couldn't open N_TTY ldisc for " | ||
1055 | "%s --- error %d.", | ||
1056 | tty_name(tty, buf), r); | ||
1057 | } | ||
1058 | } | ||
1059 | } | ||
1060 | |||
1061 | /** | ||
957 | * tty_set_ldisc - set line discipline | 1062 | * tty_set_ldisc - set line discipline |
958 | * @tty: the terminal to set | 1063 | * @tty: the terminal to set |
959 | * @ldisc: the line discipline | 1064 | * @ldisc: the line discipline |
@@ -967,28 +1072,18 @@ static void tty_ldisc_enable(struct tty_struct *tty) | |||
967 | 1072 | ||
968 | static int tty_set_ldisc(struct tty_struct *tty, int ldisc) | 1073 | static int tty_set_ldisc(struct tty_struct *tty, int ldisc) |
969 | { | 1074 | { |
970 | int retval = 0; | 1075 | int retval; |
971 | struct tty_ldisc o_ldisc; | 1076 | struct tty_ldisc o_ldisc, new_ldisc; |
972 | char buf[64]; | ||
973 | int work; | 1077 | int work; |
974 | unsigned long flags; | 1078 | unsigned long flags; |
975 | struct tty_ldisc *ld; | ||
976 | struct tty_struct *o_tty; | 1079 | struct tty_struct *o_tty; |
977 | 1080 | ||
978 | if ((ldisc < N_TTY) || (ldisc >= NR_LDISCS)) | ||
979 | return -EINVAL; | ||
980 | |||
981 | restart: | 1081 | restart: |
982 | 1082 | /* This is a bit ugly for now but means we can break the 'ldisc | |
983 | ld = tty_ldisc_get(ldisc); | 1083 | is part of the tty struct' assumption later */ |
984 | /* Eduardo Blanco <ejbs@cs.cs.com.uy> */ | 1084 | retval = tty_ldisc_get(ldisc, &new_ldisc); |
985 | /* Cyrus Durgin <cider@speakeasy.org> */ | 1085 | if (retval) |
986 | if (ld == NULL) { | 1086 | return retval; |
987 | request_module("tty-ldisc-%d", ldisc); | ||
988 | ld = tty_ldisc_get(ldisc); | ||
989 | } | ||
990 | if (ld == NULL) | ||
991 | return -EINVAL; | ||
992 | 1087 | ||
993 | /* | 1088 | /* |
994 | * Problem: What do we do if this blocks ? | 1089 | * Problem: What do we do if this blocks ? |
@@ -996,8 +1091,8 @@ restart: | |||
996 | 1091 | ||
997 | tty_wait_until_sent(tty, 0); | 1092 | tty_wait_until_sent(tty, 0); |
998 | 1093 | ||
999 | if (tty->ldisc.num == ldisc) { | 1094 | if (tty->ldisc.ops->num == ldisc) { |
1000 | tty_ldisc_put(ldisc); | 1095 | tty_ldisc_put(new_ldisc.ops); |
1001 | return 0; | 1096 | return 0; |
1002 | } | 1097 | } |
1003 | 1098 | ||
@@ -1024,7 +1119,7 @@ restart: | |||
1024 | /* Free the new ldisc we grabbed. Must drop the lock | 1119 | /* Free the new ldisc we grabbed. Must drop the lock |
1025 | first. */ | 1120 | first. */ |
1026 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 1121 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
1027 | tty_ldisc_put(ldisc); | 1122 | tty_ldisc_put(o_ldisc.ops); |
1028 | /* | 1123 | /* |
1029 | * There are several reasons we may be busy, including | 1124 | * There are several reasons we may be busy, including |
1030 | * random momentary I/O traffic. We must therefore | 1125 | * random momentary I/O traffic. We must therefore |
@@ -1038,7 +1133,7 @@ restart: | |||
1038 | } | 1133 | } |
1039 | if (o_tty && o_tty->ldisc.refcount) { | 1134 | if (o_tty && o_tty->ldisc.refcount) { |
1040 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 1135 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
1041 | tty_ldisc_put(ldisc); | 1136 | tty_ldisc_put(o_tty->ldisc.ops); |
1042 | if (wait_event_interruptible(tty_ldisc_wait, o_tty->ldisc.refcount == 0) < 0) | 1137 | if (wait_event_interruptible(tty_ldisc_wait, o_tty->ldisc.refcount == 0) < 0) |
1043 | return -ERESTARTSYS; | 1138 | return -ERESTARTSYS; |
1044 | goto restart; | 1139 | goto restart; |
@@ -1049,8 +1144,9 @@ restart: | |||
1049 | * another ldisc change | 1144 | * another ldisc change |
1050 | */ | 1145 | */ |
1051 | if (!test_bit(TTY_LDISC, &tty->flags)) { | 1146 | if (!test_bit(TTY_LDISC, &tty->flags)) { |
1147 | struct tty_ldisc *ld; | ||
1052 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 1148 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
1053 | tty_ldisc_put(ldisc); | 1149 | tty_ldisc_put(new_ldisc.ops); |
1054 | ld = tty_ldisc_ref_wait(tty); | 1150 | ld = tty_ldisc_ref_wait(tty); |
1055 | tty_ldisc_deref(ld); | 1151 | tty_ldisc_deref(ld); |
1056 | goto restart; | 1152 | goto restart; |
@@ -1060,7 +1156,7 @@ restart: | |||
1060 | if (o_tty) | 1156 | if (o_tty) |
1061 | clear_bit(TTY_LDISC, &o_tty->flags); | 1157 | clear_bit(TTY_LDISC, &o_tty->flags); |
1062 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 1158 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
1063 | 1159 | ||
1064 | /* | 1160 | /* |
1065 | * From this point on we know nobody has an ldisc | 1161 | * From this point on we know nobody has an ldisc |
1066 | * usage reference, nor can they obtain one until | 1162 | * usage reference, nor can they obtain one until |
@@ -1070,45 +1166,30 @@ restart: | |||
1070 | work = cancel_delayed_work(&tty->buf.work); | 1166 | work = cancel_delayed_work(&tty->buf.work); |
1071 | /* | 1167 | /* |
1072 | * Wait for ->hangup_work and ->buf.work handlers to terminate | 1168 | * Wait for ->hangup_work and ->buf.work handlers to terminate |
1169 | * MUST NOT hold locks here. | ||
1073 | */ | 1170 | */ |
1074 | flush_scheduled_work(); | 1171 | flush_scheduled_work(); |
1075 | /* Shutdown the current discipline. */ | 1172 | /* Shutdown the current discipline. */ |
1076 | if (tty->ldisc.close) | 1173 | if (o_ldisc.ops->close) |
1077 | (tty->ldisc.close)(tty); | 1174 | (o_ldisc.ops->close)(tty); |
1078 | 1175 | ||
1079 | /* Now set up the new line discipline. */ | 1176 | /* Now set up the new line discipline. */ |
1080 | tty_ldisc_assign(tty, ld); | 1177 | tty_ldisc_assign(tty, &new_ldisc); |
1081 | tty_set_termios_ldisc(tty, ldisc); | 1178 | tty_set_termios_ldisc(tty, ldisc); |
1082 | if (tty->ldisc.open) | 1179 | if (new_ldisc.ops->open) |
1083 | retval = (tty->ldisc.open)(tty); | 1180 | retval = (new_ldisc.ops->open)(tty); |
1084 | if (retval < 0) { | 1181 | if (retval < 0) { |
1085 | tty_ldisc_put(ldisc); | 1182 | tty_ldisc_put(new_ldisc.ops); |
1086 | /* There is an outstanding reference here so this is safe */ | 1183 | tty_ldisc_restore(tty, &o_ldisc); |
1087 | tty_ldisc_assign(tty, tty_ldisc_get(o_ldisc.num)); | ||
1088 | tty_set_termios_ldisc(tty, tty->ldisc.num); | ||
1089 | if (tty->ldisc.open && (tty->ldisc.open(tty) < 0)) { | ||
1090 | tty_ldisc_put(o_ldisc.num); | ||
1091 | /* This driver is always present */ | ||
1092 | tty_ldisc_assign(tty, tty_ldisc_get(N_TTY)); | ||
1093 | tty_set_termios_ldisc(tty, N_TTY); | ||
1094 | if (tty->ldisc.open) { | ||
1095 | int r = tty->ldisc.open(tty); | ||
1096 | |||
1097 | if (r < 0) | ||
1098 | panic("Couldn't open N_TTY ldisc for " | ||
1099 | "%s --- error %d.", | ||
1100 | tty_name(tty, buf), r); | ||
1101 | } | ||
1102 | } | ||
1103 | } | 1184 | } |
1104 | /* At this point we hold a reference to the new ldisc and a | 1185 | /* At this point we hold a reference to the new ldisc and a |
1105 | a reference to the old ldisc. If we ended up flipping back | 1186 | a reference to the old ldisc. If we ended up flipping back |
1106 | to the existing ldisc we have two references to it */ | 1187 | to the existing ldisc we have two references to it */ |
1107 | 1188 | ||
1108 | if (tty->ldisc.num != o_ldisc.num && tty->ops->set_ldisc) | 1189 | if (tty->ldisc.ops->num != o_ldisc.ops->num && tty->ops->set_ldisc) |
1109 | tty->ops->set_ldisc(tty); | 1190 | tty->ops->set_ldisc(tty); |
1110 | 1191 | ||
1111 | tty_ldisc_put(o_ldisc.num); | 1192 | tty_ldisc_put(o_ldisc.ops); |
1112 | 1193 | ||
1113 | /* | 1194 | /* |
1114 | * Allow ldisc referencing to occur as soon as the driver | 1195 | * Allow ldisc referencing to occur as soon as the driver |
@@ -1335,8 +1416,8 @@ void tty_wakeup(struct tty_struct *tty) | |||
1335 | if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) { | 1416 | if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) { |
1336 | ld = tty_ldisc_ref(tty); | 1417 | ld = tty_ldisc_ref(tty); |
1337 | if (ld) { | 1418 | if (ld) { |
1338 | if (ld->write_wakeup) | 1419 | if (ld->ops->write_wakeup) |
1339 | ld->write_wakeup(tty); | 1420 | ld->ops->write_wakeup(tty); |
1340 | tty_ldisc_deref(ld); | 1421 | tty_ldisc_deref(ld); |
1341 | } | 1422 | } |
1342 | } | 1423 | } |
@@ -1357,8 +1438,8 @@ void tty_ldisc_flush(struct tty_struct *tty) | |||
1357 | { | 1438 | { |
1358 | struct tty_ldisc *ld = tty_ldisc_ref(tty); | 1439 | struct tty_ldisc *ld = tty_ldisc_ref(tty); |
1359 | if (ld) { | 1440 | if (ld) { |
1360 | if (ld->flush_buffer) | 1441 | if (ld->ops->flush_buffer) |
1361 | ld->flush_buffer(tty); | 1442 | ld->ops->flush_buffer(tty); |
1362 | tty_ldisc_deref(ld); | 1443 | tty_ldisc_deref(ld); |
1363 | } | 1444 | } |
1364 | tty_buffer_flush(tty); | 1445 | tty_buffer_flush(tty); |
@@ -1386,7 +1467,7 @@ static void tty_reset_termios(struct tty_struct *tty) | |||
1386 | * do_tty_hangup - actual handler for hangup events | 1467 | * do_tty_hangup - actual handler for hangup events |
1387 | * @work: tty device | 1468 | * @work: tty device |
1388 | * | 1469 | * |
1389 | * This can be called by the "eventd" kernel thread. That is process | 1470 | k * This can be called by the "eventd" kernel thread. That is process |
1390 | * synchronous but doesn't hold any locks, so we need to make sure we | 1471 | * synchronous but doesn't hold any locks, so we need to make sure we |
1391 | * have the appropriate locks for what we're doing. | 1472 | * have the appropriate locks for what we're doing. |
1392 | * | 1473 | * |
@@ -1449,14 +1530,14 @@ static void do_tty_hangup(struct work_struct *work) | |||
1449 | ld = tty_ldisc_ref(tty); | 1530 | ld = tty_ldisc_ref(tty); |
1450 | if (ld != NULL) { | 1531 | if (ld != NULL) { |
1451 | /* We may have no line discipline at this point */ | 1532 | /* We may have no line discipline at this point */ |
1452 | if (ld->flush_buffer) | 1533 | if (ld->ops->flush_buffer) |
1453 | ld->flush_buffer(tty); | 1534 | ld->ops->flush_buffer(tty); |
1454 | tty_driver_flush_buffer(tty); | 1535 | tty_driver_flush_buffer(tty); |
1455 | if ((test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) && | 1536 | if ((test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) && |
1456 | ld->write_wakeup) | 1537 | ld->ops->write_wakeup) |
1457 | ld->write_wakeup(tty); | 1538 | ld->ops->write_wakeup(tty); |
1458 | if (ld->hangup) | 1539 | if (ld->ops->hangup) |
1459 | ld->hangup(tty); | 1540 | ld->ops->hangup(tty); |
1460 | } | 1541 | } |
1461 | /* | 1542 | /* |
1462 | * FIXME: Once we trust the LDISC code better we can wait here for | 1543 | * FIXME: Once we trust the LDISC code better we can wait here for |
@@ -1825,8 +1906,8 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count, | |||
1825 | /* We want to wait for the line discipline to sort out in this | 1906 | /* We want to wait for the line discipline to sort out in this |
1826 | situation */ | 1907 | situation */ |
1827 | ld = tty_ldisc_ref_wait(tty); | 1908 | ld = tty_ldisc_ref_wait(tty); |
1828 | if (ld->read) | 1909 | if (ld->ops->read) |
1829 | i = (ld->read)(tty, file, buf, count); | 1910 | i = (ld->ops->read)(tty, file, buf, count); |
1830 | else | 1911 | else |
1831 | i = -EIO; | 1912 | i = -EIO; |
1832 | tty_ldisc_deref(ld); | 1913 | tty_ldisc_deref(ld); |
@@ -1978,10 +2059,10 @@ static ssize_t tty_write(struct file *file, const char __user *buf, | |||
1978 | printk(KERN_ERR "tty driver %s lacks a write_room method.\n", | 2059 | printk(KERN_ERR "tty driver %s lacks a write_room method.\n", |
1979 | tty->driver->name); | 2060 | tty->driver->name); |
1980 | ld = tty_ldisc_ref_wait(tty); | 2061 | ld = tty_ldisc_ref_wait(tty); |
1981 | if (!ld->write) | 2062 | if (!ld->ops->write) |
1982 | ret = -EIO; | 2063 | ret = -EIO; |
1983 | else | 2064 | else |
1984 | ret = do_tty_write(ld->write, tty, file, buf, count); | 2065 | ret = do_tty_write(ld->ops->write, tty, file, buf, count); |
1985 | tty_ldisc_deref(ld); | 2066 | tty_ldisc_deref(ld); |
1986 | return ret; | 2067 | return ret; |
1987 | } | 2068 | } |
@@ -2007,6 +2088,42 @@ ssize_t redirected_tty_write(struct file *file, const char __user *buf, | |||
2007 | return tty_write(file, buf, count, ppos); | 2088 | return tty_write(file, buf, count, ppos); |
2008 | } | 2089 | } |
2009 | 2090 | ||
2091 | void tty_port_init(struct tty_port *port) | ||
2092 | { | ||
2093 | memset(port, 0, sizeof(*port)); | ||
2094 | init_waitqueue_head(&port->open_wait); | ||
2095 | init_waitqueue_head(&port->close_wait); | ||
2096 | mutex_init(&port->mutex); | ||
2097 | port->close_delay = (50 * HZ) / 100; | ||
2098 | port->closing_wait = (3000 * HZ) / 100; | ||
2099 | } | ||
2100 | EXPORT_SYMBOL(tty_port_init); | ||
2101 | |||
2102 | int tty_port_alloc_xmit_buf(struct tty_port *port) | ||
2103 | { | ||
2104 | /* We may sleep in get_zeroed_page() */ | ||
2105 | mutex_lock(&port->mutex); | ||
2106 | if (port->xmit_buf == NULL) | ||
2107 | port->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL); | ||
2108 | mutex_unlock(&port->mutex); | ||
2109 | if (port->xmit_buf == NULL) | ||
2110 | return -ENOMEM; | ||
2111 | return 0; | ||
2112 | } | ||
2113 | EXPORT_SYMBOL(tty_port_alloc_xmit_buf); | ||
2114 | |||
2115 | void tty_port_free_xmit_buf(struct tty_port *port) | ||
2116 | { | ||
2117 | mutex_lock(&port->mutex); | ||
2118 | if (port->xmit_buf != NULL) { | ||
2119 | free_page((unsigned long)port->xmit_buf); | ||
2120 | port->xmit_buf = NULL; | ||
2121 | } | ||
2122 | mutex_unlock(&port->mutex); | ||
2123 | } | ||
2124 | EXPORT_SYMBOL(tty_port_free_xmit_buf); | ||
2125 | |||
2126 | |||
2010 | static char ptychar[] = "pqrstuvwxyzabcde"; | 2127 | static char ptychar[] = "pqrstuvwxyzabcde"; |
2011 | 2128 | ||
2012 | /** | 2129 | /** |
@@ -2076,6 +2193,7 @@ static int init_dev(struct tty_driver *driver, int idx, | |||
2076 | struct ktermios *tp, **tp_loc, *o_tp, **o_tp_loc; | 2193 | struct ktermios *tp, **tp_loc, *o_tp, **o_tp_loc; |
2077 | struct ktermios *ltp, **ltp_loc, *o_ltp, **o_ltp_loc; | 2194 | struct ktermios *ltp, **ltp_loc, *o_ltp, **o_ltp_loc; |
2078 | int retval = 0; | 2195 | int retval = 0; |
2196 | struct tty_ldisc *ld; | ||
2079 | 2197 | ||
2080 | /* check whether we're reopening an existing tty */ | 2198 | /* check whether we're reopening an existing tty */ |
2081 | if (driver->flags & TTY_DRIVER_DEVPTS_MEM) { | 2199 | if (driver->flags & TTY_DRIVER_DEVPTS_MEM) { |
@@ -2224,17 +2342,19 @@ static int init_dev(struct tty_driver *driver, int idx, | |||
2224 | * If we fail here just call release_tty to clean up. No need | 2342 | * If we fail here just call release_tty to clean up. No need |
2225 | * to decrement the use counts, as release_tty doesn't care. | 2343 | * to decrement the use counts, as release_tty doesn't care. |
2226 | */ | 2344 | */ |
2345 | |||
2346 | ld = &tty->ldisc; | ||
2227 | 2347 | ||
2228 | if (tty->ldisc.open) { | 2348 | if (ld->ops->open) { |
2229 | retval = (tty->ldisc.open)(tty); | 2349 | retval = (ld->ops->open)(tty); |
2230 | if (retval) | 2350 | if (retval) |
2231 | goto release_mem_out; | 2351 | goto release_mem_out; |
2232 | } | 2352 | } |
2233 | if (o_tty && o_tty->ldisc.open) { | 2353 | if (o_tty && o_tty->ldisc.ops->open) { |
2234 | retval = (o_tty->ldisc.open)(o_tty); | 2354 | retval = (o_tty->ldisc.ops->open)(o_tty); |
2235 | if (retval) { | 2355 | if (retval) { |
2236 | if (tty->ldisc.close) | 2356 | if (ld->ops->close) |
2237 | (tty->ldisc.close)(tty); | 2357 | (ld->ops->close)(tty); |
2238 | goto release_mem_out; | 2358 | goto release_mem_out; |
2239 | } | 2359 | } |
2240 | tty_ldisc_enable(o_tty); | 2360 | tty_ldisc_enable(o_tty); |
@@ -2378,6 +2498,7 @@ static void release_tty(struct tty_struct *tty, int idx) | |||
2378 | static void release_dev(struct file *filp) | 2498 | static void release_dev(struct file *filp) |
2379 | { | 2499 | { |
2380 | struct tty_struct *tty, *o_tty; | 2500 | struct tty_struct *tty, *o_tty; |
2501 | struct tty_ldisc ld; | ||
2381 | int pty_master, tty_closing, o_tty_closing, do_sleep; | 2502 | int pty_master, tty_closing, o_tty_closing, do_sleep; |
2382 | int devpts; | 2503 | int devpts; |
2383 | int idx; | 2504 | int idx; |
@@ -2611,26 +2732,27 @@ static void release_dev(struct file *filp) | |||
2611 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 2732 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
2612 | /* | 2733 | /* |
2613 | * Shutdown the current line discipline, and reset it to N_TTY. | 2734 | * Shutdown the current line discipline, and reset it to N_TTY. |
2614 | * N.B. why reset ldisc when we're releasing the memory?? | ||
2615 | * | 2735 | * |
2616 | * FIXME: this MUST get fixed for the new reflocking | 2736 | * FIXME: this MUST get fixed for the new reflocking |
2617 | */ | 2737 | */ |
2618 | if (tty->ldisc.close) | 2738 | if (tty->ldisc.ops->close) |
2619 | (tty->ldisc.close)(tty); | 2739 | (tty->ldisc.ops->close)(tty); |
2620 | tty_ldisc_put(tty->ldisc.num); | 2740 | tty_ldisc_put(tty->ldisc.ops); |
2621 | 2741 | ||
2622 | /* | 2742 | /* |
2623 | * Switch the line discipline back | 2743 | * Switch the line discipline back |
2624 | */ | 2744 | */ |
2625 | tty_ldisc_assign(tty, tty_ldisc_get(N_TTY)); | 2745 | WARN_ON(tty_ldisc_get(N_TTY, &ld)); |
2746 | tty_ldisc_assign(tty, &ld); | ||
2626 | tty_set_termios_ldisc(tty, N_TTY); | 2747 | tty_set_termios_ldisc(tty, N_TTY); |
2627 | if (o_tty) { | 2748 | if (o_tty) { |
2628 | /* FIXME: could o_tty be in setldisc here ? */ | 2749 | /* FIXME: could o_tty be in setldisc here ? */ |
2629 | clear_bit(TTY_LDISC, &o_tty->flags); | 2750 | clear_bit(TTY_LDISC, &o_tty->flags); |
2630 | if (o_tty->ldisc.close) | 2751 | if (o_tty->ldisc.ops->close) |
2631 | (o_tty->ldisc.close)(o_tty); | 2752 | (o_tty->ldisc.ops->close)(o_tty); |
2632 | tty_ldisc_put(o_tty->ldisc.num); | 2753 | tty_ldisc_put(o_tty->ldisc.ops); |
2633 | tty_ldisc_assign(o_tty, tty_ldisc_get(N_TTY)); | 2754 | WARN_ON(tty_ldisc_get(N_TTY, &ld)); |
2755 | tty_ldisc_assign(o_tty, &ld); | ||
2634 | tty_set_termios_ldisc(o_tty, N_TTY); | 2756 | tty_set_termios_ldisc(o_tty, N_TTY); |
2635 | } | 2757 | } |
2636 | /* | 2758 | /* |
@@ -2899,8 +3021,8 @@ static unsigned int tty_poll(struct file *filp, poll_table *wait) | |||
2899 | return 0; | 3021 | return 0; |
2900 | 3022 | ||
2901 | ld = tty_ldisc_ref_wait(tty); | 3023 | ld = tty_ldisc_ref_wait(tty); |
2902 | if (ld->poll) | 3024 | if (ld->ops->poll) |
2903 | ret = (ld->poll)(tty, filp, wait); | 3025 | ret = (ld->ops->poll)(tty, filp, wait); |
2904 | tty_ldisc_deref(ld); | 3026 | tty_ldisc_deref(ld); |
2905 | return ret; | 3027 | return ret; |
2906 | } | 3028 | } |
@@ -2974,7 +3096,7 @@ static int tiocsti(struct tty_struct *tty, char __user *p) | |||
2974 | if (get_user(ch, p)) | 3096 | if (get_user(ch, p)) |
2975 | return -EFAULT; | 3097 | return -EFAULT; |
2976 | ld = tty_ldisc_ref_wait(tty); | 3098 | ld = tty_ldisc_ref_wait(tty); |
2977 | ld->receive_buf(tty, &ch, &mbz, 1); | 3099 | ld->ops->receive_buf(tty, &ch, &mbz, 1); |
2978 | tty_ldisc_deref(ld); | 3100 | tty_ldisc_deref(ld); |
2979 | return 0; | 3101 | return 0; |
2980 | } | 3102 | } |
@@ -3395,35 +3517,31 @@ static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p | |||
3395 | static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, | 3517 | static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, |
3396 | unsigned __user *p) | 3518 | unsigned __user *p) |
3397 | { | 3519 | { |
3398 | int retval = -EINVAL; | 3520 | int retval; |
3399 | 3521 | unsigned int set, clear, val; | |
3400 | if (tty->ops->tiocmset) { | ||
3401 | unsigned int set, clear, val; | ||
3402 | |||
3403 | retval = get_user(val, p); | ||
3404 | if (retval) | ||
3405 | return retval; | ||
3406 | |||
3407 | set = clear = 0; | ||
3408 | switch (cmd) { | ||
3409 | case TIOCMBIS: | ||
3410 | set = val; | ||
3411 | break; | ||
3412 | case TIOCMBIC: | ||
3413 | clear = val; | ||
3414 | break; | ||
3415 | case TIOCMSET: | ||
3416 | set = val; | ||
3417 | clear = ~val; | ||
3418 | break; | ||
3419 | } | ||
3420 | 3522 | ||
3421 | set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; | 3523 | if (tty->ops->tiocmset == NULL) |
3422 | clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; | 3524 | return -EINVAL; |
3423 | 3525 | ||
3424 | retval = tty->ops->tiocmset(tty, file, set, clear); | 3526 | retval = get_user(val, p); |
3527 | if (retval) | ||
3528 | return retval; | ||
3529 | set = clear = 0; | ||
3530 | switch (cmd) { | ||
3531 | case TIOCMBIS: | ||
3532 | set = val; | ||
3533 | break; | ||
3534 | case TIOCMBIC: | ||
3535 | clear = val; | ||
3536 | break; | ||
3537 | case TIOCMSET: | ||
3538 | set = val; | ||
3539 | clear = ~val; | ||
3540 | break; | ||
3425 | } | 3541 | } |
3426 | return retval; | 3542 | set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; |
3543 | clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; | ||
3544 | return tty->ops->tiocmset(tty, file, set, clear); | ||
3427 | } | 3545 | } |
3428 | 3546 | ||
3429 | /* | 3547 | /* |
@@ -3528,7 +3646,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
3528 | case TIOCGSID: | 3646 | case TIOCGSID: |
3529 | return tiocgsid(tty, real_tty, p); | 3647 | return tiocgsid(tty, real_tty, p); |
3530 | case TIOCGETD: | 3648 | case TIOCGETD: |
3531 | return put_user(tty->ldisc.num, (int __user *)p); | 3649 | return put_user(tty->ldisc.ops->num, (int __user *)p); |
3532 | case TIOCSETD: | 3650 | case TIOCSETD: |
3533 | return tiocsetd(tty, p); | 3651 | return tiocsetd(tty, p); |
3534 | #ifdef CONFIG_VT | 3652 | #ifdef CONFIG_VT |
@@ -3581,8 +3699,8 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
3581 | } | 3699 | } |
3582 | ld = tty_ldisc_ref_wait(tty); | 3700 | ld = tty_ldisc_ref_wait(tty); |
3583 | retval = -EINVAL; | 3701 | retval = -EINVAL; |
3584 | if (ld->ioctl) { | 3702 | if (ld->ops->ioctl) { |
3585 | retval = ld->ioctl(tty, file, cmd, arg); | 3703 | retval = ld->ops->ioctl(tty, file, cmd, arg); |
3586 | if (retval == -ENOIOCTLCMD) | 3704 | if (retval == -ENOIOCTLCMD) |
3587 | retval = -EINVAL; | 3705 | retval = -EINVAL; |
3588 | } | 3706 | } |
@@ -3609,8 +3727,8 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd, | |||
3609 | } | 3727 | } |
3610 | 3728 | ||
3611 | ld = tty_ldisc_ref_wait(tty); | 3729 | ld = tty_ldisc_ref_wait(tty); |
3612 | if (ld->compat_ioctl) | 3730 | if (ld->ops->compat_ioctl) |
3613 | retval = ld->compat_ioctl(tty, file, cmd, arg); | 3731 | retval = ld->ops->compat_ioctl(tty, file, cmd, arg); |
3614 | tty_ldisc_deref(ld); | 3732 | tty_ldisc_deref(ld); |
3615 | 3733 | ||
3616 | return retval; | 3734 | return retval; |
@@ -3782,7 +3900,8 @@ static void flush_to_ldisc(struct work_struct *work) | |||
3782 | flag_buf = head->flag_buf_ptr + head->read; | 3900 | flag_buf = head->flag_buf_ptr + head->read; |
3783 | head->read += count; | 3901 | head->read += count; |
3784 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 3902 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
3785 | disc->receive_buf(tty, char_buf, flag_buf, count); | 3903 | disc->ops->receive_buf(tty, char_buf, |
3904 | flag_buf, count); | ||
3786 | spin_lock_irqsave(&tty->buf.lock, flags); | 3905 | spin_lock_irqsave(&tty->buf.lock, flags); |
3787 | } | 3906 | } |
3788 | /* Restore the queue head */ | 3907 | /* Restore the queue head */ |
@@ -3843,9 +3962,12 @@ EXPORT_SYMBOL(tty_flip_buffer_push); | |||
3843 | 3962 | ||
3844 | static void initialize_tty_struct(struct tty_struct *tty) | 3963 | static void initialize_tty_struct(struct tty_struct *tty) |
3845 | { | 3964 | { |
3965 | struct tty_ldisc ld; | ||
3846 | memset(tty, 0, sizeof(struct tty_struct)); | 3966 | memset(tty, 0, sizeof(struct tty_struct)); |
3847 | tty->magic = TTY_MAGIC; | 3967 | tty->magic = TTY_MAGIC; |
3848 | tty_ldisc_assign(tty, tty_ldisc_get(N_TTY)); | 3968 | if (tty_ldisc_get(N_TTY, &ld) < 0) |
3969 | panic("n_tty: init_tty"); | ||
3970 | tty_ldisc_assign(tty, &ld); | ||
3849 | tty->session = NULL; | 3971 | tty->session = NULL; |
3850 | tty->pgrp = NULL; | 3972 | tty->pgrp = NULL; |
3851 | tty->overrun_time = jiffies; | 3973 | tty->overrun_time = jiffies; |
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 8f81139d6194..ea9fc5d03b99 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -491,8 +491,8 @@ static void change_termios(struct tty_struct *tty, struct ktermios *new_termios) | |||
491 | 491 | ||
492 | ld = tty_ldisc_ref(tty); | 492 | ld = tty_ldisc_ref(tty); |
493 | if (ld != NULL) { | 493 | if (ld != NULL) { |
494 | if (ld->set_termios) | 494 | if (ld->ops->set_termios) |
495 | (ld->set_termios)(tty, &old_termios); | 495 | (ld->ops->set_termios)(tty, &old_termios); |
496 | tty_ldisc_deref(ld); | 496 | tty_ldisc_deref(ld); |
497 | } | 497 | } |
498 | mutex_unlock(&tty->termios_mutex); | 498 | mutex_unlock(&tty->termios_mutex); |
@@ -552,8 +552,8 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt) | |||
552 | ld = tty_ldisc_ref(tty); | 552 | ld = tty_ldisc_ref(tty); |
553 | 553 | ||
554 | if (ld != NULL) { | 554 | if (ld != NULL) { |
555 | if ((opt & TERMIOS_FLUSH) && ld->flush_buffer) | 555 | if ((opt & TERMIOS_FLUSH) && ld->ops->flush_buffer) |
556 | ld->flush_buffer(tty); | 556 | ld->ops->flush_buffer(tty); |
557 | tty_ldisc_deref(ld); | 557 | tty_ldisc_deref(ld); |
558 | } | 558 | } |
559 | 559 | ||
@@ -959,12 +959,12 @@ int tty_perform_flush(struct tty_struct *tty, unsigned long arg) | |||
959 | ld = tty_ldisc_ref(tty); | 959 | ld = tty_ldisc_ref(tty); |
960 | switch (arg) { | 960 | switch (arg) { |
961 | case TCIFLUSH: | 961 | case TCIFLUSH: |
962 | if (ld && ld->flush_buffer) | 962 | if (ld && ld->ops->flush_buffer) |
963 | ld->flush_buffer(tty); | 963 | ld->ops->flush_buffer(tty); |
964 | break; | 964 | break; |
965 | case TCIOFLUSH: | 965 | case TCIOFLUSH: |
966 | if (ld && ld->flush_buffer) | 966 | if (ld && ld->ops->flush_buffer) |
967 | ld->flush_buffer(tty); | 967 | ld->ops->flush_buffer(tty); |
968 | /* fall through */ | 968 | /* fall through */ |
969 | case TCOFLUSH: | 969 | case TCOFLUSH: |
970 | tty_driver_flush_buffer(tty); | 970 | tty_driver_flush_buffer(tty); |