aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/serial/io_ti.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-02-20 21:38:32 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-24 21:16:39 -0700
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 63e044adc19..39d71fdb507 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
{
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
unsigned int mcr;
+ unsigned long flags;
dbg("%s - port %d", __FUNCTION__, port->number);
+ spin_lock_irqsave(&edge_port->ep_lock, flags);
mcr = edge_port->shadow_mcr;
if (set & TIOCM_RTS)
mcr |= MCR_RTS;
@@ -2578,6 +2580,7 @@ static int edge_tiocmset (struct usb_serial_port *port, struct file *file, unsig
mcr &= ~MCR_LOOPBACK;
edge_port->shadow_mcr = mcr;
+ spin_unlock_irqrestore(&edge_port->ep_lock, flags);
TIRestoreMCR (edge_port, mcr);
@@ -2590,9 +2593,12 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file)
unsigned int result = 0;
unsigned int msr;
unsigned int mcr;
+ unsigned long flags;
dbg("%s - port %d", __FUNCTION__, port->number);
+ spin_lock_irqsave(&edge_port->ep_lock, flags);
+
msr = edge_port->shadow_msr;
mcr = edge_port->shadow_mcr;
result = ((mcr & MCR_DTR) ? TIOCM_DTR: 0) /* 0x002 */
@@ -2604,6 +2610,7 @@ static int edge_tiocmget(struct usb_serial_port *port, struct file *file)
dbg("%s -- %x", __FUNCTION__, result);
+ spin_unlock_irqrestore(&edge_port->ep_lock, flags);
return result;
}