diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-09-05 11:19:15 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-09-05 11:19:15 -0700 |
commit | fd47ff55c9c31101fcc06d20cb381da3d4089bd5 (patch) | |
tree | 04992144fae8c9f4b0950b02f4719eca3d7a33cf /drivers | |
parent | 6b6dc4f40c5264556223ba94693f20d83796ab1f (diff) | |
parent | 1b4f3dfb4792f03b139edf10124fcbeb44e608e6 (diff) | |
download | linux-stable-fd47ff55c9c31101fcc06d20cb381da3d4089bd5.tar.gz linux-stable-fd47ff55c9c31101fcc06d20cb381da3d4089bd5.tar.bz2 linux-stable-fd47ff55c9c31101fcc06d20cb381da3d4089bd5.zip |
Merge tag 'usb-5.15-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull more USB updates from Greg KH:
"Here are some straggler USB-serial changes for 5.15-rc1.
These were not included in the first pull request as they came in
"late" from Johan and I had missed them in my pull request earlier
this week.
Nothing big in here, just some USB to serial driver updates and fixes.
All of these were in linux-next before I pulled them into my tree, and
have been in linux-next all this week from my tree with no reported
problems"
* tag 'usb-5.15-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
USB: serial: pl2303: fix GL type detection
USB: serial: replace symbolic permissions by octal permissions
USB: serial: cp210x: determine fw version for CP2105 and CP2108
USB: serial: cp210x: clean up type detection
USB: serial: cp210x: clean up set-chars request
USB: serial: cp210x: clean up control-request timeout
USB: serial: cp210x: fix flow-control error handling
USB: serial: cp210x: fix control-characters error handling
USB: serial: io_edgeport: drop unused descriptor helper
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/cp210x.c | 77 | ||||
-rw-r--r-- | drivers/usb/serial/cypress_m8.c | 6 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/garmin_gps.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 33 | ||||
-rw-r--r-- | drivers/usb/serial/io_ti.c | 4 | ||||
-rw-r--r-- | drivers/usb/serial/ipaq.c | 4 | ||||
-rw-r--r-- | drivers/usb/serial/iuu_phoenix.c | 10 | ||||
-rw-r--r-- | drivers/usb/serial/pl2303.c | 1 | ||||
-rw-r--r-- | drivers/usb/serial/sierra.c | 2 |
10 files changed, 48 insertions, 93 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 3c80bfbf3bec..66a6ac50a4cd 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -400,6 +400,7 @@ struct cp210x_special_chars { }; /* CP210X_VENDOR_SPECIFIC values */ +#define CP210X_GET_FW_VER 0x000E #define CP210X_READ_2NCONFIG 0x000E #define CP210X_GET_FW_VER_2N 0x0010 #define CP210X_READ_LATCH 0x00C2 @@ -638,7 +639,7 @@ static int cp210x_read_reg_block(struct usb_serial_port *port, u8 req, result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), req, REQTYPE_INTERFACE_TO_HOST, 0, port_priv->bInterfaceNumber, dmabuf, bufsize, - USB_CTRL_SET_TIMEOUT); + USB_CTRL_GET_TIMEOUT); if (result == bufsize) { memcpy(buf, dmabuf, bufsize); result = 0; @@ -1145,33 +1146,6 @@ static void cp210x_disable_event_mode(struct usb_serial_port *port) port_priv->event_mode = false; } -static int cp210x_set_chars(struct usb_serial_port *port, - struct cp210x_special_chars *chars) -{ - struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); - struct usb_serial *serial = port->serial; - void *dmabuf; - int result; - - dmabuf = kmemdup(chars, sizeof(*chars), GFP_KERNEL); - if (!dmabuf) - return -ENOMEM; - - result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), - CP210X_SET_CHARS, REQTYPE_HOST_TO_INTERFACE, 0, - port_priv->bInterfaceNumber, - dmabuf, sizeof(*chars), USB_CTRL_SET_TIMEOUT); - - kfree(dmabuf); - - if (result < 0) { - dev_err(&port->dev, "failed to set special chars: %d\n", result); - return result; - } - - return 0; -} - static bool cp210x_termios_change(const struct ktermios *a, const struct ktermios *b) { bool iflag_change, cc_change; @@ -1192,6 +1166,7 @@ static void cp210x_set_flow_control(struct tty_struct *tty, struct cp210x_flow_ctl flow_ctl; u32 flow_repl; u32 ctl_hs; + bool crtscts; int ret; /* @@ -1218,9 +1193,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty, chars.bXonChar = START_CHAR(tty); chars.bXoffChar = STOP_CHAR(tty); - ret = cp210x_set_chars(port, &chars); - if (ret) - return; + ret = cp210x_write_reg_block(port, CP210X_SET_CHARS, &chars, + sizeof(chars)); + if (ret) { + dev_err(&port->dev, "failed to set special chars: %d\n", + ret); + } } mutex_lock(&port_priv->mutex); @@ -1249,14 +1227,14 @@ static void cp210x_set_flow_control(struct tty_struct *tty, flow_repl |= CP210X_SERIAL_RTS_FLOW_CTL; else flow_repl |= CP210X_SERIAL_RTS_INACTIVE; - port_priv->crtscts = true; + crtscts = true; } else { ctl_hs &= ~CP210X_SERIAL_CTS_HANDSHAKE; if (port_priv->rts) flow_repl |= CP210X_SERIAL_RTS_ACTIVE; else flow_repl |= CP210X_SERIAL_RTS_INACTIVE; - port_priv->crtscts = false; + crtscts = false; } if (I_IXOFF(tty)) { @@ -1279,8 +1257,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty, flow_ctl.ulControlHandshake = cpu_to_le32(ctl_hs); flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl); - cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl, + ret = cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl, sizeof(flow_ctl)); + if (ret) + goto out_unlock; + + port_priv->crtscts = crtscts; out_unlock: mutex_unlock(&port_priv->mutex); } @@ -2111,12 +2093,26 @@ static int cp210x_get_fw_version(struct usb_serial *serial, u16 value) return 0; } -static void cp210x_determine_quirks(struct usb_serial *serial) +static void cp210x_determine_type(struct usb_serial *serial) { struct cp210x_serial_private *priv = usb_get_serial_data(serial); int ret; + ret = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, + CP210X_GET_PARTNUM, &priv->partnum, + sizeof(priv->partnum)); + if (ret < 0) { + dev_warn(&serial->interface->dev, + "querying part number failed\n"); + priv->partnum = CP210X_PARTNUM_UNKNOWN; + return; + } + switch (priv->partnum) { + case CP210X_PARTNUM_CP2105: + case CP210X_PARTNUM_CP2108: + cp210x_get_fw_version(serial, CP210X_GET_FW_VER); + break; case CP210X_PARTNUM_CP2102N_QFN28: case CP210X_PARTNUM_CP2102N_QFN24: case CP210X_PARTNUM_CP2102N_QFN20: @@ -2140,18 +2136,9 @@ static int cp210x_attach(struct usb_serial *serial) if (!priv) return -ENOMEM; - result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, - CP210X_GET_PARTNUM, &priv->partnum, - sizeof(priv->partnum)); - if (result < 0) { - dev_warn(&serial->interface->dev, - "querying part number failed\n"); - priv->partnum = CP210X_PARTNUM_UNKNOWN; - } - usb_set_serial_data(serial, priv); - cp210x_determine_quirks(serial); + cp210x_determine_type(serial); cp210x_init_max_speed(serial); result = cp210x_gpio_init(serial); diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 6b18990258c3..6924fa95f6bd 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -1199,9 +1199,9 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); -module_param(stats, bool, S_IRUGO | S_IWUSR); +module_param(stats, bool, 0644); MODULE_PARM_DESC(stats, "Enable statistics or not"); -module_param(interval, int, S_IRUGO | S_IWUSR); +module_param(interval, int, 0644); MODULE_PARM_DESC(interval, "Overrides interrupt interval"); -module_param(unstable_bauds, bool, S_IRUGO | S_IWUSR); +module_param(unstable_bauds, bool, 0644); MODULE_PARM_DESC(unstable_bauds, "Allow unstable baud rates"); diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 33bbb3470ca3..99d19828dae6 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -2938,5 +2938,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); -module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR); +module_param(ndi_latency_timer, int, 0644); MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override"); diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 756d1ac7e96f..e5c75944ebb7 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c @@ -1444,5 +1444,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); -module_param(initial_mode, int, S_IRUGO); +module_param(initial_mode, int, 0444); MODULE_PARM_DESC(initial_mode, "Initial mode"); diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index ea4edf5eed27..bdee78cc4a07 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -389,39 +389,6 @@ static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial) release_firmware(fw); } -#if 0 -/************************************************************************ - * - * Get string descriptor from device - * - ************************************************************************/ -static int get_string_desc(struct usb_device *dev, int Id, - struct usb_string_descriptor **pRetDesc) -{ - struct usb_string_descriptor StringDesc; - struct usb_string_descriptor *pStringDesc; - - dev_dbg(&dev->dev, "%s - USB String ID = %d\n", __func__, Id); - - if (!usb_get_descriptor(dev, USB_DT_STRING, Id, &StringDesc, - sizeof(StringDesc))) - return 0; - - pStringDesc = kmalloc(StringDesc.bLength, GFP_KERNEL); - if (!pStringDesc) - return -1; - - if (!usb_get_descriptor(dev, USB_DT_STRING, Id, pStringDesc, - StringDesc.bLength)) { - kfree(pStringDesc); - return -1; - } - - *pRetDesc = pStringDesc; - return 0; -} -#endif - static void dump_product_info(struct edgeport_serial *edge_serial, struct edgeport_product_info *product_info) { diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 84b848d2794e..a7b3c15957ba 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -2746,9 +2746,9 @@ MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); MODULE_FIRMWARE("edgeport/down3.bin"); -module_param(ignore_cpu_rev, bool, S_IRUGO | S_IWUSR); +module_param(ignore_cpu_rev, bool, 0644); MODULE_PARM_DESC(ignore_cpu_rev, "Ignore the cpu revision when connecting to a device"); -module_param(default_uart_mode, int, S_IRUGO | S_IWUSR); +module_param(default_uart_mode, int, 0644); MODULE_PARM_DESC(default_uart_mode, "Default uart_mode, 0=RS232, ..."); diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index f81746c3c26c..e11441bac44f 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -599,10 +599,10 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); -module_param(connect_retries, int, S_IRUGO|S_IWUSR); +module_param(connect_retries, int, 0644); MODULE_PARM_DESC(connect_retries, "Maximum number of connect retries (one second each)"); -module_param(initial_wait, int, S_IRUGO|S_IWUSR); +module_param(initial_wait, int, 0644); MODULE_PARM_DESC(initial_wait, "Time to wait before attempting a connection (in seconds)"); diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 19753611e7b0..0be3b5e1eaf3 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -1188,20 +1188,20 @@ MODULE_AUTHOR("Alain Degreffe eczema@ecze.com"); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); -module_param(xmas, bool, S_IRUGO | S_IWUSR); +module_param(xmas, bool, 0644); MODULE_PARM_DESC(xmas, "Xmas colors enabled or not"); -module_param(boost, int, S_IRUGO | S_IWUSR); +module_param(boost, int, 0644); MODULE_PARM_DESC(boost, "Card overclock boost (in percent 100-500)"); -module_param(clockmode, int, S_IRUGO | S_IWUSR); +module_param(clockmode, int, 0644); MODULE_PARM_DESC(clockmode, "Card clock mode (1=3.579 MHz, 2=3.680 MHz, " "3=6 Mhz)"); -module_param(cdmode, int, S_IRUGO | S_IWUSR); +module_param(cdmode, int, 0644); MODULE_PARM_DESC(cdmode, "Card detect mode (0=none, 1=CD, 2=!CD, 3=DSR, " "4=!DSR, 5=CTS, 6=!CTS, 7=RING, 8=!RING)"); -module_param(vcc_default, int, S_IRUGO | S_IWUSR); +module_param(vcc_default, int, 0644); MODULE_PARM_DESC(vcc_default, "Set default VCC (either 3 for 3.3V or 5 " "for 5V). Default to 5."); diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 930b3d50a330..f45ca7ddf78e 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -433,6 +433,7 @@ static int pl2303_detect_type(struct usb_serial *serial) switch (bcdDevice) { case 0x100: case 0x305: + case 0x405: /* * Assume it's an HXN-type if the device doesn't * support the old read request value. diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 4b49b7c33364..9d56138133a9 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -1056,5 +1056,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL v2"); -module_param(nmea, bool, S_IRUGO | S_IWUSR); +module_param(nmea, bool, 0644); MODULE_PARM_DESC(nmea, "NMEA streaming"); |