diff options
Diffstat (limited to 'drivers/usb/serial/ssu100.c')
-rw-r--r-- | drivers/usb/serial/ssu100.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index 015810b3785b..868d1e6852e2 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -67,13 +67,6 @@ struct ssu100_port_private { | |||
67 | struct async_icount icount; | 67 | struct async_icount icount; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static void ssu100_release(struct usb_serial *serial) | ||
71 | { | ||
72 | struct ssu100_port_private *priv = usb_get_serial_port_data(*serial->port); | ||
73 | |||
74 | kfree(priv); | ||
75 | } | ||
76 | |||
77 | static inline int ssu100_control_msg(struct usb_device *dev, | 70 | static inline int ssu100_control_msg(struct usb_device *dev, |
78 | u8 request, u16 data, u16 index) | 71 | u8 request, u16 data, u16 index) |
79 | { | 72 | { |
@@ -442,21 +435,33 @@ static int ssu100_ioctl(struct tty_struct *tty, | |||
442 | 435 | ||
443 | static int ssu100_attach(struct usb_serial *serial) | 436 | static int ssu100_attach(struct usb_serial *serial) |
444 | { | 437 | { |
438 | return ssu100_initdevice(serial->dev); | ||
439 | } | ||
440 | |||
441 | static int ssu100_port_probe(struct usb_serial_port *port) | ||
442 | { | ||
445 | struct ssu100_port_private *priv; | 443 | struct ssu100_port_private *priv; |
446 | struct usb_serial_port *port = *serial->port; | ||
447 | 444 | ||
448 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 445 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
449 | if (!priv) { | 446 | if (!priv) |
450 | dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__, | ||
451 | sizeof(*priv)); | ||
452 | return -ENOMEM; | 447 | return -ENOMEM; |
453 | } | ||
454 | 448 | ||
455 | spin_lock_init(&priv->status_lock); | 449 | spin_lock_init(&priv->status_lock); |
456 | init_waitqueue_head(&priv->delta_msr_wait); | 450 | init_waitqueue_head(&priv->delta_msr_wait); |
451 | |||
457 | usb_set_serial_port_data(port, priv); | 452 | usb_set_serial_port_data(port, priv); |
458 | 453 | ||
459 | return ssu100_initdevice(serial->dev); | 454 | return 0; |
455 | } | ||
456 | |||
457 | static int ssu100_port_remove(struct usb_serial_port *port) | ||
458 | { | ||
459 | struct ssu100_port_private *priv; | ||
460 | |||
461 | priv = usb_get_serial_port_data(port); | ||
462 | kfree(priv); | ||
463 | |||
464 | return 0; | ||
460 | } | 465 | } |
461 | 466 | ||
462 | static int ssu100_tiocmget(struct tty_struct *tty) | 467 | static int ssu100_tiocmget(struct tty_struct *tty) |
@@ -647,7 +652,8 @@ static struct usb_serial_driver ssu100_device = { | |||
647 | .open = ssu100_open, | 652 | .open = ssu100_open, |
648 | .close = ssu100_close, | 653 | .close = ssu100_close, |
649 | .attach = ssu100_attach, | 654 | .attach = ssu100_attach, |
650 | .release = ssu100_release, | 655 | .port_probe = ssu100_port_probe, |
656 | .port_remove = ssu100_port_remove, | ||
651 | .dtr_rts = ssu100_dtr_rts, | 657 | .dtr_rts = ssu100_dtr_rts, |
652 | .process_read_urb = ssu100_process_read_urb, | 658 | .process_read_urb = ssu100_process_read_urb, |
653 | .tiocmget = ssu100_tiocmget, | 659 | .tiocmget = ssu100_tiocmget, |