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/synclink_gt.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/synclink_gt.c')
-rw-r--r-- | drivers/char/synclink_gt.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 5e256494686a..67986ea0d479 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -3099,13 +3099,16 @@ static int carrier_raised(struct tty_port *port) | |||
3099 | return (info->signals & SerialSignal_DCD) ? 1 : 0; | 3099 | return (info->signals & SerialSignal_DCD) ? 1 : 0; |
3100 | } | 3100 | } |
3101 | 3101 | ||
3102 | static void raise_dtr_rts(struct tty_port *port) | 3102 | static void dtr_rts(struct tty_port *port, int on) |
3103 | { | 3103 | { |
3104 | unsigned long flags; | 3104 | unsigned long flags; |
3105 | struct slgt_info *info = container_of(port, struct slgt_info, port); | 3105 | struct slgt_info *info = container_of(port, struct slgt_info, port); |
3106 | 3106 | ||
3107 | spin_lock_irqsave(&info->lock,flags); | 3107 | spin_lock_irqsave(&info->lock,flags); |
3108 | info->signals |= SerialSignal_RTS + SerialSignal_DTR; | 3108 | if (on) |
3109 | info->signals |= SerialSignal_RTS + SerialSignal_DTR; | ||
3110 | else | ||
3111 | info->signals &= ~(SerialSignal_RTS + SerialSignal_DTR); | ||
3109 | set_signals(info); | 3112 | set_signals(info); |
3110 | spin_unlock_irqrestore(&info->lock,flags); | 3113 | spin_unlock_irqrestore(&info->lock,flags); |
3111 | } | 3114 | } |
@@ -3419,7 +3422,7 @@ static void add_device(struct slgt_info *info) | |||
3419 | 3422 | ||
3420 | static const struct tty_port_operations slgt_port_ops = { | 3423 | static const struct tty_port_operations slgt_port_ops = { |
3421 | .carrier_raised = carrier_raised, | 3424 | .carrier_raised = carrier_raised, |
3422 | .raise_dtr_rts = raise_dtr_rts, | 3425 | .dtr_rts = dtr_rts, |
3423 | }; | 3426 | }; |
3424 | 3427 | ||
3425 | /* | 3428 | /* |