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/pcmcia/synclink_cs.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/pcmcia/synclink_cs.c')
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 19d79fc54461..77b364889224 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -383,7 +383,7 @@ static void async_mode(MGSLPC_INFO *info); | |||
383 | static void tx_timeout(unsigned long context); | 383 | static void tx_timeout(unsigned long context); |
384 | 384 | ||
385 | static int carrier_raised(struct tty_port *port); | 385 | static int carrier_raised(struct tty_port *port); |
386 | static void raise_dtr_rts(struct tty_port *port); | 386 | static void dtr_rts(struct tty_port *port, int onoff); |
387 | 387 | ||
388 | #if SYNCLINK_GENERIC_HDLC | 388 | #if SYNCLINK_GENERIC_HDLC |
389 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) | 389 | #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
@@ -513,7 +513,7 @@ static void ldisc_receive_buf(struct tty_struct *tty, | |||
513 | 513 | ||
514 | static const struct tty_port_operations mgslpc_port_ops = { | 514 | static const struct tty_port_operations mgslpc_port_ops = { |
515 | .carrier_raised = carrier_raised, | 515 | .carrier_raised = carrier_raised, |
516 | .raise_dtr_rts = raise_dtr_rts | 516 | .dtr_rts = dtr_rts |
517 | }; | 517 | }; |
518 | 518 | ||
519 | static int mgslpc_probe(struct pcmcia_device *link) | 519 | static int mgslpc_probe(struct pcmcia_device *link) |
@@ -2528,13 +2528,16 @@ static int carrier_raised(struct tty_port *port) | |||
2528 | return 0; | 2528 | return 0; |
2529 | } | 2529 | } |
2530 | 2530 | ||
2531 | static void raise_dtr_rts(struct tty_port *port) | 2531 | static void dtr_rts(struct tty_port *port, int onoff) |
2532 | { | 2532 | { |
2533 | MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); | 2533 | MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); |
2534 | unsigned long flags; | 2534 | unsigned long flags; |
2535 | 2535 | ||
2536 | spin_lock_irqsave(&info->lock,flags); | 2536 | spin_lock_irqsave(&info->lock,flags); |
2537 | info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; | 2537 | if (onoff) |
2538 | info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; | ||
2539 | else | ||
2540 | info->serial_signals &= ~SerialSignal_RTS + SerialSignal_DTR; | ||
2538 | set_signals(info); | 2541 | set_signals(info); |
2539 | spin_unlock_irqrestore(&info->lock,flags); | 2542 | spin_unlock_irqrestore(&info->lock,flags); |
2540 | } | 2543 | } |