aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-16 16:57:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:12:38 -0400
commit77451e53e0a509a98eda272567869cfe96431ba9 (patch)
tree93b79e0aeebd4533f95235101e44112559cdc8dd /drivers/char
parentae67751785dae388beb31fc24d14870d0d4669d9 (diff)
cyclades: use tty_port
Switch cyclades to use the new tty_port structure Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/cyclades.c315
1 files changed, 157 insertions, 158 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index a957dbcc5a46..0144b19d1036 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
1234done: 1234done:
1235 tty_wakeup(info->tty); 1235 tty_wakeup(info->port.tty);
1236end: 1236end:
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
@@ -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->close_delay) {
2738 msleep_interruptible(jiffies_to_msecs 2738 msleep_interruptible(jiffies_to_msecs
2739 (info->close_delay)); 2739 (info->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,7 +3381,7 @@ 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->close_delay;
3386 tmp.closing_wait = info->closing_wait; 3386 tmp.closing_wait = info->closing_wait;
3387 tmp.baud_base = info->baud; 3387 tmp.baud_base = info->baud;
@@ -3406,9 +3406,9 @@ set_serial_info(struct cyclades_port *info,
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->close_delay = new_serial.close_delay * HZ / 100;
3428 info->closing_wait = new_serial.closing_wait * HZ / 100; 3428 info->closing_wait = new_serial.closing_wait * HZ / 100;
3429 3429
3430check_and_exit: 3430check_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 {
@@ -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/*
@@ -4379,12 +4379,11 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4379 info->magic = CYCLADES_MAGIC; 4379 info->magic = CYCLADES_MAGIC;
4380 info->card = cinfo; 4380 info->card = cinfo;
4381 info->line = port; 4381 info->line = port;
4382 info->flags = STD_COM_FLAGS;
4383 info->closing_wait = CLOSING_WAIT_DELAY; 4382 info->closing_wait = CLOSING_WAIT_DELAY;
4384 info->close_delay = 5 * HZ / 10; 4383 info->close_delay = 5 * HZ / 10;
4385 4384
4386 init_waitqueue_head(&info->open_wait); 4385 tty_port_init(&info->port);
4387 init_waitqueue_head(&info->close_wait); 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) /
@@ -5247,7 +5246,7 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
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 /* FIXME: double check locking */ 5248 /* FIXME: double check locking */
5250 (long)info->tty->ldisc.ops->num); 5249 (long)info->port.tty->ldisc.ops->num);
5251 else 5250 else
5252 size = sprintf(buf + len, "%3d %8lu %10lu %8lu " 5251 size = sprintf(buf + len, "%3d %8lu %10lu %8lu "
5253 "%10lu %8lu %9lu %6ld\n", 5252 "%10lu %8lu %9lu %6ld\n",