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:
Yin Fengwei
2018-04-13 10:31:37 +08:00
committed by Jack Ren
parent c8585a22e3
commit 1a2a07476b
3 changed files with 42 additions and 0 deletions

View File

@@ -106,9 +106,22 @@ pci_uart_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
return 0;
}
static void
pci_uart_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
{
struct uart_vdev *uart = (struct uart_vdev *)dev->arg;
if (uart == NULL)
return;
uart_release_backend(uart, opts);
uart_deinit(uart);
}
struct pci_vdev_ops pci_ops_com = {
.class_name = "uart",
.vdev_init = pci_uart_init,
.vdev_deinit = pci_uart_deinit,
.vdev_barwrite = pci_uart_write,
.vdev_barread = pci_uart_read
};