diff options
author | Alan Cox <alan@redhat.com> | 2009-01-02 08:45:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-02 13:19:38 -0500 |
commit | 3e61696bdc2103107674b06d0daf30b76193e922 (patch) | |
tree | cc4f2b7b7b0ce2162613bb9d3cf819f6bbfd3628 /drivers/char/synclinkmp.c | |
parent | 5d951fb458f847e5485b5251597fbf326000bb3b (diff) |
isicom: redo locking to use tty port locks
This helps set the basis for moving block_til_ready into common code. We also
introduce a tty_port_hangup helper as this will also be generally needed.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/synclinkmp.c')
-rw-r--r-- | drivers/char/synclinkmp.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index fcf1ec77450d..1f5c21ec4b14 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -3331,6 +3331,17 @@ static int carrier_raised(struct tty_port *port) | |||
3331 | return (info->serial_signals & SerialSignal_DCD) ? 1 : 0; | 3331 | return (info->serial_signals & SerialSignal_DCD) ? 1 : 0; |
3332 | } | 3332 | } |
3333 | 3333 | ||
3334 | static void raise_dtr_rts(struct tty_port *port) | ||
3335 | { | ||
3336 | SLMP_INFO *info = container_of(port, SLMP_INFO, port); | ||
3337 | unsigned long flags; | ||
3338 | |||
3339 | spin_lock_irqsave(&info->lock,flags); | ||
3340 | info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; | ||
3341 | set_signals(info); | ||
3342 | spin_unlock_irqrestore(&info->lock,flags); | ||
3343 | } | ||
3344 | |||
3334 | /* Block the current process until the specified port is ready to open. | 3345 | /* Block the current process until the specified port is ready to open. |
3335 | */ | 3346 | */ |
3336 | static int block_til_ready(struct tty_struct *tty, struct file *filp, | 3347 | static int block_til_ready(struct tty_struct *tty, struct file *filp, |
@@ -3381,12 +3392,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3381 | port->blocked_open++; | 3392 | port->blocked_open++; |
3382 | 3393 | ||
3383 | while (1) { | 3394 | while (1) { |
3384 | if ((tty->termios->c_cflag & CBAUD)) { | 3395 | if (tty->termios->c_cflag & CBAUD) |
3385 | spin_lock_irqsave(&info->lock,flags); | 3396 | tty_port_raise_dtr_rts(port); |
3386 | info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR; | ||
3387 | set_signals(info); | ||
3388 | spin_unlock_irqrestore(&info->lock,flags); | ||
3389 | } | ||
3390 | 3397 | ||
3391 | set_current_state(TASK_INTERRUPTIBLE); | 3398 | set_current_state(TASK_INTERRUPTIBLE); |
3392 | 3399 | ||
@@ -3793,6 +3800,7 @@ static void add_device(SLMP_INFO *info) | |||
3793 | 3800 | ||
3794 | static const struct tty_port_operations port_ops = { | 3801 | static const struct tty_port_operations port_ops = { |
3795 | .carrier_raised = carrier_raised, | 3802 | .carrier_raised = carrier_raised, |
3803 | .raise_dtr_rts = raise_dtr_rts, | ||
3796 | }; | 3804 | }; |
3797 | 3805 | ||
3798 | /* Allocate and initialize a device instance structure | 3806 | /* Allocate and initialize a device instance structure |