tty: usb-serial krefs
Use kref in the USB serial drivers so that we don't free tty structures from under the URB receive handlers as has historically been the case if you were unlucky. This also gives us a framework for general tty drivers to use tty_port objects and refcount. Contains two err->dev_err changes merged together to fix clashes in the -next tree. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -117,7 +117,7 @@ static int usb_console_setup(struct console *co, char *options)
|
||||
}
|
||||
|
||||
port = serial->port[0];
|
||||
port->port.tty = NULL;
|
||||
tty_port_tty_set(&port->port, NULL);
|
||||
|
||||
info->port = port;
|
||||
|
||||
@@ -143,7 +143,7 @@ static int usb_console_setup(struct console *co, char *options)
|
||||
}
|
||||
memset(&dummy, 0, sizeof(struct ktermios));
|
||||
tty->termios = termios;
|
||||
port->port.tty = tty;
|
||||
tty_port_tty_set(&port->port, tty);
|
||||
}
|
||||
|
||||
/* only call the device specific open if this
|
||||
@@ -163,7 +163,7 @@ static int usb_console_setup(struct console *co, char *options)
|
||||
tty_termios_encode_baud_rate(termios, baud, baud);
|
||||
serial->type->set_termios(tty, port, &dummy);
|
||||
|
||||
port->port.tty = NULL;
|
||||
tty_port_tty_set(&port->port, NULL);
|
||||
kfree(termios);
|
||||
kfree(tty);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ out:
|
||||
return retval;
|
||||
free_termios:
|
||||
kfree(termios);
|
||||
port->port.tty = NULL;
|
||||
tty_port_tty_set(&port->port, NULL);
|
||||
free_tty:
|
||||
kfree(tty);
|
||||
reset_open_count:
|
||||
|
Reference in New Issue
Block a user