diff options
| author | Tony Lindgren <tony@atomide.com> | 2012-11-13 13:25:38 -0800 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2012-11-13 13:25:38 -0800 |
| commit | 89ab216b33ba9405880fd3d89531305a931bc70f (patch) | |
| tree | 8f6428ce51ecaed6f6e1379c036dbe341eb71e34 /drivers/usb/serial/ch341.c | |
| parent | c9d501e5cb0238910337213e12a09127221c35d8 (diff) | |
| parent | 46bf4a562207c5ebd24e1dde5e5ee326cd3d6b91 (diff) | |
| download | olio-linux-3.10-89ab216b33ba9405880fd3d89531305a931bc70f.tar.xz olio-linux-3.10-89ab216b33ba9405880fd3d89531305a931bc70f.zip | |
Merge branch 'omap-for-v3.8/pm' into omap-for-v3.8/clock
Diffstat (limited to 'drivers/usb/serial/ch341.c')
| -rw-r--r-- | drivers/usb/serial/ch341.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index e9c7046ae35..d255f66e708 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -242,13 +242,11 @@ out: kfree(buffer); return r; } -/* allocate private data */ -static int ch341_attach(struct usb_serial *serial) +static int ch341_port_probe(struct usb_serial_port *port) { struct ch341_private *priv; int r; - /* private data */ priv = kzalloc(sizeof(struct ch341_private), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -258,17 +256,27 @@ static int ch341_attach(struct usb_serial *serial) priv->baud_rate = DEFAULT_BAUD_RATE; priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; - r = ch341_configure(serial->dev, priv); + r = ch341_configure(port->serial->dev, priv); if (r < 0) goto error; - usb_set_serial_port_data(serial->port[0], priv); + usb_set_serial_port_data(port, priv); return 0; error: kfree(priv); return r; } +static int ch341_port_remove(struct usb_serial_port *port) +{ + struct ch341_private *priv; + + priv = usb_get_serial_port_data(port); + kfree(priv); + + return 0; +} + static int ch341_carrier_raised(struct usb_serial_port *port) { struct ch341_private *priv = usb_get_serial_port_data(port); @@ -304,7 +312,7 @@ static void ch341_close(struct usb_serial_port *port) static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) { struct usb_serial *serial = port->serial; - struct ch341_private *priv = usb_get_serial_port_data(serial->port[0]); + struct ch341_private *priv = usb_get_serial_port_data(port); int r; priv->baud_rate = DEFAULT_BAUD_RATE; @@ -608,7 +616,8 @@ static struct usb_serial_driver ch341_device = { .tiocmget = ch341_tiocmget, .tiocmset = ch341_tiocmset, .read_int_callback = ch341_read_int_callback, - .attach = ch341_attach, + .port_probe = ch341_port_probe, + .port_remove = ch341_port_remove, .reset_resume = ch341_reset_resume, }; |