diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-04-02 07:53:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-09 14:16:55 -0400 |
commit | 1b05f030a90569d9617d0fe42910f9e5c8cc59ec (patch) | |
tree | 0c265ac6642d589bb30b947a00bb684af37c4e1e /drivers/isdn | |
parent | c6e92b63d711c12ffb47f4dbb53902b7f26032e7 (diff) |
TTY: isdn, use counts from tty_port
blocked_open and count this time.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/i4l/isdn_tty.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 33764d052e19..c81a725fde74 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -1533,8 +1533,8 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info * | |||
1533 | info->line, info->count); | 1533 | info->line, info->count); |
1534 | #endif | 1534 | #endif |
1535 | if (!(tty_hung_up_p(filp))) | 1535 | if (!(tty_hung_up_p(filp))) |
1536 | info->count--; | 1536 | info->port.count--; |
1537 | info->blocked_open++; | 1537 | info->port.blocked_open++; |
1538 | while (1) { | 1538 | while (1) { |
1539 | set_current_state(TASK_INTERRUPTIBLE); | 1539 | set_current_state(TASK_INTERRUPTIBLE); |
1540 | if (tty_hung_up_p(filp) || | 1540 | if (tty_hung_up_p(filp) || |
@@ -1559,18 +1559,18 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info * | |||
1559 | } | 1559 | } |
1560 | #ifdef ISDN_DEBUG_MODEM_OPEN | 1560 | #ifdef ISDN_DEBUG_MODEM_OPEN |
1561 | printk(KERN_DEBUG "isdn_tty_block_til_ready blocking: ttyi%d, count = %d\n", | 1561 | printk(KERN_DEBUG "isdn_tty_block_til_ready blocking: ttyi%d, count = %d\n", |
1562 | info->line, info->count); | 1562 | info->line, info->port.count); |
1563 | #endif | 1563 | #endif |
1564 | schedule(); | 1564 | schedule(); |
1565 | } | 1565 | } |
1566 | current->state = TASK_RUNNING; | 1566 | current->state = TASK_RUNNING; |
1567 | remove_wait_queue(&info->port.open_wait, &wait); | 1567 | remove_wait_queue(&info->port.open_wait, &wait); |
1568 | if (!tty_hung_up_p(filp)) | 1568 | if (!tty_hung_up_p(filp)) |
1569 | info->count++; | 1569 | info->port.count++; |
1570 | info->blocked_open--; | 1570 | info->port.blocked_open--; |
1571 | #ifdef ISDN_DEBUG_MODEM_OPEN | 1571 | #ifdef ISDN_DEBUG_MODEM_OPEN |
1572 | printk(KERN_DEBUG "isdn_tty_block_til_ready after blocking: ttyi%d, count = %d\n", | 1572 | printk(KERN_DEBUG "isdn_tty_block_til_ready after blocking: ttyi%d, count = %d\n", |
1573 | info->line, info->count); | 1573 | info->line, info->port.count); |
1574 | #endif | 1574 | #endif |
1575 | if (retval) | 1575 | if (retval) |
1576 | return retval; | 1576 | return retval; |
@@ -1595,9 +1595,9 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp) | |||
1595 | return -ENODEV; | 1595 | return -ENODEV; |
1596 | #ifdef ISDN_DEBUG_MODEM_OPEN | 1596 | #ifdef ISDN_DEBUG_MODEM_OPEN |
1597 | printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name, | 1597 | printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name, |
1598 | info->count); | 1598 | info->port.count); |
1599 | #endif | 1599 | #endif |
1600 | info->count++; | 1600 | info->port.count++; |
1601 | tty->driver_data = info; | 1601 | tty->driver_data = info; |
1602 | info->tty = tty; | 1602 | info->tty = tty; |
1603 | tty->port = &info->port; | 1603 | tty->port = &info->port; |
@@ -1642,7 +1642,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp) | |||
1642 | #endif | 1642 | #endif |
1643 | return; | 1643 | return; |
1644 | } | 1644 | } |
1645 | if ((tty->count == 1) && (info->count != 1)) { | 1645 | if ((tty->count == 1) && (info->port.count != 1)) { |
1646 | /* | 1646 | /* |
1647 | * Uh, oh. tty->count is 1, which means that the tty | 1647 | * Uh, oh. tty->count is 1, which means that the tty |
1648 | * structure will be freed. Info->count should always | 1648 | * structure will be freed. Info->count should always |
@@ -1651,15 +1651,15 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp) | |||
1651 | * serial port won't be shutdown. | 1651 | * serial port won't be shutdown. |
1652 | */ | 1652 | */ |
1653 | printk(KERN_ERR "isdn_tty_close: bad port count; tty->count is 1, " | 1653 | printk(KERN_ERR "isdn_tty_close: bad port count; tty->count is 1, " |
1654 | "info->count is %d\n", info->count); | 1654 | "info->count is %d\n", info->port.count); |
1655 | info->count = 1; | 1655 | info->port.count = 1; |
1656 | } | 1656 | } |
1657 | if (--info->count < 0) { | 1657 | if (--info->port.count < 0) { |
1658 | printk(KERN_ERR "isdn_tty_close: bad port count for ttyi%d: %d\n", | 1658 | printk(KERN_ERR "isdn_tty_close: bad port count for ttyi%d: %d\n", |
1659 | info->line, info->count); | 1659 | info->line, info->port.count); |
1660 | info->count = 0; | 1660 | info->port.count = 0; |
1661 | } | 1661 | } |
1662 | if (info->count) { | 1662 | if (info->port.count) { |
1663 | #ifdef ISDN_DEBUG_MODEM_OPEN | 1663 | #ifdef ISDN_DEBUG_MODEM_OPEN |
1664 | printk(KERN_DEBUG "isdn_tty_close after info->count != 0\n"); | 1664 | printk(KERN_DEBUG "isdn_tty_close after info->count != 0\n"); |
1665 | #endif | 1665 | #endif |
@@ -1695,7 +1695,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp) | |||
1695 | info->tty = NULL; | 1695 | info->tty = NULL; |
1696 | info->ncarrier = 0; | 1696 | info->ncarrier = 0; |
1697 | tty->closing = 0; | 1697 | tty->closing = 0; |
1698 | if (info->blocked_open) { | 1698 | if (info->port.blocked_open) { |
1699 | msleep_interruptible(500); | 1699 | msleep_interruptible(500); |
1700 | wake_up_interruptible(&info->port.open_wait); | 1700 | wake_up_interruptible(&info->port.open_wait); |
1701 | } | 1701 | } |
@@ -1717,7 +1717,7 @@ isdn_tty_hangup(struct tty_struct *tty) | |||
1717 | if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_hangup")) | 1717 | if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_hangup")) |
1718 | return; | 1718 | return; |
1719 | isdn_tty_shutdown(info); | 1719 | isdn_tty_shutdown(info); |
1720 | info->count = 0; | 1720 | info->port.count = 0; |
1721 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; | 1721 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
1722 | info->tty = NULL; | 1722 | info->tty = NULL; |
1723 | wake_up_interruptible(&info->port.open_wait); | 1723 | wake_up_interruptible(&info->port.open_wait); |
@@ -1896,8 +1896,6 @@ isdn_tty_modem_init(void) | |||
1896 | info->line = i; | 1896 | info->line = i; |
1897 | info->tty = NULL; | 1897 | info->tty = NULL; |
1898 | info->x_char = 0; | 1898 | info->x_char = 0; |
1899 | info->count = 0; | ||
1900 | info->blocked_open = 0; | ||
1901 | info->isdn_driver = -1; | 1899 | info->isdn_driver = -1; |
1902 | info->isdn_channel = -1; | 1900 | info->isdn_channel = -1; |
1903 | info->drv_index = -1; | 1901 | info->drv_index = -1; |
@@ -2047,7 +2045,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup) | |||
2047 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) { | 2045 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) { |
2048 | modem_info *info = &dev->mdm.info[i]; | 2046 | modem_info *info = &dev->mdm.info[i]; |
2049 | 2047 | ||
2050 | if (info->count == 0) | 2048 | if (info->port.count == 0) |
2051 | continue; | 2049 | continue; |
2052 | if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */ | 2050 | if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */ |
2053 | (info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */ | 2051 | (info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */ |
@@ -2190,7 +2188,7 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c) | |||
2190 | * for incoming call of this device when | 2188 | * for incoming call of this device when |
2191 | * DCD follow the state of incoming carrier | 2189 | * DCD follow the state of incoming carrier |
2192 | */ | 2190 | */ |
2193 | if (info->blocked_open && | 2191 | if (info->port.blocked_open && |
2194 | (info->emu.mdmreg[REG_DCD] & BIT_DCD)) { | 2192 | (info->emu.mdmreg[REG_DCD] & BIT_DCD)) { |
2195 | wake_up_interruptible(&info->port.open_wait); | 2193 | wake_up_interruptible(&info->port.open_wait); |
2196 | } | 2194 | } |
@@ -2200,7 +2198,8 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c) | |||
2200 | * set DCD-bit of its modem-status. | 2198 | * set DCD-bit of its modem-status. |
2201 | */ | 2199 | */ |
2202 | if (TTY_IS_ACTIVE(info) || | 2200 | if (TTY_IS_ACTIVE(info) || |
2203 | (info->blocked_open && (info->emu.mdmreg[REG_DCD] & BIT_DCD))) { | 2201 | (info->port.blocked_open && |
2202 | (info->emu.mdmreg[REG_DCD] & BIT_DCD))) { | ||
2204 | info->msr |= UART_MSR_DCD; | 2203 | info->msr |= UART_MSR_DCD; |
2205 | info->emu.charge = 0; | 2204 | info->emu.charge = 0; |
2206 | if (info->dialing & 0xf) | 2205 | if (info->dialing & 0xf) |