aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/synclink.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2009-06-11 07:24:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-11 11:50:56 -0400
commitfcc8ac1825d3d0fb81f73bc1a80ebc863168bb56 (patch)
tree737f7209430fd319ca257df62c9b1e64587d5a8b /drivers/char/synclink.c
parent65a29f60e121ae5116ac1736b50a237bf2db3225 (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.c')
-rw-r--r--drivers/char/synclink.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index afd0b26ca056..afded3a2379c 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -3247,13 +3247,16 @@ static int carrier_raised(struct tty_port *port)
3247 return (info->serial_signals & SerialSignal_DCD) ? 1 : 0; 3247 return (info->serial_signals & SerialSignal_DCD) ? 1 : 0;
3248} 3248}
3249 3249
3250static void raise_dtr_rts(struct tty_port *port) 3250static void dtr_rts(struct tty_port *port, int on)
3251{ 3251{
3252 struct mgsl_struct *info = container_of(port, struct mgsl_struct, port); 3252 struct mgsl_struct *info = container_of(port, struct mgsl_struct, port);
3253 unsigned long flags; 3253 unsigned long flags;
3254 3254
3255 spin_lock_irqsave(&info->irq_spinlock,flags); 3255 spin_lock_irqsave(&info->irq_spinlock,flags);
3256 info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; 3256 if (on)
3257 info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR;
3258 else
3259 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
3257 usc_set_serial_signals(info); 3260 usc_set_serial_signals(info);
3258 spin_unlock_irqrestore(&info->irq_spinlock,flags); 3261 spin_unlock_irqrestore(&info->irq_spinlock,flags);
3259} 3262}
@@ -4258,7 +4261,7 @@ static void mgsl_add_device( struct mgsl_struct *info )
4258 4261
4259static const struct tty_port_operations mgsl_port_ops = { 4262static const struct tty_port_operations mgsl_port_ops = {
4260 .carrier_raised = carrier_raised, 4263 .carrier_raised = carrier_raised,
4261 .raise_dtr_rts = raise_dtr_rts, 4264 .dtr_rts = dtr_rts,
4262}; 4265};
4263 4266
4264 4267