aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ftdi_sio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ftdi_sio.c')
-rw-r--r--drivers/usb/serial/ftdi_sio.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index ae84c326a540..dcc87aaa8628 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1938,18 +1938,16 @@ static void ftdi_process_read(struct work_struct *work)
1938 /* Compare new line status to the old one, signal if different/ 1938 /* Compare new line status to the old one, signal if different/
1939 N.B. packet may be processed more than once, but differences 1939 N.B. packet may be processed more than once, but differences
1940 are only processed once. */ 1940 are only processed once. */
1941 if (priv != NULL) { 1941 char new_status = data[packet_offset + 0] &
1942 char new_status = data[packet_offset + 0] & 1942 FTDI_STATUS_B0_MASK;
1943 FTDI_STATUS_B0_MASK; 1943 if (new_status != priv->prev_status) {
1944 if (new_status != priv->prev_status) { 1944 priv->diff_status |=
1945 priv->diff_status |= 1945 new_status ^ priv->prev_status;
1946 new_status ^ priv->prev_status; 1946 wake_up_interruptible(&priv->delta_msr_wait);
1947 wake_up_interruptible(&priv->delta_msr_wait); 1947 priv->prev_status = new_status;
1948 priv->prev_status = new_status;
1949 }
1950 } 1948 }
1951 1949
1952 length = min(PKTSZ, urb->actual_length-packet_offset)-2; 1950 length = min_t(u32, PKTSZ, urb->actual_length-packet_offset)-2;
1953 if (length < 0) { 1951 if (length < 0) {
1954 dev_err(&port->dev, "%s - bad packet length: %d\n", 1952 dev_err(&port->dev, "%s - bad packet length: %d\n",
1955 __func__, length+2); 1953 __func__, length+2);
@@ -2294,11 +2292,8 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file)
2294 FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, 2292 FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
2295 0, 0, 2293 0, 0,
2296 buf, 1, WDR_TIMEOUT); 2294 buf, 1, WDR_TIMEOUT);
2297 if (ret < 0) { 2295 if (ret < 0)
2298 dbg("%s Could not get modem status of device - err: %d", __func__,
2299 ret);
2300 return ret; 2296 return ret;
2301 }
2302 break; 2297 break;
2303 case FT8U232AM: 2298 case FT8U232AM:
2304 case FT232BM: 2299 case FT232BM:
@@ -2313,15 +2308,11 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file)
2313 FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE, 2308 FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
2314 0, priv->interface, 2309 0, priv->interface,
2315 buf, 2, WDR_TIMEOUT); 2310 buf, 2, WDR_TIMEOUT);
2316 if (ret < 0) { 2311 if (ret < 0)
2317 dbg("%s Could not get modem status of device - err: %d", __func__,
2318 ret);
2319 return ret; 2312 return ret;
2320 }
2321 break; 2313 break;
2322 default: 2314 default:
2323 return -EFAULT; 2315 return -EFAULT;
2324 break;
2325 } 2316 }
2326 2317
2327 return (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) | 2318 return (buf[0] & FTDI_SIO_DSR_MASK ? TIOCM_DSR : 0) |