/* Called asynchronously after the last tty kref is dropped, and the tty layer has already done the tty_shutdown(tty);  */
static void serial_cleanup(struct tty_struct *tty)
/* Called asynchronously after the last tty kref is dropped, and the tty layer has already done the tty_shutdown(tty);  */
static void serial_cleanup(struct tty_struct *tty)
{
	struct usb_serial_port *port = tty->driver_data;
	struct usb_serial *serial;
	struct module *owner;
	if (port->console)
		return;
	dbg("%s - port %d", __func__, port->number);
	tty->driver_data = NULL;
	serial = port->serial;
	owner = serial->type->driver.owner;
	mutex_lock(&serial->disc_mutex);
	if (!serial->disconnected)
		usb_autopm_put_interface(serial->interface);
	mutex_unlock(&serial->disc_mutex);
	usb_serial_put(serial);
	module_put(owner);
}