Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

esp: use tty_port

Switch esp to use the new tty_port structures

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alan Cox and committed by
Linus Torvalds
4982d6b3 52d41738

+138 -143
+136 -136
drivers/char/esp.c
··· 128 128 129 129 #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) 130 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 132 serial_driver.refcount, \ 133 - info->count, tty->count, s) 133 + info->port.count, tty->count, s) 134 134 #else 135 135 #define DBG_CNT(s) 136 136 #endif ··· 172 172 173 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 178 static inline void serial_out(struct esp_struct *info, int offset, 179 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 273 274 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 277 int i; 278 278 struct esp_pio_buffer *pio_buf; 279 279 struct esp_pio_buffer *err_buf; ··· 295 295 296 296 for (i = 0; i < num_bytes - 1; i += 2) { 297 297 *((unsigned short *)(pio_buf->data + i)) = 298 - inw(info->port + UART_ESI_RX); 298 + inw(info->io_port + UART_ESI_RX); 299 299 err_buf->data[i] = serial_in(info, UART_ESI_RWS); 300 300 err_buf->data[i + 1] = (err_buf->data[i] >> 3) & status_mask; 301 301 err_buf->data[i] &= status_mask; ··· 308 308 } 309 309 310 310 /* make sure everything is still ok since interrupts were enabled */ 311 - tty = info->tty; 311 + tty = info->port.tty; 312 312 313 313 if (!tty) { 314 314 release_pio_buffer(pio_buf); ··· 325 325 326 326 if (err_buf->data[i] & 0x04) { 327 327 flag = TTY_BREAK; 328 - if (info->flags & ASYNC_SAK) 328 + if (info->port.flags & ASYNC_SAK) 329 329 do_SAK(tty); 330 330 } else if (err_buf->data[i] & 0x02) 331 331 flag = TTY_FRAME; ··· 370 370 static inline void receive_chars_dma_done(struct esp_struct *info, 371 371 int status) 372 372 { 373 - struct tty_struct *tty = info->tty; 373 + struct tty_struct *tty = info->port.tty; 374 374 int num_bytes; 375 375 unsigned long flags; 376 376 ··· 396 396 if (status & 0x10) { 397 397 statflag = TTY_BREAK; 398 398 (info->icount.brk)++; 399 - if (info->flags & ASYNC_SAK) 399 + if (info->port.flags & ASYNC_SAK) 400 400 do_SAK(tty); 401 401 } else if (status & 0x08) { 402 402 statflag = TTY_FRAME; ··· 451 451 452 452 for (i = 0; i < space_avail - 1; i += 2) { 453 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 457 if (space_avail & 0x0001) ··· 470 470 } 471 471 472 472 if (info->xmit_cnt < WAKEUP_CHARS) { 473 - if (info->tty) 474 - tty_wakeup(info->tty); 473 + if (info->port.tty) 474 + tty_wakeup(info->port.tty); 475 475 476 476 #ifdef SERIAL_DEBUG_INTR 477 477 printk("THRE..."); ··· 507 507 info->xmit_tail = (info->xmit_tail + dma_bytes) & (ESP_XMIT_SIZE - 1); 508 508 509 509 if (info->xmit_cnt < WAKEUP_CHARS) { 510 - if (info->tty) 511 - tty_wakeup(info->tty); 510 + if (info->port.tty) 511 + tty_wakeup(info->port.tty); 512 512 513 513 #ifdef SERIAL_DEBUG_INTR 514 514 printk("THRE..."); ··· 575 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 579 #if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR)) 580 580 printk("ttys%d CD now %s...", info->line, 581 581 (status & UART_MSR_DCD) ? "on" : "off"); 582 582 #endif 583 583 if (status & UART_MSR_DCD) 584 - wake_up_interruptible(&info->open_wait); 584 + wake_up_interruptible(&info->port.open_wait); 585 585 else { 586 586 #ifdef SERIAL_DEBUG_OPEN 587 587 printk("scheduling hangup..."); 588 588 #endif 589 - tty_hangup(info->tty); 589 + tty_hangup(info->port.tty); 590 590 } 591 591 } 592 592 } ··· 609 609 610 610 spin_lock(&info->lock); 611 611 612 - if (!info->tty) { 612 + if (!info->port.tty) { 613 613 spin_unlock(&info->lock); 614 614 return IRQ_NONE; 615 615 } ··· 647 647 num_bytes = serial_in(info, UART_ESI_STAT1) << 8; 648 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 652 if (num_bytes) { 653 653 if (dma_bytes || ··· 661 661 662 662 if (!(info->stat_flags & (ESP_STAT_DMA_RX | ESP_STAT_DMA_TX)) && 663 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 665 info->IER &= ~UART_IER_THRI; 666 666 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); 667 667 serial_out(info, UART_ESI_CMD2, info->IER); ··· 782 782 783 783 spin_lock_irqsave(&info->lock, flags); 784 784 785 - if (info->flags & ASYNC_INITIALIZED) 785 + if (info->port.flags & ASYNC_INITIALIZED) 786 786 goto out; 787 787 788 788 if (!info->xmit_buf) { ··· 806 806 num_chars |= serial_in(info, UART_ESI_STAT2); 807 807 808 808 while (num_chars > 1) { 809 - inw(info->port + UART_ESI_RX); 809 + inw(info->io_port + UART_ESI_RX); 810 810 num_chars -= 2; 811 811 } 812 812 ··· 834 834 835 835 if (retval) { 836 836 if (capable(CAP_SYS_ADMIN)) { 837 - if (info->tty) 837 + if (info->port.tty) 838 838 set_bit(TTY_IO_ERROR, 839 - &info->tty->flags); 839 + &info->port.tty->flags); 840 840 retval = 0; 841 841 } 842 842 goto out_unlocked; ··· 874 874 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); 875 875 serial_out(info, UART_ESI_CMD2, info->IER); 876 876 877 - if (info->tty) 878 - clear_bit(TTY_IO_ERROR, &info->tty->flags); 877 + if (info->port.tty) 878 + clear_bit(TTY_IO_ERROR, &info->port.tty->flags); 879 879 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 880 880 spin_unlock_irqrestore(&info->lock, flags); 881 881 882 882 /* 883 883 * Set up the tty->alt_speed kludge 884 884 */ 885 - if (info->tty) { 886 - if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 887 - info->tty->alt_speed = 57600; 888 - if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 889 - info->tty->alt_speed = 115200; 890 - if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 891 - info->tty->alt_speed = 230400; 892 - if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 893 - info->tty->alt_speed = 460800; 885 + if (info->port.tty) { 886 + if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 887 + info->port.tty->alt_speed = 57600; 888 + if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 889 + info->port.tty->alt_speed = 115200; 890 + if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 891 + info->port.tty->alt_speed = 230400; 892 + if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 893 + info->port.tty->alt_speed = 460800; 894 894 } 895 895 896 896 /* 897 897 * set the speed of the serial port 898 898 */ 899 899 change_speed(info); 900 - info->flags |= ASYNC_INITIALIZED; 900 + info->port.flags |= ASYNC_INITIALIZED; 901 901 return 0; 902 902 903 903 out: ··· 914 914 { 915 915 unsigned long flags, f; 916 916 917 - if (!(info->flags & ASYNC_INITIALIZED)) 917 + if (!(info->port.flags & ASYNC_INITIALIZED)) 918 918 return; 919 919 920 920 #ifdef SERIAL_DEBUG_OPEN ··· 951 951 952 952 while (current_port) { 953 953 if ((current_port != info) && 954 - (current_port->flags & ASYNC_INITIALIZED)) 954 + (current_port->port.flags & ASYNC_INITIALIZED)) 955 955 break; 956 956 957 957 current_port = current_port->next_port; ··· 974 974 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); 975 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 978 info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); 979 979 980 980 info->MCR &= ~UART_MCR_OUT2; ··· 982 982 serial_out(info, UART_ESI_CMD2, UART_MCR); 983 983 serial_out(info, UART_ESI_CMD2, info->MCR); 984 984 985 - if (info->tty) 986 - set_bit(TTY_IO_ERROR, &info->tty->flags); 985 + if (info->port.tty) 986 + set_bit(TTY_IO_ERROR, &info->port.tty->flags); 987 987 988 - info->flags &= ~ASYNC_INITIALIZED; 988 + info->port.flags &= ~ASYNC_INITIALIZED; 989 989 spin_unlock_irqrestore(&info->lock, flags); 990 990 } 991 991 ··· 1002 1002 unsigned char flow1 = 0, flow2 = 0; 1003 1003 unsigned long flags; 1004 1004 1005 - if (!info->tty || !info->tty->termios) 1005 + if (!info->port.tty || !info->port.tty->termios) 1006 1006 return; 1007 - cflag = info->tty->termios->c_cflag; 1008 - port = info->port; 1007 + cflag = info->port.tty->termios->c_cflag; 1008 + port = info->io_port; 1009 1009 1010 1010 /* byte size and parity */ 1011 1011 switch (cflag & CSIZE) { ··· 1029 1029 if (cflag & CMSPAR) 1030 1030 cval |= UART_LCR_SPAR; 1031 1031 #endif 1032 - baud = tty_get_baud_rate(info->tty); 1032 + baud = tty_get_baud_rate(info->port.tty); 1033 1033 if (baud == 38400 && 1034 - ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) 1034 + ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) 1035 1035 quot = info->custom_divisor; 1036 1036 else { 1037 1037 if (baud == 134) /* Special case since 134 is really 134.5 */ ··· 1046 1046 if (baud) { 1047 1047 /* Actual rate */ 1048 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 1051 info->timeout = ((1024 * HZ * bits * quot) / BASE_BAUD) + (HZ / 50); 1052 1052 1053 1053 /* CTS flow control flag and modem status interrupts */ 1054 1054 /* info->IER &= ~UART_IER_MSI; */ 1055 1055 if (cflag & CRTSCTS) { 1056 - info->flags |= ASYNC_CTS_FLOW; 1056 + info->port.flags |= ASYNC_CTS_FLOW; 1057 1057 /* info->IER |= UART_IER_MSI; */ 1058 1058 flow1 = 0x04; 1059 1059 flow2 = 0x10; 1060 1060 } else 1061 - info->flags &= ~ASYNC_CTS_FLOW; 1061 + info->port.flags &= ~ASYNC_CTS_FLOW; 1062 1062 if (cflag & CLOCAL) 1063 - info->flags &= ~ASYNC_CHECK_CD; 1063 + info->port.flags &= ~ASYNC_CHECK_CD; 1064 1064 else 1065 - info->flags |= ASYNC_CHECK_CD; 1065 + info->port.flags |= ASYNC_CHECK_CD; 1066 1066 1067 1067 /* 1068 1068 * Set up parity check flag 1069 1069 */ 1070 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 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 1074 info->read_status_mask |= UART_LSR_BI; 1075 1075 1076 1076 info->ignore_status_mask = 0; 1077 1077 #if 0 1078 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 1080 info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; 1081 1081 info->read_status_mask |= UART_LSR_PE | UART_LSR_FE; 1082 1082 } 1083 1083 #endif 1084 - if (I_IGNBRK(info->tty)) { 1084 + if (I_IGNBRK(info->port.tty)) { 1085 1085 info->ignore_status_mask |= UART_LSR_BI; 1086 1086 info->read_status_mask |= UART_LSR_BI; 1087 1087 /* 1088 1088 * If we're ignore parity and break indicators, ignore 1089 1089 * overruns too. (For real raw support). 1090 1090 */ 1091 - if (I_IGNPAR(info->tty)) { 1091 + if (I_IGNPAR(info->port.tty)) { 1092 1092 info->ignore_status_mask |= UART_LSR_OE | \ 1093 1093 UART_LSR_PE | UART_LSR_FE; 1094 1094 info->read_status_mask |= UART_LSR_OE | \ ··· 1096 1096 } 1097 1097 } 1098 1098 1099 - if (I_IXOFF(info->tty)) 1099 + if (I_IXOFF(info->port.tty)) 1100 1100 flow1 |= 0x81; 1101 1101 1102 1102 spin_lock_irqsave(&info->lock, flags); ··· 1116 1116 serial_out(info, UART_ESI_CMD2, flow2); 1117 1117 1118 1118 /* set flow control characters (XON/XOFF only) */ 1119 - if (I_IXOFF(info->tty)) { 1119 + if (I_IXOFF(info->port.tty)) { 1120 1120 serial_out(info, UART_ESI_CMD1, ESI_SET_FLOW_CHARS); 1121 - serial_out(info, UART_ESI_CMD2, START_CHAR(info->tty)); 1122 - serial_out(info, UART_ESI_CMD2, STOP_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->port.tty)); 1123 1123 serial_out(info, UART_ESI_CMD2, 0x10); 1124 1124 serial_out(info, UART_ESI_CMD2, 0x21); 1125 1125 switch (cflag & CSIZE) { ··· 1355 1355 memset(&tmp, 0, sizeof(tmp)); 1356 1356 tmp.type = PORT_16550A; 1357 1357 tmp.line = info->line; 1358 - tmp.port = info->port; 1358 + tmp.port = info->io_port; 1359 1359 tmp.irq = info->irq; 1360 - tmp.flags = info->flags; 1360 + tmp.flags = info->port.flags; 1361 1361 tmp.xmit_fifo_size = 1024; 1362 1362 tmp.baud_base = BASE_BAUD; 1363 1363 tmp.close_delay = info->close_delay; ··· 1407 1407 1408 1408 if ((new_serial.type != PORT_16550A) || 1409 1409 (new_serial.hub6) || 1410 - (info->port != new_serial.port) || 1410 + (info->io_port != new_serial.port) || 1411 1411 (new_serial.baud_base != BASE_BAUD) || 1412 1412 (new_serial.irq > 15) || 1413 1413 (new_serial.irq < 2) || ··· 1425 1425 if (change_irq || 1426 1426 (new_serial.close_delay != info->close_delay) || 1427 1427 ((new_serial.flags & ~ASYNC_USR_MASK) != 1428 - (info->flags & ~ASYNC_USR_MASK))) 1428 + (info->port.flags & ~ASYNC_USR_MASK))) 1429 1429 return -EPERM; 1430 - info->flags = ((info->flags & ~ASYNC_USR_MASK) | 1430 + info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) | 1431 1431 (new_serial.flags & ASYNC_USR_MASK)); 1432 1432 info->custom_divisor = new_serial.custom_divisor; 1433 1433 } else { ··· 1441 1441 if ((current_async->line >= info->line) && 1442 1442 (current_async->line < (info->line + 8))) { 1443 1443 if (current_async == info) { 1444 - if (current_async->count > 1) 1444 + if (current_async->port.count > 1) 1445 1445 return -EBUSY; 1446 - } else if (current_async->count) 1446 + } else if (current_async->port.count) 1447 1447 return -EBUSY; 1448 1448 } 1449 1449 ··· 1456 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 1460 (new_serial.flags & ASYNC_FLAGS)); 1461 1461 info->custom_divisor = new_serial.custom_divisor; 1462 1462 info->close_delay = new_serial.close_delay * HZ/100; ··· 1487 1487 } 1488 1488 } 1489 1489 1490 - if (info->flags & ASYNC_INITIALIZED) { 1491 - if (((old_info.flags & ASYNC_SPD_MASK) != 1492 - (info->flags & ASYNC_SPD_MASK)) || 1490 + if (info->port.flags & ASYNC_INITIALIZED) { 1491 + if (((old_info.port.flags & ASYNC_SPD_MASK) != 1492 + (info->port.flags & ASYNC_SPD_MASK)) || 1493 1493 (old_info.custom_divisor != info->custom_divisor)) { 1494 - if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 1495 - info->tty->alt_speed = 57600; 1496 - if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 1497 - info->tty->alt_speed = 115200; 1498 - if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 1499 - info->tty->alt_speed = 230400; 1500 - if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 1501 - info->tty->alt_speed = 460800; 1494 + if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 1495 + info->port.tty->alt_speed = 57600; 1496 + if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 1497 + info->port.tty->alt_speed = 115200; 1498 + if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 1499 + info->port.tty->alt_speed = 230400; 1500 + if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 1501 + info->port.tty->alt_speed = 460800; 1502 1502 change_speed(info); 1503 1503 } 1504 1504 } else ··· 1554 1554 1555 1555 while (current_async) { 1556 1556 if (current_async == info) { 1557 - if (current_async->count > 1) 1557 + if (current_async->port.count > 1) 1558 1558 return -EBUSY; 1559 - } else if (current_async->count) 1559 + } else if (current_async->port.count) 1560 1560 return -EBUSY; 1561 1561 1562 1562 current_async = current_async->next_port; ··· 1578 1578 spin_unlock_irqrestore(&info->lock, flags); 1579 1579 } else { 1580 1580 /* DMA mode to PIO mode only */ 1581 - if (info->count > 1) 1581 + if (info->port.count > 1) 1582 1582 return -EBUSY; 1583 1583 1584 1584 shutdown(info); ··· 1634 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 1638 retval = startup(info); 1639 1639 1640 1640 return retval; ··· 1917 1917 1918 1918 #ifdef SERIAL_DEBUG_OPEN 1919 1919 printk(KERN_DEBUG "rs_close ttys%d, count = %d\n", 1920 - info->line, info->count); 1920 + info->line, info->port.count); 1921 1921 #endif 1922 - if (tty->count == 1 && info->count != 1) { 1922 + if (tty->count == 1 && info->port.count != 1) { 1923 1923 /* 1924 1924 * Uh, oh. tty->count is 1, which means that the tty 1925 1925 * structure will be freed. Info->count should always ··· 1927 1927 * one, we've got real problems, since it means the 1928 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); 1931 - info->count = 1; 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->port.count = 1; 1932 1932 } 1933 - if (--info->count < 0) { 1933 + if (--info->port.count < 0) { 1934 1934 printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n", 1935 - info->line, info->count); 1936 - info->count = 0; 1935 + info->line, info->port.count); 1936 + info->port.count = 0; 1937 1937 } 1938 - if (info->count) { 1938 + if (info->port.count) { 1939 1939 DBG_CNT("before DEC-2"); 1940 1940 goto out; 1941 1941 } 1942 - info->flags |= ASYNC_CLOSING; 1942 + info->port.flags |= ASYNC_CLOSING; 1943 1943 1944 1944 spin_unlock_irqrestore(&info->lock, flags); 1945 1945 /* ··· 1958 1958 /* info->IER &= ~UART_IER_RLSI; */ 1959 1959 info->IER &= ~UART_IER_RDI; 1960 1960 info->read_status_mask &= ~UART_LSR_DR; 1961 - if (info->flags & ASYNC_INITIALIZED) { 1961 + if (info->port.flags & ASYNC_INITIALIZED) { 1962 1962 1963 1963 spin_lock_irqsave(&info->lock, flags); 1964 1964 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); ··· 1981 1981 rs_flush_buffer(tty); 1982 1982 tty_ldisc_flush(tty); 1983 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 1987 if (info->close_delay) 1988 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); 1992 - wake_up_interruptible(&info->close_wait); 1991 + info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1992 + wake_up_interruptible(&info->port.close_wait); 1993 1993 return; 1994 1994 1995 1995 out: ··· 2047 2047 2048 2048 rs_flush_buffer(tty); 2049 2049 shutdown(info); 2050 - info->count = 0; 2051 - info->flags &= ~ASYNC_NORMAL_ACTIVE; 2052 - info->tty = NULL; 2053 - wake_up_interruptible(&info->open_wait); 2050 + info->port.count = 0; 2051 + info->port.flags &= ~ASYNC_NORMAL_ACTIVE; 2052 + info->port.tty = NULL; 2053 + wake_up_interruptible(&info->port.open_wait); 2054 2054 } 2055 2055 2056 2056 /* ··· 2071 2071 * until it's done, and then try again. 2072 2072 */ 2073 2073 if (tty_hung_up_p(filp) || 2074 - (info->flags & ASYNC_CLOSING)) { 2075 - if (info->flags & ASYNC_CLOSING) 2076 - interruptible_sleep_on(&info->close_wait); 2074 + (info->port.flags & ASYNC_CLOSING)) { 2075 + if (info->port.flags & ASYNC_CLOSING) 2076 + interruptible_sleep_on(&info->port.close_wait); 2077 2077 #ifdef SERIAL_DO_RESTART 2078 - if (info->flags & ASYNC_HUP_NOTIFY) 2078 + if (info->port.flags & ASYNC_HUP_NOTIFY) 2079 2079 return -EAGAIN; 2080 2080 else 2081 2081 return -ERESTARTSYS; ··· 2090 2090 */ 2091 2091 if ((filp->f_flags & O_NONBLOCK) || 2092 2092 (tty->flags & (1 << TTY_IO_ERROR))) { 2093 - info->flags |= ASYNC_NORMAL_ACTIVE; 2093 + info->port.flags |= ASYNC_NORMAL_ACTIVE; 2094 2094 return 0; 2095 2095 } 2096 2096 ··· 2100 2100 /* 2101 2101 * Block waiting for the carrier detect and the line to become 2102 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 2104 * rs_close() knows when to free things. We restore it upon 2105 2105 * exit, either normal or abnormal. 2106 2106 */ 2107 2107 retval = 0; 2108 - add_wait_queue(&info->open_wait, &wait); 2108 + add_wait_queue(&info->port.open_wait, &wait); 2109 2109 #ifdef SERIAL_DEBUG_OPEN 2110 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 2112 #endif 2113 2113 spin_lock_irqsave(&info->lock, flags); 2114 2114 if (!tty_hung_up_p(filp)) 2115 - info->count--; 2116 - info->blocked_open++; 2115 + info->port.count--; 2116 + info->port.blocked_open++; 2117 2117 while (1) { 2118 2118 if ((tty->termios->c_cflag & CBAUD)) { 2119 2119 unsigned int scratch; ··· 2128 2128 } 2129 2129 set_current_state(TASK_INTERRUPTIBLE); 2130 2130 if (tty_hung_up_p(filp) || 2131 - !(info->flags & ASYNC_INITIALIZED)) { 2131 + !(info->port.flags & ASYNC_INITIALIZED)) { 2132 2132 #ifdef SERIAL_DO_RESTART 2133 - if (info->flags & ASYNC_HUP_NOTIFY) 2133 + if (info->port.flags & ASYNC_HUP_NOTIFY) 2134 2134 retval = -EAGAIN; 2135 2135 else 2136 2136 retval = -ERESTARTSYS; ··· 2144 2144 if (serial_in(info, UART_ESI_STAT2) & UART_MSR_DCD) 2145 2145 do_clocal = 1; 2146 2146 2147 - if (!(info->flags & ASYNC_CLOSING) && 2147 + if (!(info->port.flags & ASYNC_CLOSING) && 2148 2148 (do_clocal)) 2149 2149 break; 2150 2150 if (signal_pending(current)) { ··· 2153 2153 } 2154 2154 #ifdef SERIAL_DEBUG_OPEN 2155 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 2157 #endif 2158 2158 spin_unlock_irqrestore(&info->lock, flags); 2159 2159 schedule(); 2160 2160 spin_lock_irqsave(&info->lock, flags); 2161 2161 } 2162 2162 set_current_state(TASK_RUNNING); 2163 - remove_wait_queue(&info->open_wait, &wait); 2163 + remove_wait_queue(&info->port.open_wait, &wait); 2164 2164 if (!tty_hung_up_p(filp)) 2165 - info->count++; 2166 - info->blocked_open--; 2165 + info->port.count++; 2166 + info->port.blocked_open--; 2167 2167 spin_unlock_irqrestore(&info->lock, flags); 2168 2168 #ifdef SERIAL_DEBUG_OPEN 2169 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 2171 #endif 2172 2172 if (retval) 2173 2173 return retval; 2174 - info->flags |= ASYNC_NORMAL_ACTIVE; 2174 + info->port.flags |= ASYNC_NORMAL_ACTIVE; 2175 2175 return 0; 2176 2176 } 2177 2177 ··· 2204 2204 } 2205 2205 2206 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 2208 #endif 2209 2209 spin_lock_irqsave(&info->lock, flags); 2210 - info->count++; 2210 + info->port.count++; 2211 2211 tty->driver_data = info; 2212 - info->tty = tty; 2212 + info->port.tty = tty; 2213 2213 2214 2214 spin_unlock_irqrestore(&info->lock, flags); 2215 2215 ··· 2263 2263 int port_detected = 0; 2264 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 2267 return -EIO; 2268 2268 2269 2269 spin_lock_irqsave(&info->lock, flags); ··· 2300 2300 } 2301 2301 } 2302 2302 if (!port_detected) 2303 - release_region(info->port, REGION_SIZE); 2303 + release_region(info->io_port, REGION_SIZE); 2304 2304 2305 2305 spin_unlock_irqrestore(&info->lock, flags); 2306 2306 return (port_detected); ··· 2414 2414 offset = 0; 2415 2415 2416 2416 do { 2417 - info->port = esp[i] + offset; 2417 + info->io_port = esp[i] + offset; 2418 2418 info->irq = irq[i]; 2419 2419 info->line = (i * 8) + (offset / 8); 2420 2420 ··· 2425 2425 } 2426 2426 2427 2427 info->custom_divisor = (divisor[i] >> (offset / 2)) & 0xf; 2428 - info->flags = STD_COM_FLAGS; 2428 + info->port.flags = STD_COM_FLAGS; 2429 2429 if (info->custom_divisor) 2430 - info->flags |= ASYNC_SPD_CUST; 2430 + info->port.flags |= ASYNC_SPD_CUST; 2431 2431 info->magic = ESP_MAGIC; 2432 2432 info->close_delay = 5*HZ/10; 2433 2433 info->closing_wait = 30*HZ; ··· 2436 2436 info->config.flow_off = flow_off; 2437 2437 info->config.pio_threshold = pio_threshold; 2438 2438 info->next_port = ports; 2439 - init_waitqueue_head(&info->open_wait); 2440 - init_waitqueue_head(&info->close_wait); 2439 + init_waitqueue_head(&info->port.open_wait); 2440 + init_waitqueue_head(&info->port.close_wait); 2441 2441 init_waitqueue_head(&info->delta_msr_wait); 2442 2442 init_waitqueue_head(&info->break_wait); 2443 2443 ports = info; 2444 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 2447 if (info->line % 8) { 2448 2448 printk("secondary port\n"); ··· 2498 2498 put_tty_driver(esp_driver); 2499 2499 2500 2500 while (ports) { 2501 - if (ports->port) 2502 - release_region(ports->port, REGION_SIZE); 2501 + if (ports->io_port) 2502 + release_region(ports->io_port, REGION_SIZE); 2503 2503 temp_async = ports->next_port; 2504 2504 kfree(ports); 2505 2505 ports = temp_async;
+2 -7
include/linux/hayesesp.h
··· 76 76 77 77 struct esp_struct { 78 78 int magic; 79 + struct tty_port port; 79 80 spinlock_t lock; 80 - int port; 81 + int io_port; 81 82 int irq; 82 - int flags; /* defined in tty.h */ 83 - struct tty_struct *tty; 84 83 int read_status_mask; 85 84 int ignore_status_mask; 86 85 int timeout; ··· 92 93 int MCR; /* Modem control register */ 93 94 unsigned long last_active; 94 95 int line; 95 - int count; /* # of fd on device */ 96 - int blocked_open; /* # of blocked opens */ 97 96 unsigned char *xmit_buf; 98 97 int xmit_head; 99 98 int xmit_tail; 100 99 int xmit_cnt; 101 - wait_queue_head_t open_wait; 102 - wait_queue_head_t close_wait; 103 100 wait_queue_head_t delta_msr_wait; 104 101 wait_queue_head_t break_wait; 105 102 struct async_icount icount; /* kernel counters for the 4 input interrupts */