Commit b70526a6 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] callout removal: ircomm_tty

callout removal: ircomm_tty
parent 9fc6726f
......@@ -93,7 +93,6 @@ struct ircomm_tty_cb {
void *ckey;
struct termios normal_termios;
struct termios callout_termios;
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
......@@ -103,8 +102,6 @@ struct ircomm_tty_cb {
unsigned short close_delay;
unsigned short closing_wait; /* time to wait before closing */
long session; /* Session of opening process */
long pgrp; /* pgrp of opening process */
int open_count;
int blocked_open; /* # of blocked opens */
......
......@@ -248,49 +248,21 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
tty = self->tty;
if (tty->driver->subtype == SERIAL_TYPE_CALLOUT) {
/* this is a callout device */
/* just verify that normal device is not in use */
if (self->flags & ASYNC_NORMAL_ACTIVE)
return -EBUSY;
if ((self->flags & ASYNC_CALLOUT_ACTIVE) &&
(self->flags & ASYNC_SESSION_LOCKOUT) &&
(self->session != current->session))
return -EBUSY;
if ((self->flags & ASYNC_CALLOUT_ACTIVE) &&
(self->flags & ASYNC_PGRP_LOCKOUT) &&
(self->pgrp != current->pgrp))
return -EBUSY;
self->flags |= ASYNC_CALLOUT_ACTIVE;
return 0;
}
/*
* If non-blocking mode is set, or the port is not enabled,
* then make the check up front and then exit.
*/
if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){
/* nonblock mode is set or port is not enabled */
/* just verify that callout device is not active */
if (self->flags & ASYNC_CALLOUT_ACTIVE)
return -EBUSY;
self->flags |= ASYNC_NORMAL_ACTIVE;
IRDA_DEBUG(1, "%s(), O_NONBLOCK requested!\n", __FUNCTION__ );
return 0;
}
if (self->flags & ASYNC_CALLOUT_ACTIVE) {
if (self->normal_termios.c_cflag & CLOCAL) {
IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __FUNCTION__ );
do_clocal = 1;
}
} else {
if (tty->termios->c_cflag & CLOCAL) {
IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __FUNCTION__ );
do_clocal = 1;
}
}
/* Wait for carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
......@@ -315,8 +287,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
self->blocked_open++;
while (1) {
if (!(self->flags & ASYNC_CALLOUT_ACTIVE) &&
(tty->termios->c_cflag & CBAUD)) {
if (tty->termios->c_cflag & CBAUD) {
/* Here, we use to lock those two guys, but
* as ircomm_param_request() does it itself,
* I don't see the point (and I see the deadlock).
......@@ -339,8 +310,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
* specified, we cannot return before the IrCOMM link is
* ready
*/
if (!(self->flags & ASYNC_CALLOUT_ACTIVE) &&
!(self->flags & ASYNC_CLOSING) &&
if (!(self->flags & ASYNC_CLOSING) &&
(do_clocal || (self->settings.dce & IRCOMM_CD)) &&
self->state == IRCOMM_TTY_READY)
{
......@@ -509,10 +479,6 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
return ret;
}
self->session = current->session;
self->pgrp = current->pgrp;
return 0;
}
......@@ -605,8 +571,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
wake_up_interruptible(&self->open_wait);
}
self->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE|
ASYNC_CLOSING);
self->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&self->close_wait);
MOD_DEC_USE_COUNT;
......@@ -1054,7 +1019,7 @@ static void ircomm_tty_hangup(struct tty_struct *tty)
/* I guess we need to lock here - Jean II */
spin_lock_irqsave(&self->spinlock, flags);
self->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE);
self->flags &= ~ASYNC_NORMAL_ACTIVE;
self->tty = 0;
self->open_count = 0;
spin_unlock_irqrestore(&self->spinlock, flags);
......@@ -1133,9 +1098,7 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self)
if (status & IRCOMM_CD) {
wake_up_interruptible(&self->open_wait);
} else if (!((self->flags & ASYNC_CALLOUT_ACTIVE) &&
(self->flags & ASYNC_CALLOUT_NOHUP)))
{
} else {
IRDA_DEBUG(2,
"%s(), Doing serial hangup..\n", __FUNCTION__ );
if (tty)
......@@ -1364,8 +1327,6 @@ static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
ret += sprintf(buf+ret, "ASYNC_CLOSING|");
if (self->flags & ASYNC_NORMAL_ACTIVE)
ret += sprintf(buf+ret, "ASYNC_NORMAL_ACTIVE|");
if (self->flags & ASYNC_CALLOUT_ACTIVE)
ret += sprintf(buf+ret, "ASYNC_CALLOUT_ACTIVE|");
if (self->flags)
ret--; /* remove the last | */
ret += sprintf(buf+ret, "\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment