Skip to content

Commit fd47ff5

Browse files
committed
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
2 parents 6b6dc4f + 1b4f3df commit fd47ff5

File tree

10 files changed

+48
-93
lines changed

10 files changed

+48
-93
lines changed

drivers/usb/serial/cp210x.c

Lines changed: 32 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ struct cp210x_special_chars {
400400
};
401401

402402
/* CP210X_VENDOR_SPECIFIC values */
403+
#define CP210X_GET_FW_VER 0x000E
403404
#define CP210X_READ_2NCONFIG 0x000E
404405
#define CP210X_GET_FW_VER_2N 0x0010
405406
#define CP210X_READ_LATCH 0x00C2
@@ -638,7 +639,7 @@ static int cp210x_read_reg_block(struct usb_serial_port *port, u8 req,
638639
result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
639640
req, REQTYPE_INTERFACE_TO_HOST, 0,
640641
port_priv->bInterfaceNumber, dmabuf, bufsize,
641-
USB_CTRL_SET_TIMEOUT);
642+
USB_CTRL_GET_TIMEOUT);
642643
if (result == bufsize) {
643644
memcpy(buf, dmabuf, bufsize);
644645
result = 0;
@@ -1145,33 +1146,6 @@ static void cp210x_disable_event_mode(struct usb_serial_port *port)
11451146
port_priv->event_mode = false;
11461147
}
11471148

1148-
static int cp210x_set_chars(struct usb_serial_port *port,
1149-
struct cp210x_special_chars *chars)
1150-
{
1151-
struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
1152-
struct usb_serial *serial = port->serial;
1153-
void *dmabuf;
1154-
int result;
1155-
1156-
dmabuf = kmemdup(chars, sizeof(*chars), GFP_KERNEL);
1157-
if (!dmabuf)
1158-
return -ENOMEM;
1159-
1160-
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
1161-
CP210X_SET_CHARS, REQTYPE_HOST_TO_INTERFACE, 0,
1162-
port_priv->bInterfaceNumber,
1163-
dmabuf, sizeof(*chars), USB_CTRL_SET_TIMEOUT);
1164-
1165-
kfree(dmabuf);
1166-
1167-
if (result < 0) {
1168-
dev_err(&port->dev, "failed to set special chars: %d\n", result);
1169-
return result;
1170-
}
1171-
1172-
return 0;
1173-
}
1174-
11751149
static bool cp210x_termios_change(const struct ktermios *a, const struct ktermios *b)
11761150
{
11771151
bool iflag_change, cc_change;
@@ -1192,6 +1166,7 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
11921166
struct cp210x_flow_ctl flow_ctl;
11931167
u32 flow_repl;
11941168
u32 ctl_hs;
1169+
bool crtscts;
11951170
int ret;
11961171

11971172
/*
@@ -1218,9 +1193,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
12181193
chars.bXonChar = START_CHAR(tty);
12191194
chars.bXoffChar = STOP_CHAR(tty);
12201195

1221-
ret = cp210x_set_chars(port, &chars);
1222-
if (ret)
1223-
return;
1196+
ret = cp210x_write_reg_block(port, CP210X_SET_CHARS, &chars,
1197+
sizeof(chars));
1198+
if (ret) {
1199+
dev_err(&port->dev, "failed to set special chars: %d\n",
1200+
ret);
1201+
}
12241202
}
12251203

12261204
mutex_lock(&port_priv->mutex);
@@ -1249,14 +1227,14 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
12491227
flow_repl |= CP210X_SERIAL_RTS_FLOW_CTL;
12501228
else
12511229
flow_repl |= CP210X_SERIAL_RTS_INACTIVE;
1252-
port_priv->crtscts = true;
1230+
crtscts = true;
12531231
} else {
12541232
ctl_hs &= ~CP210X_SERIAL_CTS_HANDSHAKE;
12551233
if (port_priv->rts)
12561234
flow_repl |= CP210X_SERIAL_RTS_ACTIVE;
12571235
else
12581236
flow_repl |= CP210X_SERIAL_RTS_INACTIVE;
1259-
port_priv->crtscts = false;
1237+
crtscts = false;
12601238
}
12611239

12621240
if (I_IXOFF(tty)) {
@@ -1279,8 +1257,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
12791257
flow_ctl.ulControlHandshake = cpu_to_le32(ctl_hs);
12801258
flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl);
12811259

1282-
cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl,
1260+
ret = cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl,
12831261
sizeof(flow_ctl));
1262+
if (ret)
1263+
goto out_unlock;
1264+
1265+
port_priv->crtscts = crtscts;
12841266
out_unlock:
12851267
mutex_unlock(&port_priv->mutex);
12861268
}
@@ -2111,12 +2093,26 @@ static int cp210x_get_fw_version(struct usb_serial *serial, u16 value)
21112093
return 0;
21122094
}
21132095

2114-
static void cp210x_determine_quirks(struct usb_serial *serial)
2096+
static void cp210x_determine_type(struct usb_serial *serial)
21152097
{
21162098
struct cp210x_serial_private *priv = usb_get_serial_data(serial);
21172099
int ret;
21182100

2101+
ret = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
2102+
CP210X_GET_PARTNUM, &priv->partnum,
2103+
sizeof(priv->partnum));
2104+
if (ret < 0) {
2105+
dev_warn(&serial->interface->dev,
2106+
"querying part number failed\n");
2107+
priv->partnum = CP210X_PARTNUM_UNKNOWN;
2108+
return;
2109+
}
2110+
21192111
switch (priv->partnum) {
2112+
case CP210X_PARTNUM_CP2105:
2113+
case CP210X_PARTNUM_CP2108:
2114+
cp210x_get_fw_version(serial, CP210X_GET_FW_VER);
2115+
break;
21202116
case CP210X_PARTNUM_CP2102N_QFN28:
21212117
case CP210X_PARTNUM_CP2102N_QFN24:
21222118
case CP210X_PARTNUM_CP2102N_QFN20:
@@ -2140,18 +2136,9 @@ static int cp210x_attach(struct usb_serial *serial)
21402136
if (!priv)
21412137
return -ENOMEM;
21422138

2143-
result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
2144-
CP210X_GET_PARTNUM, &priv->partnum,
2145-
sizeof(priv->partnum));
2146-
if (result < 0) {
2147-
dev_warn(&serial->interface->dev,
2148-
"querying part number failed\n");
2149-
priv->partnum = CP210X_PARTNUM_UNKNOWN;
2150-
}
2151-
21522139
usb_set_serial_data(serial, priv);
21532140

2154-
cp210x_determine_quirks(serial);
2141+
cp210x_determine_type(serial);
21552142
cp210x_init_max_speed(serial);
21562143

21572144
result = cp210x_gpio_init(serial);

drivers/usb/serial/cypress_m8.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,9 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
11991199
MODULE_DESCRIPTION(DRIVER_DESC);
12001200
MODULE_LICENSE("GPL");
12011201

1202-
module_param(stats, bool, S_IRUGO | S_IWUSR);
1202+
module_param(stats, bool, 0644);
12031203
MODULE_PARM_DESC(stats, "Enable statistics or not");
1204-
module_param(interval, int, S_IRUGO | S_IWUSR);
1204+
module_param(interval, int, 0644);
12051205
MODULE_PARM_DESC(interval, "Overrides interrupt interval");
1206-
module_param(unstable_bauds, bool, S_IRUGO | S_IWUSR);
1206+
module_param(unstable_bauds, bool, 0644);
12071207
MODULE_PARM_DESC(unstable_bauds, "Allow unstable baud rates");

drivers/usb/serial/ftdi_sio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2938,5 +2938,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
29382938
MODULE_DESCRIPTION(DRIVER_DESC);
29392939
MODULE_LICENSE("GPL");
29402940

2941-
module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR);
2941+
module_param(ndi_latency_timer, int, 0644);
29422942
MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override");

drivers/usb/serial/garmin_gps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,5 +1444,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
14441444
MODULE_DESCRIPTION(DRIVER_DESC);
14451445
MODULE_LICENSE("GPL");
14461446

1447-
module_param(initial_mode, int, S_IRUGO);
1447+
module_param(initial_mode, int, 0444);
14481448
MODULE_PARM_DESC(initial_mode, "Initial mode");

drivers/usb/serial/io_edgeport.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -389,39 +389,6 @@ static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial)
389389
release_firmware(fw);
390390
}
391391

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-
425392
static void dump_product_info(struct edgeport_serial *edge_serial,
426393
struct edgeport_product_info *product_info)
427394
{

drivers/usb/serial/io_ti.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2746,9 +2746,9 @@ MODULE_DESCRIPTION(DRIVER_DESC);
27462746
MODULE_LICENSE("GPL");
27472747
MODULE_FIRMWARE("edgeport/down3.bin");
27482748

2749-
module_param(ignore_cpu_rev, bool, S_IRUGO | S_IWUSR);
2749+
module_param(ignore_cpu_rev, bool, 0644);
27502750
MODULE_PARM_DESC(ignore_cpu_rev,
27512751
"Ignore the cpu revision when connecting to a device");
27522752

2753-
module_param(default_uart_mode, int, S_IRUGO | S_IWUSR);
2753+
module_param(default_uart_mode, int, 0644);
27542754
MODULE_PARM_DESC(default_uart_mode, "Default uart_mode, 0=RS232, ...");

drivers/usb/serial/ipaq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,10 +599,10 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
599599
MODULE_DESCRIPTION(DRIVER_DESC);
600600
MODULE_LICENSE("GPL");
601601

602-
module_param(connect_retries, int, S_IRUGO|S_IWUSR);
602+
module_param(connect_retries, int, 0644);
603603
MODULE_PARM_DESC(connect_retries,
604604
"Maximum number of connect retries (one second each)");
605605

606-
module_param(initial_wait, int, S_IRUGO|S_IWUSR);
606+
module_param(initial_wait, int, 0644);
607607
MODULE_PARM_DESC(initial_wait,
608608
"Time to wait before attempting a connection (in seconds)");

drivers/usb/serial/iuu_phoenix.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,20 +1188,20 @@ MODULE_AUTHOR("Alain Degreffe [email protected]");
11881188
MODULE_DESCRIPTION(DRIVER_DESC);
11891189
MODULE_LICENSE("GPL");
11901190

1191-
module_param(xmas, bool, S_IRUGO | S_IWUSR);
1191+
module_param(xmas, bool, 0644);
11921192
MODULE_PARM_DESC(xmas, "Xmas colors enabled or not");
11931193

1194-
module_param(boost, int, S_IRUGO | S_IWUSR);
1194+
module_param(boost, int, 0644);
11951195
MODULE_PARM_DESC(boost, "Card overclock boost (in percent 100-500)");
11961196

1197-
module_param(clockmode, int, S_IRUGO | S_IWUSR);
1197+
module_param(clockmode, int, 0644);
11981198
MODULE_PARM_DESC(clockmode, "Card clock mode (1=3.579 MHz, 2=3.680 MHz, "
11991199
"3=6 Mhz)");
12001200

1201-
module_param(cdmode, int, S_IRUGO | S_IWUSR);
1201+
module_param(cdmode, int, 0644);
12021202
MODULE_PARM_DESC(cdmode, "Card detect mode (0=none, 1=CD, 2=!CD, 3=DSR, "
12031203
"4=!DSR, 5=CTS, 6=!CTS, 7=RING, 8=!RING)");
12041204

1205-
module_param(vcc_default, int, S_IRUGO | S_IWUSR);
1205+
module_param(vcc_default, int, 0644);
12061206
MODULE_PARM_DESC(vcc_default, "Set default VCC (either 3 for 3.3V or 5 "
12071207
"for 5V). Default to 5.");

drivers/usb/serial/pl2303.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ static int pl2303_detect_type(struct usb_serial *serial)
433433
switch (bcdDevice) {
434434
case 0x100:
435435
case 0x305:
436+
case 0x405:
436437
/*
437438
* Assume it's an HXN-type if the device doesn't
438439
* support the old read request value.

drivers/usb/serial/sierra.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,5 +1056,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
10561056
MODULE_DESCRIPTION(DRIVER_DESC);
10571057
MODULE_LICENSE("GPL v2");
10581058

1059-
module_param(nmea, bool, S_IRUGO | S_IWUSR);
1059+
module_param(nmea, bool, 0644);
10601060
MODULE_PARM_DESC(nmea, "NMEA streaming");

0 commit comments

Comments
 (0)