aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_ti.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-02-20 16:38:32 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-25 00:16:39 -0400
commit3d71fe0bb29a3fbffdbe69dd0696927b6a23dd4e (patch)
treeb7be283010b7e3060c8a5b503565eaaa5b27d90b /drivers/usb/serial/io_ti.c
parent04ca89d4948ad4b6ec3b33e9588ae1885643148c (diff)
USB: io_ti: lock mcr and msr shadows properly
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r--drivers/usb/serial/io_ti.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 63e044adc19a..39d71fdb5071 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2559,9 +2559,11 @@ static int edge_tiocmset (struct usb_serial_port *port, struct file *file, unsig
2559{ 2559{
2560 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 2560 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2561 unsigned int mcr; 2561 unsigned int mcr;
2562 unsigned long flags;
2562 2563
2563 dbg("%s - port %d", __FUNCTION__, port->number); 2564 dbg("%s - port %d", __FUNCTION__, port->number);
2564 2565
2566 spin_lock_irqsave(&edge_port->ep_lock, flags);
2565 mcr = edge_port->shadow_mcr; 2567 mcr = edge_port->shadow_mcr;
2566 if (set & TIOCM_RTS) 2568 if (set & TIOCM_RTS)
2567 mcr |= MCR_RTS; 2569 mcr |= MCR_RTS;
@@ -2578,6 +2580,7 @@ static int edge_tiocmset (struct usb_serial_port *port, struct file *file, unsig
2578 mcr &= ~MCR_LOOPBACK; 2580 mcr &= ~MCR_LOOPBACK;
2579 2581
2580 edge_port->shadow_mcr = mcr; 2582 edge_port->shadow_mcr = mcr;
2583 spin_unlock_irqrestore(&edge_port->ep_lock, flags);
2581 2584
2582 TIRestoreMCR (edge_port, mcr); 2585 TIRestoreMCR (edge_port, mcr);
2583 2586
@@ -2590,9 +2593,12 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file)
2590 unsigned int result = 0; 2593 unsigned int result = 0;
2591 unsigned int msr; 2594 unsigned int msr;
2592 unsigned int mcr; 2595 unsigned int mcr;
2596 unsigned long flags;
2593 2597
2594 dbg("%s - port %d", __FUNCTION__, port->number); 2598 dbg("%s - port %d", __FUNCTION__, port->number);
2595 2599
2600 spin_lock_irqsave(&edge_port->ep_lock, flags);
2601
2596 msr = edge_port->shadow_msr; 2602 msr = edge_port->shadow_msr;
2597 mcr = edge_port->shadow_mcr; 2603 mcr = edge_port->shadow_mcr;
2598 result = ((mcr & MCR_DTR) ? TIOCM_DTR: 0) /* 0x002 */ 2604 result = ((mcr & MCR_DTR) ? TIOCM_DTR: 0) /* 0x002 */
@@ -2604,6 +2610,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file)
2604 2610
2605 2611
2606 dbg("%s -- %x", __FUNCTION__, result); 2612 dbg("%s -- %x", __FUNCTION__, result);
2613 spin_unlock_irqrestore(&edge_port->ep_lock, flags);
2607 2614
2608 return result; 2615 return result;
2609} 2616}