Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+48 -93
+32 -45
drivers/usb/serial/cp210x.c
··· 400 400 }; 401 401 402 402 /* CP210X_VENDOR_SPECIFIC values */ 403 + #define CP210X_GET_FW_VER 0x000E 403 404 #define CP210X_READ_2NCONFIG 0x000E 404 405 #define CP210X_GET_FW_VER_2N 0x0010 405 406 #define CP210X_READ_LATCH 0x00C2 ··· 639 638 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 640 639 req, REQTYPE_INTERFACE_TO_HOST, 0, 641 640 port_priv->bInterfaceNumber, dmabuf, bufsize, 642 - USB_CTRL_SET_TIMEOUT); 641 + USB_CTRL_GET_TIMEOUT); 643 642 if (result == bufsize) { 644 643 memcpy(buf, dmabuf, bufsize); 645 644 result = 0; ··· 1146 1145 port_priv->event_mode = false; 1147 1146 } 1148 1147 1149 - static int cp210x_set_chars(struct usb_serial_port *port, 1150 - struct cp210x_special_chars *chars) 1151 - { 1152 - struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); 1153 - struct usb_serial *serial = port->serial; 1154 - void *dmabuf; 1155 - int result; 1156 - 1157 - dmabuf = kmemdup(chars, sizeof(*chars), GFP_KERNEL); 1158 - if (!dmabuf) 1159 - return -ENOMEM; 1160 - 1161 - result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 1162 - CP210X_SET_CHARS, REQTYPE_HOST_TO_INTERFACE, 0, 1163 - port_priv->bInterfaceNumber, 1164 - dmabuf, sizeof(*chars), USB_CTRL_SET_TIMEOUT); 1165 - 1166 - kfree(dmabuf); 1167 - 1168 - if (result < 0) { 1169 - dev_err(&port->dev, "failed to set special chars: %d\n", result); 1170 - return result; 1171 - } 1172 - 1173 - return 0; 1174 - } 1175 - 1176 1148 static bool cp210x_termios_change(const struct ktermios *a, const struct ktermios *b) 1177 1149 { 1178 1150 bool iflag_change, cc_change; ··· 1166 1192 struct cp210x_flow_ctl flow_ctl; 1167 1193 u32 flow_repl; 1168 1194 u32 ctl_hs; 1195 + bool crtscts; 1169 1196 int ret; 1170 1197 1171 1198 /* ··· 1193 1218 chars.bXonChar = START_CHAR(tty); 1194 1219 chars.bXoffChar = STOP_CHAR(tty); 1195 1220 1196 - ret = cp210x_set_chars(port, &chars); 1197 - if (ret) 1198 - return; 1221 + ret = cp210x_write_reg_block(port, CP210X_SET_CHARS, &chars, 1222 + sizeof(chars)); 1223 + if (ret) { 1224 + dev_err(&port->dev, "failed to set special chars: %d\n", 1225 + ret); 1226 + } 1199 1227 } 1200 1228 1201 1229 mutex_lock(&port_priv->mutex); ··· 1227 1249 flow_repl |= CP210X_SERIAL_RTS_FLOW_CTL; 1228 1250 else 1229 1251 flow_repl |= CP210X_SERIAL_RTS_INACTIVE; 1230 - port_priv->crtscts = true; 1252 + crtscts = true; 1231 1253 } else { 1232 1254 ctl_hs &= ~CP210X_SERIAL_CTS_HANDSHAKE; 1233 1255 if (port_priv->rts) 1234 1256 flow_repl |= CP210X_SERIAL_RTS_ACTIVE; 1235 1257 else 1236 1258 flow_repl |= CP210X_SERIAL_RTS_INACTIVE; 1237 - port_priv->crtscts = false; 1259 + crtscts = false; 1238 1260 } 1239 1261 1240 1262 if (I_IXOFF(tty)) { ··· 1257 1279 flow_ctl.ulControlHandshake = cpu_to_le32(ctl_hs); 1258 1280 flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl); 1259 1281 1260 - cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl, 1282 + ret = cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl, 1261 1283 sizeof(flow_ctl)); 1284 + if (ret) 1285 + goto out_unlock; 1286 + 1287 + port_priv->crtscts = crtscts; 1262 1288 out_unlock: 1263 1289 mutex_unlock(&port_priv->mutex); 1264 1290 } ··· 2093 2111 return 0; 2094 2112 } 2095 2113 2096 - static void cp210x_determine_quirks(struct usb_serial *serial) 2114 + static void cp210x_determine_type(struct usb_serial *serial) 2097 2115 { 2098 2116 struct cp210x_serial_private *priv = usb_get_serial_data(serial); 2099 2117 int ret; 2100 2118 2119 + ret = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, 2120 + CP210X_GET_PARTNUM, &priv->partnum, 2121 + sizeof(priv->partnum)); 2122 + if (ret < 0) { 2123 + dev_warn(&serial->interface->dev, 2124 + "querying part number failed\n"); 2125 + priv->partnum = CP210X_PARTNUM_UNKNOWN; 2126 + return; 2127 + } 2128 + 2101 2129 switch (priv->partnum) { 2130 + case CP210X_PARTNUM_CP2105: 2131 + case CP210X_PARTNUM_CP2108: 2132 + cp210x_get_fw_version(serial, CP210X_GET_FW_VER); 2133 + break; 2102 2134 case CP210X_PARTNUM_CP2102N_QFN28: 2103 2135 case CP210X_PARTNUM_CP2102N_QFN24: 2104 2136 case CP210X_PARTNUM_CP2102N_QFN20: ··· 2136 2140 if (!priv) 2137 2141 return -ENOMEM; 2138 2142 2139 - result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, 2140 - CP210X_GET_PARTNUM, &priv->partnum, 2141 - sizeof(priv->partnum)); 2142 - if (result < 0) { 2143 - dev_warn(&serial->interface->dev, 2144 - "querying part number failed\n"); 2145 - priv->partnum = CP210X_PARTNUM_UNKNOWN; 2146 - } 2147 - 2148 2143 usb_set_serial_data(serial, priv); 2149 2144 2150 - cp210x_determine_quirks(serial); 2145 + cp210x_determine_type(serial); 2151 2146 cp210x_init_max_speed(serial); 2152 2147 2153 2148 result = cp210x_gpio_init(serial);
+3 -3
drivers/usb/serial/cypress_m8.c
··· 1199 1199 MODULE_DESCRIPTION(DRIVER_DESC); 1200 1200 MODULE_LICENSE("GPL"); 1201 1201 1202 - module_param(stats, bool, S_IRUGO | S_IWUSR); 1202 + module_param(stats, bool, 0644); 1203 1203 MODULE_PARM_DESC(stats, "Enable statistics or not"); 1204 - module_param(interval, int, S_IRUGO | S_IWUSR); 1204 + module_param(interval, int, 0644); 1205 1205 MODULE_PARM_DESC(interval, "Overrides interrupt interval"); 1206 - module_param(unstable_bauds, bool, S_IRUGO | S_IWUSR); 1206 + module_param(unstable_bauds, bool, 0644); 1207 1207 MODULE_PARM_DESC(unstable_bauds, "Allow unstable baud rates");
+1 -1
drivers/usb/serial/ftdi_sio.c
··· 2938 2938 MODULE_DESCRIPTION(DRIVER_DESC); 2939 2939 MODULE_LICENSE("GPL"); 2940 2940 2941 - module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR); 2941 + module_param(ndi_latency_timer, int, 0644); 2942 2942 MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override");
+1 -1
drivers/usb/serial/garmin_gps.c
··· 1444 1444 MODULE_DESCRIPTION(DRIVER_DESC); 1445 1445 MODULE_LICENSE("GPL"); 1446 1446 1447 - module_param(initial_mode, int, S_IRUGO); 1447 + module_param(initial_mode, int, 0444); 1448 1448 MODULE_PARM_DESC(initial_mode, "Initial mode");
-33
drivers/usb/serial/io_edgeport.c
··· 389 389 release_firmware(fw); 390 390 } 391 391 392 - #if 0 393 - /************************************************************************ 394 - * 395 - * Get string descriptor from device 396 - * 397 - ************************************************************************/ 398 - static int get_string_desc(struct usb_device *dev, int Id, 399 - struct usb_string_descriptor **pRetDesc) 400 - { 401 - struct usb_string_descriptor StringDesc; 402 - struct usb_string_descriptor *pStringDesc; 403 - 404 - dev_dbg(&dev->dev, "%s - USB String ID = %d\n", __func__, Id); 405 - 406 - if (!usb_get_descriptor(dev, USB_DT_STRING, Id, &StringDesc, 407 - sizeof(StringDesc))) 408 - return 0; 409 - 410 - pStringDesc = kmalloc(StringDesc.bLength, GFP_KERNEL); 411 - if (!pStringDesc) 412 - return -1; 413 - 414 - if (!usb_get_descriptor(dev, USB_DT_STRING, Id, pStringDesc, 415 - StringDesc.bLength)) { 416 - kfree(pStringDesc); 417 - return -1; 418 - } 419 - 420 - *pRetDesc = pStringDesc; 421 - return 0; 422 - } 423 - #endif 424 - 425 392 static void dump_product_info(struct edgeport_serial *edge_serial, 426 393 struct edgeport_product_info *product_info) 427 394 {
+2 -2
drivers/usb/serial/io_ti.c
··· 2746 2746 MODULE_LICENSE("GPL"); 2747 2747 MODULE_FIRMWARE("edgeport/down3.bin"); 2748 2748 2749 - module_param(ignore_cpu_rev, bool, S_IRUGO | S_IWUSR); 2749 + module_param(ignore_cpu_rev, bool, 0644); 2750 2750 MODULE_PARM_DESC(ignore_cpu_rev, 2751 2751 "Ignore the cpu revision when connecting to a device"); 2752 2752 2753 - module_param(default_uart_mode, int, S_IRUGO | S_IWUSR); 2753 + module_param(default_uart_mode, int, 0644); 2754 2754 MODULE_PARM_DESC(default_uart_mode, "Default uart_mode, 0=RS232, ...");
+2 -2
drivers/usb/serial/ipaq.c
··· 599 599 MODULE_DESCRIPTION(DRIVER_DESC); 600 600 MODULE_LICENSE("GPL"); 601 601 602 - module_param(connect_retries, int, S_IRUGO|S_IWUSR); 602 + module_param(connect_retries, int, 0644); 603 603 MODULE_PARM_DESC(connect_retries, 604 604 "Maximum number of connect retries (one second each)"); 605 605 606 - module_param(initial_wait, int, S_IRUGO|S_IWUSR); 606 + module_param(initial_wait, int, 0644); 607 607 MODULE_PARM_DESC(initial_wait, 608 608 "Time to wait before attempting a connection (in seconds)");
+5 -5
drivers/usb/serial/iuu_phoenix.c
··· 1188 1188 MODULE_DESCRIPTION(DRIVER_DESC); 1189 1189 MODULE_LICENSE("GPL"); 1190 1190 1191 - module_param(xmas, bool, S_IRUGO | S_IWUSR); 1191 + module_param(xmas, bool, 0644); 1192 1192 MODULE_PARM_DESC(xmas, "Xmas colors enabled or not"); 1193 1193 1194 - module_param(boost, int, S_IRUGO | S_IWUSR); 1194 + module_param(boost, int, 0644); 1195 1195 MODULE_PARM_DESC(boost, "Card overclock boost (in percent 100-500)"); 1196 1196 1197 - module_param(clockmode, int, S_IRUGO | S_IWUSR); 1197 + module_param(clockmode, int, 0644); 1198 1198 MODULE_PARM_DESC(clockmode, "Card clock mode (1=3.579 MHz, 2=3.680 MHz, " 1199 1199 "3=6 Mhz)"); 1200 1200 1201 - module_param(cdmode, int, S_IRUGO | S_IWUSR); 1201 + module_param(cdmode, int, 0644); 1202 1202 MODULE_PARM_DESC(cdmode, "Card detect mode (0=none, 1=CD, 2=!CD, 3=DSR, " 1203 1203 "4=!DSR, 5=CTS, 6=!CTS, 7=RING, 8=!RING)"); 1204 1204 1205 - module_param(vcc_default, int, S_IRUGO | S_IWUSR); 1205 + module_param(vcc_default, int, 0644); 1206 1206 MODULE_PARM_DESC(vcc_default, "Set default VCC (either 3 for 3.3V or 5 " 1207 1207 "for 5V). Default to 5.");
+1
drivers/usb/serial/pl2303.c
··· 433 433 switch (bcdDevice) { 434 434 case 0x100: 435 435 case 0x305: 436 + case 0x405: 436 437 /* 437 438 * Assume it's an HXN-type if the device doesn't 438 439 * support the old read request value.
+1 -1
drivers/usb/serial/sierra.c
··· 1056 1056 MODULE_DESCRIPTION(DRIVER_DESC); 1057 1057 MODULE_LICENSE("GPL v2"); 1058 1058 1059 - module_param(nmea, bool, S_IRUGO | S_IWUSR); 1059 + module_param(nmea, bool, 0644); 1060 1060 MODULE_PARM_DESC(nmea, "NMEA streaming");