diff options
author | Alan Cox <alan@redhat.com> | 2009-01-02 08:45:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-02 13:19:38 -0500 |
commit | 5d951fb458f847e5485b5251597fbf326000bb3b (patch) | |
tree | f668a015282f657f258995a1e5a85e145ca8251a /drivers/char/mxser.c | |
parent | d0c9873addc1f18e7becb50094dad07df8cc4694 (diff) |
tty: Pull the dtr raise into tty port
This moves another per device special out of what should be shared open
wait paths into private methods
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/mxser.c')
-rw-r--r-- | drivers/char/mxser.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index eafbbcf355e..ff5ff618880 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -547,6 +547,17 @@ static int mxser_carrier_raised(struct tty_port *port) | |||
547 | return (inb(mp->ioaddr + UART_MSR) & UART_MSR_DCD)?1:0; | 547 | return (inb(mp->ioaddr + UART_MSR) & UART_MSR_DCD)?1:0; |
548 | } | 548 | } |
549 | 549 | ||
550 | static void mxser_raise_dtr_rts(struct tty_port *port) | ||
551 | { | ||
552 | struct mxser_port *mp = container_of(port, struct mxser_port, port); | ||
553 | unsigned long flags; | ||
554 | |||
555 | spin_lock_irqsave(&mp->slock, flags); | ||
556 | outb(inb(mp->ioaddr + UART_MCR) | | ||
557 | UART_MCR_DTR | UART_MCR_RTS, mp->ioaddr + UART_MCR); | ||
558 | spin_unlock_irqrestore(&mp->slock, flags); | ||
559 | } | ||
560 | |||
550 | static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, | 561 | static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, |
551 | struct mxser_port *mp) | 562 | struct mxser_port *mp) |
552 | { | 563 | { |
@@ -586,10 +597,7 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, | |||
586 | spin_unlock_irqrestore(&mp->slock, flags); | 597 | spin_unlock_irqrestore(&mp->slock, flags); |
587 | port->blocked_open++; | 598 | port->blocked_open++; |
588 | while (1) { | 599 | while (1) { |
589 | spin_lock_irqsave(&mp->slock, flags); | 600 | tty_port_raise_dtr_rts(port); |
590 | outb(inb(mp->ioaddr + UART_MCR) | | ||
591 | UART_MCR_DTR | UART_MCR_RTS, mp->ioaddr + UART_MCR); | ||
592 | spin_unlock_irqrestore(&mp->slock, flags); | ||
593 | set_current_state(TASK_INTERRUPTIBLE); | 601 | set_current_state(TASK_INTERRUPTIBLE); |
594 | if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { | 602 | if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { |
595 | if (port->flags & ASYNC_HUP_NOTIFY) | 603 | if (port->flags & ASYNC_HUP_NOTIFY) |
@@ -2458,6 +2466,7 @@ static const struct tty_operations mxser_ops = { | |||
2458 | 2466 | ||
2459 | struct tty_port_operations mxser_port_ops = { | 2467 | struct tty_port_operations mxser_port_ops = { |
2460 | .carrier_raised = mxser_carrier_raised, | 2468 | .carrier_raised = mxser_carrier_raised, |
2469 | .raise_dtr_rts = mxser_raise_dtr_rts, | ||
2461 | }; | 2470 | }; |
2462 | 2471 | ||
2463 | /* | 2472 | /* |