aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/serial/ftdi_sio.c45
1 files changed, 14 insertions, 31 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 01efe6dda05c..6e437f9e4b9b 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -982,7 +982,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
982 982
983static __u32 get_ftdi_divisor(struct tty_struct *tty, 983static __u32 get_ftdi_divisor(struct tty_struct *tty,
984 struct usb_serial_port *port) 984 struct usb_serial_port *port)
985{ /* get_ftdi_divisor */ 985{
986 struct ftdi_private *priv = usb_get_serial_port_data(port); 986 struct ftdi_private *priv = usb_get_serial_port_data(port);
987 __u32 div_value = 0; 987 __u32 div_value = 0;
988 int div_okay = 1; 988 int div_okay = 1;
@@ -1206,12 +1206,11 @@ static int get_serial_info(struct usb_serial_port *port,
1206 if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) 1206 if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
1207 return -EFAULT; 1207 return -EFAULT;
1208 return 0; 1208 return 0;
1209} /* get_serial_info */ 1209}
1210
1211 1210
1212static int set_serial_info(struct tty_struct *tty, 1211static int set_serial_info(struct tty_struct *tty,
1213 struct usb_serial_port *port, struct serial_struct __user *newinfo) 1212 struct usb_serial_port *port, struct serial_struct __user *newinfo)
1214{ /* set_serial_info */ 1213{
1215 struct ftdi_private *priv = usb_get_serial_port_data(port); 1214 struct ftdi_private *priv = usb_get_serial_port_data(port);
1216 struct serial_struct new_serial; 1215 struct serial_struct new_serial;
1217 struct ftdi_private old_priv; 1216 struct ftdi_private old_priv;
@@ -1274,8 +1273,7 @@ check_and_exit:
1274 else 1273 else
1275 mutex_unlock(&priv->cfg_lock); 1274 mutex_unlock(&priv->cfg_lock);
1276 return 0; 1275 return 0;
1277 1276}
1278} /* set_serial_info */
1279 1277
1280 1278
1281/* Determine type of FTDI chip based on USB config and descriptor. */ 1279/* Determine type of FTDI chip based on USB config and descriptor. */
@@ -1577,7 +1575,7 @@ static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
1577 priv->flags |= ASYNC_SPD_CUST; 1575 priv->flags |= ASYNC_SPD_CUST;
1578 priv->custom_divisor = 77; 1576 priv->custom_divisor = 77;
1579 priv->force_baud = 38400; 1577 priv->force_baud = 38400;
1580} /* ftdi_USB_UIRT_setup */ 1578}
1581 1579
1582/* Setup for the HE-TIRA1 device, which requires hardwired 1580/* Setup for the HE-TIRA1 device, which requires hardwired
1583 * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */ 1581 * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */
@@ -1590,7 +1588,7 @@ static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
1590 priv->custom_divisor = 240; 1588 priv->custom_divisor = 240;
1591 priv->force_baud = 38400; 1589 priv->force_baud = 38400;
1592 priv->force_rtscts = 1; 1590 priv->force_rtscts = 1;
1593} /* ftdi_HE_TIRA1_setup */ 1591}
1594 1592
1595/* 1593/*
1596 * Module parameter to control latency timer for NDI FTDI-based USB devices. 1594 * Module parameter to control latency timer for NDI FTDI-based USB devices.
@@ -1684,7 +1682,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port)
1684} 1682}
1685 1683
1686static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port) 1684static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)
1687{ /* ftdi_open */ 1685{
1688 struct usb_device *dev = port->serial->dev; 1686 struct usb_device *dev = port->serial->dev;
1689 struct ftdi_private *priv = usb_get_serial_port_data(port); 1687 struct ftdi_private *priv = usb_get_serial_port_data(port);
1690 int result; 1688 int result;
@@ -1714,8 +1712,7 @@ static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)
1714 kref_get(&priv->kref); 1712 kref_get(&priv->kref);
1715 1713
1716 return result; 1714 return result;
1717} /* ftdi_open */ 1715}
1718
1719 1716
1720static void ftdi_dtr_rts(struct usb_serial_port *port, int on) 1717static void ftdi_dtr_rts(struct usb_serial_port *port, int on)
1721{ 1718{
@@ -1745,12 +1742,9 @@ static void ftdi_dtr_rts(struct usb_serial_port *port, int on)
1745 * usbserial:__serial_close only calls ftdi_close if the point is open 1742 * usbserial:__serial_close only calls ftdi_close if the point is open
1746 * 1743 *
1747 * This only gets called when it is the last close 1744 * This only gets called when it is the last close
1748 *
1749 *
1750 */ 1745 */
1751
1752static void ftdi_close(struct usb_serial_port *port) 1746static void ftdi_close(struct usb_serial_port *port)
1753{ /* ftdi_close */ 1747{
1754 struct ftdi_private *priv = usb_get_serial_port_data(port); 1748 struct ftdi_private *priv = usb_get_serial_port_data(port);
1755 1749
1756 dbg("%s", __func__); 1750 dbg("%s", __func__);
@@ -1758,9 +1752,7 @@ static void ftdi_close(struct usb_serial_port *port)
1758 /* shutdown our bulk read */ 1752 /* shutdown our bulk read */
1759 usb_kill_urb(port->read_urb); 1753 usb_kill_urb(port->read_urb);
1760 kref_put(&priv->kref, ftdi_sio_priv_release); 1754 kref_put(&priv->kref, ftdi_sio_priv_release);
1761} /* ftdi_close */ 1755}
1762
1763
1764 1756
1765/* The SIO requires the first byte to have: 1757/* The SIO requires the first byte to have:
1766 * B0 1 1758 * B0 1
@@ -1771,7 +1763,7 @@ static void ftdi_close(struct usb_serial_port *port)
1771 */ 1763 */
1772static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port, 1764static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port,
1773 const unsigned char *buf, int count) 1765 const unsigned char *buf, int count)
1774{ /* ftdi_write */ 1766{
1775 struct ftdi_private *priv = usb_get_serial_port_data(port); 1767 struct ftdi_private *priv = usb_get_serial_port_data(port);
1776 struct urb *urb; 1768 struct urb *urb;
1777 unsigned char *buffer; 1769 unsigned char *buffer;
@@ -1887,11 +1879,9 @@ error_no_buffer:
1887 priv->tx_outstanding_urbs--; 1879 priv->tx_outstanding_urbs--;
1888 spin_unlock_irqrestore(&priv->tx_lock, flags); 1880 spin_unlock_irqrestore(&priv->tx_lock, flags);
1889 return count; 1881 return count;
1890} /* ftdi_write */ 1882}
1891
1892 1883
1893/* This function may get called when the device is closed */ 1884/* This function may get called when the device is closed */
1894
1895static void ftdi_write_bulk_callback(struct urb *urb) 1885static void ftdi_write_bulk_callback(struct urb *urb)
1896{ 1886{
1897 unsigned long flags; 1887 unsigned long flags;
@@ -1928,8 +1918,7 @@ static void ftdi_write_bulk_callback(struct urb *urb)
1928 } 1918 }
1929 1919
1930 usb_serial_port_softint(port); 1920 usb_serial_port_softint(port);
1931} /* ftdi_write_bulk_callback */ 1921}
1932
1933 1922
1934static int ftdi_write_room(struct tty_struct *tty) 1923static int ftdi_write_room(struct tty_struct *tty)
1935{ 1924{
@@ -2095,15 +2084,13 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
2095 2084
2096} 2085}
2097 2086
2098
2099/* old_termios contains the original termios settings and tty->termios contains 2087/* old_termios contains the original termios settings and tty->termios contains
2100 * the new setting to be used 2088 * the new setting to be used
2101 * WARNING: set_termios calls this with old_termios in kernel space 2089 * WARNING: set_termios calls this with old_termios in kernel space
2102 */ 2090 */
2103
2104static void ftdi_set_termios(struct tty_struct *tty, 2091static void ftdi_set_termios(struct tty_struct *tty,
2105 struct usb_serial_port *port, struct ktermios *old_termios) 2092 struct usb_serial_port *port, struct ktermios *old_termios)
2106{ /* ftdi_termios */ 2093{
2107 struct usb_device *dev = port->serial->dev; 2094 struct usb_device *dev = port->serial->dev;
2108 struct ftdi_private *priv = usb_get_serial_port_data(port); 2095 struct ftdi_private *priv = usb_get_serial_port_data(port);
2109 struct ktermios *termios = tty->termios; 2096 struct ktermios *termios = tty->termios;
@@ -2331,7 +2318,6 @@ static int ftdi_tiocmset(struct tty_struct *tty, struct file *file,
2331 return update_mctrl(port, set, clear); 2318 return update_mctrl(port, set, clear);
2332} 2319}
2333 2320
2334
2335static int ftdi_ioctl(struct tty_struct *tty, struct file *file, 2321static int ftdi_ioctl(struct tty_struct *tty, struct file *file,
2336 unsigned int cmd, unsigned long arg) 2322 unsigned int cmd, unsigned long arg)
2337{ 2323{
@@ -2430,15 +2416,12 @@ failed_sio_register:
2430 return retval; 2416 return retval;
2431} 2417}
2432 2418
2433
2434static void __exit ftdi_exit(void) 2419static void __exit ftdi_exit(void)
2435{ 2420{
2436
2437 dbg("%s", __func__); 2421 dbg("%s", __func__);
2438 2422
2439 usb_deregister(&ftdi_driver); 2423 usb_deregister(&ftdi_driver);
2440 usb_serial_deregister(&ftdi_sio_device); 2424 usb_serial_deregister(&ftdi_sio_device);
2441
2442} 2425}
2443 2426
2444 2427