diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-12-29 13:22:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-03 15:31:47 -0500 |
commit | c50db82dcacfb4f6ab272f98ba964076b3ca529c (patch) | |
tree | b949f2c68fc76c4502f20f532446745097c9ea9e | |
parent | 49fabf29869c9c21f4d7243fa5b2b9ebc3890a85 (diff) |
USB: f81232: switch to generic tiocmiwait
Switch to generic tiocmiwait rather than rely on a custom implementation
using racy interruptible_sleep_on().
Note that this driver is mostly stubbed out so neither version of
tiocmiwait will actually work until someone implements
f81232_update_line_status().
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/serial/f81232.c | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 42c55601b4c9..1e012fbe7e02 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c | |||
@@ -56,7 +56,7 @@ static void f81232_update_line_status(struct usb_serial_port *port, | |||
56 | unsigned int actual_length) | 56 | unsigned int actual_length) |
57 | { | 57 | { |
58 | /* | 58 | /* |
59 | * FIXME: Call | 59 | * FIXME: Update port->icount, and call |
60 | * | 60 | * |
61 | * wake_up_interruptible(&port->port.delta_msr_wait); | 61 | * wake_up_interruptible(&port->port.delta_msr_wait); |
62 | * | 62 | * |
@@ -247,46 +247,6 @@ static int f81232_carrier_raised(struct usb_serial_port *port) | |||
247 | return 0; | 247 | return 0; |
248 | } | 248 | } |
249 | 249 | ||
250 | static int f81232_tiocmiwait(struct tty_struct *tty, unsigned long arg) | ||
251 | { | ||
252 | struct usb_serial_port *port = tty->driver_data; | ||
253 | struct f81232_private *priv = usb_get_serial_port_data(port); | ||
254 | unsigned long flags; | ||
255 | unsigned int prevstatus; | ||
256 | unsigned int status; | ||
257 | unsigned int changed; | ||
258 | |||
259 | spin_lock_irqsave(&priv->lock, flags); | ||
260 | prevstatus = priv->line_status; | ||
261 | spin_unlock_irqrestore(&priv->lock, flags); | ||
262 | |||
263 | while (1) { | ||
264 | interruptible_sleep_on(&port->port.delta_msr_wait); | ||
265 | /* see if a signal did it */ | ||
266 | if (signal_pending(current)) | ||
267 | return -ERESTARTSYS; | ||
268 | |||
269 | if (port->serial->disconnected) | ||
270 | return -EIO; | ||
271 | |||
272 | spin_lock_irqsave(&priv->lock, flags); | ||
273 | status = priv->line_status; | ||
274 | spin_unlock_irqrestore(&priv->lock, flags); | ||
275 | |||
276 | changed = prevstatus ^ status; | ||
277 | |||
278 | if (((arg & TIOCM_RNG) && (changed & UART_RING)) || | ||
279 | ((arg & TIOCM_DSR) && (changed & UART_DSR)) || | ||
280 | ((arg & TIOCM_CD) && (changed & UART_DCD)) || | ||
281 | ((arg & TIOCM_CTS) && (changed & UART_CTS))) { | ||
282 | return 0; | ||
283 | } | ||
284 | prevstatus = status; | ||
285 | } | ||
286 | /* NOTREACHED */ | ||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | static int f81232_ioctl(struct tty_struct *tty, | 250 | static int f81232_ioctl(struct tty_struct *tty, |
291 | unsigned int cmd, unsigned long arg) | 251 | unsigned int cmd, unsigned long arg) |
292 | { | 252 | { |
@@ -356,7 +316,7 @@ static struct usb_serial_driver f81232_device = { | |||
356 | .set_termios = f81232_set_termios, | 316 | .set_termios = f81232_set_termios, |
357 | .tiocmget = f81232_tiocmget, | 317 | .tiocmget = f81232_tiocmget, |
358 | .tiocmset = f81232_tiocmset, | 318 | .tiocmset = f81232_tiocmset, |
359 | .tiocmiwait = f81232_tiocmiwait, | 319 | .tiocmiwait = usb_serial_generic_tiocmiwait, |
360 | .process_read_urb = f81232_process_read_urb, | 320 | .process_read_urb = f81232_process_read_urb, |
361 | .read_int_callback = f81232_read_int_callback, | 321 | .read_int_callback = f81232_read_int_callback, |
362 | .port_probe = f81232_port_probe, | 322 | .port_probe = f81232_port_probe, |