mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Fix detaching of uart(4) devices.
With our new TTY layer we use a two step device destruction procedure. The TTY first gets abandoned by the device driver. When the TTY layer notices all threads have left the TTY layer, it deallocates the TTY. This means that the device unit number should not be reused before a callback from the TTY layer to the device driver has been made. newbus doesn't seem to support this concept (yet), so right now just add a destructor with a big comment in it. It's not ideal, but at least it's better than panicing. Reported by: rnoland
This commit is contained in:
parent
16c8eda0bd
commit
9b866e4e8b
1 changed files with 13 additions and 0 deletions
|
|
@ -327,6 +327,18 @@ uart_tty_intr(void *arg)
|
|||
tty_unlock(tp);
|
||||
}
|
||||
|
||||
static void
|
||||
uart_tty_free(void *arg)
|
||||
{
|
||||
|
||||
/*
|
||||
* XXX: uart(4) could reuse the device unit number before it is
|
||||
* being freed by the TTY layer. We should use this hook to free
|
||||
* the device unit number, but unfortunately newbus does not
|
||||
* seem to support such a construct.
|
||||
*/
|
||||
}
|
||||
|
||||
static struct ttydevsw uart_tty_class = {
|
||||
.tsw_flags = TF_INITLOCK|TF_CALLOUT,
|
||||
.tsw_open = uart_tty_open,
|
||||
|
|
@ -335,6 +347,7 @@ static struct ttydevsw uart_tty_class = {
|
|||
.tsw_ioctl = uart_tty_ioctl,
|
||||
.tsw_param = uart_tty_param,
|
||||
.tsw_modem = uart_tty_modem,
|
||||
.tsw_free = uart_tty_free,
|
||||
};
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Reference in a new issue