aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/i4l/isdn_tty.c97
1 files changed, 1 insertions, 96 deletions
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index b41a80a453d7..7bc50670d7d9 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -1486,101 +1486,6 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
1486 * ------------------------------------------------------------ 1486 * ------------------------------------------------------------
1487 */ 1487 */
1488 1488
1489static int
1490isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *info)
1491{
1492 struct tty_port *port = &info->port;
1493 DECLARE_WAITQUEUE(wait, NULL);
1494 int do_clocal = 0;
1495 int retval;
1496
1497 /*
1498 * If the device is in the middle of being closed, then block
1499 * until it's done, and then try again.
1500 */
1501 if (tty_hung_up_p(filp) ||
1502 (port->flags & ASYNC_CLOSING)) {
1503 if (port->flags & ASYNC_CLOSING)
1504 interruptible_sleep_on(&port->close_wait);
1505#ifdef MODEM_DO_RESTART
1506 if (port->flags & ASYNC_HUP_NOTIFY)
1507 return -EAGAIN;
1508 else
1509 return -ERESTARTSYS;
1510#else
1511 return -EAGAIN;
1512#endif
1513 }
1514 /*
1515 * If non-blocking mode is set, then make the check up front
1516 * and then exit.
1517 */
1518 if ((filp->f_flags & O_NONBLOCK) ||
1519 (tty->flags & (1 << TTY_IO_ERROR))) {
1520 port->flags |= ASYNC_NORMAL_ACTIVE;
1521 return 0;
1522 }
1523 if (tty->termios->c_cflag & CLOCAL)
1524 do_clocal = 1;
1525 /*
1526 * Block waiting for the carrier detect and the line to become
1527 * free (i.e., not in use by the callout). While we are in
1528 * this loop, info->count is dropped by one, so that
1529 * isdn_tty_close() knows when to free things. We restore it upon
1530 * exit, either normal or abnormal.
1531 */
1532 retval = 0;
1533 add_wait_queue(&port->open_wait, &wait);
1534#ifdef ISDN_DEBUG_MODEM_OPEN
1535 printk(KERN_DEBUG "isdn_tty_block_til_ready before block: ttyi%d, count = %d\n",
1536 info->line, info->count);
1537#endif
1538 if (!(tty_hung_up_p(filp)))
1539 port->count--;
1540 port->blocked_open++;
1541 while (1) {
1542 set_current_state(TASK_INTERRUPTIBLE);
1543 if (tty_hung_up_p(filp) ||
1544 !(port->flags & ASYNC_INITIALIZED)) {
1545#ifdef MODEM_DO_RESTART
1546 if (port->flags & ASYNC_HUP_NOTIFY)
1547 retval = -EAGAIN;
1548 else
1549 retval = -ERESTARTSYS;
1550#else
1551 retval = -EAGAIN;
1552#endif
1553 break;
1554 }
1555 if (!(port->flags & ASYNC_CLOSING) &&
1556 (do_clocal || tty_port_carrier_raised(port))) {
1557 break;
1558 }
1559 if (signal_pending(current)) {
1560 retval = -ERESTARTSYS;
1561 break;
1562 }
1563#ifdef ISDN_DEBUG_MODEM_OPEN
1564 printk(KERN_DEBUG "isdn_tty_block_til_ready blocking: ttyi%d, count = %d\n",
1565 info->line, port->count);
1566#endif
1567 schedule();
1568 }
1569 current->state = TASK_RUNNING;
1570 remove_wait_queue(&port->open_wait, &wait);
1571 if (!tty_hung_up_p(filp))
1572 port->count++;
1573 port->blocked_open--;
1574#ifdef ISDN_DEBUG_MODEM_OPEN
1575 printk(KERN_DEBUG "isdn_tty_block_til_ready after blocking: ttyi%d, count = %d\n",
1576 info->line, port->count);
1577#endif
1578 if (retval)
1579 return retval;
1580 port->flags |= ASYNC_NORMAL_ACTIVE;
1581 return 0;
1582}
1583
1584/* 1489/*
1585 * This routine is called whenever a serial port is opened. It 1490 * This routine is called whenever a serial port is opened. It
1586 * enables interrupts for a serial port, linking in its async structure into 1491 * enables interrupts for a serial port, linking in its async structure into
@@ -1616,7 +1521,7 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
1616#endif 1521#endif
1617 return retval; 1522 return retval;
1618 } 1523 }
1619 retval = isdn_tty_block_til_ready(tty, filp, info); 1524 retval = tty_port_block_til_ready(port, tty, filp);
1620 if (retval) { 1525 if (retval) {
1621#ifdef ISDN_DEBUG_MODEM_OPEN 1526#ifdef ISDN_DEBUG_MODEM_OPEN
1622 printk(KERN_DEBUG "isdn_tty_open return after isdn_tty_block_til_ready \n"); 1527 printk(KERN_DEBUG "isdn_tty_open return after isdn_tty_block_til_ready \n");