diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-02-20 16:39:25 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-25 00:16:39 -0400 |
commit | 7b1fc8bc6d6881ff7f8876cbe665b3ad5271bc03 (patch) | |
tree | aa7828f20d8deae3de7b47630b915368e63bb1af /drivers/usb/serial/iuu_phoenix.c | |
parent | e298449401463dd18f24a87c48f9b0ec62bad936 (diff) |
USB: iuu_phoenix: lock priv->tiostatus properly
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/iuu_phoenix.c')
-rw-r--r-- | drivers/usb/serial/iuu_phoenix.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index fde188e23ce1..a09b9a85b16d 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -148,20 +148,21 @@ static int iuu_tiocmset(struct usb_serial_port *port, struct file *file, | |||
148 | unsigned int set, unsigned int clear) | 148 | unsigned int set, unsigned int clear) |
149 | { | 149 | { |
150 | struct iuu_private *priv = usb_get_serial_port_data(port); | 150 | struct iuu_private *priv = usb_get_serial_port_data(port); |
151 | struct tty_struct *tty; | 151 | unsigned long flags; |
152 | tty = port->tty; | ||
153 | 152 | ||
153 | /* FIXME: locking on tiomstatus */ | ||
154 | dbg("%s (%d) msg : SET = 0x%04x, CLEAR = 0x%04x ", __FUNCTION__, | 154 | dbg("%s (%d) msg : SET = 0x%04x, CLEAR = 0x%04x ", __FUNCTION__, |
155 | port->number, set, clear); | 155 | port->number, set, clear); |
156 | |||
157 | spin_lock_irqsave(&priv->lock, flags); | ||
156 | if (set & TIOCM_RTS) | 158 | if (set & TIOCM_RTS) |
157 | priv->tiostatus = TIOCM_RTS; | 159 | priv->tiostatus = TIOCM_RTS; |
158 | 160 | ||
159 | if (!(set & TIOCM_RTS) && priv->tiostatus == TIOCM_RTS) { | 161 | if (!(set & TIOCM_RTS) && priv->tiostatus == TIOCM_RTS) { |
160 | dbg("%s TIOCMSET RESET called !!!", __FUNCTION__); | 162 | dbg("%s TIOCMSET RESET called !!!", __FUNCTION__); |
161 | priv->reset = 1; | 163 | priv->reset = 1; |
162 | return 0; | ||
163 | } | 164 | } |
164 | 165 | spin_unlock_irqrestore(&priv->lock, flags); | |
165 | return 0; | 166 | return 0; |
166 | } | 167 | } |
167 | 168 | ||
@@ -173,7 +174,14 @@ static int iuu_tiocmset(struct usb_serial_port *port, struct file *file, | |||
173 | static int iuu_tiocmget(struct usb_serial_port *port, struct file *file) | 174 | static int iuu_tiocmget(struct usb_serial_port *port, struct file *file) |
174 | { | 175 | { |
175 | struct iuu_private *priv = usb_get_serial_port_data(port); | 176 | struct iuu_private *priv = usb_get_serial_port_data(port); |
176 | return priv->tiostatus; | 177 | unsigned long flags; |
178 | int rc; | ||
179 | |||
180 | spin_lock_irqsave(&priv->lock, flags); | ||
181 | rc = priv->tiostatus; | ||
182 | spin_unlock_irqrestore(&priv->lock, flags); | ||
183 | |||
184 | return rc; | ||
177 | } | 185 | } |
178 | 186 | ||
179 | static void iuu_rxcmd(struct urb *urb) | 187 | static void iuu_rxcmd(struct urb *urb) |