Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125042
b: refs/heads/master
c: 4bd43f2
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Jan 2, 2009
1 parent e8b50f4 commit ff09125
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7e94b1d9bffc18dca3b45554d9d118a3ffcc4d1b
refs/heads/master: 4bd43f2c31848d751f63e8753cd2788d48fb5f30
15 changes: 10 additions & 5 deletions trunk/drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,29 +269,34 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
return;
}

--port->port.count;
if (port->port.count == 0)
if (port->port.count == 1)
/* only call the device specific close if this
* port is being closed by the last owner */
* port is being closed by the last owner. Ensure we do
* this before we drop the port count. The call is protected
* by the port mutex
*/
port->serial->type->close(tty, port, filp);

if (port->port.count == (port->console? 1 : 0)) {
if (port->port.count == (port->console ? 2 : 1)) {
struct tty_struct *tty = tty_port_tty_get(&port->port);
if (tty) {
/* We must do this before we drop the port count to
zero. */
if (tty->driver_data)
tty->driver_data = NULL;
tty_port_tty_set(&port->port, NULL);
tty_kref_put(tty);
}
}

if (port->port.count == 0) {
if (port->port.count == 1) {
mutex_lock(&port->serial->disc_mutex);
if (!port->serial->disconnected)
usb_autopm_put_interface(port->serial->interface);
mutex_unlock(&port->serial->disc_mutex);
module_put(port->serial->type->driver.owner);
}
--port->port.count;

mutex_unlock(&port->mutex);
usb_serial_put(port->serial);
Expand Down

0 comments on commit ff09125

Please sign in to comment.