···128128129129#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)130130#define DBG_CNT(s) printk(KERN_DEBUG "(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \131131- tty->name, info->flags, \131131+ tty->name, info->port.flags, \132132 serial_driver.refcount, \133133- info->count, tty->count, s)133133+ info->port.count, tty->count, s)134134#else135135#define DBG_CNT(s)136136#endif···172172173173static inline unsigned int serial_in(struct esp_struct *info, int offset)174174{175175- return inb(info->port + offset);175175+ return inb(info->io_port + offset);176176}177177178178static inline void serial_out(struct esp_struct *info, int offset,179179 unsigned char value)180180{181181- outb(value, info->port+offset);181181+ outb(value, info->io_port+offset);182182}183183184184/*···273273274274static inline void receive_chars_pio(struct esp_struct *info, int num_bytes)275275{276276- struct tty_struct *tty = info->tty;276276+ struct tty_struct *tty = info->port.tty;277277 int i;278278 struct esp_pio_buffer *pio_buf;279279 struct esp_pio_buffer *err_buf;···295295296296 for (i = 0; i < num_bytes - 1; i += 2) {297297 *((unsigned short *)(pio_buf->data + i)) =298298- inw(info->port + UART_ESI_RX);298298+ inw(info->io_port + UART_ESI_RX);299299 err_buf->data[i] = serial_in(info, UART_ESI_RWS);300300 err_buf->data[i + 1] = (err_buf->data[i] >> 3) & status_mask;301301 err_buf->data[i] &= status_mask;···308308 }309309310310 /* make sure everything is still ok since interrupts were enabled */311311- tty = info->tty;311311+ tty = info->port.tty;312312313313 if (!tty) {314314 release_pio_buffer(pio_buf);···325325326326 if (err_buf->data[i] & 0x04) {327327 flag = TTY_BREAK;328328- if (info->flags & ASYNC_SAK)328328+ if (info->port.flags & ASYNC_SAK)329329 do_SAK(tty);330330 } else if (err_buf->data[i] & 0x02)331331 flag = TTY_FRAME;···370370static inline void receive_chars_dma_done(struct esp_struct *info,371371 int status)372372{373373- struct tty_struct *tty = info->tty;373373+ struct tty_struct *tty = info->port.tty;374374 int num_bytes;375375 unsigned long flags;376376···396396 if (status & 0x10) {397397 statflag = TTY_BREAK;398398 (info->icount.brk)++;399399- if (info->flags & ASYNC_SAK)399399+ if (info->port.flags & ASYNC_SAK)400400 do_SAK(tty);401401 } else if (status & 0x08) {402402 statflag = TTY_FRAME;···451451452452 for (i = 0; i < space_avail - 1; i += 2) {453453 outw(*((unsigned short *)(pio_buf->data + i)),454454- info->port + UART_ESI_TX);454454+ info->io_port + UART_ESI_TX);455455 }456456457457 if (space_avail & 0x0001)···470470 }471471472472 if (info->xmit_cnt < WAKEUP_CHARS) {473473- if (info->tty)474474- tty_wakeup(info->tty);473473+ if (info->port.tty)474474+ tty_wakeup(info->port.tty);475475476476#ifdef SERIAL_DEBUG_INTR477477 printk("THRE...");···507507 info->xmit_tail = (info->xmit_tail + dma_bytes) & (ESP_XMIT_SIZE - 1);508508509509 if (info->xmit_cnt < WAKEUP_CHARS) {510510- if (info->tty)511511- tty_wakeup(info->tty);510510+ if (info->port.tty)511511+ tty_wakeup(info->port.tty);512512513513#ifdef SERIAL_DEBUG_INTR514514 printk("THRE...");···575575 wake_up_interruptible(&info->delta_msr_wait);576576 }577577578578- if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {578578+ if ((info->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {579579#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))580580 printk("ttys%d CD now %s...", info->line,581581 (status & UART_MSR_DCD) ? "on" : "off");582582#endif583583 if (status & UART_MSR_DCD)584584- wake_up_interruptible(&info->open_wait);584584+ wake_up_interruptible(&info->port.open_wait);585585 else {586586#ifdef SERIAL_DEBUG_OPEN587587 printk("scheduling hangup...");588588#endif589589- tty_hangup(info->tty);589589+ tty_hangup(info->port.tty);590590 }591591 }592592}···609609610610 spin_lock(&info->lock);611611612612- if (!info->tty) {612612+ if (!info->port.tty) {613613 spin_unlock(&info->lock);614614 return IRQ_NONE;615615 }···647647 num_bytes = serial_in(info, UART_ESI_STAT1) << 8;648648 num_bytes |= serial_in(info, UART_ESI_STAT2);649649650650- num_bytes = tty_buffer_request_room(info->tty, num_bytes);650650+ num_bytes = tty_buffer_request_room(info->port.tty, num_bytes);651651652652 if (num_bytes) {653653 if (dma_bytes ||···661661662662 if (!(info->stat_flags & (ESP_STAT_DMA_RX | ESP_STAT_DMA_TX)) &&663663 (scratch & 0x02) && (info->IER & UART_IER_THRI)) {664664- if ((info->xmit_cnt <= 0) || info->tty->stopped) {664664+ if ((info->xmit_cnt <= 0) || info->port.tty->stopped) {665665 info->IER &= ~UART_IER_THRI;666666 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK);667667 serial_out(info, UART_ESI_CMD2, info->IER);···782782783783 spin_lock_irqsave(&info->lock, flags);784784785785- if (info->flags & ASYNC_INITIALIZED)785785+ if (info->port.flags & ASYNC_INITIALIZED)786786 goto out;787787788788 if (!info->xmit_buf) {···806806 num_chars |= serial_in(info, UART_ESI_STAT2);807807808808 while (num_chars > 1) {809809- inw(info->port + UART_ESI_RX);809809+ inw(info->io_port + UART_ESI_RX);810810 num_chars -= 2;811811 }812812···834834835835 if (retval) {836836 if (capable(CAP_SYS_ADMIN)) {837837- if (info->tty)837837+ if (info->port.tty)838838 set_bit(TTY_IO_ERROR,839839- &info->tty->flags);839839+ &info->port.tty->flags);840840 retval = 0;841841 }842842 goto out_unlocked;···874874 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK);875875 serial_out(info, UART_ESI_CMD2, info->IER);876876877877- if (info->tty)878878- clear_bit(TTY_IO_ERROR, &info->tty->flags);877877+ if (info->port.tty)878878+ clear_bit(TTY_IO_ERROR, &info->port.tty->flags);879879 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;880880 spin_unlock_irqrestore(&info->lock, flags);881881882882 /*883883 * Set up the tty->alt_speed kludge884884 */885885- if (info->tty) {886886- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)887887- info->tty->alt_speed = 57600;888888- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)889889- info->tty->alt_speed = 115200;890890- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)891891- info->tty->alt_speed = 230400;892892- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)893893- info->tty->alt_speed = 460800;885885+ if (info->port.tty) {886886+ if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)887887+ info->port.tty->alt_speed = 57600;888888+ if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)889889+ info->port.tty->alt_speed = 115200;890890+ if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)891891+ info->port.tty->alt_speed = 230400;892892+ if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)893893+ info->port.tty->alt_speed = 460800;894894 }895895896896 /*897897 * set the speed of the serial port898898 */899899 change_speed(info);900900- info->flags |= ASYNC_INITIALIZED;900900+ info->port.flags |= ASYNC_INITIALIZED;901901 return 0;902902903903out:···914914{915915 unsigned long flags, f;916916917917- if (!(info->flags & ASYNC_INITIALIZED))917917+ if (!(info->port.flags & ASYNC_INITIALIZED))918918 return;919919920920#ifdef SERIAL_DEBUG_OPEN···951951952952 while (current_port) {953953 if ((current_port != info) &&954954- (current_port->flags & ASYNC_INITIALIZED))954954+ (current_port->port.flags & ASYNC_INITIALIZED))955955 break;956956957957 current_port = current_port->next_port;···974974 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK);975975 serial_out(info, UART_ESI_CMD2, 0x00);976976977977- if (!info->tty || (info->tty->termios->c_cflag & HUPCL))977977+ if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL))978978 info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS);979979980980 info->MCR &= ~UART_MCR_OUT2;···982982 serial_out(info, UART_ESI_CMD2, UART_MCR);983983 serial_out(info, UART_ESI_CMD2, info->MCR);984984985985- if (info->tty)986986- set_bit(TTY_IO_ERROR, &info->tty->flags);985985+ if (info->port.tty)986986+ set_bit(TTY_IO_ERROR, &info->port.tty->flags);987987988988- info->flags &= ~ASYNC_INITIALIZED;988988+ info->port.flags &= ~ASYNC_INITIALIZED;989989 spin_unlock_irqrestore(&info->lock, flags);990990}991991···10021002 unsigned char flow1 = 0, flow2 = 0;10031003 unsigned long flags;1004100410051005- if (!info->tty || !info->tty->termios)10051005+ if (!info->port.tty || !info->port.tty->termios)10061006 return;10071007- cflag = info->tty->termios->c_cflag;10081008- port = info->port;10071007+ cflag = info->port.tty->termios->c_cflag;10081008+ port = info->io_port;1009100910101010 /* byte size and parity */10111011 switch (cflag & CSIZE) {···10291029 if (cflag & CMSPAR)10301030 cval |= UART_LCR_SPAR;10311031#endif10321032- baud = tty_get_baud_rate(info->tty);10321032+ baud = tty_get_baud_rate(info->port.tty);10331033 if (baud == 38400 &&10341034- ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST))10341034+ ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST))10351035 quot = info->custom_divisor;10361036 else {10371037 if (baud == 134) /* Special case since 134 is really 134.5 */···10461046 if (baud) {10471047 /* Actual rate */10481048 baud = BASE_BAUD/quot;10491049- tty_encode_baud_rate(info->tty, baud, baud);10491049+ tty_encode_baud_rate(info->port.tty, baud, baud);10501050 }10511051 info->timeout = ((1024 * HZ * bits * quot) / BASE_BAUD) + (HZ / 50);1052105210531053 /* CTS flow control flag and modem status interrupts */10541054 /* info->IER &= ~UART_IER_MSI; */10551055 if (cflag & CRTSCTS) {10561056- info->flags |= ASYNC_CTS_FLOW;10561056+ info->port.flags |= ASYNC_CTS_FLOW;10571057 /* info->IER |= UART_IER_MSI; */10581058 flow1 = 0x04;10591059 flow2 = 0x10;10601060 } else10611061- info->flags &= ~ASYNC_CTS_FLOW;10611061+ info->port.flags &= ~ASYNC_CTS_FLOW;10621062 if (cflag & CLOCAL)10631063- info->flags &= ~ASYNC_CHECK_CD;10631063+ info->port.flags &= ~ASYNC_CHECK_CD;10641064 else10651065- info->flags |= ASYNC_CHECK_CD;10651065+ info->port.flags |= ASYNC_CHECK_CD;1066106610671067 /*10681068 * Set up parity check flag10691069 */10701070 info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;10711071- if (I_INPCK(info->tty))10711071+ if (I_INPCK(info->port.tty))10721072 info->read_status_mask |= UART_LSR_FE | UART_LSR_PE;10731073- if (I_BRKINT(info->tty) || I_PARMRK(info->tty))10731073+ if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))10741074 info->read_status_mask |= UART_LSR_BI;1075107510761076 info->ignore_status_mask = 0;10771077#if 010781078 /* This should be safe, but for some broken bits of hardware... */10791079- if (I_IGNPAR(info->tty)) {10791079+ if (I_IGNPAR(info->port.tty)) {10801080 info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE;10811081 info->read_status_mask |= UART_LSR_PE | UART_LSR_FE;10821082 }10831083#endif10841084- if (I_IGNBRK(info->tty)) {10841084+ if (I_IGNBRK(info->port.tty)) {10851085 info->ignore_status_mask |= UART_LSR_BI;10861086 info->read_status_mask |= UART_LSR_BI;10871087 /*10881088 * If we're ignore parity and break indicators, ignore10891089 * overruns too. (For real raw support).10901090 */10911091- if (I_IGNPAR(info->tty)) {10911091+ if (I_IGNPAR(info->port.tty)) {10921092 info->ignore_status_mask |= UART_LSR_OE | \10931093 UART_LSR_PE | UART_LSR_FE;10941094 info->read_status_mask |= UART_LSR_OE | \···10961096 }10971097 }1098109810991099- if (I_IXOFF(info->tty))10991099+ if (I_IXOFF(info->port.tty))11001100 flow1 |= 0x81;1101110111021102 spin_lock_irqsave(&info->lock, flags);···11161116 serial_out(info, UART_ESI_CMD2, flow2);1117111711181118 /* set flow control characters (XON/XOFF only) */11191119- if (I_IXOFF(info->tty)) {11191119+ if (I_IXOFF(info->port.tty)) {11201120 serial_out(info, UART_ESI_CMD1, ESI_SET_FLOW_CHARS);11211121- serial_out(info, UART_ESI_CMD2, START_CHAR(info->tty));11221122- serial_out(info, UART_ESI_CMD2, STOP_CHAR(info->tty));11211121+ serial_out(info, UART_ESI_CMD2, START_CHAR(info->port.tty));11221122+ serial_out(info, UART_ESI_CMD2, STOP_CHAR(info->port.tty));11231123 serial_out(info, UART_ESI_CMD2, 0x10);11241124 serial_out(info, UART_ESI_CMD2, 0x21);11251125 switch (cflag & CSIZE) {···13551355 memset(&tmp, 0, sizeof(tmp));13561356 tmp.type = PORT_16550A;13571357 tmp.line = info->line;13581358- tmp.port = info->port;13581358+ tmp.port = info->io_port;13591359 tmp.irq = info->irq;13601360- tmp.flags = info->flags;13601360+ tmp.flags = info->port.flags;13611361 tmp.xmit_fifo_size = 1024;13621362 tmp.baud_base = BASE_BAUD;13631363 tmp.close_delay = info->close_delay;···1407140714081408 if ((new_serial.type != PORT_16550A) ||14091409 (new_serial.hub6) ||14101410- (info->port != new_serial.port) ||14101410+ (info->io_port != new_serial.port) ||14111411 (new_serial.baud_base != BASE_BAUD) ||14121412 (new_serial.irq > 15) ||14131413 (new_serial.irq < 2) ||···14251425 if (change_irq ||14261426 (new_serial.close_delay != info->close_delay) ||14271427 ((new_serial.flags & ~ASYNC_USR_MASK) !=14281428- (info->flags & ~ASYNC_USR_MASK)))14281428+ (info->port.flags & ~ASYNC_USR_MASK)))14291429 return -EPERM;14301430- info->flags = ((info->flags & ~ASYNC_USR_MASK) |14301430+ info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) |14311431 (new_serial.flags & ASYNC_USR_MASK));14321432 info->custom_divisor = new_serial.custom_divisor;14331433 } else {···14411441 if ((current_async->line >= info->line) &&14421442 (current_async->line < (info->line + 8))) {14431443 if (current_async == info) {14441444- if (current_async->count > 1)14441444+ if (current_async->port.count > 1)14451445 return -EBUSY;14461446- } else if (current_async->count)14461446+ } else if (current_async->port.count)14471447 return -EBUSY;14481448 }14491449···14561456 * At this point, we start making changes.....14571457 */1458145814591459- info->flags = ((info->flags & ~ASYNC_FLAGS) |14591459+ info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) |14601460 (new_serial.flags & ASYNC_FLAGS));14611461 info->custom_divisor = new_serial.custom_divisor;14621462 info->close_delay = new_serial.close_delay * HZ/100;···14871487 }14881488 }1489148914901490- if (info->flags & ASYNC_INITIALIZED) {14911491- if (((old_info.flags & ASYNC_SPD_MASK) !=14921492- (info->flags & ASYNC_SPD_MASK)) ||14901490+ if (info->port.flags & ASYNC_INITIALIZED) {14911491+ if (((old_info.port.flags & ASYNC_SPD_MASK) !=14921492+ (info->port.flags & ASYNC_SPD_MASK)) ||14931493 (old_info.custom_divisor != info->custom_divisor)) {14941494- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)14951495- info->tty->alt_speed = 57600;14961496- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)14971497- info->tty->alt_speed = 115200;14981498- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)14991499- info->tty->alt_speed = 230400;15001500- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)15011501- info->tty->alt_speed = 460800;14941494+ if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)14951495+ info->port.tty->alt_speed = 57600;14961496+ if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)14971497+ info->port.tty->alt_speed = 115200;14981498+ if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)14991499+ info->port.tty->alt_speed = 230400;15001500+ if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)15011501+ info->port.tty->alt_speed = 460800;15021502 change_speed(info);15031503 }15041504 } else···1554155415551555 while (current_async) {15561556 if (current_async == info) {15571557- if (current_async->count > 1)15571557+ if (current_async->port.count > 1)15581558 return -EBUSY;15591559- } else if (current_async->count)15591559+ } else if (current_async->port.count)15601560 return -EBUSY;1561156115621562 current_async = current_async->next_port;···15781578 spin_unlock_irqrestore(&info->lock, flags);15791579 } else {15801580 /* DMA mode to PIO mode only */15811581- if (info->count > 1)15811581+ if (info->port.count > 1)15821582 return -EBUSY;1583158315841584 shutdown(info);···16341634 spin_unlock_irqrestore(&info->lock, flags);16351635 }1636163616371637- if (!(info->flags & ASYNC_INITIALIZED))16371637+ if (!(info->port.flags & ASYNC_INITIALIZED))16381638 retval = startup(info);1639163916401640 return retval;···1917191719181918#ifdef SERIAL_DEBUG_OPEN19191919 printk(KERN_DEBUG "rs_close ttys%d, count = %d\n",19201920- info->line, info->count);19201920+ info->line, info->port.count);19211921#endif19221922- if (tty->count == 1 && info->count != 1) {19221922+ if (tty->count == 1 && info->port.count != 1) {19231923 /*19241924 * Uh, oh. tty->count is 1, which means that the tty19251925 * structure will be freed. Info->count should always···19271927 * one, we've got real problems, since it means the19281928 * serial port won't be shutdown.19291929 */19301930- printk(KERN_DEBUG "rs_close: bad serial port count; tty->count is 1, info->count is %d\n", info->count);19311931- info->count = 1;19301930+ printk(KERN_DEBUG "rs_close: bad serial port count; tty->count is 1, info->port.count is %d\n", info->port.count);19311931+ info->port.count = 1;19321932 }19331933- if (--info->count < 0) {19331933+ if (--info->port.count < 0) {19341934 printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n",19351935- info->line, info->count);19361936- info->count = 0;19351935+ info->line, info->port.count);19361936+ info->port.count = 0;19371937 }19381938- if (info->count) {19381938+ if (info->port.count) {19391939 DBG_CNT("before DEC-2");19401940 goto out;19411941 }19421942- info->flags |= ASYNC_CLOSING;19421942+ info->port.flags |= ASYNC_CLOSING;1943194319441944 spin_unlock_irqrestore(&info->lock, flags);19451945 /*···19581958 /* info->IER &= ~UART_IER_RLSI; */19591959 info->IER &= ~UART_IER_RDI;19601960 info->read_status_mask &= ~UART_LSR_DR;19611961- if (info->flags & ASYNC_INITIALIZED) {19611961+ if (info->port.flags & ASYNC_INITIALIZED) {1962196219631963 spin_lock_irqsave(&info->lock, flags);19641964 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK);···19811981 rs_flush_buffer(tty);19821982 tty_ldisc_flush(tty);19831983 tty->closing = 0;19841984- info->tty = NULL;19841984+ info->port.tty = NULL;1985198519861986- if (info->blocked_open) {19861986+ if (info->port.blocked_open) {19871987 if (info->close_delay)19881988 msleep_interruptible(jiffies_to_msecs(info->close_delay));19891989- wake_up_interruptible(&info->open_wait);19891989+ wake_up_interruptible(&info->port.open_wait);19901990 }19911991- info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);19921992- wake_up_interruptible(&info->close_wait);19911991+ info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);19921992+ wake_up_interruptible(&info->port.close_wait);19931993 return;1994199419951995out:···2047204720482048 rs_flush_buffer(tty);20492049 shutdown(info);20502050- info->count = 0;20512051- info->flags &= ~ASYNC_NORMAL_ACTIVE;20522052- info->tty = NULL;20532053- wake_up_interruptible(&info->open_wait);20502050+ info->port.count = 0;20512051+ info->port.flags &= ~ASYNC_NORMAL_ACTIVE;20522052+ info->port.tty = NULL;20532053+ wake_up_interruptible(&info->port.open_wait);20542054}2055205520562056/*···20712071 * until it's done, and then try again.20722072 */20732073 if (tty_hung_up_p(filp) ||20742074- (info->flags & ASYNC_CLOSING)) {20752075- if (info->flags & ASYNC_CLOSING)20762076- interruptible_sleep_on(&info->close_wait);20742074+ (info->port.flags & ASYNC_CLOSING)) {20752075+ if (info->port.flags & ASYNC_CLOSING)20762076+ interruptible_sleep_on(&info->port.close_wait);20772077#ifdef SERIAL_DO_RESTART20782078- if (info->flags & ASYNC_HUP_NOTIFY)20782078+ if (info->port.flags & ASYNC_HUP_NOTIFY)20792079 return -EAGAIN;20802080 else20812081 return -ERESTARTSYS;···20902090 */20912091 if ((filp->f_flags & O_NONBLOCK) ||20922092 (tty->flags & (1 << TTY_IO_ERROR))) {20932093- info->flags |= ASYNC_NORMAL_ACTIVE;20932093+ info->port.flags |= ASYNC_NORMAL_ACTIVE;20942094 return 0;20952095 }20962096···21002100 /*21012101 * Block waiting for the carrier detect and the line to become21022102 * free (i.e., not in use by the callout). While we are in21032103- * this loop, info->count is dropped by one, so that21032103+ * this loop, info->port.count is dropped by one, so that21042104 * rs_close() knows when to free things. We restore it upon21052105 * exit, either normal or abnormal.21062106 */21072107 retval = 0;21082108- add_wait_queue(&info->open_wait, &wait);21082108+ add_wait_queue(&info->port.open_wait, &wait);21092109#ifdef SERIAL_DEBUG_OPEN21102110 printk(KERN_DEBUG "block_til_ready before block: ttys%d, count = %d\n",21112111- info->line, info->count);21112111+ info->line, info->port.count);21122112#endif21132113 spin_lock_irqsave(&info->lock, flags);21142114 if (!tty_hung_up_p(filp))21152115- info->count--;21162116- info->blocked_open++;21152115+ info->port.count--;21162116+ info->port.blocked_open++;21172117 while (1) {21182118 if ((tty->termios->c_cflag & CBAUD)) {21192119 unsigned int scratch;···21282128 }21292129 set_current_state(TASK_INTERRUPTIBLE);21302130 if (tty_hung_up_p(filp) ||21312131- !(info->flags & ASYNC_INITIALIZED)) {21312131+ !(info->port.flags & ASYNC_INITIALIZED)) {21322132#ifdef SERIAL_DO_RESTART21332133- if (info->flags & ASYNC_HUP_NOTIFY)21332133+ if (info->port.flags & ASYNC_HUP_NOTIFY)21342134 retval = -EAGAIN;21352135 else21362136 retval = -ERESTARTSYS;···21442144 if (serial_in(info, UART_ESI_STAT2) & UART_MSR_DCD)21452145 do_clocal = 1;2146214621472147- if (!(info->flags & ASYNC_CLOSING) &&21472147+ if (!(info->port.flags & ASYNC_CLOSING) &&21482148 (do_clocal))21492149 break;21502150 if (signal_pending(current)) {···21532153 }21542154#ifdef SERIAL_DEBUG_OPEN21552155 printk(KERN_DEBUG "block_til_ready blocking: ttys%d, count = %d\n",21562156- info->line, info->count);21562156+ info->line, info->port.count);21572157#endif21582158 spin_unlock_irqrestore(&info->lock, flags);21592159 schedule();21602160 spin_lock_irqsave(&info->lock, flags);21612161 }21622162 set_current_state(TASK_RUNNING);21632163- remove_wait_queue(&info->open_wait, &wait);21632163+ remove_wait_queue(&info->port.open_wait, &wait);21642164 if (!tty_hung_up_p(filp))21652165- info->count++;21662166- info->blocked_open--;21652165+ info->port.count++;21662166+ info->port.blocked_open--;21672167 spin_unlock_irqrestore(&info->lock, flags);21682168#ifdef SERIAL_DEBUG_OPEN21692169 printk(KERN_DEBUG "block_til_ready after blocking: ttys%d, count = %d\n",21702170- info->line, info->count);21702170+ info->line, info->port.count);21712171#endif21722172 if (retval)21732173 return retval;21742174- info->flags |= ASYNC_NORMAL_ACTIVE;21742174+ info->port.flags |= ASYNC_NORMAL_ACTIVE;21752175 return 0;21762176}21772177···22042204 }2205220522062206#ifdef SERIAL_DEBUG_OPEN22072207- printk(KERN_DEBUG "esp_open %s, count = %d\n", tty->name, info->count);22072207+ printk(KERN_DEBUG "esp_open %s, count = %d\n", tty->name, info->port.count);22082208#endif22092209 spin_lock_irqsave(&info->lock, flags);22102210- info->count++;22102210+ info->port.count++;22112211 tty->driver_data = info;22122212- info->tty = tty;22122212+ info->port.tty = tty;2213221322142214 spin_unlock_irqrestore(&info->lock, flags);22152215···22632263 int port_detected = 0;22642264 unsigned long flags;2265226522662266- if (!request_region(info->port, REGION_SIZE, "esp serial"))22662266+ if (!request_region(info->io_port, REGION_SIZE, "esp serial"))22672267 return -EIO;2268226822692269 spin_lock_irqsave(&info->lock, flags);···23002300 }23012301 }23022302 if (!port_detected)23032303- release_region(info->port, REGION_SIZE);23032303+ release_region(info->io_port, REGION_SIZE);2304230423052305 spin_unlock_irqrestore(&info->lock, flags);23062306 return (port_detected);···24142414 offset = 0;2415241524162416 do {24172417- info->port = esp[i] + offset;24172417+ info->io_port = esp[i] + offset;24182418 info->irq = irq[i];24192419 info->line = (i * 8) + (offset / 8);24202420···24252425 }2426242624272427 info->custom_divisor = (divisor[i] >> (offset / 2)) & 0xf;24282428- info->flags = STD_COM_FLAGS;24282428+ info->port.flags = STD_COM_FLAGS;24292429 if (info->custom_divisor)24302430- info->flags |= ASYNC_SPD_CUST;24302430+ info->port.flags |= ASYNC_SPD_CUST;24312431 info->magic = ESP_MAGIC;24322432 info->close_delay = 5*HZ/10;24332433 info->closing_wait = 30*HZ;···24362436 info->config.flow_off = flow_off;24372437 info->config.pio_threshold = pio_threshold;24382438 info->next_port = ports;24392439- init_waitqueue_head(&info->open_wait);24402440- init_waitqueue_head(&info->close_wait);24392439+ init_waitqueue_head(&info->port.open_wait);24402440+ init_waitqueue_head(&info->port.close_wait);24412441 init_waitqueue_head(&info->delta_msr_wait);24422442 init_waitqueue_head(&info->break_wait);24432443 ports = info;24442444 printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",24452445- info->line, info->port, info->irq);24452445+ info->line, info->io_port, info->irq);2446244624472447 if (info->line % 8) {24482448 printk("secondary port\n");···24982498 put_tty_driver(esp_driver);2499249925002500 while (ports) {25012501- if (ports->port)25022502- release_region(ports->port, REGION_SIZE);25012501+ if (ports->io_port)25022502+ release_region(ports->io_port, REGION_SIZE);25032503 temp_async = ports->next_port;25042504 kfree(ports);25052505 ports = temp_async;
+2-7
include/linux/hayesesp.h
···76767777struct esp_struct {7878 int magic;7979+ struct tty_port port;7980 spinlock_t lock;8080- int port;8181+ int io_port;8182 int irq;8282- int flags; /* defined in tty.h */8383- struct tty_struct *tty;8483 int read_status_mask;8584 int ignore_status_mask;8685 int timeout;···9293 int MCR; /* Modem control register */9394 unsigned long last_active;9495 int line;9595- int count; /* # of fd on device */9696- int blocked_open; /* # of blocked opens */9796 unsigned char *xmit_buf;9897 int xmit_head;9998 int xmit_tail;10099 int xmit_cnt;101101- wait_queue_head_t open_wait;102102- wait_queue_head_t close_wait;103100 wait_queue_head_t delta_msr_wait;104101 wait_queue_head_t break_wait;105102 struct async_icount icount; /* kernel counters for the 4 input interrupts */