summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mos7840.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-20 17:22:51 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-20 17:22:51 +0200
commit8ebe0e20bf483de2860073898f08cbdf855e93e0 (patch)
tree882f8e11ca110620b6bbbe84cbb57054de5abd77 /drivers/usb/serial/mos7840.c
parentusb: host: xhci: print correct command ring address (diff)
parentUSB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit (diff)
downloadlinux-8ebe0e20bf483de2860073898f08cbdf855e93e0.tar.xz
linux-8ebe0e20bf483de2860073898f08cbdf855e93e0.zip
Merge tag 'usb-serial-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next
Johan writes: USB-serial updates for v4.12-rc1 Here are the USB-serial updates for 4.12, including: - support for devices with up to 16 ports (e.g. some Moxa devices) - support for endpoint sanity checks in core, which allows for code sharing and avoids allocating resources for rejected interfaces - support for endpoint-port remapping, which allows some driver hacks to be removed as well as omninet to use the generic write implementation - removal of an obsolete tty open-race workaround which prevented a port from being opened immediately after having been registered - generic-driver support for interfaces with just a bulk-in endpoint - improved ftdi_sio event-char and latency-timer handling - improved ftdi_sio support for some broken BM chips Included are also various clean ups and a new ftdi_sio device id. All have been in linux-next with no reported issues. Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r--drivers/usb/serial/mos7840.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 3821c53fcee9..e8669aae14b3 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1868,7 +1868,6 @@ static void mos7840_set_termios(struct tty_struct *tty,
struct ktermios *old_termios)
{
int status;
- unsigned int cflag;
struct usb_serial *serial;
struct moschip_port *mos7840_port;
@@ -1890,15 +1889,6 @@ static void mos7840_set_termios(struct tty_struct *tty,
return;
}
- dev_dbg(&port->dev, "%s", "setting termios - \n");
-
- cflag = tty->termios.c_cflag;
-
- dev_dbg(&port->dev, "%s - clfag %08x iflag %08x\n", __func__,
- tty->termios.c_cflag, RELEVANT_IFLAG(tty->termios.c_iflag));
- dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__,
- old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
-
/* change the port settings to the new ones specified */
mos7840_change_port_settings(tty, mos7840_port, old_termios);
@@ -2104,26 +2094,27 @@ out:
return 0;
}
-static int mos7840_calc_num_ports(struct usb_serial *serial)
+static int mos7840_calc_num_ports(struct usb_serial *serial,
+ struct usb_serial_endpoints *epds)
{
int device_type = (unsigned long)usb_get_serial_data(serial);
- int mos7840_num_ports;
+ int num_ports;
- mos7840_num_ports = (device_type >> 4) & 0x000F;
+ num_ports = (device_type >> 4) & 0x000F;
- return mos7840_num_ports;
-}
+ /*
+ * num_ports is currently never zero as device_type is one of
+ * MOSCHIP_DEVICE_ID_78{1,2,4}0.
+ */
+ if (num_ports == 0)
+ return -ENODEV;
-static int mos7840_attach(struct usb_serial *serial)
-{
- if (serial->num_bulk_in < serial->num_ports ||
- serial->num_bulk_out < serial->num_ports ||
- serial->num_interrupt_in < 1) {
+ if (epds->num_bulk_in < num_ports || epds->num_bulk_out < num_ports) {
dev_err(&serial->interface->dev, "missing endpoints\n");
return -ENODEV;
}
- return 0;
+ return num_ports;
}
static int mos7840_port_probe(struct usb_serial_port *port)
@@ -2384,7 +2375,7 @@ static struct usb_serial_driver moschip7840_4port_device = {
},
.description = DRIVER_DESC,
.id_table = id_table,
- .num_ports = 4,
+ .num_interrupt_in = 1,
.open = mos7840_open,
.close = mos7840_close,
.write = mos7840_write,
@@ -2401,7 +2392,6 @@ static struct usb_serial_driver moschip7840_4port_device = {
.tiocmset = mos7840_tiocmset,
.tiocmiwait = usb_serial_generic_tiocmiwait,
.get_icount = usb_serial_generic_get_icount,
- .attach = mos7840_attach,
.port_probe = mos7840_port_probe,
.port_remove = mos7840_port_remove,
.read_bulk_callback = mos7840_bulk_in_callback,