diff options
Diffstat (limited to 'drivers/usb/serial/belkin_sa.c')
-rw-r--r-- | drivers/usb/serial/belkin_sa.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 99449424193f..ea29556f0d72 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c | |||
@@ -45,8 +45,8 @@ | |||
45 | #define DRIVER_DESC "USB Belkin Serial converter driver" | 45 | #define DRIVER_DESC "USB Belkin Serial converter driver" |
46 | 46 | ||
47 | /* function prototypes for a Belkin USB Serial Adapter F5U103 */ | 47 | /* function prototypes for a Belkin USB Serial Adapter F5U103 */ |
48 | static int belkin_sa_startup(struct usb_serial *serial); | 48 | static int belkin_sa_port_probe(struct usb_serial_port *port); |
49 | static void belkin_sa_release(struct usb_serial *serial); | 49 | static int belkin_sa_port_remove(struct usb_serial_port *port); |
50 | static int belkin_sa_open(struct tty_struct *tty, | 50 | static int belkin_sa_open(struct tty_struct *tty, |
51 | struct usb_serial_port *port); | 51 | struct usb_serial_port *port); |
52 | static void belkin_sa_close(struct usb_serial_port *port); | 52 | static void belkin_sa_close(struct usb_serial_port *port); |
@@ -88,8 +88,8 @@ static struct usb_serial_driver belkin_device = { | |||
88 | .break_ctl = belkin_sa_break_ctl, | 88 | .break_ctl = belkin_sa_break_ctl, |
89 | .tiocmget = belkin_sa_tiocmget, | 89 | .tiocmget = belkin_sa_tiocmget, |
90 | .tiocmset = belkin_sa_tiocmset, | 90 | .tiocmset = belkin_sa_tiocmset, |
91 | .attach = belkin_sa_startup, | 91 | .port_probe = belkin_sa_port_probe, |
92 | .release = belkin_sa_release, | 92 | .port_remove = belkin_sa_port_remove, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static struct usb_serial_driver * const serial_drivers[] = { | 95 | static struct usb_serial_driver * const serial_drivers[] = { |
@@ -118,17 +118,15 @@ struct belkin_sa_private { | |||
118 | (c), BELKIN_SA_SET_REQUEST_TYPE, \ | 118 | (c), BELKIN_SA_SET_REQUEST_TYPE, \ |
119 | (v), 0, NULL, 0, WDR_TIMEOUT) | 119 | (v), 0, NULL, 0, WDR_TIMEOUT) |
120 | 120 | ||
121 | /* do some startup allocations not currently performed by usb_serial_probe() */ | 121 | static int belkin_sa_port_probe(struct usb_serial_port *port) |
122 | static int belkin_sa_startup(struct usb_serial *serial) | ||
123 | { | 122 | { |
124 | struct usb_device *dev = serial->dev; | 123 | struct usb_device *dev = port->serial->dev; |
125 | struct belkin_sa_private *priv; | 124 | struct belkin_sa_private *priv; |
126 | 125 | ||
127 | /* allocate the private data structure */ | ||
128 | priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL); | 126 | priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL); |
129 | if (!priv) | 127 | if (!priv) |
130 | return -1; /* error */ | 128 | return -ENOMEM; |
131 | /* set initial values for control structures */ | 129 | |
132 | spin_lock_init(&priv->lock); | 130 | spin_lock_init(&priv->lock); |
133 | priv->control_state = 0; | 131 | priv->control_state = 0; |
134 | priv->last_lsr = 0; | 132 | priv->last_lsr = 0; |
@@ -140,18 +138,19 @@ static int belkin_sa_startup(struct usb_serial *serial) | |||
140 | le16_to_cpu(dev->descriptor.bcdDevice), | 138 | le16_to_cpu(dev->descriptor.bcdDevice), |
141 | priv->bad_flow_control); | 139 | priv->bad_flow_control); |
142 | 140 | ||
143 | init_waitqueue_head(&serial->port[0]->write_wait); | 141 | usb_set_serial_port_data(port, priv); |
144 | usb_set_serial_port_data(serial->port[0], priv); | ||
145 | 142 | ||
146 | return 0; | 143 | return 0; |
147 | } | 144 | } |
148 | 145 | ||
149 | static void belkin_sa_release(struct usb_serial *serial) | 146 | static int belkin_sa_port_remove(struct usb_serial_port *port) |
150 | { | 147 | { |
151 | int i; | 148 | struct belkin_sa_private *priv; |
152 | 149 | ||
153 | for (i = 0; i < serial->num_ports; ++i) | 150 | priv = usb_get_serial_port_data(port); |
154 | kfree(usb_get_serial_port_data(serial->port[i])); | 151 | kfree(priv); |
152 | |||
153 | return 0; | ||
155 | } | 154 | } |
156 | 155 | ||
157 | static int belkin_sa_open(struct tty_struct *tty, | 156 | static int belkin_sa_open(struct tty_struct *tty, |