···945945946946static void isicom_close(struct tty_struct *tty, struct file *filp)947947{948948- struct isi_port *port = tty->driver_data;948948+ struct isi_port *ip = tty->driver_data;949949+ struct tty_port *port = &ip->port;949950 struct isi_board *card;950951 unsigned long flags;951952952952- if (!port)953953+ BUG_ON(!ip);954954+955955+ card = ip->card;956956+ if (isicom_paranoia_check(ip, tty->name, "isicom_close"))953957 return;954954- card = port->card;955955- if (isicom_paranoia_check(port, tty->name, "isicom_close"))956956- return;957958958958- pr_dbg("Close start!!!.\n");959959-960960- spin_lock_irqsave(&port->port.lock, flags);961961- if (tty_hung_up_p(filp)) {962962- spin_unlock_irqrestore(&port->port.lock, flags);963963- return;964964- }965965-966966- if (tty->count == 1 && port->port.count != 1) {967967- printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port "968968- "count tty->count = 1 port count = %d.\n",969969- card->base, port->port.count);970970- port->port.count = 1;971971- }972972- if (--port->port.count < 0) {973973- printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port "974974- "count for channel%d = %d", card->base, port->channel,975975- port->port.count);976976- port->port.count = 0;977977- }978978-979979- if (port->port.count) {980980- spin_unlock_irqrestore(&port->port.lock, flags);981981- return;982982- }983983- port->port.flags |= ASYNC_CLOSING;984984- tty->closing = 1;985985- spin_unlock_irqrestore(&port->port.lock, flags);986986-987987- if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)988988- tty_wait_until_sent(tty, port->port.closing_wait);989959 /* indicate to the card that no more data can be received990960 on this port */991961 spin_lock_irqsave(&card->card_lock, flags);992992- if (port->port.flags & ASYNC_INITIALIZED) {993993- card->port_status &= ~(1 << port->channel);962962+ if (port->flags & ASYNC_INITIALIZED) {963963+ card->port_status &= ~(1 << ip->channel);994964 outw(card->port_status, card->base + 0x02);995965 }996996- isicom_shutdown_port(port);966966+ isicom_shutdown_port(ip);997967 spin_unlock_irqrestore(&card->card_lock, flags);998968999969 isicom_flush_buffer(tty);10001000- tty_ldisc_flush(tty);10011001-10021002- spin_lock_irqsave(&port->port.lock, flags);10031003- tty->closing = 0;10041004-10051005- if (port->port.blocked_open) {10061006- spin_unlock_irqrestore(&port->port.lock, flags);10071007- if (port->port.close_delay) {10081008- pr_dbg("scheduling until time out.\n");10091009- msleep_interruptible(10101010- jiffies_to_msecs(port->port.close_delay));10111011- }10121012- spin_lock_irqsave(&port->port.lock, flags);10131013- wake_up_interruptible(&port->port.open_wait);10141014- }10151015- port->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);10161016- wake_up_interruptible(&port->port.close_wait);10171017- spin_unlock_irqrestore(&port->port.lock, flags);970970+971971+ tty_port_close_end(port, tty);1018972}10199731020974/* write et all */
+29-49
drivers/char/istallion.c
···767767 break;768768 }769769 if (i == ARRAY_SIZE(stli_brdstr)) {770770- printk("STALLION: unknown board name, %s?\n", argp[0]);770770+ printk(KERN_WARNING "istallion: unknown board name, %s?\n", argp[0]);771771 return 0;772772 }773773···855855 return;856856 port = &portp->port;857857858858- spin_lock_irqsave(&port->lock, flags);859859- if (tty_hung_up_p(filp)) {860860- spin_unlock_irqrestore(&port->lock, flags);858858+ if (tty_port_close_start(port, tty, filp) == 0)861859 return;862862- }863863- if (tty->count == 1 && port->count != 1)864864- port->count = 1;865865- if (port->count-- > 1) {866866- spin_unlock_irqrestore(&port->lock, flags);867867- return;868868- }869869-870870- port->flags |= ASYNC_CLOSING;871871- tty->closing = 1;872872- spin_unlock_irqrestore(&port->lock, flags);873860874861/*875862 * May want to wait for data to drain before closing. The BUSY flag···869882 stli_flushchars(tty);870883 spin_unlock_irqrestore(&stli_lock, flags);871884885885+ /* We end up doing this twice for the moment. This needs looking at886886+ eventually. Note we still use portp->closing_wait as a result */872887 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE)873888 tty_wait_until_sent(tty, portp->closing_wait);874889···894905 set_bit(ST_DOFLUSHRX, &portp->state);895906 stli_flushbuffer(tty);896907897897- tty->closing = 0;898898- tty_port_tty_set(&portp->port, NULL);899899-900900- if (port->blocked_open) {901901- if (portp->close_delay)902902- msleep_interruptible(jiffies_to_msecs(portp->close_delay));903903- wake_up_interruptible(&port->open_wait);904904- }905905-906906- port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);907907- wake_up_interruptible(&port->close_wait);908908+ tty_port_close_end(port, tty);909909+ tty_port_tty_set(port, NULL);908910}909911910912/*****************************************************************************/···14621482 sio.irq = 0;14631483 sio.flags = portp->port.flags;14641484 sio.baud_base = portp->baud_base;14651465- sio.close_delay = portp->close_delay;14851485+ sio.close_delay = portp->port.close_delay;14661486 sio.closing_wait = portp->closing_wait;14671487 sio.custom_divisor = portp->custom_divisor;14681488 sio.xmit_fifo_size = 0;···14941514 return -EFAULT;14951515 if (!capable(CAP_SYS_ADMIN)) {14961516 if ((sio.baud_base != portp->baud_base) ||14971497- (sio.close_delay != portp->close_delay) ||15171517+ (sio.close_delay != portp->port.close_delay) ||14981518 ((sio.flags & ~ASYNC_USR_MASK) !=14991519 (portp->port.flags & ~ASYNC_USR_MASK)))15001520 return -EPERM;···15031523 portp->port.flags = (portp->port.flags & ~ASYNC_USR_MASK) |15041524 (sio.flags & ASYNC_USR_MASK);15051525 portp->baud_base = sio.baud_base;15061506- portp->close_delay = sio.close_delay;15261526+ portp->port.close_delay = sio.close_delay;15071527 portp->closing_wait = sio.closing_wait;15081528 portp->custom_divisor = sio.custom_divisor;15091529···20452065 unsigned char __iomem *bits;2046206620472067 if (test_bit(ST_CMDING, &portp->state)) {20482048- printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n",20682068+ printk(KERN_ERR "istallion: command already busy, cmd=%x!\n",20492069 (int) cmd);20502070 return;20512071 }···26052625 for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) {26062626 portp = kzalloc(sizeof(struct stliport), GFP_KERNEL);26072627 if (!portp) {26082608- printk("STALLION: failed to allocate port structure\n");26282628+ printk(KERN_WARNING "istallion: failed to allocate port structure\n");26092629 continue;26102630 }26112631 tty_port_init(&portp->port);···26152635 portp->brdnr = brdp->brdnr;26162636 portp->panelnr = panelnr;26172637 portp->baud_base = STL_BAUDBASE;26182618- portp->close_delay = STL_CLOSEDELAY;26382638+ portp->port.close_delay = STL_CLOSEDELAY;26192639 portp->closing_wait = 30 * HZ;26202640 init_waitqueue_head(&portp->port.open_wait);26212641 init_waitqueue_head(&portp->port.close_wait);···26722692 unsigned char val;2673269326742694 if (offset > brdp->memsize) {26752675- printk(KERN_ERR "STALLION: shared memory pointer=%x out of "26952695+ printk(KERN_ERR "istallion: shared memory pointer=%x out of "26762696 "range at line=%d(%d), brd=%d\n",26772697 (int) offset, line, __LINE__, brdp->brdnr);26782698 ptr = NULL;···27462766 unsigned char val;2747276727482768 if (offset > brdp->memsize) {27492749- printk(KERN_ERR "STALLION: shared memory pointer=%x out of "27692769+ printk(KERN_ERR "istallion: shared memory pointer=%x out of "27502770 "range at line=%d(%d), brd=%d\n",27512771 (int) offset, line, __LINE__, brdp->brdnr);27522772 ptr = NULL;···27982818 unsigned char val;2799281928002820 if (offset > brdp->memsize) {28012801- printk(KERN_ERR "STALLION: shared memory pointer=%x out of "28212821+ printk(KERN_ERR "istallion: shared memory pointer=%x out of "28022822 "range at line=%d(%d), brd=%d\n",28032823 (int) offset, line, __LINE__, brdp->brdnr);28042824 ptr = NULL;···28432863 unsigned char val;2844286428452865 if (offset > brdp->memsize) {28462846- printk(KERN_ERR "STALLION: shared memory pointer=%x out of "28662866+ printk(KERN_ERR "istallion: shared memory pointer=%x out of "28472867 "range at line=%d(%d), board=%d\n",28482868 (int) offset, line, __LINE__, brdp->brdnr);28492869 ptr = NULL;···29082928 void __iomem *ptr;2909292929102930 if (offset > brdp->memsize) {29112911- printk(KERN_ERR "STALLION: shared memory pointer=%x out of "29312931+ printk(KERN_ERR "istallion: shared memory pointer=%x out of "29122932 "range at line=%d(%d), brd=%d\n",29132933 (int) offset, line, __LINE__, brdp->brdnr);29142934 ptr = NULL;···29742994 unsigned char val;2975299529762996 if (offset > brdp->memsize) {29772977- printk(KERN_ERR "STALLION: shared memory pointer=%x out of "29972997+ printk(KERN_ERR "istallion: shared memory pointer=%x out of "29782998 "range at line=%d(%d), brd=%d\n",29792999 (int) offset, line, __LINE__, brdp->brdnr);29803000 ptr = NULL;···34133433#endif3414343434153435 if (nrdevs < (brdp->nrports + 1)) {34163416- printk(KERN_ERR "STALLION: slave failed to allocate memory for "34363436+ printk(KERN_ERR "istallion: slave failed to allocate memory for "34173437 "all devices, devices=%d\n", nrdevs);34183438 brdp->nrports = nrdevs - 1;34193439 }···34233443 brdp->bitsize = (nrdevs + 7) / 8;34243444 memoff = readl(&hdrp->memp);34253445 if (memoff > brdp->memsize) {34263426- printk(KERN_ERR "STALLION: corrupted shared memory region?\n");34463446+ printk(KERN_ERR "istallion: corrupted shared memory region?\n");34273447 rc = -EIO;34283448 goto stli_donestartup;34293449 }34303450 memp = (cdkmem_t __iomem *) EBRDGETMEMPTR(brdp, memoff);34313451 if (readw(&memp->dtype) != TYP_ASYNCTRL) {34323432- printk(KERN_ERR "STALLION: no slave control device found\n");34523452+ printk(KERN_ERR "istallion: no slave control device found\n");34333453 goto stli_donestartup;34343454 }34353455 memp++;···35143534 retval = stli_initonb(brdp);35153535 break;35163536 default:35173517- printk(KERN_ERR "STALLION: board=%d is unknown board "35373537+ printk(KERN_ERR "istallion: board=%d is unknown board "35183538 "type=%d\n", brdp->brdnr, brdp->brdtype);35193539 retval = -ENODEV;35203540 }···35233543 return retval;3524354435253545 stli_initports(brdp);35263526- printk(KERN_INFO "STALLION: %s found, board=%d io=%x mem=%x "35463546+ printk(KERN_INFO "istallion: %s found, board=%d io=%x mem=%x "35273547 "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype],35283548 brdp->brdnr, brdp->iobase, (int) brdp->memaddr,35293549 brdp->nrpanels, brdp->nrports);···36173637 if (! foundit) {36183638 brdp->memaddr = 0;36193639 brdp->membase = NULL;36203620- printk(KERN_ERR "STALLION: failed to probe shared memory "36403640+ printk(KERN_ERR "istallion: failed to probe shared memory "36213641 "region for %s in EISA slot=%d\n",36223642 stli_brdnames[brdp->brdtype], (brdp->iobase >> 12));36233643 return -ENODEV;···37623782 mutex_lock(&stli_brdslock);37633783 brdnr = stli_getbrdnr();37643784 if (brdnr < 0) {37653765- printk(KERN_INFO "STALLION: too many boards found, "37853785+ printk(KERN_INFO "istallion: too many boards found, "37663786 "maximum supported %d\n", STL_MAXBRDS);37673787 mutex_unlock(&stli_brdslock);37683788 retval = -EIO;···3834385438353855 brdp = kzalloc(sizeof(struct stlibrd), GFP_KERNEL);38363856 if (!brdp) {38373837- printk(KERN_ERR "STALLION: failed to allocate memory "38573857+ printk(KERN_ERR "istallion: failed to allocate memory "38383858 "(size=%Zd)\n", sizeof(struct stlibrd));38393859 return NULL;38403860 }···4473449344744494 stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL);44754495 if (!stli_txcookbuf) {44764476- printk(KERN_ERR "STALLION: failed to allocate memory "44964496+ printk(KERN_ERR "istallion: failed to allocate memory "44774497 "(size=%d)\n", STLI_TXBUFSIZE);44784498 retval = -ENOMEM;44794499 goto err;···4498451844994519 retval = tty_register_driver(stli_serial);45004520 if (retval) {45014501- printk(KERN_ERR "STALLION: failed to register serial driver\n");45214521+ printk(KERN_ERR "istallion: failed to register serial driver\n");45024522 goto err_ttyput;45034523 }45044524···45124532 */45134533 retval = register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stli_fsiomem);45144534 if (retval) {45154515- printk(KERN_ERR "STALLION: failed to register serial memory "45354535+ printk(KERN_ERR "istallion: failed to register serial memory "45164536 "device\n");45174537 goto err_deinit;45184538 }
+9-47
drivers/char/mxser.c
···10801080static void mxser_close(struct tty_struct *tty, struct file *filp)10811081{10821082 struct mxser_port *info = tty->driver_data;10831083+ struct tty_port *port = &info->port;1083108410841085 unsigned long timeout;10851085- unsigned long flags;1086108610871087 if (tty->index == MXSER_PORTS)10881088 return;10891089 if (!info)10901090 return;1091109110921092- spin_lock_irqsave(&info->port.lock, flags);10921092+ if (tty_port_close_start(port, tty, filp) == 0)10931093+ return;1093109410941094- if (tty_hung_up_p(filp)) {10951095- spin_unlock_irqrestore(&info->port.lock, flags);10961096- return;10971097- }10981098- if ((tty->count == 1) && (info->port.count != 1)) {10991099- /*11001100- * Uh, oh. tty->count is 1, which means that the tty11011101- * structure will be freed. Info->port.count should always11021102- * be one in these conditions. If it's greater than11031103- * one, we've got real problems, since it means the11041104- * serial port won't be shutdown.11051105- */11061106- printk(KERN_ERR "mxser_close: bad serial port count; "11071107- "tty->count is 1, info->port.count is %d\n", info->port.count);11081108- info->port.count = 1;11091109- }11101110- if (--info->port.count < 0) {11111111- printk(KERN_ERR "mxser_close: bad serial port count for "11121112- "ttys%d: %d\n", tty->index, info->port.count);11131113- info->port.count = 0;11141114- }11151115- if (info->port.count) {11161116- spin_unlock_irqrestore(&info->port.lock, flags);11171117- return;11181118- }11191119- info->port.flags |= ASYNC_CLOSING;11201120- spin_unlock_irqrestore(&info->port.lock, flags);11211095 /*11221096 * Save the termios structure, since this port may have11231097 * separate termios for callout and dialin.10981098+ *10991099+ * FIXME: Can this go ?11241100 */11251101 if (info->port.flags & ASYNC_NORMAL_ACTIVE)11261102 info->normal_termios = *tty->termios;11271127- /*11281128- * Now we wait for the transmit buffer to clear; and we notify11291129- * the line discipline to only process XON/XOFF characters.11301130- */11311131- tty->closing = 1;11321132- if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)11331133- tty_wait_until_sent(tty, info->port.closing_wait);11341103 /*11351104 * At this point we stop accepting input. To do this, we11361105 * disable the receive line status interrupts, and tell the···11251156 }11261157 }11271158 mxser_shutdown(tty);11281128-11291159 mxser_flush_buffer(tty);11301130- tty_ldisc_flush(tty);1131116011321132- tty->closing = 0;11331133- tty_port_tty_set(&info->port, NULL);11341134- if (info->port.blocked_open) {11351135- if (info->port.close_delay)11361136- schedule_timeout_interruptible(info->port.close_delay);11371137- wake_up_interruptible(&info->port.open_wait);11381138- }11391139-11401140- info->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);11611161+ /* Right now the tty_port set is done outside of the close_end helper11621162+ as we don't yet have everyone using refcounts */ 11631163+ tty_port_close_end(port, tty);11641164+ tty_port_tty_set(port, NULL);11411165}1142116611431167static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count)
+5-44
drivers/char/riscom8.c
···929929 if (!port || rc_paranoia_check(port, tty->name, "close"))930930 return;931931932932- spin_lock_irqsave(&port->port.lock, flags);933933-934934- if (tty_hung_up_p(filp))935935- goto out;936936-937932 bp = port_Board(port);938938- if ((tty->count == 1) && (port->port.count != 1)) {939939- printk(KERN_INFO "rc%d: rc_close: bad port count;"940940- " tty->count is 1, port count is %d\n",941941- board_No(bp), port->port.count);942942- port->port.count = 1;943943- }944944- if (--port->port.count < 0) {945945- printk(KERN_INFO "rc%d: rc_close: bad port count "946946- "for tty%d: %d\n",947947- board_No(bp), port_No(port), port->port.count);948948- port->port.count = 0;949949- }950950- if (port->port.count)951951- goto out;952952- port->port.flags |= ASYNC_CLOSING;953953- /*954954- * Now we wait for the transmit buffer to clear; and we notify955955- * the line discipline to only process XON/XOFF characters.956956- */957957- tty->closing = 1;958958- spin_unlock_irqrestore(&port->port.lock, flags);959959- if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)960960- tty_wait_until_sent(tty, port->port.closing_wait);933933+934934+ if (tty_port_close_start(&port->port, tty, filp) == 0)935935+ return;936936+961937 /*962938 * At this point we stop accepting input. To do this, we963939 * disable the receive line status interrupts, and tell the···965989 rc_shutdown_port(tty, bp, port);966990 rc_flush_buffer(tty);967991 spin_unlock_irqrestore(&riscom_lock, flags);968968- tty_ldisc_flush(tty);969992970970- spin_lock_irqsave(&port->port.lock, flags);971971- tty->closing = 0;972972- port->port.tty = NULL;973973- if (port->port.blocked_open) {974974- spin_unlock_irqrestore(&port->port.lock, flags);975975- if (port->port.close_delay)976976- msleep_interruptible(jiffies_to_msecs(port->port.close_delay));977977- wake_up_interruptible(&port->port.open_wait);978978- spin_lock_irqsave(&port->port.lock, flags);979979- }980980- port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);981981- wake_up_interruptible(&port->port.close_wait);982982-983983-out:984984- spin_unlock_irqrestore(&riscom_lock, flags);993993+ tty_port_close_end(&port->port, tty);985994}986995987996static int rc_write(struct tty_struct *tty,
+4-35
drivers/char/stallion.c
···833833 pr_debug("stl_close(tty=%p,filp=%p)\n", tty, filp);834834835835 portp = tty->driver_data;836836- if (portp == NULL)837837- return;836836+ BUG_ON(portp == NULL);837837+838838 port = &portp->port;839839840840- spin_lock_irqsave(&port->lock, flags);841841- if (tty_hung_up_p(filp)) {842842- spin_unlock_irqrestore(&port->lock, flags);840840+ if (tty_port_close_start(port, tty, filp) == 0)843841 return;844844- }845845- if (tty->count == 1 && port->count != 1)846846- port->count = 1;847847- if (port->count-- > 1) {848848- spin_unlock_irqrestore(&port->lock, flags);849849- return;850850- }851851-852852- port->count = 0;853853- port->flags |= ASYNC_CLOSING;854854-855842/*856843 * May want to wait for any data to drain before closing. The BUSY857844 * flag keeps track of whether we are still sending or not - it is858845 * very accurate for the cd1400, not quite so for the sc26198.859846 * (The sc26198 has no "end-of-data" interrupt only empty FIFO)860847 */861861- tty->closing = 1;862862-863863- spin_unlock_irqrestore(&port->lock, flags);864864-865865- if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE)866866- tty_wait_until_sent(tty, portp->closing_wait);867848 stl_waituntilsent(tty, (HZ / 2));868868-869849870850 spin_lock_irqsave(&port->lock, flags);871851 portp->port.flags &= ~ASYNC_INITIALIZED;···863883 portp->tx.head = NULL;864884 portp->tx.tail = NULL;865885 }866866- set_bit(TTY_IO_ERROR, &tty->flags);867867- tty_ldisc_flush(tty);868886869869- tty->closing = 0;887887+ tty_port_close_end(port, tty);870888 tty_port_tty_set(port, NULL);871871-872872- if (port->blocked_open) {873873- if (portp->close_delay)874874- msleep_interruptible(jiffies_to_msecs(portp->close_delay));875875- wake_up_interruptible(&portp->port.open_wait);876876- }877877-878878- portp->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);879879- wake_up_interruptible(&port->close_wait);880889}881890882891/*****************************************************************************/
+3-55
drivers/char/synclink.c
···31043104 if (debug_level >= DEBUG_LEVEL_INFO)31053105 printk("%s(%d):mgsl_close(%s) entry, count=%d\n",31063106 __FILE__,__LINE__, info->device_name, info->port.count);31073107-31083108- if (!info->port.count)31093109- return;3110310731113111- if (tty_hung_up_p(filp))31083108+ if (tty_port_close_start(&info->port, tty, filp) == 0) 31123109 goto cleanup;3113311031143114- if ((tty->count == 1) && (info->port.count != 1)) {31153115- /*31163116- * tty->count is 1 and the tty structure will be freed.31173117- * info->port.count should be one in this case.31183118- * if it's not, correct it so that the port is shutdown.31193119- */31203120- printk("mgsl_close: bad refcount; tty->count is 1, "31213121- "info->port.count is %d\n", info->port.count);31223122- info->port.count = 1;31233123- }31243124-31253125- info->port.count--;31263126-31273127- /* if at least one open remaining, leave hardware active */31283128- if (info->port.count)31293129- goto cleanup;31303130-31313131- info->port.flags |= ASYNC_CLOSING;31323132-31333133- /* set tty->closing to notify line discipline to 31343134- * only process XON/XOFF characters. Only the N_TTY31353135- * discipline appears to use this (ppp does not).31363136- */31373137- tty->closing = 1;31383138-31393139- /* wait for transmit data to clear all layers */31403140-31413141- if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {31423142- if (debug_level >= DEBUG_LEVEL_INFO)31433143- printk("%s(%d):mgsl_close(%s) calling tty_wait_until_sent\n",31443144- __FILE__,__LINE__, info->device_name );31453145- tty_wait_until_sent(tty, info->port.closing_wait);31463146- }31473147-31483111 if (info->port.flags & ASYNC_INITIALIZED)31493112 mgsl_wait_until_sent(tty, info->timeout);31503150-31513113 mgsl_flush_buffer(tty);31523152-31533114 tty_ldisc_flush(tty);31543154-31553115 shutdown(info);31563156-31573157- tty->closing = 0;31163116+31173117+ tty_port_close_end(&info->port, tty); 31583118 info->port.tty = NULL;31593159-31603160- if (info->port.blocked_open) {31613161- if (info->port.close_delay) {31623162- msleep_interruptible(jiffies_to_msecs(info->port.close_delay));31633163- }31643164- wake_up_interruptible(&info->port.open_wait);31653165- }31663166-31673167- info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);31683168-31693169- wake_up_interruptible(&info->port.close_wait);31703170-31713119cleanup: 31723120 if (debug_level >= DEBUG_LEVEL_INFO)31733121 printk("%s(%d):mgsl_close(%s) exit, count=%d\n", __FILE__,__LINE__,
+2-49
drivers/char/synclink_gt.c
···720720 return;721721 DBGINFO(("%s close entry, count=%d\n", info->device_name, info->port.count));722722723723- if (!info->port.count)724724- return;725725-726726- if (tty_hung_up_p(filp))723723+ if (tty_port_close_start(&info->port, tty, filp) == 0)727724 goto cleanup;728728-729729- if ((tty->count == 1) && (info->port.count != 1)) {730730- /*731731- * tty->count is 1 and the tty structure will be freed.732732- * info->port.count should be one in this case.733733- * if it's not, correct it so that the port is shutdown.734734- */735735- DBGERR(("%s close: bad refcount; tty->count=1, "736736- "info->port.count=%d\n", info->device_name, info->port.count));737737- info->port.count = 1;738738- }739739-740740- info->port.count--;741741-742742- /* if at least one open remaining, leave hardware active */743743- if (info->port.count)744744- goto cleanup;745745-746746- info->port.flags |= ASYNC_CLOSING;747747-748748- /* set tty->closing to notify line discipline to749749- * only process XON/XOFF characters. Only the N_TTY750750- * discipline appears to use this (ppp does not).751751- */752752- tty->closing = 1;753753-754754- /* wait for transmit data to clear all layers */755755-756756- if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {757757- DBGINFO(("%s call tty_wait_until_sent\n", info->device_name));758758- tty_wait_until_sent(tty, info->port.closing_wait);759759- }760725761726 if (info->port.flags & ASYNC_INITIALIZED)762727 wait_until_sent(tty, info->timeout);···730765731766 shutdown(info);732767733733- tty->closing = 0;768768+ tty_port_close_end(&info->port, tty);734769 info->port.tty = NULL;735735-736736- if (info->port.blocked_open) {737737- if (info->port.close_delay) {738738- msleep_interruptible(jiffies_to_msecs(info->port.close_delay));739739- }740740- wake_up_interruptible(&info->port.open_wait);741741- }742742-743743- info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);744744-745745- wake_up_interruptible(&info->port.close_wait);746746-747770cleanup:748771 DBGINFO(("%s close exit, count=%d\n", tty->driver->name, info->port.count));749772}
+3-55
drivers/char/synclinkmp.c
···810810 printk("%s(%d):%s close() entry, count=%d\n",811811 __FILE__,__LINE__, info->device_name, info->port.count);812812813813- if (!info->port.count)814814- return;815815-816816- if (tty_hung_up_p(filp))813813+ if (tty_port_close_start(&info->port, tty, filp) == 0)817814 goto cleanup;818818-819819- if ((tty->count == 1) && (info->port.count != 1)) {820820- /*821821- * tty->count is 1 and the tty structure will be freed.822822- * info->port.count should be one in this case.823823- * if it's not, correct it so that the port is shutdown.824824- */825825- printk("%s(%d):%s close: bad refcount; tty->count is 1, "826826- "info->port.count is %d\n",827827- __FILE__,__LINE__, info->device_name, info->port.count);828828- info->port.count = 1;829829- }830830-831831- info->port.count--;832832-833833- /* if at least one open remaining, leave hardware active */834834- if (info->port.count)835835- goto cleanup;836836-837837- info->port.flags |= ASYNC_CLOSING;838838-839839- /* set tty->closing to notify line discipline to840840- * only process XON/XOFF characters. Only the N_TTY841841- * discipline appears to use this (ppp does not).842842- */843843- tty->closing = 1;844844-845845- /* wait for transmit data to clear all layers */846846-847847- if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {848848- if (debug_level >= DEBUG_LEVEL_INFO)849849- printk("%s(%d):%s close() calling tty_wait_until_sent\n",850850- __FILE__,__LINE__, info->device_name );851851- tty_wait_until_sent(tty, info->port.closing_wait);852852- }853853-815815+854816 if (info->port.flags & ASYNC_INITIALIZED)855817 wait_until_sent(tty, info->timeout);856818857819 flush_buffer(tty);858858-859820 tty_ldisc_flush(tty);860860-861821 shutdown(info);862822863863- tty->closing = 0;823823+ tty_port_close_end(&info->port, tty);864824 info->port.tty = NULL;865865-866866- if (info->port.blocked_open) {867867- if (info->port.close_delay) {868868- msleep_interruptible(jiffies_to_msecs(info->port.close_delay));869869- }870870- wake_up_interruptible(&info->port.open_wait);871871- }872872-873873- info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);874874-875875- wake_up_interruptible(&info->port.close_wait);876876-877825cleanup:878826 if (debug_level >= DEBUG_LEVEL_INFO)879827 printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__,