Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334527
b: refs/heads/master
c: 4295fe7
h: refs/heads/master
i:
  334525: 820f5a4
  334523: de76845
  334519: a866508
  334511: eb6b0bc
  334495: c44e811
  334463: ab032dc
v: v3
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Oct 16, 2012
1 parent 1490b25 commit c388186
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa919751a2d26a88140fc5810124dd81644efe51
refs/heads/master: 4295fe7791a1b20c90cbaaa6f23f2fb94218b8a7
40 changes: 17 additions & 23 deletions trunk/drivers/usb/serial/cp210x.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static const struct usb_device_id id_table[] = {

MODULE_DEVICE_TABLE(usb, id_table);

struct cp210x_port_private {
struct cp210x_serial_private {
__u8 bInterfaceNumber;
};

Expand Down Expand Up @@ -276,7 +276,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
unsigned int *data, int size)
{
struct usb_serial *serial = port->serial;
struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
struct cp210x_serial_private *spriv = usb_get_serial_data(serial);
__le32 *buf;
int result, i, length;

Expand All @@ -292,7 +292,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
/* Issue the request, attempting to read 'size' bytes */
result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
request, REQTYPE_INTERFACE_TO_HOST, 0x0000,
port_priv->bInterfaceNumber, buf, size,
spriv->bInterfaceNumber, buf, size,
USB_CTRL_GET_TIMEOUT);

/* Convert data into an array of integers */
Expand Down Expand Up @@ -323,7 +323,7 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
unsigned int *data, int size)
{
struct usb_serial *serial = port->serial;
struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
struct cp210x_serial_private *spriv = usb_get_serial_data(serial);
__le32 *buf;
int result, i, length;

Expand All @@ -345,13 +345,13 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_INTERFACE, 0x0000,
port_priv->bInterfaceNumber, buf, size,
spriv->bInterfaceNumber, buf, size,
USB_CTRL_SET_TIMEOUT);
} else {
result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_INTERFACE, data[0],
port_priv->bInterfaceNumber, NULL, 0,
spriv->bInterfaceNumber, NULL, 0,
USB_CTRL_SET_TIMEOUT);
}

Expand Down Expand Up @@ -845,36 +845,30 @@ static void cp210x_break_ctl (struct tty_struct *tty, int break_state)

static int cp210x_startup(struct usb_serial *serial)
{
struct cp210x_port_private *port_priv;
int i;
struct usb_host_interface *cur_altsetting;
struct cp210x_serial_private *spriv;

/* cp210x buffers behave strangely unless device is reset */
usb_reset_device(serial->dev);

for (i = 0; i < serial->num_ports; i++) {
port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL);
if (!port_priv)
return -ENOMEM;
spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
if (!spriv)
return -ENOMEM;

port_priv->bInterfaceNumber =
serial->interface->cur_altsetting->desc.bInterfaceNumber;
cur_altsetting = serial->interface->cur_altsetting;
spriv->bInterfaceNumber = cur_altsetting->desc.bInterfaceNumber;

usb_set_serial_port_data(serial->port[i], port_priv);
}
usb_set_serial_data(serial, spriv);

return 0;
}

static void cp210x_release(struct usb_serial *serial)
{
struct cp210x_port_private *port_priv;
int i;
struct cp210x_serial_private *spriv;

for (i = 0; i < serial->num_ports; i++) {
port_priv = usb_get_serial_port_data(serial->port[i]);
kfree(port_priv);
usb_set_serial_port_data(serial->port[i], NULL);
}
spriv = usb_get_serial_data(serial);
kfree(spriv);
}

module_usb_serial_driver(serial_drivers, id_table);
Expand Down

0 comments on commit c388186

Please sign in to comment.