Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325577
b: refs/heads/master
c: 0ba9ff8
h: refs/heads/master
i:
  325575: 11a3bf9
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Jun 12, 2012
1 parent 2bd0d17 commit 123a72b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 38c58032f07be4dee764baa573b233e9a828c119
refs/heads/master: 0ba9ff846b2f4720e30ace37b028ef14fb97fb74
43 changes: 33 additions & 10 deletions trunk/net/irda/ircomm/ircomm_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,35 @@ static const struct tty_operations ops = {
#endif /* CONFIG_PROC_FS */
};

static void ircomm_port_raise_dtr_rts(struct tty_port *port, int raise)
{
struct ircomm_tty_cb *self = container_of(port, struct ircomm_tty_cb,
port);
/*
* 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).
* Jean II
*/
if (raise)
self->settings.dte |= IRCOMM_RTS | IRCOMM_DTR;
else
self->settings.dte &= ~(IRCOMM_RTS | IRCOMM_DTR);

ircomm_param_request(self, IRCOMM_DTE, TRUE);
}

static int ircomm_port_carrier_raised(struct tty_port *port)
{
struct ircomm_tty_cb *self = container_of(port, struct ircomm_tty_cb,
port);
return self->settings.dce & IRCOMM_CD;
}

static const struct tty_port_operations ircomm_port_ops = {
.dtr_rts = ircomm_port_raise_dtr_rts,
.carrier_raised = ircomm_port_carrier_raised,
};

/*
* Function ircomm_tty_init()
*
Expand Down Expand Up @@ -290,15 +319,8 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
port->blocked_open++;

while (1) {
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).
* Jean II */
self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR;

ircomm_param_request(self, IRCOMM_DTE, TRUE);
}
if (tty->termios->c_cflag & CBAUD)
tty_port_raise_dtr_rts(port);

current->state = TASK_INTERRUPTIBLE;

Expand All @@ -315,7 +337,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
* ready
*/
if (!test_bit(ASYNCB_CLOSING, &port->flags) &&
(do_clocal || (self->settings.dce & IRCOMM_CD)) &&
(do_clocal || tty_port_carrier_raised(port)) &&
self->state == IRCOMM_TTY_READY)
{
break;
Expand Down Expand Up @@ -379,6 +401,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
}

tty_port_init(&self->port);
self->port.ops = &ircomm_port_ops;
self->magic = IRCOMM_TTY_MAGIC;
self->flow = FLOW_STOP;

Expand Down

0 comments on commit 123a72b

Please sign in to comment.