Skip to content

Commit 33a61d2

Browse files
committed
USB: serial: cp210x: clean up set-chars request
Use the generic control request helper to implement the SET_CHARS request. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent befc28a commit 33a61d2

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

drivers/usb/serial/cp210x.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,31 +1145,6 @@ static void cp210x_disable_event_mode(struct usb_serial_port *port)
11451145
port_priv->event_mode = false;
11461146
}
11471147

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-
return result;
1169-
1170-
return 0;
1171-
}
1172-
11731148
static bool cp210x_termios_change(const struct ktermios *a, const struct ktermios *b)
11741149
{
11751150
bool iflag_change, cc_change;
@@ -1217,7 +1192,8 @@ static void cp210x_set_flow_control(struct tty_struct *tty,
12171192
chars.bXonChar = START_CHAR(tty);
12181193
chars.bXoffChar = STOP_CHAR(tty);
12191194

1220-
ret = cp210x_set_chars(port, &chars);
1195+
ret = cp210x_write_reg_block(port, CP210X_SET_CHARS, &chars,
1196+
sizeof(chars));
12211197
if (ret) {
12221198
dev_err(&port->dev, "failed to set special chars: %d\n",
12231199
ret);

0 commit comments

Comments
 (0)