mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
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>
This commit is contained in:
parent
c6e92b63d7
commit
1b05f030a9
@ -1533,8 +1533,8 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
|
|||||||
info->line, info->count);
|
info->line, info->count);
|
||||||
#endif
|
#endif
|
||||||
if (!(tty_hung_up_p(filp)))
|
if (!(tty_hung_up_p(filp)))
|
||||||
info->count--;
|
info->port.count--;
|
||||||
info->blocked_open++;
|
info->port.blocked_open++;
|
||||||
while (1) {
|
while (1) {
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
if (tty_hung_up_p(filp) ||
|
if (tty_hung_up_p(filp) ||
|
||||||
@ -1559,18 +1559,18 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
|
|||||||
}
|
}
|
||||||
#ifdef ISDN_DEBUG_MODEM_OPEN
|
#ifdef ISDN_DEBUG_MODEM_OPEN
|
||||||
printk(KERN_DEBUG "isdn_tty_block_til_ready blocking: ttyi%d, count = %d\n",
|
printk(KERN_DEBUG "isdn_tty_block_til_ready blocking: ttyi%d, count = %d\n",
|
||||||
info->line, info->count);
|
info->line, info->port.count);
|
||||||
#endif
|
#endif
|
||||||
schedule();
|
schedule();
|
||||||
}
|
}
|
||||||
current->state = TASK_RUNNING;
|
current->state = TASK_RUNNING;
|
||||||
remove_wait_queue(&info->port.open_wait, &wait);
|
remove_wait_queue(&info->port.open_wait, &wait);
|
||||||
if (!tty_hung_up_p(filp))
|
if (!tty_hung_up_p(filp))
|
||||||
info->count++;
|
info->port.count++;
|
||||||
info->blocked_open--;
|
info->port.blocked_open--;
|
||||||
#ifdef ISDN_DEBUG_MODEM_OPEN
|
#ifdef ISDN_DEBUG_MODEM_OPEN
|
||||||
printk(KERN_DEBUG "isdn_tty_block_til_ready after blocking: ttyi%d, count = %d\n",
|
printk(KERN_DEBUG "isdn_tty_block_til_ready after blocking: ttyi%d, count = %d\n",
|
||||||
info->line, info->count);
|
info->line, info->port.count);
|
||||||
#endif
|
#endif
|
||||||
if (retval)
|
if (retval)
|
||||||
return retval;
|
return retval;
|
||||||
@ -1595,9 +1595,9 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
#ifdef ISDN_DEBUG_MODEM_OPEN
|
#ifdef ISDN_DEBUG_MODEM_OPEN
|
||||||
printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name,
|
printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name,
|
||||||
info->count);
|
info->port.count);
|
||||||
#endif
|
#endif
|
||||||
info->count++;
|
info->port.count++;
|
||||||
tty->driver_data = info;
|
tty->driver_data = info;
|
||||||
info->tty = tty;
|
info->tty = tty;
|
||||||
tty->port = &info->port;
|
tty->port = &info->port;
|
||||||
@ -1642,7 +1642,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
|
|||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((tty->count == 1) && (info->count != 1)) {
|
if ((tty->count == 1) && (info->port.count != 1)) {
|
||||||
/*
|
/*
|
||||||
* Uh, oh. tty->count is 1, which means that the tty
|
* Uh, oh. tty->count is 1, which means that the tty
|
||||||
* structure will be freed. Info->count should always
|
* structure will be freed. Info->count should always
|
||||||
@ -1651,15 +1651,15 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
|
|||||||
* serial port won't be shutdown.
|
* serial port won't be shutdown.
|
||||||
*/
|
*/
|
||||||
printk(KERN_ERR "isdn_tty_close: bad port count; tty->count is 1, "
|
printk(KERN_ERR "isdn_tty_close: bad port count; tty->count is 1, "
|
||||||
"info->count is %d\n", info->count);
|
"info->count is %d\n", info->port.count);
|
||||||
info->count = 1;
|
info->port.count = 1;
|
||||||
}
|
}
|
||||||
if (--info->count < 0) {
|
if (--info->port.count < 0) {
|
||||||
printk(KERN_ERR "isdn_tty_close: bad port count for ttyi%d: %d\n",
|
printk(KERN_ERR "isdn_tty_close: bad port count for ttyi%d: %d\n",
|
||||||
info->line, info->count);
|
info->line, info->port.count);
|
||||||
info->count = 0;
|
info->port.count = 0;
|
||||||
}
|
}
|
||||||
if (info->count) {
|
if (info->port.count) {
|
||||||
#ifdef ISDN_DEBUG_MODEM_OPEN
|
#ifdef ISDN_DEBUG_MODEM_OPEN
|
||||||
printk(KERN_DEBUG "isdn_tty_close after info->count != 0\n");
|
printk(KERN_DEBUG "isdn_tty_close after info->count != 0\n");
|
||||||
#endif
|
#endif
|
||||||
@ -1695,7 +1695,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
|
|||||||
info->tty = NULL;
|
info->tty = NULL;
|
||||||
info->ncarrier = 0;
|
info->ncarrier = 0;
|
||||||
tty->closing = 0;
|
tty->closing = 0;
|
||||||
if (info->blocked_open) {
|
if (info->port.blocked_open) {
|
||||||
msleep_interruptible(500);
|
msleep_interruptible(500);
|
||||||
wake_up_interruptible(&info->port.open_wait);
|
wake_up_interruptible(&info->port.open_wait);
|
||||||
}
|
}
|
||||||
@ -1717,7 +1717,7 @@ isdn_tty_hangup(struct tty_struct *tty)
|
|||||||
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_hangup"))
|
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_hangup"))
|
||||||
return;
|
return;
|
||||||
isdn_tty_shutdown(info);
|
isdn_tty_shutdown(info);
|
||||||
info->count = 0;
|
info->port.count = 0;
|
||||||
info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
|
info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
|
||||||
info->tty = NULL;
|
info->tty = NULL;
|
||||||
wake_up_interruptible(&info->port.open_wait);
|
wake_up_interruptible(&info->port.open_wait);
|
||||||
@ -1896,8 +1896,6 @@ isdn_tty_modem_init(void)
|
|||||||
info->line = i;
|
info->line = i;
|
||||||
info->tty = NULL;
|
info->tty = NULL;
|
||||||
info->x_char = 0;
|
info->x_char = 0;
|
||||||
info->count = 0;
|
|
||||||
info->blocked_open = 0;
|
|
||||||
info->isdn_driver = -1;
|
info->isdn_driver = -1;
|
||||||
info->isdn_channel = -1;
|
info->isdn_channel = -1;
|
||||||
info->drv_index = -1;
|
info->drv_index = -1;
|
||||||
@ -2047,7 +2045,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
|
|||||||
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
|
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
|
||||||
modem_info *info = &dev->mdm.info[i];
|
modem_info *info = &dev->mdm.info[i];
|
||||||
|
|
||||||
if (info->count == 0)
|
if (info->port.count == 0)
|
||||||
continue;
|
continue;
|
||||||
if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */
|
if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */
|
||||||
(info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */
|
(info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */
|
||||||
@ -2190,7 +2188,7 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
|
|||||||
* for incoming call of this device when
|
* for incoming call of this device when
|
||||||
* DCD follow the state of incoming carrier
|
* DCD follow the state of incoming carrier
|
||||||
*/
|
*/
|
||||||
if (info->blocked_open &&
|
if (info->port.blocked_open &&
|
||||||
(info->emu.mdmreg[REG_DCD] & BIT_DCD)) {
|
(info->emu.mdmreg[REG_DCD] & BIT_DCD)) {
|
||||||
wake_up_interruptible(&info->port.open_wait);
|
wake_up_interruptible(&info->port.open_wait);
|
||||||
}
|
}
|
||||||
@ -2200,7 +2198,8 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
|
|||||||
* set DCD-bit of its modem-status.
|
* set DCD-bit of its modem-status.
|
||||||
*/
|
*/
|
||||||
if (TTY_IS_ACTIVE(info) ||
|
if (TTY_IS_ACTIVE(info) ||
|
||||||
(info->blocked_open && (info->emu.mdmreg[REG_DCD] & BIT_DCD))) {
|
(info->port.blocked_open &&
|
||||||
|
(info->emu.mdmreg[REG_DCD] & BIT_DCD))) {
|
||||||
info->msr |= UART_MSR_DCD;
|
info->msr |= UART_MSR_DCD;
|
||||||
info->emu.charge = 0;
|
info->emu.charge = 0;
|
||||||
if (info->dialing & 0xf)
|
if (info->dialing & 0xf)
|
||||||
|
@ -442,8 +442,6 @@ typedef struct modem_info {
|
|||||||
int msr; /* Modem status register */
|
int msr; /* Modem status register */
|
||||||
int lsr; /* Line status register */
|
int lsr; /* Line status register */
|
||||||
int line;
|
int line;
|
||||||
int count; /* # of fd on device */
|
|
||||||
int blocked_open; /* # of blocked opens */
|
|
||||||
int online; /* 1 = B-Channel is up, drop data */
|
int online; /* 1 = B-Channel is up, drop data */
|
||||||
/* 2 = B-Channel is up, deliver d.*/
|
/* 2 = B-Channel is up, deliver d.*/
|
||||||
int dialing; /* Dial in progress or ATA */
|
int dialing; /* Dial in progress or ATA */
|
||||||
|
Loading…
Reference in New Issue
Block a user