diff options
Diffstat (limited to 'drivers/usb/serial/io_edgeport.c')
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 53ef5996e33d..0191693625d6 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -224,7 +224,8 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file); | |||
224 | static int edge_tiocmset(struct tty_struct *tty, struct file *file, | 224 | static int edge_tiocmset(struct tty_struct *tty, struct file *file, |
225 | unsigned int set, unsigned int clear); | 225 | unsigned int set, unsigned int clear); |
226 | static int edge_startup(struct usb_serial *serial); | 226 | static int edge_startup(struct usb_serial *serial); |
227 | static void edge_shutdown(struct usb_serial *serial); | 227 | static void edge_disconnect(struct usb_serial *serial); |
228 | static void edge_release(struct usb_serial *serial); | ||
228 | 229 | ||
229 | #include "io_tables.h" /* all of the devices that this driver supports */ | 230 | #include "io_tables.h" /* all of the devices that this driver supports */ |
230 | 231 | ||
@@ -3193,21 +3194,16 @@ static int edge_startup(struct usb_serial *serial) | |||
3193 | 3194 | ||
3194 | 3195 | ||
3195 | /**************************************************************************** | 3196 | /**************************************************************************** |
3196 | * edge_shutdown | 3197 | * edge_disconnect |
3197 | * This function is called whenever the device is removed from the usb bus. | 3198 | * This function is called whenever the device is removed from the usb bus. |
3198 | ****************************************************************************/ | 3199 | ****************************************************************************/ |
3199 | static void edge_shutdown(struct usb_serial *serial) | 3200 | static void edge_disconnect(struct usb_serial *serial) |
3200 | { | 3201 | { |
3201 | struct edgeport_serial *edge_serial = usb_get_serial_data(serial); | 3202 | struct edgeport_serial *edge_serial = usb_get_serial_data(serial); |
3202 | int i; | ||
3203 | 3203 | ||
3204 | dbg("%s", __func__); | 3204 | dbg("%s", __func__); |
3205 | 3205 | ||
3206 | /* stop reads and writes on all ports */ | 3206 | /* stop reads and writes on all ports */ |
3207 | for (i = 0; i < serial->num_ports; ++i) { | ||
3208 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
3209 | usb_set_serial_port_data(serial->port[i], NULL); | ||
3210 | } | ||
3211 | /* free up our endpoint stuff */ | 3207 | /* free up our endpoint stuff */ |
3212 | if (edge_serial->is_epic) { | 3208 | if (edge_serial->is_epic) { |
3213 | usb_kill_urb(edge_serial->interrupt_read_urb); | 3209 | usb_kill_urb(edge_serial->interrupt_read_urb); |
@@ -3218,9 +3214,24 @@ static void edge_shutdown(struct usb_serial *serial) | |||
3218 | usb_free_urb(edge_serial->read_urb); | 3214 | usb_free_urb(edge_serial->read_urb); |
3219 | kfree(edge_serial->bulk_in_buffer); | 3215 | kfree(edge_serial->bulk_in_buffer); |
3220 | } | 3216 | } |
3217 | } | ||
3218 | |||
3219 | |||
3220 | /**************************************************************************** | ||
3221 | * edge_release | ||
3222 | * This function is called when the device structure is deallocated. | ||
3223 | ****************************************************************************/ | ||
3224 | static void edge_release(struct usb_serial *serial) | ||
3225 | { | ||
3226 | struct edgeport_serial *edge_serial = usb_get_serial_data(serial); | ||
3227 | int i; | ||
3228 | |||
3229 | dbg("%s", __func__); | ||
3230 | |||
3231 | for (i = 0; i < serial->num_ports; ++i) | ||
3232 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
3221 | 3233 | ||
3222 | kfree(edge_serial); | 3234 | kfree(edge_serial); |
3223 | usb_set_serial_data(serial, NULL); | ||
3224 | } | 3235 | } |
3225 | 3236 | ||
3226 | 3237 | ||