diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 1bc0a24b896b..28125de7d902 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -191,7 +191,7 @@ void usb_serial_put(struct usb_serial *serial) | |||
191 | * This is the first place a new tty gets used. Hence this is where we | 191 | * This is the first place a new tty gets used. Hence this is where we |
192 | * acquire references to the usb_serial structure and the driver module, | 192 | * acquire references to the usb_serial structure and the driver module, |
193 | * where we store a pointer to the port, and where we do an autoresume. | 193 | * where we store a pointer to the port, and where we do an autoresume. |
194 | * All these actions are reversed in serial_do_free(). | 194 | * All these actions are reversed in serial_release(). |
195 | */ | 195 | */ |
196 | static int serial_install(struct tty_driver *driver, struct tty_struct *tty) | 196 | static int serial_install(struct tty_driver *driver, struct tty_struct *tty) |
197 | { | 197 | { |
@@ -296,13 +296,13 @@ bailout_mutex_unlock: | |||
296 | } | 296 | } |
297 | 297 | ||
298 | /** | 298 | /** |
299 | * serial_do_down - shut down hardware | 299 | * serial_down - shut down hardware |
300 | * @port: port to shut down | 300 | * @port: port to shut down |
301 | * | 301 | * |
302 | * Shut down a USB serial port unless it is the console. We never | 302 | * Shut down a USB serial port unless it is the console. We never |
303 | * shut down the console hardware as it will always be in use. | 303 | * shut down the console hardware as it will always be in use. |
304 | */ | 304 | */ |
305 | static void serial_do_down(struct usb_serial_port *port) | 305 | static void serial_down(struct usb_serial_port *port) |
306 | { | 306 | { |
307 | struct usb_serial_driver *drv = port->serial->type; | 307 | struct usb_serial_driver *drv = port->serial->type; |
308 | struct usb_serial *serial; | 308 | struct usb_serial *serial; |
@@ -328,7 +328,7 @@ static void serial_do_down(struct usb_serial_port *port) | |||
328 | static void serial_hangup(struct tty_struct *tty) | 328 | static void serial_hangup(struct tty_struct *tty) |
329 | { | 329 | { |
330 | struct usb_serial_port *port = tty->driver_data; | 330 | struct usb_serial_port *port = tty->driver_data; |
331 | serial_do_down(port); | 331 | serial_down(port); |
332 | tty_port_hangup(&port->port); | 332 | tty_port_hangup(&port->port); |
333 | /* We must not free port yet - the USB serial layer depends on it's | 333 | /* We must not free port yet - the USB serial layer depends on it's |
334 | continued existence */ | 334 | continued existence */ |
@@ -342,13 +342,13 @@ static void serial_close(struct tty_struct *tty, struct file *filp) | |||
342 | 342 | ||
343 | if (tty_port_close_start(&port->port, tty, filp) == 0) | 343 | if (tty_port_close_start(&port->port, tty, filp) == 0) |
344 | return; | 344 | return; |
345 | serial_do_down(port); | 345 | serial_down(port); |
346 | tty_port_close_end(&port->port, tty); | 346 | tty_port_close_end(&port->port, tty); |
347 | tty_port_tty_set(&port->port, NULL); | 347 | tty_port_tty_set(&port->port, NULL); |
348 | } | 348 | } |
349 | 349 | ||
350 | /** | 350 | /** |
351 | * serial_do_free - free resources post close/hangup | 351 | * serial_release - free resources post close/hangup |
352 | * @port: port to free up | 352 | * @port: port to free up |
353 | * | 353 | * |
354 | * Do the resource freeing and refcount dropping for the port. | 354 | * Do the resource freeing and refcount dropping for the port. |
@@ -356,7 +356,7 @@ static void serial_close(struct tty_struct *tty, struct file *filp) | |||
356 | * | 356 | * |
357 | * Called when the last tty kref is dropped. | 357 | * Called when the last tty kref is dropped. |
358 | */ | 358 | */ |
359 | static void serial_do_free(struct tty_struct *tty) | 359 | static void serial_release(struct tty_struct *tty) |
360 | { | 360 | { |
361 | struct usb_serial_port *port = tty->driver_data; | 361 | struct usb_serial_port *port = tty->driver_data; |
362 | struct usb_serial *serial; | 362 | struct usb_serial *serial; |
@@ -368,6 +368,9 @@ static void serial_do_free(struct tty_struct *tty) | |||
368 | if (port->console) | 368 | if (port->console) |
369 | return; | 369 | return; |
370 | 370 | ||
371 | /* Standard shutdown processing */ | ||
372 | tty_shutdown(tty); | ||
373 | |||
371 | tty->driver_data = NULL; | 374 | tty->driver_data = NULL; |
372 | 375 | ||
373 | serial = port->serial; | 376 | serial = port->serial; |
@@ -1204,7 +1207,7 @@ static const struct tty_operations serial_ops = { | |||
1204 | .chars_in_buffer = serial_chars_in_buffer, | 1207 | .chars_in_buffer = serial_chars_in_buffer, |
1205 | .tiocmget = serial_tiocmget, | 1208 | .tiocmget = serial_tiocmget, |
1206 | .tiocmset = serial_tiocmset, | 1209 | .tiocmset = serial_tiocmset, |
1207 | .shutdown = serial_do_free, | 1210 | .shutdown = serial_release, |
1208 | .install = serial_install, | 1211 | .install = serial_install, |
1209 | .proc_fops = &serial_proc_fops, | 1212 | .proc_fops = &serial_proc_fops, |
1210 | }; | 1213 | }; |