aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ark3116.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ark3116.c')
-rw-r--r--drivers/usb/serial/ark3116.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index cf2522c397d3..bd50a8a41a0f 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -125,9 +125,6 @@ static inline int calc_divisor(int bps)
125 125
126static int ark3116_attach(struct usb_serial *serial) 126static int ark3116_attach(struct usb_serial *serial)
127{ 127{
128 struct usb_serial_port *port = serial->port[0];
129 struct ark3116_private *priv;
130
131 /* make sure we have our end-points */ 128 /* make sure we have our end-points */
132 if ((serial->num_bulk_in == 0) || 129 if ((serial->num_bulk_in == 0) ||
133 (serial->num_bulk_out == 0) || 130 (serial->num_bulk_out == 0) ||
@@ -142,8 +139,15 @@ static int ark3116_attach(struct usb_serial *serial)
142 return -EINVAL; 139 return -EINVAL;
143 } 140 }
144 141
145 priv = kzalloc(sizeof(struct ark3116_private), 142 return 0;
146 GFP_KERNEL); 143}
144
145static int ark3116_port_probe(struct usb_serial_port *port)
146{
147 struct usb_serial *serial = port->serial;
148 struct ark3116_private *priv;
149
150 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
147 if (!priv) 151 if (!priv)
148 return -ENOMEM; 152 return -ENOMEM;
149 153
@@ -198,18 +202,15 @@ static int ark3116_attach(struct usb_serial *serial)
198 return 0; 202 return 0;
199} 203}
200 204
201static void ark3116_release(struct usb_serial *serial) 205static int ark3116_port_remove(struct usb_serial_port *port)
202{ 206{
203 struct usb_serial_port *port = serial->port[0];
204 struct ark3116_private *priv = usb_get_serial_port_data(port); 207 struct ark3116_private *priv = usb_get_serial_port_data(port);
205 208
206 /* device is closed, so URBs and DMA should be down */ 209 /* device is closed, so URBs and DMA should be down */
207
208 usb_set_serial_port_data(port, NULL);
209
210 mutex_destroy(&priv->hw_lock); 210 mutex_destroy(&priv->hw_lock);
211
212 kfree(priv); 211 kfree(priv);
212
213 return 0;
213} 214}
214 215
215static void ark3116_init_termios(struct tty_struct *tty) 216static void ark3116_init_termios(struct tty_struct *tty)
@@ -723,7 +724,8 @@ static struct usb_serial_driver ark3116_device = {
723 .id_table = id_table, 724 .id_table = id_table,
724 .num_ports = 1, 725 .num_ports = 1,
725 .attach = ark3116_attach, 726 .attach = ark3116_attach,
726 .release = ark3116_release, 727 .port_probe = ark3116_port_probe,
728 .port_remove = ark3116_port_remove,
727 .set_termios = ark3116_set_termios, 729 .set_termios = ark3116_set_termios,
728 .init_termios = ark3116_init_termios, 730 .init_termios = ark3116_init_termios,
729 .ioctl = ark3116_ioctl, 731 .ioctl = ark3116_ioctl,