diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2009-06-11 07:24:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 11:50:56 -0400 |
commit | fcc8ac1825d3d0fb81f73bc1a80ebc863168bb56 (patch) | |
tree | 737f7209430fd319ca257df62c9b1e64587d5a8b /drivers/char/mxser.c | |
parent | 65a29f60e121ae5116ac1736b50a237bf2db3225 (diff) |
tty: Add carrier processing on close to the tty_port core
Some drivers implement this internally, others miss it out. Push the
behaviour into the core code as that way everyone will do it consistently.
Update the dtr rts method to raise or lower depending upon flags. Having a
single method in this style fits most of the implementations more cleanly than
two funtions.
We need this in place before we tackle the USB side
Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/mxser.c')
-rw-r--r-- | drivers/char/mxser.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 13f8871e5b21..9533f43a30bb 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -547,14 +547,18 @@ 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) | 550 | static void mxser_dtr_rts(struct tty_port *port, int on) |
551 | { | 551 | { |
552 | struct mxser_port *mp = container_of(port, struct mxser_port, port); | 552 | struct mxser_port *mp = container_of(port, struct mxser_port, port); |
553 | unsigned long flags; | 553 | unsigned long flags; |
554 | 554 | ||
555 | spin_lock_irqsave(&mp->slock, flags); | 555 | spin_lock_irqsave(&mp->slock, flags); |
556 | outb(inb(mp->ioaddr + UART_MCR) | | 556 | if (on) |
557 | UART_MCR_DTR | UART_MCR_RTS, mp->ioaddr + UART_MCR); | 557 | outb(inb(mp->ioaddr + UART_MCR) | |
558 | UART_MCR_DTR | UART_MCR_RTS, mp->ioaddr + UART_MCR); | ||
559 | else | ||
560 | outb(inb(mp->ioaddr + UART_MCR)&~(UART_MCR_DTR | UART_MCR_RTS), | ||
561 | mp->ioaddr + UART_MCR); | ||
558 | spin_unlock_irqrestore(&mp->slock, flags); | 562 | spin_unlock_irqrestore(&mp->slock, flags); |
559 | } | 563 | } |
560 | 564 | ||
@@ -2356,7 +2360,7 @@ static const struct tty_operations mxser_ops = { | |||
2356 | 2360 | ||
2357 | struct tty_port_operations mxser_port_ops = { | 2361 | struct tty_port_operations mxser_port_ops = { |
2358 | .carrier_raised = mxser_carrier_raised, | 2362 | .carrier_raised = mxser_carrier_raised, |
2359 | .raise_dtr_rts = mxser_raise_dtr_rts, | 2363 | .dtr_rts = mxser_dtr_rts, |
2360 | }; | 2364 | }; |
2361 | 2365 | ||
2362 | /* | 2366 | /* |