mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-07 17:46:15 +00:00
DM: cleanup resource for uart.
Add deinit function for uart. Another work is add resource cleanup functions which is called by other components when they are using uart. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -274,6 +274,18 @@ uart_opentty(struct uart_vdev *uart)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
uart_closetty(struct uart_vdev *uart)
|
||||
{
|
||||
if (uart->tty.fd != STDIN_FILENO)
|
||||
mevent_delete_close(uart->mev);
|
||||
else
|
||||
mevent_delete(uart->mev);
|
||||
|
||||
uart->mev = 0;
|
||||
ttyclose();
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
modem_status(uint8_t mcr)
|
||||
{
|
||||
@@ -692,3 +704,19 @@ uart_set_backend(struct uart_vdev *uart, const char *opts)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
uart_release_backend(struct uart_vdev *uart, const char *opts)
|
||||
{
|
||||
if (opts == NULL)
|
||||
return;
|
||||
|
||||
uart_closetty(uart);
|
||||
if (strcmp("stdio", opts) == 0) {
|
||||
stdio_in_use = false;
|
||||
} else
|
||||
close(uart->tty.fd);
|
||||
|
||||
uart->tty.fd = 0;
|
||||
uart->tty.opened = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user